模板删除方法处理
This commit is contained in:
parent
a01d2f2b8d
commit
8288d2f136
@ -7,8 +7,11 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.util.ArrayUtil;
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
import com.ktg.common.constant.UserConstants;
|
import com.ktg.common.constant.UserConstants;
|
||||||
import com.ktg.common.utils.StringUtils;
|
import com.ktg.common.utils.StringUtils;
|
||||||
|
import com.ktg.mes.qc.service.IQcTemplateIndexService;
|
||||||
|
import com.ktg.mes.qc.service.IQcTemplateProductService;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
@ -39,6 +42,12 @@ public class QcTemplateController extends BaseController
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IQcTemplateService qcTemplateService;
|
private IQcTemplateService qcTemplateService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IQcTemplateIndexService qcTemplateIndexService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IQcTemplateProductService qcTemplateProductService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询检测模板列表
|
* 查询检测模板列表
|
||||||
*/
|
*/
|
||||||
@ -146,9 +155,18 @@ public class QcTemplateController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:remove')")
|
@PreAuthorize("@ss.hasPermi('mes:qc:qctemplate:remove')")
|
||||||
@Log(title = "检测模板", businessType = BusinessType.DELETE)
|
@Log(title = "检测模板", businessType = BusinessType.DELETE)
|
||||||
|
@Transactional
|
||||||
@DeleteMapping("/{templateIds}")
|
@DeleteMapping("/{templateIds}")
|
||||||
public AjaxResult remove(@PathVariable Long[] templateIds)
|
public AjaxResult remove(@PathVariable Long[] templateIds)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
for (Long id:templateIds
|
||||||
|
) {
|
||||||
|
//删除当前模板下所有检测项数据
|
||||||
|
qcTemplateIndexService.deleteByTemplateId(id);
|
||||||
|
//删除当前模板下所有检测产品
|
||||||
|
qcTemplateProductService.deleteByTemplateId(id);
|
||||||
|
}
|
||||||
return toAjax(qcTemplateService.deleteQcTemplateByTemplateIds(templateIds));
|
return toAjax(qcTemplateService.deleteQcTemplateByTemplateIds(templateIds));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,4 +58,11 @@ public interface QcTemplateIndexMapper
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteQcTemplateIndexByRecordIds(Long[] recordIds);
|
public int deleteQcTemplateIndexByRecordIds(Long[] recordIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据检测模板ID删除所有检测项
|
||||||
|
* @param templateId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int deleteByTemplateId(Long templateId);
|
||||||
}
|
}
|
||||||
|
@ -61,4 +61,7 @@ public interface QcTemplateProductMapper
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteQcTemplateProductByRecordIds(Long[] recordIds);
|
public int deleteQcTemplateProductByRecordIds(Long[] recordIds);
|
||||||
|
|
||||||
|
public int deleteByTemplateId(Long templateId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -58,4 +58,11 @@ public interface IQcTemplateIndexService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteQcTemplateIndexByRecordId(Long recordId);
|
public int deleteQcTemplateIndexByRecordId(Long recordId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据检测模板ID删除所有检测项
|
||||||
|
* @param templateId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int deleteByTemplateId(Long templateId);
|
||||||
}
|
}
|
||||||
|
@ -60,4 +60,11 @@ public interface IQcTemplateProductService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteQcTemplateProductByRecordId(Long recordId);
|
public int deleteQcTemplateProductByRecordId(Long recordId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据检测模板ID删除产品
|
||||||
|
* @param templateId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int deleteByTemplateId(Long templateId);
|
||||||
}
|
}
|
||||||
|
@ -93,4 +93,9 @@ public class QcTemplateIndexServiceImpl implements IQcTemplateIndexService
|
|||||||
{
|
{
|
||||||
return qcTemplateIndexMapper.deleteQcTemplateIndexByRecordId(recordId);
|
return qcTemplateIndexMapper.deleteQcTemplateIndexByRecordId(recordId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int deleteByTemplateId(Long templateId) {
|
||||||
|
return qcTemplateIndexMapper.deleteByTemplateId(templateId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,4 +106,9 @@ public class QcTemplateProductServiceImpl implements IQcTemplateProductService
|
|||||||
{
|
{
|
||||||
return qcTemplateProductMapper.deleteQcTemplateProductByRecordId(recordId);
|
return qcTemplateProductMapper.deleteQcTemplateProductByRecordId(recordId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int deleteByTemplateId(Long templateId) {
|
||||||
|
return qcTemplateProductMapper.deleteByTemplateId(templateId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,4 +144,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
#{recordId}
|
#{recordId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteByTemplateId" parameterType="Long">
|
||||||
|
delete from qc_template_index where template_id = #{templateId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
@ -144,4 +144,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
#{recordId}
|
#{recordId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteByTemplateId" parameterType="Long">
|
||||||
|
delete from qc_template_product where template_id = #{templateId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
Loading…
Reference in New Issue
Block a user