Commit 329111dc authored by 高滢's avatar 高滢

Merge branch 'gaoying' into 'dev'

Gaoying

See merge request !204
parents 4a6edec8 46fe8a1f
...@@ -22,4 +22,6 @@ public interface TaskSampleRelationMapper extends BaseMapper<TaskSampleRelation> ...@@ -22,4 +22,6 @@ public interface TaskSampleRelationMapper extends BaseMapper<TaskSampleRelation>
/** /**
* 根据样品id查询*/ * 根据样品id查询*/
List<SampleTaskVo> selectTaskBysampleId(@Param("idList") List<Long> idList); List<SampleTaskVo> selectTaskBysampleId(@Param("idList") List<Long> idList);
public int selectTaskSumBySampleId(@Param("sampleId") Long sampleId);
} }
...@@ -3,7 +3,9 @@ package com.ruoyi.web; ...@@ -3,7 +3,9 @@ package com.ruoyi.web;
import java.util.List; import java.util.List;
import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.domain.Sample; import com.ruoyi.domain.Sample;
import com.ruoyi.mapper.TaskSampleRelationMapper;
import com.ruoyi.service.SampleManagementService; import com.ruoyi.service.SampleManagementService;
import com.ruoyi.web.request.SampleManagementGetInfoRequest; import com.ruoyi.web.request.SampleManagementGetInfoRequest;
import com.ruoyi.web.request.SampleManagementRequest; import com.ruoyi.web.request.SampleManagementRequest;
...@@ -35,6 +37,9 @@ public class SampleManagementController extends BaseController ...@@ -35,6 +37,9 @@ public class SampleManagementController extends BaseController
@Autowired @Autowired
private SampleManagementService sampleManagementService; private SampleManagementService sampleManagementService;
@Autowired
private TaskSampleRelationMapper taskSampleRelationMapper;
/** /**
* 查询样品管理列表 * 查询样品管理列表
*/ */
...@@ -99,6 +104,10 @@ public class SampleManagementController extends BaseController ...@@ -99,6 +104,10 @@ public class SampleManagementController extends BaseController
@PostMapping ("/del") @PostMapping ("/del")
public AjaxResult remove(@Validated @RequestBody SampleManagementGetInfoRequest request) public AjaxResult remove(@Validated @RequestBody SampleManagementGetInfoRequest request)
{ {
int num = taskSampleRelationMapper.selectTaskSumBySampleId(request.getId());
if(num>0){
throw new ServiceException("已有相关任务,不允许删除");
}
return toAjax(sampleManagementService.removeById(request.getId())); return toAjax(sampleManagementService.removeById(request.getId()));
} }
......
...@@ -39,4 +39,12 @@ ...@@ -39,4 +39,12 @@
#{id} #{id}
</foreach> </foreach>
</select> </select>
<select id="selectTaskSumBySampleId">
select
count(task_id)
FROM
t_task_sample_relation
where sample_id = #{sampleId}
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment