微调
This commit is contained in:
@@ -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<>();
|
||||
|
||||
Reference in New Issue
Block a user