feat: 体系数据列表 release
This commit is contained in:
+1
@@ -19,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
+32
-17
@@ -1,18 +1,14 @@
|
||||
package com.adc.da.slrs.sarMenuStandard.entity;
|
||||
|
||||
import com.adc.da.base.page.BasePage;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@@ -49,6 +45,11 @@ public class StandSystemDTO {
|
||||
@ApiModelProperty(value = "开始发布日期")
|
||||
private Date startReleaseDate;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "发布日期")
|
||||
private Date releaseDate;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "结束发布日期")
|
||||
@@ -59,6 +60,11 @@ public class StandSystemDTO {
|
||||
@ApiModelProperty(value = "开始实施日期")
|
||||
private Date startImplementDate;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "实施日期")
|
||||
private Date implementDate;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "结束实施日期")
|
||||
@@ -67,37 +73,46 @@ public class StandSystemDTO {
|
||||
@ApiModelProperty(value = "代替标准")
|
||||
private String replaceStandardNo;
|
||||
|
||||
@ApiModelProperty(value = "编制单位Id")
|
||||
private String deptId;
|
||||
|
||||
@ApiModelProperty(value = "编制单位")
|
||||
private String dept;
|
||||
|
||||
@ApiModelProperty(value = "起草人Id")
|
||||
private String draftUserId;
|
||||
|
||||
@ApiModelProperty(value = "起草人")
|
||||
private String draftUserName;
|
||||
|
||||
@ApiModelProperty(value = "数据来源")
|
||||
private String dataSource;
|
||||
|
||||
@ApiModelProperty(value = "发布日期排序规则")
|
||||
private String orderReleaseDate;
|
||||
@ApiModelProperty(value = "排序字段")
|
||||
private String sortField;
|
||||
|
||||
@ApiModelProperty(value = "实施日期排序规则")
|
||||
private String orderImplementDate;
|
||||
@ApiModelProperty(value = "排序规则")
|
||||
private String sortMode;
|
||||
|
||||
@ApiModelProperty(value = "标准类型(数据排序用)")
|
||||
private String standSort;
|
||||
|
||||
private String selectIds;
|
||||
|
||||
private List<String> selectIdList;
|
||||
|
||||
@NotNull(message = "页码不能为空")
|
||||
@ApiModelProperty(value = "页码")
|
||||
private int page;
|
||||
|
||||
@NotEmpty(message = "每页条数不能为空")
|
||||
@ApiModelProperty(value = "每页数量")
|
||||
private int pageSize;
|
||||
|
||||
@ApiModelProperty(value = "体系排序顺序号")
|
||||
private int systemSort;
|
||||
|
||||
@ApiModelProperty(value = "国标外表企标排序号")
|
||||
private int standTypeSort;
|
||||
|
||||
@ApiModelProperty(value = "标准类别排序号")
|
||||
private int standCategorySort;
|
||||
|
||||
@ApiModelProperty(value = "相关联的节点ID列表(数据库查询用)")
|
||||
private List<String> menuIdList;
|
||||
|
||||
public void setSelectIds(String selectIds) {
|
||||
this.selectIds = selectIds;
|
||||
this.selectIdList = java.util.Arrays.asList(selectIds.split(","));
|
||||
|
||||
+94
-5
@@ -7,6 +7,7 @@ import com.adc.da.slrs.sarBussStandMenu.service.ISarBussStandMenuService;
|
||||
import com.adc.da.slrs.sarBussionessStand.dao.SarBussionessStandDao;
|
||||
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.StandSystemDTO;
|
||||
import com.adc.da.slrs.sarMenuStandard.service.ISarMenuStandardNewService;
|
||||
import com.adc.da.slrs.sarResource.dao.TsResourceDao;
|
||||
@@ -14,6 +15,9 @@ import com.adc.da.slrs.sarRole.dao.TsRoleDao;
|
||||
import com.adc.da.slrs.sarStandMenu.dao.SarStandMenuDao;
|
||||
import com.adc.da.slrs.sarStandMenu.entity.SarStandMenu;
|
||||
import com.adc.da.slrs.sarStandMenu.service.ISarStandMenuService;
|
||||
import com.adc.da.slrs.tsDictionaryType.entity.TsDicType;
|
||||
import com.adc.da.slrs.tsDictionaryType.service.ITsDicTypeService;
|
||||
import com.adc.da.slrs.tsDictionaryType.service.ITsDictionaryService;
|
||||
import com.adc.da.sys.sarMenuStandard.dao.SarMenuStandardDao;
|
||||
import com.adc.da.sys.sarMenuStandard.entity.SarMenuStandard;
|
||||
import com.adc.da.sys.sarMenuStandard.entity.StandMenuRelation;
|
||||
@@ -66,6 +70,12 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
|
||||
@Resource
|
||||
private SarBussionessStandDao sarBussionessStandDao;
|
||||
|
||||
@Resource
|
||||
private ITsDicTypeService dicItemService;
|
||||
|
||||
@Resource
|
||||
private ITsDictionaryService dicService;
|
||||
|
||||
@Override
|
||||
public String getTopMenu(SarMenuStandardNew sarMenuStandardNew){
|
||||
QueryWrapper qw = new QueryWrapper();
|
||||
@@ -160,6 +170,7 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
|
||||
resource.setChildren(recursionGetListChildrenStand((resource), (children)));
|
||||
}
|
||||
// 把所有关联表中的数据拉出来
|
||||
// TODO 优化一下性能
|
||||
// 国标
|
||||
List<SarStandMenu> gbStandMenu = sarStandMenuDao.getGBStandMenu().stream().filter(sarStandMenu -> sarStandMenu.getMenuId().length() > 30).collect(Collectors.toList());
|
||||
List<StandMenuRelation> gbRelations = BeanCopyUtils.copyBeanList(gbStandMenu, StandMenuRelation.class);
|
||||
@@ -184,23 +195,77 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
|
||||
if (StringUtils.isBlank(menuId)) {
|
||||
throw new AdcDaBaseException("menuId不能为空");
|
||||
}
|
||||
|
||||
// 体系树
|
||||
SarMenuStandard sarMenuStandard = this.standardSystemTree().get(0);
|
||||
|
||||
// 找到menuId对应的节点
|
||||
SarMenuStandard targetNode = SarMenuStandard.findNodeById(sarMenuStandard, menuId);
|
||||
|
||||
// 收集目标节点及其所有子节点的ID
|
||||
List<String> childIds = new ArrayList<>();
|
||||
targetNode.collectChildIds(childIds);
|
||||
standSystemDTO.setMenuIdList(childIds);
|
||||
|
||||
// 查国标
|
||||
List<StandSystemDTO> gbList = sarStandMenuDao.getStandInfoSystemData(standSystemDTO, "INLAND");
|
||||
// 查外标
|
||||
List<StandSystemDTO> fbList = sarStandMenuDao.getStandInfoSystemData(standSystemDTO, "FOREIGN");
|
||||
// 查企标
|
||||
// List<StandSystemDTO> esList = sarBussionessStandDao.getESSystemData(standSystemDTO);
|
||||
List<StandSystemDTO> esList = sarBussionessStandDao.getESSystemData(standSystemDTO);
|
||||
// 数据转换后整合
|
||||
List<StandSystemDTO> resultList = new ArrayList<>();
|
||||
resultList.addAll(gbList);
|
||||
resultList.addAll(fbList);
|
||||
// resultList.addAll(esList);
|
||||
// 构造体系路径
|
||||
resultList.addAll(esList);
|
||||
|
||||
// TODO 排序
|
||||
// 构造体系路径映射
|
||||
Map<String, String> pathMap = new HashMap<>();
|
||||
sarMenuStandard.buildPathMap(pathMap, "");
|
||||
|
||||
// 为树设置systemSort
|
||||
SarMenuStandard.setSystemSort(sarMenuStandard, "");
|
||||
|
||||
// 国标外标标准状态字典
|
||||
List<TsDicType> gbStateDictList = dicItemService.selectAllDicTypeNameByDicCode("STANDSTATE");
|
||||
// 企标标准状态字典
|
||||
List<TsDicType> esStateDictList = dicItemService.selectAllDicTypeNameByDicCode("TEXTSTATUSBUSS");
|
||||
|
||||
// 构造体系路径 && 设置标准内部类别排序号 && 翻译
|
||||
for (StandSystemDTO dto : resultList) {
|
||||
String fullPath = pathMap.get(dto.getMenuId());
|
||||
dto.setStandSystem(fullPath);
|
||||
dto.setStandCategorySort(StandCategoryEnum.getSortByStandType(dto.getDataSource(), dto.getStandSort()));
|
||||
// 设置体系排序号
|
||||
SarMenuStandard node = SarMenuStandard.findNodeById(targetNode, dto.getMenuId());
|
||||
dto.setSystemSort(node.getSystemSort());
|
||||
// 翻译
|
||||
this.translateStandardSystemDTO(dto, gbStateDictList, esStateDictList);
|
||||
}
|
||||
|
||||
// 根据排序字段对 resultList 进行排序
|
||||
// 按照标准体系排序
|
||||
// 体系内部按照国内/海外/企业排序
|
||||
// 每个类别的标准内部按照搜索中心设定的类别排序
|
||||
// 每个类别的标准内部按照类别排序
|
||||
resultList.sort(Comparator.comparingInt(StandSystemDTO::getSystemSort)
|
||||
.thenComparingInt(StandSystemDTO::getStandTypeSort)
|
||||
.thenComparingInt(StandSystemDTO::getStandCategorySort));
|
||||
// 两个时间排序
|
||||
String sortField = standSystemDTO.getSortField();
|
||||
if (StringUtils.isNotBlank(sortField)) {
|
||||
String sortMode = standSystemDTO.getSortMode();
|
||||
if (sortField.equals("releaseDate") && sortMode.equals("desc")) {
|
||||
resultList.sort(Comparator.comparing(StandSystemDTO::getStartImplementDate));
|
||||
} else {
|
||||
resultList.sort(Comparator.comparing(StandSystemDTO::getStartImplementDate).reversed());
|
||||
}
|
||||
if (sortField.equals("implementDate") && sortMode.equals("desc")) {
|
||||
resultList.sort(Comparator.comparing(StandSystemDTO::getStartImplementDate));
|
||||
} else {
|
||||
resultList.sort(Comparator.comparing(StandSystemDTO::getStartImplementDate).reversed());
|
||||
}
|
||||
}
|
||||
|
||||
// 手动分页
|
||||
int pageNum = standSystemDTO.getPage();
|
||||
int pageSize = standSystemDTO.getPageSize();
|
||||
@@ -224,6 +289,30 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl<SarMenuStandar
|
||||
return page;
|
||||
}
|
||||
|
||||
private void translateStandardSystemDTO(StandSystemDTO dto, List<TsDicType> gbStateDictList, List<TsDicType> esStateDictList) {
|
||||
// 翻译数据来源、标准状态
|
||||
switch (dto.getDataSource()) {
|
||||
case "INLAND":
|
||||
dto.setDataSource("国内标准库");
|
||||
dto.setStandState(gbStateDictList.stream()
|
||||
.filter(dict -> dict.getDicTypeCode().equals(dto.getStandState()))
|
||||
.findFirst().orElse(new TsDicType()).getDicTypeName());
|
||||
break;
|
||||
case "FOREIGN":
|
||||
dto.setDataSource("海外标准库");
|
||||
dto.setStandState(gbStateDictList.stream()
|
||||
.filter(dict -> dict.getDicTypeCode().equals(dto.getStandState()))
|
||||
.findFirst().orElse(new TsDicType()).getDicTypeName());
|
||||
break;
|
||||
case "ENTERPRISE":
|
||||
dto.setDataSource("企业标准库");
|
||||
dto.setStandState(esStateDictList.stream()
|
||||
.filter(dict -> dict.getDicTypeCode().equals(dto.getStandState()))
|
||||
.findFirst().orElse(new TsDicType()).getDicTypeName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void standardSystemListExport(StandSystemDTO standSystemDTO, HttpServletResponse response) {
|
||||
// List<StandSystemDTO> exportList = this.standardSystemList(standSystemDTO);
|
||||
|
||||
@@ -159,23 +159,37 @@
|
||||
<select id="getStandInfoSystemData" resultType="com.adc.da.slrs.sarMenuStandard.entity.StandSystemDTO">
|
||||
SELECT
|
||||
gb.ID AS standId,
|
||||
gb.STAND_NUMBER AS standNo,
|
||||
CONCAT(gb.STAND_SORT, ' ', gb.STAND_NUMBER) AS standNo,
|
||||
gb.STAND_NAME AS standName,
|
||||
gb.STAND_STATE AS standState,
|
||||
gb.ISSUE_TIME AS releaseDate,
|
||||
gb.PUT_TIME AS implementDate,
|
||||
gb.REPLACE_STAND_NUM AS replaceStandardNo,
|
||||
gba.QCDW AS deptId,
|
||||
o.ORG_NAME AS dept,
|
||||
gba.WSSMR AS draftUserId,
|
||||
u.UNAME AS draftUserName,
|
||||
gb.STAND_TYPE AS dataSource
|
||||
gba.QCDW AS dept,
|
||||
gba.WSSMR AS draftUserName,
|
||||
gb.STAND_TYPE AS dataSource,
|
||||
gb.STAND_SORT AS standSort,
|
||||
CASE
|
||||
WHEN gb.STAND_TYPE = 'INLAND' THEN 1
|
||||
WHEN gb.STAND_TYPE = 'FOREIGN' THEN 2
|
||||
END AS standTypeSort,
|
||||
m.MENU_ID AS menuId
|
||||
FROM
|
||||
`sar_standards_info` AS gb
|
||||
LEFT JOIN `sar_stand_attr_info` AS gba ON gb.ID = gba.STAND_ID
|
||||
LEFT JOIN `ts_user` AS u ON gba.WSSMR = u.USID
|
||||
LEFT JOIN `ts_org` AS o ON gba.QCDW = o.ID
|
||||
WHERE gb.STAND_TYPE = 'INLAND'
|
||||
LEFT JOIN `sar_stand_menu` AS m ON gb.ID = m.STAND_ID AND LENGTH(m.MENU_ID) > 30
|
||||
WHERE 1 = 1
|
||||
<!--国标/外标-->
|
||||
<if test="param.standNo != null and param.standNo != ''">
|
||||
AND gb.STAND_TYPE = #{dataSource}
|
||||
</if>
|
||||
<!--关联的节点IDList-->
|
||||
<if test="param.menuIdList != null and param.menuIdList.size() > 0">
|
||||
AND m.MENU_ID IN
|
||||
<foreach item="item" index="index" collection="param.menuIdList" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<!--标准编号-->
|
||||
<if test="param.standNo != null and param.standNo != ''">
|
||||
AND gb.STAND_NUMBER LIKE CONCAT('%',#{param.standNo},'%')
|
||||
@@ -198,11 +212,11 @@
|
||||
</if>
|
||||
<!--编制单位-->
|
||||
<if test="param.dept != null and param.dept != ''">
|
||||
AND o.ORG_NAME LIKE CONCAT('%',#{param.dept},'%')
|
||||
AND gba.QCDW LIKE CONCAT('%',#{param.dept},'%')
|
||||
</if>
|
||||
<!--起草人-->
|
||||
<if test="param.draftUserName != null and param.draftUserName != ''">
|
||||
AND u.UNAME LIKE CONCAT('%',#{param.draftUserName},'%')
|
||||
AND gba.WSSMR LIKE CONCAT('%',#{param.draftUserName},'%')
|
||||
</if>
|
||||
<!--数据来源-->
|
||||
<if test="param.dataSource != null and param.dataSource != ''">
|
||||
|
||||
+46
-19
@@ -1270,52 +1270,79 @@
|
||||
<select id="getESSystemData" resultType="com.adc.da.slrs.sarMenuStandard.entity.StandSystemDTO">
|
||||
SELECT
|
||||
es.ID AS standId,
|
||||
es.STAND_NUMBER AS standNo,
|
||||
es.STAND_CODE AS standNo,
|
||||
es.STAND_NAME AS standName,
|
||||
es.STAND_STATE AS standState,
|
||||
es.TEXT_STATUS_BUSS AS standState,
|
||||
es.ISSUE_TIME AS releaseDate,
|
||||
es.PUT_TIME AS implementDate,
|
||||
es.REPLACE_STAND_NUM AS replaceStandardNo,
|
||||
esa.QCDW AS dept,
|
||||
esa.WSSMR AS draftUserName,
|
||||
esa.QCRBUSS AS draftUserName,
|
||||
'ENTERPRISE' AS dataSource,
|
||||
m.MENU_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
|
||||
FROM
|
||||
`sar_bussioness_stand` AS es
|
||||
LEFT JOIN `sar_buss_stand_attr_info` AS esa ON es.ID = esa.STAND_ID
|
||||
WHERE gb.STAND_TYPE = 'INLAND'
|
||||
LEFT JOIN `sar_buss_stand_menu` AS m ON es.ID = m.BUSS_STAND_ID AND LENGTH(m.MENU_ID) > 30
|
||||
WHERE 1 = 1
|
||||
<!--标准编号-->
|
||||
<if test="param.standNo != null and param.standNo != ''">
|
||||
AND gb.STAND_NUMBER LIKE CONCAT('%',#{param.standNo},'%')
|
||||
AND es.STAND_CODE LIKE CONCAT('%',#{param.standNo},'%')
|
||||
</if>
|
||||
<!--关联的节点IDList-->
|
||||
<if test="param.menuIdList != null and param.menuIdList.size() > 0">
|
||||
AND m.MENU_ID IN
|
||||
<foreach item="item" index="index" collection="param.menuIdList" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<!--标准名称-->
|
||||
<if test="param.standName != null and param.standName != ''">
|
||||
AND gb.STAND_NAME LIKE CONCAT('%',#{param.standName},'%')
|
||||
AND es.STAND_NAME LIKE CONCAT('%',#{param.standName},'%')
|
||||
</if>
|
||||
<!--发布时间-->
|
||||
<if test="param.startReleaseDate != null and param.endReleaseDate != null">
|
||||
AND gb.ISSUE_TIME BETWEEN #{param.startReleaseDate} AND #{param.endReleaseDate}
|
||||
AND es.ISSUE_TIME BETWEEN #{param.startReleaseDate} AND #{param.endReleaseDate}
|
||||
</if>
|
||||
<!--实施日期-->
|
||||
<if test="param.startImplementDate != null and param.endImplementDate != null">
|
||||
AND gb.PUT_TIME BETWEEN #{param.startImplementDate} AND #{param.endImplementDate}
|
||||
AND es.PUT_TIME BETWEEN #{param.startImplementDate} AND #{param.endImplementDate}
|
||||
</if>
|
||||
<!--代替标准-->
|
||||
<if test="param.replaceStandardNo != null and param.replaceStandardNo != null">
|
||||
AND gb.REPLACE_STAND_NUM LIKE CONCAT('%',#{param.replaceStandardNo},'%')
|
||||
<if test="param.replaceStandardNo != null and param.replaceStandardNo != ''">
|
||||
AND es.REPLACE_STAND_NUM LIKE CONCAT('%',#{param.replaceStandardNo},'%')
|
||||
</if>
|
||||
<!--编制单位-->
|
||||
<if test="param.dept != null and param.dept != null">
|
||||
AND gba.QCDW LIKE CONCAT('%',#{param.dept},'%')
|
||||
<if test="param.dept != null and param.dept != ''">
|
||||
AND esa.QCDW LIKE CONCAT('%',#{param.dept},'%')
|
||||
</if>
|
||||
<!--起草人-->
|
||||
<if test="param.draftUserName != null and param.draftUserName != null">
|
||||
AND gba.WSSMR LIKE CONCAT('%',#{param.draftUserName},'%')
|
||||
</if>
|
||||
<!--数据来源-->
|
||||
<if test="param.dataSource != null and param.dataSource != null">
|
||||
AND gb.STAND_TYPE = #{dataSource}
|
||||
<if test="param.draftUserName != null and param.draftUserName != ''">
|
||||
AND esa.QCRBUSS LIKE CONCAT('%',#{param.draftUserName},'%')
|
||||
</if>
|
||||
<if test="param.selectIdList != null and param.selectIdList.size() > 0">
|
||||
AND gb.ID IN
|
||||
AND es.ID IN
|
||||
<foreach item="item" index="index" collection="param.selectIdList" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.springframework.format.annotation.DateTimeFormat;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -64,6 +65,10 @@ public class SarMenuStandard extends BaseEntity {
|
||||
@TableField("DISPLAY_SEQ")
|
||||
private Integer displaySeq;
|
||||
|
||||
@ApiModelProperty(value = "排序")
|
||||
@TableField(exist = false)
|
||||
private Integer systemSort;
|
||||
|
||||
@ApiModelProperty(value = "路径")
|
||||
@TableField("HREF")
|
||||
private String href;
|
||||
@@ -146,4 +151,54 @@ public class SarMenuStandard extends BaseEntity {
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
// 添加用于构建映射的方法
|
||||
public void buildPathMap(Map<String, String> pathMap, String parentPath) {
|
||||
String currentPath = parentPath.isEmpty() ? this.menuName : parentPath + "/" + this.menuName;
|
||||
pathMap.put(this.id, currentPath);
|
||||
for (SarMenuStandard child : children) {
|
||||
child.buildPathMap(pathMap, currentPath);
|
||||
}
|
||||
}
|
||||
|
||||
// 添加用于收集子节点ID的方法
|
||||
public void collectChildIds(List<String> childIds) {
|
||||
childIds.add(this.id);
|
||||
for (SarMenuStandard child : children) {
|
||||
child.collectChildIds(childIds);
|
||||
}
|
||||
}
|
||||
|
||||
public static SarMenuStandard findNodeById(SarMenuStandard node, String menuId) {
|
||||
if (node == null) {
|
||||
return null;
|
||||
}
|
||||
// 检查当前节点的ID是否匹配
|
||||
if (menuId.equals(node.getId())) {
|
||||
return node;
|
||||
}
|
||||
// 在子节点中递归搜索
|
||||
for (SarMenuStandard child : node.getChildren()) {
|
||||
SarMenuStandard found = findNodeById(child, menuId);
|
||||
if (found != null) {
|
||||
return found;
|
||||
}
|
||||
}
|
||||
// 如果在当前节点及其子节点中都没有找到,返回null
|
||||
return null;
|
||||
}
|
||||
|
||||
// 递归方法来设置每个节点的 systemSort
|
||||
public static void setSystemSort(SarMenuStandard node, String parentSort) {
|
||||
// 计算当前节点的 systemSort
|
||||
String currentSort = parentSort.isEmpty() ? String.valueOf(node.getDisplaySeq()) : parentSort + node.getDisplaySeq();
|
||||
|
||||
// 设置当前节点的 systemSort
|
||||
node.setSystemSort(Integer.parseInt(currentSort));
|
||||
|
||||
// 递归设置子节点的 systemSort
|
||||
for (SarMenuStandard child : node.getChildren()) {
|
||||
setSystemSort(child, currentSort);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user