|
@@ -63,64 +63,55 @@ public class LisMappingFacade extends LisMappingServiceImpl {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 新增化验公表映射关系
|
|
|
+ * 保存化验公表映射关系
|
|
|
*
|
|
|
* @param lisMappingVO
|
|
|
* @return
|
|
|
*/
|
|
|
- public Boolean addLisMapping(LisMappingVO lisMappingVO) {
|
|
|
+ public Boolean saveLisMapping(LisMappingVO lisMappingVO) {
|
|
|
String userId = UserUtils.getCurrentPrincipleID();
|
|
|
Date now = DateUtil.now();
|
|
|
+ LisMapping lisMapping = new LisMapping();
|
|
|
+ lisMapping.setCreator(userId);
|
|
|
+ lisMapping.setGmtCreate(now);
|
|
|
+
|
|
|
QueryWrapper<LisMapping> lisMappingQueryWrapper = new QueryWrapper<>();
|
|
|
lisMappingQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
.eq("meal_name", lisMappingVO.getMealName())
|
|
|
.eq("item_name", lisMappingVO.getItemName());
|
|
|
-
|
|
|
List<LisMapping> lisMappingList = this.list(lisMappingQueryWrapper);
|
|
|
- if (ListUtil.isNotEmpty(lisMappingList)) {
|
|
|
- //错误码00020009 提示是否修改,是,调用修改接口
|
|
|
- throw new CommonException(CommonErrorCode.IS_EXISTS, "映射关系已添加,是否更新");
|
|
|
+ if (lisMappingList.size() > 1) {
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "存在多条映射关系,请删除重复映射");
|
|
|
+ } else if (lisMappingList.size() == 1) {
|
|
|
+ lisMapping = lisMappingList.get(0);
|
|
|
}
|
|
|
- LisMapping lisMapping = new LisMapping();
|
|
|
lisMapping.setMealName(lisMappingVO.getMealName());
|
|
|
lisMapping.setItemName(lisMappingVO.getItemName());
|
|
|
lisMapping.setUniqueName(lisMappingVO.getUniqueName());
|
|
|
- lisMapping.setCreator(userId);
|
|
|
lisMapping.setModifier(userId);
|
|
|
- lisMapping.setGmtCreate(now);
|
|
|
lisMapping.setGmtModified(now);
|
|
|
lisMapping.setIsDeleted(IsDeleteEnum.N.getKey());
|
|
|
- Boolean state = this.save(lisMapping);
|
|
|
+ Boolean state = this.saveOrUpdate(lisMapping);
|
|
|
return state;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 修改化验公表映射关系
|
|
|
+ * 判断映射关系是否已存在
|
|
|
*
|
|
|
* @param lisMappingVO
|
|
|
* @return
|
|
|
*/
|
|
|
- public Boolean modifyLisMapping(LisMappingVO lisMappingVO) {
|
|
|
- String userId = UserUtils.getCurrentPrincipleID();
|
|
|
- Date now = DateUtil.now();
|
|
|
+ public Boolean hasLisMapping(LisMappingVO lisMappingVO) {
|
|
|
QueryWrapper<LisMapping> lisMappingQueryWrapper = new QueryWrapper<>();
|
|
|
lisMappingQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
.eq("meal_name", lisMappingVO.getMealName())
|
|
|
.eq("item_name", lisMappingVO.getItemName());
|
|
|
- //.eq("unique_name",lisMappingVO.getUniqueName());
|
|
|
List<LisMapping> lisMappingList = this.list(lisMappingQueryWrapper);
|
|
|
- if (ListUtil.isEmpty(lisMappingList)) {
|
|
|
- throw new CommonException(CommonErrorCode.NOT_EXISTS, "映射关系不存在,不允许修改");
|
|
|
- } else if (lisMappingList.size() > 1) {
|
|
|
- throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "存在多条映射关系,不允许修改");
|
|
|
+ if (ListUtil.isNotEmpty(lisMappingList)) {
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
}
|
|
|
-
|
|
|
- LisMapping lisMapping = lisMappingList.get(0);
|
|
|
- lisMapping.setUniqueName(lisMappingVO.getUniqueName());
|
|
|
- lisMapping.setModifier(userId);
|
|
|
- lisMapping.setGmtModified(now);
|
|
|
- Boolean state = this.updateById(lisMapping);
|
|
|
- return state;
|
|
|
}
|
|
|
|
|
|
/**
|