diff --git a/jero-boot-modules/src/main/java/com/jero/modules/laws/common/service/impl/LawsCommonServiceImpl.java b/jero-boot-modules/src/main/java/com/jero/modules/laws/common/service/impl/LawsCommonServiceImpl.java index 9571b045..e3b54d13 100644 --- a/jero-boot-modules/src/main/java/com/jero/modules/laws/common/service/impl/LawsCommonServiceImpl.java +++ b/jero-boot-modules/src/main/java/com/jero/modules/laws/common/service/impl/LawsCommonServiceImpl.java @@ -13,7 +13,7 @@ import com.jero.modules.laws.common.mapper.LawsCommonMapper; import com.jero.modules.laws.common.service.ILawsCommonService; import com.jero.modules.tag.entity.LawsArea; import com.jero.modules.tag.entity.LawsTag; -import com.jero.modules.tag.enums.FileTableIdEnum; +import com.jero.modules.tag.enums.TableNameEnum; import com.jero.modules.tag.enums.LawsFieldTypeEnum; import com.jero.modules.tag.service.ILawsAreaService; import com.spire.ms.System.Collections.ArrayList; @@ -50,7 +50,7 @@ public class LawsCommonServiceImpl implements ILawsCommonService { // 获取操作模块 String module = parameterMap.get("module").toString(); // 获取要操作的表名 - String tableName = FileTableIdEnum.getTableName(module); + String tableName = TableNameEnum.getTableName(module); // 查询全部字段列表 List fieldList = lawsCommonMapper.getFieldList(tableName); @@ -127,7 +127,7 @@ public class LawsCommonServiceImpl implements ILawsCommonService { @Override public List getCommonHeader(String module) { // 获取要操作的表名 - String tableName = FileTableIdEnum.getTableName(module); + String tableName = TableNameEnum.getTableName(module); // 获取全部字段 List fieldList = lawsCommonMapper.getFieldList(tableName); // 筛选出用于列表显示的字段(isShowList **列表是否显示0否 1是*) @@ -146,7 +146,7 @@ public class LawsCommonServiceImpl implements ILawsCommonService { // 获取操作模块 String module = parameterMap.get("module").toString(); // 获取要操作的表名 - String tableName = FileTableIdEnum.getTableName(module); + String tableName = TableNameEnum.getTableName(module); // 获取全部字段 List fieldList = lawsCommonMapper.getFieldList(tableName); // 筛选出表单显示的 @@ -192,7 +192,7 @@ public class LawsCommonServiceImpl implements ILawsCommonService { String id = parameterMap.get("id").toString(); parameterMap.remove("id"); // 获取要操作的表名 - String tableName = FileTableIdEnum.getTableName(module); + String tableName = TableNameEnum.getTableName(module); // 获取全部字段 List fieldList = lawsCommonMapper.getFieldList(tableName); // 筛选出表单显示的 @@ -235,7 +235,7 @@ public class LawsCommonServiceImpl implements ILawsCommonService { // 获取操作语言 LanguageEnum language = MessageUtils.getLanguage(); // 获取要操作的表名 - String tableName = FileTableIdEnum.getTableName(module); + String tableName = TableNameEnum.getTableName(module); // 获取全部字段 List fieldList = lawsCommonMapper.getFieldList(tableName); fieldList = fieldList.stream().filter(lawsTag -> YesOrNoEnum.YES.getInteger() @@ -266,7 +266,7 @@ public class LawsCommonServiceImpl implements ILawsCommonService { // 获取操作语言 LanguageEnum language = MessageUtils.getLanguage(); // 获取要操作的表名 - String tableName = FileTableIdEnum.getTableName(module); + String tableName = TableNameEnum.getTableName(module); // 获取全部字段 List fieldList = lawsCommonMapper.getFieldList(tableName); // 筛选表单显示的字段 @@ -326,7 +326,7 @@ public class LawsCommonServiceImpl implements ILawsCommonService { @Override public Map getByIdAndModule(String id, String module) { // 获取要操作的表名 - String tableName = FileTableIdEnum.getTableName(module); + String tableName = TableNameEnum.getTableName(module); // 获取全部字段 List fieldList = lawsCommonMapper.getFieldList(tableName); @@ -351,7 +351,7 @@ public class LawsCommonServiceImpl implements ILawsCommonService { @Override public String deleteByIdsAndModule(String ids, String module) { // 获取要操作的表名 - String tableName = FileTableIdEnum.getTableName(module); + String tableName = TableNameEnum.getTableName(module); // 获取要删除的id集合 if (StringUtils.isBlank(ids)) { throw new JeroBootException(MessageUtils.getMessage(ResultCommon.ERROR)); diff --git a/jero-boot-modules/src/main/java/com/jero/modules/tag/controller/LawsTagController.java b/jero-boot-modules/src/main/java/com/jero/modules/tag/controller/LawsTagController.java index eeb2a18a..a397cbe0 100644 --- a/jero-boot-modules/src/main/java/com/jero/modules/tag/controller/LawsTagController.java +++ b/jero-boot-modules/src/main/java/com/jero/modules/tag/controller/LawsTagController.java @@ -10,7 +10,7 @@ import com.jero.common.system.base.controller.JeroController; import com.jero.common.util.MessageUtils; import com.jero.modules.enums.FixedFieldEnum; import com.jero.modules.tag.entity.LawsTag; -import com.jero.modules.tag.enums.FileTableIdEnum; +import com.jero.modules.tag.enums.TableNameEnum; import com.jero.modules.tag.service.ILawsTagService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -106,18 +106,18 @@ public class LawsTagController extends JeroController }else{ //类不同, 删除原标签,同步数据库.再加回来新的,再同步 this.lawsTagService.deleteById(lawsTagDB.getId()); - if(lawsTag.getIsModel().equals(FileTableIdEnum.DOMESTIC_REGULATIONS.getValue())) {//同步文档库 - //this.onlCgformApiController.h(String.valueOf(FileTableIdEnum.FILE_TABLE_ID.getValue()), "normal"); + if(lawsTag.getIsModel().equals(TableNameEnum.DOMESTIC_REGULATIONS.getValue())) {//同步文档库 + //this.onlCgformApiController.h(String.valueOf(TableNameEnum.FILE_TABLE_ID.getValue()), "normal"); }else {//同步文档拆分 - //this.onlCgformApiController.h(String.valueOf(FileTableIdEnum.FILE_SPLIT_ID.getValue()), "normal"); + //this.onlCgformApiController.h(String.valueOf(TableNameEnum.FILE_SPLIT_ID.getValue()), "normal"); } this.lawsTagService.add(lawsTag); } - if(lawsTag.getIsModel().equals(FileTableIdEnum.DOMESTIC_REGULATIONS.getValue())) {//同步文档库 - //this.onlCgformApiController.h(String.valueOf(FileTableIdEnum.FILE_TABLE_ID.getValue()), "normal"); + if(lawsTag.getIsModel().equals(TableNameEnum.DOMESTIC_REGULATIONS.getValue())) {//同步文档库 + //this.onlCgformApiController.h(String.valueOf(TableNameEnum.FILE_TABLE_ID.getValue()), "normal"); }else {//同步文档拆分 - //this.onlCgformApiController.h(String.valueOf(FileTableIdEnum.FILE_SPLIT_ID.getValue()), "normal"); + //this.onlCgformApiController.h(String.valueOf(TableNameEnum.FILE_SPLIT_ID.getValue()), "normal"); } }else{ //中英切换提示语 @@ -125,10 +125,10 @@ public class LawsTagController extends JeroController } }else { lawsTagService.add(lawsTag); - if(lawsTag.getIsModel().equals(FileTableIdEnum.DOMESTIC_REGULATIONS.getValue())) {//同步文档库 - //this.onlCgformApiController.h(String.valueOf(FileTableIdEnum.FILE_TABLE_ID.getValue()), "normal"); + if(lawsTag.getIsModel().equals(TableNameEnum.DOMESTIC_REGULATIONS.getValue())) {//同步文档库 + //this.onlCgformApiController.h(String.valueOf(TableNameEnum.FILE_TABLE_ID.getValue()), "normal"); }else {//同步文档拆分 - //this.onlCgformApiController.h(String.valueOf(FileTableIdEnum.FILE_SPLIT_ID.getValue()), "normal"); + //this.onlCgformApiController.h(String.valueOf(TableNameEnum.FILE_SPLIT_ID.getValue()), "normal"); } return result.success("添加成功!"); } @@ -151,7 +151,7 @@ public class LawsTagController extends JeroController return Result.error(MessageUtils.getMessage("tag.edit.固定字段,不可修改")); }else { String isModel = lawsTag.getIsModel(); - String tableName = FileTableIdEnum.getTableName(isModel); + String tableName = TableNameEnum.getTableName(isModel); QueryWrapper queryWrapper=new QueryWrapper<>(); //查询同一模块下,同名数据 queryWrapper.eq("db_Field_txt", lawsTag.getDbFieldTxt()) @@ -164,11 +164,11 @@ public class LawsTagController extends JeroController if (lawsTagOld.getId().equals(lawsTag.getId())) { lawsTagService.editById(lawsTag); //同步文档库 - if (isModel.equals(FileTableIdEnum.DOMESTIC_REGULATIONS.getValue())) { + if (isModel.equals(TableNameEnum.DOMESTIC_REGULATIONS.getValue())) { - //this.onlCgformApiController.h(String.valueOf(FileTableIdEnum.FILE_TABLE_ID.getValue()), "normal"); + //this.onlCgformApiController.h(String.valueOf(TableNameEnum.FILE_TABLE_ID.getValue()), "normal"); } else {//同步文档拆分 - //this.onlCgformApiController.h(String.valueOf(FileTableIdEnum.FILE_SPLIT_ID.getValue()), "normal"); + //this.onlCgformApiController.h(String.valueOf(TableNameEnum.FILE_SPLIT_ID.getValue()), "normal"); } //已存在同名的数据,不是正在编辑的这个 } else { @@ -177,10 +177,10 @@ public class LawsTagController extends JeroController lawsTagService.updateDictDelFlag(CommonConstant.DEL_FLAG_0, lawsTagOld.getId()); lawsTag.setId(lawsTagOld.getId()); lawsTagService.editById(lawsTag); - if (isModel.equals(FileTableIdEnum.DOMESTIC_REGULATIONS.getValue())) {//同步文档库 - //this.onlCgformApiController.h(String.valueOf(FileTableIdEnum.FILE_TABLE_ID.getValue()), "normal"); + if (isModel.equals(TableNameEnum.DOMESTIC_REGULATIONS.getValue())) {//同步文档库 + //this.onlCgformApiController.h(String.valueOf(TableNameEnum.FILE_TABLE_ID.getValue()), "normal"); } else {//同步文档拆分 - //this.onlCgformApiController.h(String.valueOf(FileTableIdEnum.FILE_SPLIT_ID.getValue()), "normal"); + //this.onlCgformApiController.h(String.valueOf(TableNameEnum.FILE_SPLIT_ID.getValue()), "normal"); } //有未删数据,报错 } else { @@ -189,10 +189,10 @@ public class LawsTagController extends JeroController } }else{ lawsTagService.editById(lawsTag); - if(isModel.equals(FileTableIdEnum.DOMESTIC_REGULATIONS.getValue())) {//同步文档库 - //this.onlCgformApiController.h(String.valueOf(FileTableIdEnum.FILE_TABLE_ID.getValue()), "normal"); + if(isModel.equals(TableNameEnum.DOMESTIC_REGULATIONS.getValue())) {//同步文档库 + //this.onlCgformApiController.h(String.valueOf(TableNameEnum.FILE_TABLE_ID.getValue()), "normal"); }else {//同步文档拆分 - //this.onlCgformApiController.h(String.valueOf(FileTableIdEnum.FILE_SPLIT_ID.getValue()), "normal"); + //this.onlCgformApiController.h(String.valueOf(TableNameEnum.FILE_SPLIT_ID.getValue()), "normal"); } } return Result.OK("编辑成功!"); @@ -221,7 +221,7 @@ public class LawsTagController extends JeroController return Result.error(MessageUtils.getMessage("tag.edit.固定字段,不可删除")); } else { lawsTagService.removeById(id); - ////onlCgformApiController.h(String.valueOf(FileTableIdEnum.FILE_TABLE_ID),"normal");//逻辑删除-->改变状态,数据库不删 + ////onlCgformApiController.h(String.valueOf(TableNameEnum.FILE_TABLE_ID),"normal");//逻辑删除-->改变状态,数据库不删 return Result.OK("删除成功!"); } } @@ -258,7 +258,7 @@ public class LawsTagController extends JeroController } } else { lawsTagService.removeById(midTag.getId()); - ////onlCgformApiController.h(String.valueOf(FileTableIdEnum.FILE_TABLE_ID),"normal");//逻辑删除-->改变状态,数据库不删 + ////onlCgformApiController.h(String.valueOf(TableNameEnum.FILE_TABLE_ID),"normal");//逻辑删除-->改变状态,数据库不删 //中英切换提示语 if(LanguageEnum.CN.getValue().equals(midTag.getCut())) { result.success("批量删除成功!"); diff --git a/jero-boot-modules/src/main/java/com/jero/modules/tag/enums/FileTableIdEnum.java b/jero-boot-modules/src/main/java/com/jero/modules/tag/enums/TableNameEnum.java similarity index 75% rename from jero-boot-modules/src/main/java/com/jero/modules/tag/enums/FileTableIdEnum.java rename to jero-boot-modules/src/main/java/com/jero/modules/tag/enums/TableNameEnum.java index 070a08a9..120cf47f 100644 --- a/jero-boot-modules/src/main/java/com/jero/modules/tag/enums/FileTableIdEnum.java +++ b/jero-boot-modules/src/main/java/com/jero/modules/tag/enums/TableNameEnum.java @@ -6,7 +6,7 @@ import lombok.Getter; @Getter @AllArgsConstructor -public enum FileTableIdEnum { +public enum TableNameEnum { /** * */ @@ -20,9 +20,9 @@ public enum FileTableIdEnum { String value; public static String getTableName(String value){ - for (FileTableIdEnum fileTableIdEnum : values()) { - if (fileTableIdEnum.getValue().equals(value)) { - return fileTableIdEnum.getTableName(); + for (TableNameEnum tableNameEnum : values()) { + if (tableNameEnum.getValue().equals(value)) { + return tableNameEnum.getTableName(); } } throw new JeroBootException("标签类型不存在"); diff --git a/jero-boot-modules/src/main/java/com/jero/modules/tag/service/impl/ILawsTagServiceImpl.java b/jero-boot-modules/src/main/java/com/jero/modules/tag/service/impl/ILawsTagServiceImpl.java index 5e3db497..e62f159f 100644 --- a/jero-boot-modules/src/main/java/com/jero/modules/tag/service/impl/ILawsTagServiceImpl.java +++ b/jero-boot-modules/src/main/java/com/jero/modules/tag/service/impl/ILawsTagServiceImpl.java @@ -18,7 +18,7 @@ import com.jero.modules.system.service.impl.SysDictServiceImpl; import com.jero.modules.system.util.HanYuPinYinUtil; import com.jero.modules.tag.entity.LawsArea; import com.jero.modules.tag.entity.LawsTag; -import com.jero.modules.tag.enums.FileTableIdEnum; +import com.jero.modules.tag.enums.TableNameEnum; import com.jero.modules.tag.mapper.LawsTagMapper; import com.jero.modules.tag.service.ILawsTagService; import org.apache.commons.lang3.StringUtils; @@ -117,10 +117,10 @@ public class ILawsTagServiceImpl extends ServiceImpl imp } } lawsTag.setDelFlag(CommonConstant.DEL_FLAG_0); - //if(lawsTag.getIsModel().equals(FileTableIdEnum.FILE_TABLE_IS_MODEL.getValue())) {//设置文档库-表id - // lawsTag.setCgformHeadId(FileTableIdEnum.FILE_TABLE_ID.getValue()); + //if(lawsTag.getIsModel().equals(TableNameEnum.FILE_TABLE_IS_MODEL.getValue())) {//设置文档库-表id + // lawsTag.setCgformHeadId(TableNameEnum.FILE_TABLE_ID.getValue()); //}else {//设置文档拆分-表id - // lawsTag.setCgformHeadId(FileTableIdEnum.FILE_SPLIT_ID.getValue()); + // lawsTag.setCgformHeadId(TableNameEnum.FILE_SPLIT_ID.getValue()); //} lawsTag.setDbIsKey(Integer.valueOf(YesOrNoEnum.NO.getValue())); lawsTag.setDbIsNull(Integer.valueOf(YesOrNoEnum.YES.getValue())); @@ -160,41 +160,6 @@ public class ILawsTagServiceImpl extends ServiceImpl imp @Override public void editById(LawsTag lawsTag) { Integer inputOrderNum = lawsTag.getOrderNum(); - //查询展示顺序相同的 - QueryWrapper queryWrapper= new QueryWrapper<>(); - queryWrapper.eq("is_model", lawsTag.getIsModel()) - .eq("is_delete",CommonConstant.DEL_FLAG_0) - .orderByAsc("order_num"); - Integer orderNumData = list(queryWrapper).stream().filter(e->e.getId().equals(lawsTag.getId())) - .map(e -> e.getOrderNum()).collect(Collectors.toList()).get(0); - queryWrapper.eq("order_num", inputOrderNum); - Integer orderNumCount = lawsTagMapper.selectCount(queryWrapper); - //有重复展示顺序的,后面的号全+1 - if(orderNumCount > 0 && !orderNumData.equals(inputOrderNum)) { - //设置排序 - QueryWrapper orderNumQueryWrapper = new QueryWrapper<>(); - orderNumQueryWrapper.ge("order_num", inputOrderNum) - .eq("is_model", lawsTag.getIsModel()) - .eq("is_delete", CommonConstant.DEL_FLAG_0) - .orderByAsc("order_num"); - List geOrderNumList = list(orderNumQueryWrapper); - - //判断相邻的序号,去掉不邻的 - for(int i = 0 ; i < geOrderNumList.size() ; i++) { - if (geOrderNumList.size()==1){ - break; - }else if(i+1 >= geOrderNumList.size()){ - break; - }else if (geOrderNumList.get(i + 1).getOrderNum() - geOrderNumList.get(i).getOrderNum() > 1) { - int deleteStart = geOrderNumList.get(i+1).getOrderNum(); - geOrderNumList = geOrderNumList.stream().filter(e->e.getOrderNum() < deleteStart).collect(Collectors.toList()); - break; - } - } - - geOrderNumList.stream().forEach(e -> e.setOrderNum(e.getOrderNum() + 1)); - saveOrUpdateBatch(geOrderNumList); - } //字段名称设置成拼音+下划线,存入数据库 String pinYin = HanYuPinYinUtil.changeToNumberPinYin(lawsTag.getDbFieldTxt()); @@ -256,7 +221,7 @@ public class ILawsTagServiceImpl extends ServiceImpl imp }else { type = "varchar("+dbLength+")"; } - String tableName = FileTableIdEnum.getTableName(isModel); + String tableName = TableNameEnum.getTableName(isModel); String dbFieldTxt = lawsTag.getDbFieldTxt(); String dbFieldNameOld = lawsTag.getDbFieldNameOld(); String sql;