diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialMachineMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialMachineMapper.xml index 564a4fb3..77786822 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialMachineMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/clz/MaterialMachineMapper.xml @@ -849,6 +849,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" WHERE temp.status = #{status} + GROUP BY + temp.typeName, + temp.typeModelName , + temp.maId -- 排序:proName和teamName都不为空的排在最前面 ORDER BY -- 核心排序逻辑:两个字段都不为空的记录优先级最高 diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeMapper.xml index ccf06c1e..d6fc1c65 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeMapper.xml @@ -179,7 +179,8 @@ t.sampling_ratio, t.is_check, t.jiju_type, - mt2.type_name as materialName + mt2.type_name as materialName, + t.is_rs as isRs FROM ma_type AS t left join ma_type mt2 on t.parent_id = mt2.type_id left join ma_type mt3 on mt2.parent_id = mt3.type_id @@ -263,6 +264,7 @@ jiJu_type, company_id, is_lease, + is_rs, #{typeName}, @@ -302,6 +304,7 @@ #{jiJuType}, #{companyId}, #{isLease}, + #{isRs}, @@ -355,6 +358,7 @@ third_report_url = #{thirdReportUrl}, other_report_name = #{otherReportName}, other_report_url = #{otherReportUrl}, + is_rs = #{isRs}, where type_id = #{typeId} @@ -1451,11 +1455,9 @@ GROUP BY m.type_id ORDER BY - m.sort_num ASC, - CASE - WHEN m.update_time > m.create_time THEN - m.update_time ELSE m.create_time - END DESC, + ISNULL(m.sort_num) ASC, + m.sort_num ASC, -- 优先按排序号升序 + GREATEST(m.create_time, m.update_time) DESC, m.create_time DESC