Commit 28ae1e11 authored by renchao's avatar renchao

送验单模块代码编写

parent d4cffa84
......@@ -76,6 +76,11 @@ public class TSampleListServiceImpl extends ServiceImpl<TSampleListMapper, TSamp
//参数校验
Rcode.NOT_PARAM.assertNotNull(query);
Rcode.NOT_PARAM.assertNotEmpty(query.getYh());
//判断数据是否存在
TSampleList temp = baseMapper.selectById(query.getYh());
if (temp == null) {
return R.failed("数据不存在,样号:" + query.getYh());
}
//条件封装
TSampleList tSampleList = new TSampleList();
BeanUtils.copyProperties(query, tSampleList);
......@@ -102,8 +107,8 @@ public class TSampleListServiceImpl extends ServiceImpl<TSampleListMapper, TSamp
Rcode.NOT_PARAM.assertNotNull(query);
Rcode.NOT_PARAM.assertNotEmpty(query.getYh());
//判断数据是否已存在,如果存在不能添加
R r = getByYh(query);
if (r.getData() != null) {
TSampleList temp = baseMapper.selectById(query.getYh());
if (temp != null) {
return R.failed("送验单样号已存在,样号:" + query.getYh());
}
//继续判断参数
......@@ -141,6 +146,10 @@ public class TSampleListServiceImpl extends ServiceImpl<TSampleListMapper, TSamp
//参数校验
Rcode.NOT_PARAM.assertNotNull(query);
Rcode.NOT_PARAM.assertNotEmpty(query.getYh());
TSampleList temp = baseMapper.selectById(query.getYh());
if (temp == null) {
return R.failed("数据不存在,样号:" + query.getYh());
}
//删除
int delete = baseMapper.delete(new QueryWrapper<TSampleList>().eq(ProjectEnum.TSampleListType.YH.getLabel(), query.getYh()));
if (delete > 0) {
......@@ -158,6 +167,11 @@ public class TSampleListServiceImpl extends ServiceImpl<TSampleListMapper, TSamp
//参加校验
Rcode.NOT_PARAM.assertNotNull(query);
Rcode.NOT_PARAM.assertNotEmpty(query.getYh());
//判断数据是否存在
TSampleList temp = baseMapper.selectById(query.getYh());
if (temp == null) {
return R.failed("数据不存在,样号:" + query.getYh());
}
Rcode.NOT_PARAM.assertNotNull(query.getImageType());
Rcode.NOT_PARAM.assertNotNull(file);
......@@ -191,6 +205,9 @@ public class TSampleListServiceImpl extends ServiceImpl<TSampleListMapper, TSamp
Rcode.NOT_PARAM.assertNotEmpty(query.getYh());
Rcode.NOT_PARAM.assertNotNull(query.getImageType());
TSampleList tSampleList = baseMapper.selectById(query.getYh());
if (tSampleList == null) {
return R.failed("数据不存在,样号:" + query.getYh());
}
//获取二维码或者记录形式
ImageUtil.getImage(query.getImageType(), tSampleList, response);
//如果下载失败才会执行return
......
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