feat: 药品关联关系查重功能

v3
chenhc 5 months ago
parent 66b2a6bc81
commit 4c06fcb809

@ -1,9 +1,13 @@
package com.glxp.udidl.admin.controller.collect;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.pagehelper.PageInfo;
import com.glxp.udidl.admin.entity.chs.CodeRel;
import com.glxp.udidl.admin.entity.collect.RelCodeBatch;
import com.glxp.udidl.admin.enums.ResultEnum;
import com.glxp.udidl.admin.req.collect.RelCodeBatchRequest;
import com.glxp.udidl.admin.req.collect.RelCodeDetailRequest;
import com.glxp.udidl.admin.res.BaseResponse;
@ -11,6 +15,7 @@ import com.glxp.udidl.admin.res.PageSimpleResponse;
import com.glxp.udidl.admin.res.collect.RelCodeBatchResponse;
import com.glxp.udidl.admin.service.collect.RelCodeBatchService;
import com.glxp.udidl.admin.util.ResultVOUtils;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
@ -99,4 +104,13 @@ public class RelCodeBatchController {
return ResultVOUtils.success(relCodeBatchService.detailByParentCode(parentCode));
}
@PostMapping("/udiwms/relCode/checkCode")
public BaseResponse checkCode(@RequestBody List<String> codeList) {
if (CollUtil.isEmpty(codeList)){
return ResultVOUtils.error(ResultEnum.DATA_ERROR,"参数错误");
}
List<String> list = relCodeBatchService.checkCode(codeList);
return ResultVOUtils.success(list);
}
}

@ -298,4 +298,21 @@ public class RelCodeBatchService extends ServiceImpl<RelCodeBatchMapper, RelCode
}
return;
}
public List<String> checkCode(List<String> codeList) {
List<String> list = new ArrayList<>();
List<RelCodeDetail> list1 = relCodeDetailService.list(new LambdaQueryWrapper<RelCodeDetail>().in(RelCodeDetail::getCurCode, codeList));
List<RelCodeDetail> list2 = relCodeDetailService.list(new LambdaQueryWrapper<RelCodeDetail>().in(RelCodeDetail::getParentCode, codeList));
if (CollUtil.isNotEmpty(list1)){
list1.forEach(item -> {
list.add(item.getCurCode());
});
}
if (CollUtil.isNotEmpty(list2)){
list2.forEach(item -> {
list.add(item.getParentCode());
});
}
return list;
}
}

Loading…
Cancel
Save