app试验管理、审查管理、检测报告管理、合格证管理

This commit is contained in:
hayu 2024-08-16 21:28:08 +08:00
parent d62b7314a0
commit d2e4193511
3 changed files with 17 additions and 0 deletions

View File

@ -142,4 +142,11 @@ public interface SamplesManageAppDao {
* @return
*/
int getCountByDepartmentId(Integer departmentId, Integer customId);
/**
* 根据id查询数据
* @param id
* @return
*/
int getCountById(Integer id);
}

View File

@ -227,6 +227,11 @@ public class SamplesManageAppServiceImpl implements SamplesManageAppService {
Integer userId = Integer.parseInt(UserUtil.getLoginUser().getId().toString());
data.setUpdateBy(userId);
//删除详情
//查询是否为最后一条数据
int count = samplesManageAppDao.getCountById(data.getId());
if (count<=1){
return ServerResponse.createBySuccessMsg("不可删除,请至少保留一条数据");
}
int res = samplesManageAppDao.delSamplesDetailsList(data);
if (res > 0) {
return ServerResponse.createBySuccessMsg("删除成功");

View File

@ -231,4 +231,9 @@
AND p_id = #{customId}
AND id = #{departmentId}
</select>
<select id="getCountById" resultType="java.lang.Integer">
SELECT COUNT(*)
FROM tb_sample_device
WHERE sample_id IN (SELECT tsd.sample_id FROM tb_sample_device tsd WHERE tsd.id = #{id})
</select>
</mapper>