feat: 标准删除改成逻辑删除
This commit is contained in:
@@ -64,6 +64,14 @@ public interface LawsCommonMapper {
|
|||||||
int deleteByIdsAndModule(@org.apache.ibatis.annotations.Param("tableName") String tableName,
|
int deleteByIdsAndModule(@org.apache.ibatis.annotations.Param("tableName") String tableName,
|
||||||
@org.apache.ibatis.annotations.Param("idList") List<String> idList);
|
@org.apache.ibatis.annotations.Param("idList") List<String> idList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: caihaohan
|
||||||
|
* @Date: 2023/9/18
|
||||||
|
* @Description: 根据ids和模块标识逻辑删除
|
||||||
|
**/
|
||||||
|
int logicalDeleteByIdsAndModule(@org.apache.ibatis.annotations.Param("tableName") String tableName,
|
||||||
|
@org.apache.ibatis.annotations.Param("idList") List<String> idList);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: liao
|
* @Author: liao
|
||||||
* @Date: 2023/8/24 15:00
|
* @Date: 2023/8/24 15:00
|
||||||
|
|||||||
+7
@@ -28,6 +28,13 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<update id="logicalDeleteByIdsAndModule">
|
||||||
|
UPDATE ${tableName} SET del_flag = 1 WHERE id IN
|
||||||
|
<foreach collection="idList" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
|
|
||||||
<update id="commonEdit">
|
<update id="commonEdit">
|
||||||
UPDATE ${tableName}
|
UPDATE ${tableName}
|
||||||
SET ${updateSql}
|
SET ${updateSql}
|
||||||
|
|||||||
+2
-2
@@ -538,7 +538,7 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
|
|||||||
}
|
}
|
||||||
List<String> idList = Arrays.asList(ids.split(","));
|
List<String> idList = Arrays.asList(ids.split(","));
|
||||||
// 操作数据库进行删除操作
|
// 操作数据库进行删除操作
|
||||||
int rowsDeleted = lawsCommonMapper.deleteByIdsAndModule(tableName, idList);
|
int rowsDeleted = lawsCommonMapper.logicalDeleteByIdsAndModule(tableName, idList);
|
||||||
if (rowsDeleted > 0) {
|
if (rowsDeleted > 0) {
|
||||||
return MessageUtils.getMessage(ResultCommon.OK);
|
return MessageUtils.getMessage(ResultCommon.OK);
|
||||||
}
|
}
|
||||||
@@ -687,7 +687,7 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
|
|||||||
String commonInsertValues = "'" + id + "','" + sysUser.getUsername() + "',"
|
String commonInsertValues = "'" + id + "','" + sysUser.getUsername() + "',"
|
||||||
+ FieldCommon.STR_TO_DATE_PREFIX + sdf.format(new Date()) + FieldCommon.STR_TO_DATE_SUFFIX + ",'" + sysUser.getUsername() + "',"
|
+ FieldCommon.STR_TO_DATE_PREFIX + sdf.format(new Date()) + FieldCommon.STR_TO_DATE_SUFFIX + ",'" + sysUser.getUsername() + "',"
|
||||||
+ FieldCommon.STR_TO_DATE_PREFIX + sdf.format(new Date()) + FieldCommon.STR_TO_DATE_SUFFIX + ",'" + sysUser.getOrgCode() + "'";
|
+ FieldCommon.STR_TO_DATE_PREFIX + sdf.format(new Date()) + FieldCommon.STR_TO_DATE_SUFFIX + ",'" + sysUser.getOrgCode() + "'";
|
||||||
fieldsBuilder.append("id,create_by,create_time,update_by,update_time,sys_code");
|
fieldsBuilder.append("id,create_by,create_time,update_by,update_time,org_code");
|
||||||
valuesBuilder.append(commonInsertValues);
|
valuesBuilder.append(commonInsertValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user