微调
This commit is contained in:
@@ -2,12 +2,20 @@ package com.njcn.gather.err.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.njcn.gather.err.pojo.po.PqErrSys;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-11-27
|
||||
*/
|
||||
public interface PqErrSysMapper extends MPJBaseMapper<PqErrSys> {
|
||||
|
||||
/**
|
||||
* 根据ids获取绑定的计划数量
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
Integer getCountBoundByIds(@Param("ids") List<String> ids);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,5 +3,16 @@
|
||||
<mapper namespace="com.njcn.gather.err.mapper.PqErrSysMapper">
|
||||
|
||||
|
||||
<select id="getCountBoundByIds" resultType="java.lang.Integer">
|
||||
SELECT COUNT(*) FROM ad_plan
|
||||
<if test="ids!= null and ids.size() > 0">
|
||||
<where>
|
||||
AND Error_Sys_Id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</where>
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.njcn.gather.err.pojo.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2025-03-10
|
||||
*/
|
||||
@Getter
|
||||
public enum ErrResponseEnum {
|
||||
ERR_SYS_BOUND_NOT_DELETE("A100001","误差体系已被计划所绑定,无法删除!");
|
||||
|
||||
private String code;
|
||||
private String message;
|
||||
|
||||
ErrResponseEnum(String code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.gather.err.mapper.PqErrSysMapper;
|
||||
import com.njcn.gather.err.pojo.enums.ErrResponseEnum;
|
||||
import com.njcn.gather.err.pojo.param.PqErrSysParam;
|
||||
import com.njcn.gather.err.pojo.po.PqErrSys;
|
||||
import com.njcn.gather.err.pojo.po.PqErrSysDtls;
|
||||
@@ -93,6 +94,10 @@ public class PqErrSysServiceImpl extends ServiceImpl<PqErrSysMapper, PqErrSys> i
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public boolean deletePqErrSys(List<String> ids) {
|
||||
Integer count = this.baseMapper.getCountBoundByIds(ids);
|
||||
if (count > 0) {
|
||||
throw new BusinessException(ErrResponseEnum.ERR_SYS_BOUND_NOT_DELETE);
|
||||
}
|
||||
pqErrSysDtlsService.deletePqErrSysDtlsByPqErrSysId(ids);
|
||||
this.lambdaUpdate().in(PqErrSys::getId, ids).set(PqErrSys::getState, DataStateEnum.DELETED.getCode()).update();
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user