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

This commit is contained in:
hayu 2024-08-16 20:45:11 +08:00
parent 308c11f75b
commit d62b7314a0
3 changed files with 29 additions and 3 deletions

View File

@ -133,4 +133,13 @@ public interface SamplesManageAppDao {
* @return
*/
int getCountByDevCode(String devCode,String sampleTools);
/**
* 根据部门id和单位id查询数据
* 判断该部门是否在单位之下
* @param departmentId
* @param customId
* @return
*/
int getCountByDepartmentId(Integer departmentId, Integer customId);
}

View File

@ -105,11 +105,21 @@ public class SamplesManageAppServiceImpl implements SamplesManageAppService {
* @param data
*/
public Boolean addSamplesDevice(List<SamplesManageAppVo> data) {
//获取单位id
Integer customId = data.get(0).getCustomId();
for (SamplesManageAppVo dto : data){
//查询设备编号是否重复
if (StringHelper.isNotEmpty(dto.getDevCode())){
if (samplesManageAppDao.getCountByDevCode(dto.getDevCode(),dto.getSampleTools())>0){
throw new RuntimeException(dto.getSampleTools() +"设备编号:"+ dto.getDevCode() +"已存在");
// if (StringHelper.isNotEmpty(dto.getDevCode())){
// if (samplesManageAppDao.getCountByDevCode(dto.getDevCode(),dto.getSampleTools())>0){
// throw new RuntimeException(dto.getSampleTools() +"设备编号:"+ dto.getDevCode() +"已存在");
// }
// }
//判断是否含有不是该单位下部门的数据
if (customId!=null && dto.getDepartmentId()!=null){
int res=samplesManageAppDao.getCountByDepartmentId(dto.getDepartmentId(),customId);
if (res<=0){
throw new RuntimeException(dto.getSampleDepartment() +"不在该单位下");
}
}

View File

@ -224,4 +224,11 @@
and dev_type_name = #{sampleTools}
and del_falg = 0
</select>
<select id="getCountByDepartmentId" resultType="java.lang.Integer">
SELECT count(*)
FROM tb_custom
WHERE del_flag = 0
AND p_id = #{customId}
AND id = #{departmentId}
</select>
</mapper>