|
@@ -1,21 +1,21 @@
|
|
|
package com.platform.service.custom.impl;
|
|
|
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
|
import com.platform.common.bean.AbstractPageResultBean;
|
|
|
import com.platform.common.exception.DeniedException;
|
|
|
import com.platform.common.util.StringUtils;
|
|
|
import com.platform.dao.bean.MyPage;
|
|
|
-import com.github.pagehelper.PageHelper;
|
|
|
-import com.platform.dao.enums.ClassNameCodeEnum;
|
|
|
-import com.platform.dao.vo.query.custom.CustomClassNameVO;
|
|
|
import com.platform.dao.dto.custom.CustomClassNameDTO;
|
|
|
import com.platform.dao.entity.custom.CustomClassName;
|
|
|
+import com.platform.dao.enums.ClassNameCodeEnum;
|
|
|
import com.platform.dao.mapper.custom.CustomClassNameMapper;
|
|
|
+import com.platform.dao.vo.query.custom.CustomClassNameVO;
|
|
|
+import com.platform.service.base.impl.BaseServiceImpl;
|
|
|
import com.platform.service.custom.CustomClassNameService;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-import com.platform.service.base.impl.BaseServiceImpl;
|
|
|
import tk.mybatis.mapper.weekend.Weekend;
|
|
|
import tk.mybatis.mapper.weekend.WeekendCriteria;
|
|
|
-import lombok.AllArgsConstructor;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
@@ -60,9 +60,41 @@ public class CustomClassNameServiceImpl extends BaseServiceImpl<CustomClassNameM
|
|
|
if(!oldCustom.getCode().equals(record.getCode())){
|
|
|
throw new DeniedException("配置类型不可修改");
|
|
|
}
|
|
|
+ String oldCode = oldCustom.getHandleCode();
|
|
|
+ String oldMethodCode = oldCustom.getMethodCode();
|
|
|
+ String oldTitleColumnCode = oldCustom.getTitleColumnCode();
|
|
|
+ String oldTitleCode = oldCustom.getTitleCode();
|
|
|
+ CustomClassName checkQuery = new CustomClassName();
|
|
|
+ checkQuery.setCode(record.getCode());
|
|
|
+ // 修改反射类的限制条件
|
|
|
+ if(ClassNameCodeEnum.REFLECT.getValue().equals(record.getCode())){
|
|
|
+ if(!oldCode.equals(record.getCode()) || !oldMethodCode.equals(record.getMethodCode())
|
|
|
+ || !oldTitleColumnCode.equals(record.getTitleColumnCode()) || !oldTitleCode.equals(record.getTitleCode())){
|
|
|
+ // 校验修改的唯一性
|
|
|
+ checkQuery.setHandleCode(record.getHandleCode());
|
|
|
+ checkQuery.setMethodCode(record.getMethodCode());
|
|
|
+ checkQuery.setTitleColumnCode(record.getTitleColumnCode());
|
|
|
+ checkQuery.setTitleCode(record.getTitleCode());
|
|
|
+ if(getCountByModel(checkQuery) > 0){
|
|
|
+ throw new DeniedException("修改的数据已存在");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if(!oldTitleCode.equals(record.getTitleCode())){
|
|
|
+ checkQuery.setTitleCode(record.getTitleCode());
|
|
|
+ if(getCountByModel(checkQuery) > 0){
|
|
|
+ throw new DeniedException("修改的数据已存在");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
modModelByDTO(record);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<CustomClassNameVO> getCustomClassNameList(CustomClassNameDTO record) {
|
|
|
+ return mapper.getDistinctList(record);
|
|
|
+ }
|
|
|
+
|
|
|
private void checkPreview(CustomClassNameDTO record){
|
|
|
if(StringUtils.isBlank(record.getTitle())){
|
|
|
throw new DeniedException("表名不可为空");
|
|
@@ -92,10 +124,13 @@ public class CustomClassNameServiceImpl extends BaseServiceImpl<CustomClassNameM
|
|
|
if(StringUtils.isBlank(record.getTitleColumnName())){
|
|
|
throw new DeniedException("具体列名不可为空");
|
|
|
}
|
|
|
+ if(StringUtils.isBlank(record.getTitleColumnCode())){
|
|
|
+ throw new DeniedException("具体列编码不可为空");
|
|
|
+ }
|
|
|
// 判断数据库中是否唯一
|
|
|
checkQuery.setHandleCode(record.getHandleCode());
|
|
|
checkQuery.setMethodCode(record.getMethodCode());
|
|
|
- checkQuery.setTitleColumnName(record.getTitleColumnName());
|
|
|
+ checkQuery.setTitleColumnCode(record.getTitleColumnCode());
|
|
|
}
|
|
|
countNum = getCountByModel(checkQuery);
|
|
|
if(countNum > 0){
|