微调
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;
|
||||
|
||||
@@ -510,6 +510,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取备注信息
|
||||
*
|
||||
|
||||
@@ -4,6 +4,8 @@ import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.njcn.gather.script.pojo.po.PqScript;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @date 2024-11-18
|
||||
@@ -18,5 +20,13 @@ public interface PqScriptMapper extends MPJBaseMapper<PqScript> {
|
||||
* @Date: 2024/12/16 18:08
|
||||
*/
|
||||
Boolean selectScriptIsValueType(@Param("scriptId") String scriptId);
|
||||
|
||||
/**
|
||||
* 根据脚本id获取绑定的计划数量
|
||||
*
|
||||
* @param scriptIds
|
||||
* @return
|
||||
*/
|
||||
Integer getBoundCountByScriptIds(@Param("scriptIds") List<String> scriptIds);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,5 +12,16 @@
|
||||
State=1
|
||||
and Id = #{scriptId}
|
||||
</select>
|
||||
<select id="getBoundCountByScriptIds" resultType="java.lang.Integer">
|
||||
SELECT COUNT(*) FROM ad_plan
|
||||
<if test="scriptIds !=null and scriptIds.size()!=0">
|
||||
<where>
|
||||
AND Script_Id in
|
||||
<foreach collection="scriptIds" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</where>
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.njcn.gather.script.pojo.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2025-03-10
|
||||
*/
|
||||
@Getter
|
||||
public enum ScriptResponseEnum {
|
||||
SCRIPT_BOUND_NOT_DELETE("A020001", "脚本已被计划所绑定,无法删除!");
|
||||
|
||||
private String code;
|
||||
private String message;
|
||||
|
||||
ScriptResponseEnum(String code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,11 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
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.plan.pojo.po.AdPlan;
|
||||
import com.njcn.gather.plan.service.IAdPlanService;
|
||||
import com.njcn.gather.script.mapper.PqScriptMapper;
|
||||
import com.njcn.gather.script.pojo.enums.ScriptResponseEnum;
|
||||
import com.njcn.gather.script.pojo.param.PqScriptParam;
|
||||
import com.njcn.gather.script.pojo.po.PqScript;
|
||||
import com.njcn.gather.script.service.IPqScriptDtlsService;
|
||||
@@ -77,6 +81,10 @@ public class PqScriptServiceImpl extends ServiceImpl<PqScriptMapper, PqScript> i
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public boolean deletePqScript(List<String> ids) {
|
||||
Integer count = this.baseMapper.getBoundCountByScriptIds(ids);
|
||||
if (count > 0) {
|
||||
throw new BusinessException(ScriptResponseEnum.SCRIPT_BOUND_NOT_DELETE);
|
||||
}
|
||||
//删除对应的脚本详情
|
||||
pqScriptDtlsService.deletePqScriptDtlsByScriptId(ids);
|
||||
LambdaUpdateWrapper<PqScript> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
|
||||
@@ -2,6 +2,9 @@ package com.njcn.gather.source.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.njcn.gather.source.pojo.po.PqSource;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
@@ -9,5 +12,12 @@ import com.njcn.gather.source.pojo.po.PqSource;
|
||||
*/
|
||||
public interface PqSourceMapper extends MPJBaseMapper<PqSource> {
|
||||
|
||||
/**
|
||||
* 根据ids获取绑定的计划数量
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
Integer getCountBoundByIds(@Param("ids") List<String> ids);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,5 +3,16 @@
|
||||
<mapper namespace="com.njcn.gather.source.mapper.PqSourceMapper">
|
||||
|
||||
|
||||
<select id="getCountBoundByIds" resultType="java.lang.Integer">
|
||||
SELECT COUNT(*) FROM ad_plan_source
|
||||
<if test="ids!= null and ids.size() > 0">
|
||||
<where>
|
||||
and Source_Id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</where>
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.njcn.gather.source.pojo.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2025-03-10
|
||||
*/
|
||||
@Getter
|
||||
public enum SourceResponseEnum {
|
||||
SOURCE_BOUND_NOT_DELETE("A030001", "源已被计划所绑定,无法删除!");
|
||||
|
||||
private String code;
|
||||
private String message;
|
||||
|
||||
SourceResponseEnum(String code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.gather.device.pojo.enums.CommonEnum;
|
||||
import com.njcn.gather.device.pojo.enums.DevResponseEnum;
|
||||
import com.njcn.gather.source.mapper.PqSourceMapper;
|
||||
import com.njcn.gather.source.pojo.enums.SourceResponseEnum;
|
||||
import com.njcn.gather.source.pojo.param.PqSourceParam;
|
||||
import com.njcn.gather.source.pojo.po.PqSource;
|
||||
import com.njcn.gather.source.pojo.po.SourceInitialize;
|
||||
@@ -85,6 +86,10 @@ public class PqSourceServiceImpl extends ServiceImpl<PqSourceMapper, PqSource> i
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public boolean deletePqSource(List<String> ids) {
|
||||
Integer count = this.baseMapper.getCountBoundByIds(ids);
|
||||
if(count > 0){
|
||||
throw new BusinessException(SourceResponseEnum.SOURCE_BOUND_NOT_DELETE);
|
||||
}
|
||||
return this.lambdaUpdate().in(PqSource::getId, ids).set(PqSource::getState, DataStateEnum.DELETED.getCode()).update();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user