feat: 体系搜索列表新排序规则
This commit is contained in:
-85
@@ -1,85 +0,0 @@
|
||||
package com.adc.da.slrs.sarMenuStandard.entity;
|
||||
|
||||
import com.adc.da.exception.AdcDaBaseException;
|
||||
|
||||
/**
|
||||
* @author: Mzaxd
|
||||
* @Date: 2023/11/15 17:36
|
||||
*/
|
||||
public enum StandCategoryEnum {
|
||||
// INLAND 类型的枚举实例
|
||||
INLAND_GB("INLAND", "GB", 0),
|
||||
INLAND_GBT("INLAND", "GB/T", 1),
|
||||
INLAND_QCT("INLAND", "QC/T", 2),
|
||||
INLAND_JT("INLAND", "JT", 3),
|
||||
INLAND_JB("INLAND", "JB", 4),
|
||||
INLAND_GA("INLAND", "GA", 5),
|
||||
INLAND_GJB("INLAND", "GJB", 6),
|
||||
INLAND_HJ("INLAND", "HJ", 7),
|
||||
|
||||
// FOREIGN 类型的枚举实例
|
||||
FOREIGN_ECE("FOREIGN", "ECE", 0),
|
||||
FOREIGN_EU("FOREIGN", "EU", 1),
|
||||
FOREIGN_EC("FOREIGN", "EC", 2),
|
||||
FOREIGN_EEC("FOREIGN", "EEC", 3),
|
||||
FOREIGN_ISO("FOREIGN", "ISO", 4),
|
||||
FOREIGN_IEC("FOREIGN", "IEC", 5),
|
||||
FOREIGN_GTR("FOREIGN", "GTR", 6),
|
||||
FOREIGN_CFR("FOREIGN", "CFR", 7),
|
||||
FOREIGN_JASO("FOREIGN", "JASO", 8),
|
||||
FOREIGN_JIS("FOREIGN", "JIS", 9),
|
||||
FOREIGN_GSO("FOREIGN", "GSO", 10),
|
||||
FOREIGN_GOST("FOREIGN", "GOST", 11),
|
||||
FOREIGN_ΓOCT("FOREIGN", "ΓOCT", 12),
|
||||
FOREIGN_TP("FOREIGN", "TP", 13),
|
||||
FOREIGN_SASO("FOREIGN", "SASO", 14),
|
||||
FOREIGN_UAE("FOREIGN", "UAE", 15),
|
||||
FOREIGN_CONTRAN("FOREIGN", "CONTRAN", 16),
|
||||
FOREIGN_DENATRAN("FOREIGN", "DENATRAN", 17),
|
||||
FOREIGN_ABNT_NBR("FOREIGN", "ABNT NBR", 18),
|
||||
FOREIGN_NBR("FOREIGN", "NBR", 19),
|
||||
FOREIGN_INMETRO("FOREIGN", "INMETRO", 20),
|
||||
FOREIGN_CONAMA("FOREIGN", "CONAMA", 21),
|
||||
FOREIGN_Normative_Instruction("FOREIGN", "Normative Instruction", 22),
|
||||
FOREIGN_ADR("FOREIGN", "ADR", 23),
|
||||
;
|
||||
|
||||
private final String standType;
|
||||
private final String standSort;
|
||||
private final int sortValue;
|
||||
|
||||
StandCategoryEnum(String standType, String standSort, int sortValue) {
|
||||
this.standType = standType;
|
||||
this.standSort = standSort;
|
||||
this.sortValue = sortValue;
|
||||
}
|
||||
|
||||
// 根据 standSort 返回 value 的静态方法
|
||||
public static int getSortByStandType(String standType, String standSort) {
|
||||
for (StandCategoryEnum category : StandCategoryEnum.values()) {
|
||||
if (category.getStandType().equals(standType) && category.getStandSort().equals(standSort)) {
|
||||
return category.getSortValue();
|
||||
}
|
||||
// 给国标 外标默认值
|
||||
if (category.getStandType().equals("INLAND")) {
|
||||
return 8;
|
||||
} else if (category.getStandType().equals("FOREIGN")) {
|
||||
return 24;
|
||||
}
|
||||
}
|
||||
throw new AdcDaBaseException("标准类型错误");
|
||||
}
|
||||
|
||||
// Getter 方法
|
||||
public String getStandType() {
|
||||
return standType;
|
||||
}
|
||||
|
||||
public String getStandSort() {
|
||||
return standSort;
|
||||
}
|
||||
|
||||
public int getSortValue() {
|
||||
return sortValue;
|
||||
}
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package com.adc.da.slrs.sarMenuStandard.entity;
|
||||
|
||||
|
||||
import com.adc.da.slrs.tsDictionaryType.entity.TsDicType;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: Mzaxd
|
||||
* @Date: 2023/11/15 17:36
|
||||
*/
|
||||
@Component
|
||||
public class StandCategorySortUtil {
|
||||
|
||||
// 构造器
|
||||
public static Integer getSortByStandType(List<TsDicType> gbSortDictList,
|
||||
List<TsDicType> fbSortDictList,
|
||||
List<TsDicType> esSortDictList,
|
||||
String standType, String standSort) {
|
||||
switch (standType) {
|
||||
case "INLAND":
|
||||
for (TsDicType gbSortDict : gbSortDictList) {
|
||||
if (gbSortDict.getDicTypeName().equals(standSort)) {
|
||||
return gbSortDict.getShowIndex().intValue();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "FOREIGN":
|
||||
for (TsDicType fbSortDict : fbSortDictList) {
|
||||
if (fbSortDict.getDicTypeName().equals(standSort)) {
|
||||
return fbSortDict.getShowIndex().intValue();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "ENTERPRISE":
|
||||
for (TsDicType esSortDict : esSortDictList) {
|
||||
if (esSortDict.getDicTypeName().equals(standSort)) {
|
||||
return esSortDict.getShowIndex().intValue();
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
+12
-3
@@ -14,7 +14,7 @@ import com.adc.da.slrs.sarBussionessStand.dao.SarBussionessStandDao;
|
||||
import com.adc.da.slrs.sarLawsTopic.entity.SarLawsTopicVO;
|
||||
import com.adc.da.slrs.sarMenuStandard.dao.SarMenuStandardNewDao;
|
||||
import com.adc.da.slrs.sarMenuStandard.entity.SarMenuStandardNew;
|
||||
import com.adc.da.slrs.sarMenuStandard.entity.StandCategoryEnum;
|
||||
import com.adc.da.slrs.sarMenuStandard.entity.StandCategorySortUtil;
|
||||
import com.adc.da.slrs.sarMenuStandard.entity.StandSystemDTO;
|
||||
import com.adc.da.slrs.sarMenuStandard.service.ISarMenuStandardNewService;
|
||||
import com.adc.da.slrs.sarResource.dao.TsResourceDao;
|
||||
@@ -282,11 +282,20 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
|
||||
// 企标标准状态字典
|
||||
List<TsDicType> esStateDictList = dicItemService.selectAllDicTypeNameByDicCode("TEXTSTATUSBUSS");
|
||||
|
||||
// 国标排序字典
|
||||
List<TsDicType> gbSortDictList = dicItemService.selectAllDicTypeNameByDicCode("ES_INLAND");
|
||||
// 外标排序字典
|
||||
List<TsDicType> fbSortDictList = dicItemService.selectAllDicTypeNameByDicCode("ES_FOREIGN");
|
||||
// 企标排序字典
|
||||
List<TsDicType> esSortDictList = dicItemService.selectAllDicTypeNameByDicCode("ES_BUSS");
|
||||
|
||||
// 构造体系路径 && 设置标准内部类别排序号 && 翻译
|
||||
for (StandSystemDTO dto : resultList) {
|
||||
String fullPath = pathMap.get(dto.getMenuId());
|
||||
dto.setStandSystem(fullPath);
|
||||
dto.setStandCategorySort(StandCategoryEnum.getSortByStandType(dto.getDataSource(), dto.getStandSort()));
|
||||
dto.setStandCategorySort(StandCategorySortUtil.getSortByStandType(
|
||||
gbSortDictList, fbSortDictList, esSortDictList, dto.getDataSource(), dto.getStandSort())
|
||||
);
|
||||
// 设置体系排序号
|
||||
SarMenuStandard node = SarMenuStandard.findNodeById(targetNode, dto.getMenuId());
|
||||
dto.setSystemSort(node.getSystemSort());
|
||||
@@ -418,7 +427,7 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
|
||||
@Override
|
||||
public void deleteMenuStandard(String menuId) {
|
||||
// 先找到节点的名字
|
||||
String menuName = getById(menuId).getMenuName();
|
||||
String menuName = getById(menuId).getMenuName();
|
||||
// 删除主表中的节点
|
||||
LambdaUpdateWrapper<SarMenuStandard> menuUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
menuUpdateWrapper.eq(SarMenuStandard::getId, menuId);
|
||||
|
||||
+1
-20
@@ -1287,26 +1287,7 @@
|
||||
'ENTERPRISE' AS dataSource,
|
||||
sms.ID AS menuId,
|
||||
3 AS standTypeSort,
|
||||
CASE
|
||||
when es.stand_code like concat('%', 'Q/FT A', '%') THEN 0
|
||||
when es.stand_code like concat('%', 'Q/FT B', '%') THEN 1
|
||||
when es.stand_code like concat('%', 'Q/FT E', '%') THEN 2
|
||||
when es.stand_code like concat('%', 'Q/FT F', '%') THEN 3
|
||||
when es.stand_code like concat('%', 'Q/FT G', '%') THEN 4
|
||||
when es.stand_code like concat('%', 'Q/FT M', '%') THEN 5
|
||||
when es.stand_code like concat('%', 'Q/FT Q', '%') THEN 6
|
||||
when es.stand_code like concat('%', 'Q/FT R', '%') THEN 7
|
||||
when es.stand_code like concat('%', 'Q/FT S', '%') THEN 8
|
||||
when es.stand_code like concat('%', 'Q/FT T', '%') THEN 9
|
||||
when es.stand_code like concat('%', 'Q/FT V', '%') THEN 10
|
||||
when es.stand_code like concat('%', 'Q/FT X', '%') THEN 11
|
||||
when es.stand_code like concat('%', 'Q/FT Y', '%') THEN 12
|
||||
when es.stand_code like concat('%', 'Q/FT Z', '%') THEN 13
|
||||
when es.stand_code like concat('%', 'Q/QCBFC', '%') THEN 14
|
||||
when es.stand_code like concat('%', '雷萨企标Q/FL', '%') THEN 15
|
||||
when es.stand_code like concat('%', 'Q/QCFLC', '%') THEN 16
|
||||
ELSE 17
|
||||
END AS standCategorySort
|
||||
stand_sort AS standSort
|
||||
FROM
|
||||
`sar_bussioness_stand` AS es
|
||||
LEFT JOIN `sar_buss_stand_attr_info` AS esa ON es.ID = esa.STAND_ID
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
<resultMap id="codeAndName" type="com.adc.da.slrs.tsDictionaryType.entity.TsDicType">
|
||||
<result property="dicTypeCode" column="dicTypeCode"/>
|
||||
<result property="dicTypeName" column="dicTypeName"/>
|
||||
<result property="showIndex" column="showIndex"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="getSearchMenu" resultMap="searchMenu">
|
||||
@@ -37,7 +38,7 @@
|
||||
select DIC_TYPE_NAME from ts_dictype where DIC_TYPE_CODE = #{typeCode}
|
||||
</select>
|
||||
<select id="selectAllDicTypeNameByDicCode" resultMap="codeAndName">
|
||||
select DIC_TYPE_CODE as dicTypeCode, DIC_TYPE_NAME as dicTypeName from ts_dictype
|
||||
select DIC_TYPE_CODE as dicTypeCode, DIC_TYPE_NAME as dicTypeName, SHOW_INDEX as showIndex from ts_dictype
|
||||
where DIC_ID = (select id from ts_dictionary where DICTIONARY_CODE = #{dicCode})
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user