update 标准预警

This commit is contained in:
liao
2023-11-08 18:14:26 +08:00
parent dbb87ec8c0
commit 9dca93defb
2 changed files with 104 additions and 61 deletions
@@ -4,13 +4,36 @@
<select id="pageList" resultType="com.jero.modules.laws.localTool.entity.StandardEarlyWarning"> <select id="pageList" resultType="com.jero.modules.laws.localTool.entity.StandardEarlyWarning">
SELECT SELECT
dataInfo.source,
dataInfo.id,
dataInfo.standard_number,
dataInfo.standard_name,
dataInfo.responsible_department,
dataInfo.new_model_implementation_date,
dataInfo.on_the_production_date,
dataInfo.implementation_date
FROM
(SELECT DISTINCT
standard.source, standard.source,
standard.id, standard.id,
standard.standard_number, standard.standard_number,
standard.standard_name, standard.standard_name,
standard.responsible_department, standard.responsible_department,
<if test="param.newModelImplementationDate != null and param.newModelImplementationDate != ''">
SUBSTRING_INDEX( SUBSTRING_INDEX( standard.new_model_implementation_date, ',', n.digit + 1 ), ',', - 1 ) AS
new_model_implementation_date,
</if>
<if test="param.newModelImplementationDate == null or param.newModelImplementationDate == ''">
standard.new_model_implementation_date,
</if>
<if test="param.onTheProductionDate != null and param.onTheProductionDate != ''">
SUBSTRING_INDEX( SUBSTRING_INDEX( standard.on_the_production_date, ',', n.digit + 1 ), ',', - 1 ) AS
on_the_production_date,
</if>
<if test="param.onTheProductionDate == null or param.onTheProductionDate == ''">
standard.on_the_production_date, standard.on_the_production_date,
standard.new_model_implementation_date </if>
standard.implementation_date
FROM FROM
( (
SELECT SELECT
@@ -40,18 +63,25 @@
WHERE WHERE
los.del_flag = 0 los.del_flag = 0
) AS standard ) AS standard
JOIN ( SELECT 0 AS digit UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL
SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 ) AS n
ON
<if test="param.newModelImplementationDate != null and param.newModelImplementationDate != ''">
CHAR_LENGTH( standard.new_model_implementation_date ) - CHAR_LENGTH( REPLACE (
standard.new_model_implementation_date, ',', '' ) ) >= n.digit
</if>
<if test="param.onTheProductionDate != null and param.onTheProductionDate != ''">
CHAR_LENGTH( standard.on_the_production_date ) - CHAR_LENGTH( REPLACE ( standard.on_the_production_date,
',', '' ) ) >= n.digit
</if>
WHERE WHERE
<if test="param.newModelImplementationDate != null and param.newModelImplementationDate != ''"> <if test="param.newModelImplementationDate != null and param.newModelImplementationDate != ''">
standard.new_model_implementation_date IS NOT NULL AND standard.new_model_implementation_date IS NOT NULL AND
<foreach collection="param.dayStrings" separator=" or " open="(" close=")" item="item"> standard.new_model_implementation_date != ''
standard.new_model_implementation_date LIKE CONCAT('%', #{item}, '%')
</foreach>
</if> </if>
<if test="param.onTheProductionDate != null and param.onTheProductionDate != ''"> <if test="param.onTheProductionDate != null and param.onTheProductionDate != ''">
standard.on_the_production_date IS NOT NULL AND standard.on_the_production_date IS NOT NULL AND
<foreach collection="param.dayStrings" separator=" or " open="(" close=")" item="item"> standard.on_the_production_date != ''
standard.on_the_production_date LIKE CONCAT('%', #{item}, '%')
</foreach>
</if> </if>
<if test="param.source != null and param.source != ''"> <if test="param.source != null and param.source != ''">
AND standard.source = #{param.source} AND standard.source = #{param.source}
@@ -63,8 +93,21 @@
AND (standard.standard_number LIKE CONCAT('%', #{param.standardNumberOrName}, '%') AND (standard.standard_number LIKE CONCAT('%', #{param.standardNumberOrName}, '%')
OR OR
standard.standard_name LIKE CONCAT('%', #{param.standardNumberOrName}, '%')) standard.standard_name LIKE CONCAT('%', #{param.standardNumberOrName}, '%'))
</if>) AS dataInfo
WHERE
<if test="param.newModelImplementationDate != null and param.newModelImplementationDate != ''">
dataInfo.new_model_implementation_date IN
<foreach collection="param.dayStrings" separator="," open="(" close=")" item="item">
#{item}
</foreach>
</if>
<if test="param.onTheProductionDate != null and param.onTheProductionDate != ''">
dataInfo.on_the_production_date IN
<foreach collection="param.dayStrings" separator="," open="(" close=")" item="item">
#{item}
</foreach>
</if> </if>
ORDER BY ORDER BY
standard.implementation_date DESC dataInfo.implementation_date DESC
</select> </select>
</mapper> </mapper>
@@ -64,7 +64,7 @@ public class LawsStandardEarlyWarningServiceImpl implements ILawsStandardEarlyWa
standardEarlyWarning.setDayStrings(dayStrings); standardEarlyWarning.setDayStrings(dayStrings);
Page<StandardEarlyWarning> page = new Page<>(pageNo, pageSize); Page<StandardEarlyWarning> page = new Page<>(pageNo, pageSize);
IPage<StandardEarlyWarning> pageList = lawsStandardEarlyWarningMapper.pageList(page, standardEarlyWarning); IPage<StandardEarlyWarning> pageList = lawsStandardEarlyWarningMapper.pageList(page, standardEarlyWarning);
pageList.getRecords().forEach(warning -> { /*pageList.getRecords().forEach(warning -> {
// 新车型实施日期 // 新车型实施日期
if (StringUtils.isNotBlank(standardEarlyWarning.getNewModelImplementationDate())) { if (StringUtils.isNotBlank(standardEarlyWarning.getNewModelImplementationDate())) {
List<String> eStrings = Arrays.asList(warning.getNewModelImplementationDate().split(",")); List<String> eStrings = Arrays.asList(warning.getNewModelImplementationDate().split(","));
@@ -87,7 +87,7 @@ public class LawsStandardEarlyWarningServiceImpl implements ILawsStandardEarlyWa
} }
warning.setOnTheProductionDate(intersection.get(0)); warning.setOnTheProductionDate(intersection.get(0));
} }
}); });*/
return pageList; return pageList;
} }