xiahan 2 maanden geleden
bovenliggende
commit
40ede39e58

+ 24 - 0
zhsw-common/src/main/java/com/rongwei/zhsw/system/config/MySqlInjector.java

@@ -0,0 +1,24 @@
+package com.rongwei.zhsw.system.config;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.core.injector.AbstractMethod;
+import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector;
+import com.baomidou.mybatisplus.extension.injector.methods.additional.InsertBatchSomeColumn;
+
+import java.util.List;
+
+/**
+ * MySqlInjector class
+ *
+ * @author XH
+ * @date 2025/05/09
+ */
+public class MySqlInjector extends DefaultSqlInjector {
+    @Override
+    public List<AbstractMethod> getMethodList(Class<?> mapperClass) {
+        List<AbstractMethod> methodList = super.getMethodList(mapperClass);
+        //更新时自动填充的字段,不用插入值
+        methodList.add(new InsertBatchSomeColumn(i -> i.getFieldFill() != FieldFill.UPDATE));
+        return methodList;
+    }
+}

+ 18 - 0
zhsw-common/src/main/java/com/rongwei/zhsw/system/config/MybatisPlusConfig.java

@@ -0,0 +1,18 @@
+package com.rongwei.zhsw.system.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * MybatisPlusConfig class
+ *
+ * @author XH
+ * @date 2025/05/09
+ */
+@Configuration
+public class MybatisPlusConfig {
+    @Bean
+    public MySqlInjector sqlInjector() {
+        return new MySqlInjector();
+    }
+}

+ 14 - 0
zhsw-common/src/main/java/com/rongwei/zhsw/system/dao/CommonMapper.java

@@ -0,0 +1,14 @@
+package com.rongwei.zhsw.system.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+import java.util.List;
+
+public interface CommonMapper<T> extends BaseMapper<T> {
+    /**
+     * 全量插入,等价于insert
+     * @param entityList
+     * @return
+     */
+    int insertBatchSomeColumn(List<T> entityList);
+}

+ 2 - 1
zhsw-common/src/main/java/com/rongwei/zhsw/system/dao/SwBillManagementPaidDao.java

@@ -3,6 +3,7 @@ package com.rongwei.zhsw.system.dao;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.rongwe.zhsw.system.domain.SwBillManagementPaidDo;
+import com.rongwe.zhsw.system.domain.SwBillingRecordDo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -15,7 +16,7 @@ import java.util.List;
  * @since 2025-03-07 16:49:11
  */
 @Mapper
-public interface SwBillManagementPaidDao extends BaseMapper<SwBillManagementPaidDo> {
+public interface SwBillManagementPaidDao extends CommonMapper<SwBillManagementPaidDo> {
 
 
     void deleteByIds(@Param("idList") List<String> idList);

+ 1 - 1
zhsw-common/src/main/java/com/rongwei/zhsw/system/dao/SwBillingRecordDao.java

@@ -16,7 +16,7 @@ import java.util.Date;
  * @since 2025-03-07 16:35:07
  */
 @Mapper
-public interface SwBillingRecordDao extends BaseMapper<SwBillingRecordDo> {
+public interface SwBillingRecordDao extends CommonMapper<SwBillingRecordDo> {
 
 
     int updateWeChatPayInfo(@Param("dseKey") String dseKey, @Param("orderNo") String orderNo, @Param("wechatNo") String wechatNo,

File diff suppressed because it is too large
+ 158 - 156
zhsw-common/src/main/java/com/rongwei/zhsw/system/service/impl/SwBillManagementUnpaidServiceImpl.java


+ 5 - 7
zhsw-common/src/main/resources/mybatis/zhsw/SwBillManagementUnpaidDao.xml

@@ -6,12 +6,10 @@
 
     <delete id="deleteByIds">
         <if test="idList != null and idList.size() > 0">
-            <foreach collection="idList" item="id" separator=";" >
-        delete from sw_bill_management_unpaid where ID = #{id}
-
-        </foreach>
-    </if>
+            delete from sw_bill_management_unpaid where ID in
+            <foreach collection="idList" item="id" open="(" close=")"  separator=",">
+                 #{id}
+            </foreach>
+        </if>
     </delete>
-
-
 </mapper>