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,67 +4,110 @@
<select id="pageList" resultType="com.jero.modules.laws.localTool.entity.StandardEarlyWarning"> <select id="pageList" resultType="com.jero.modules.laws.localTool.entity.StandardEarlyWarning">
SELECT SELECT
standard.source, dataInfo.source,
standard.id, dataInfo.id,
standard.standard_number, dataInfo.standard_number,
standard.standard_name, dataInfo.standard_name,
standard.responsible_department, dataInfo.responsible_department,
standard.on_the_production_date, dataInfo.new_model_implementation_date,
standard.new_model_implementation_date dataInfo.on_the_production_date,
dataInfo.implementation_date
FROM FROM
( (SELECT DISTINCT
SELECT standard.source,
'1' AS source, standard.id,
lds.id, standard.standard_number,
lds.standard_number, standard.standard_name,
lds.standard_name, standard.responsible_department,
lds.responsible_department, <if test="param.newModelImplementationDate != null and param.newModelImplementationDate != ''">
lds.on_the_production_date, SUBSTRING_INDEX( SUBSTRING_INDEX( standard.new_model_implementation_date, ',', n.digit + 1 ), ',', - 1 ) AS
lds.new_model_implementation_date, new_model_implementation_date,
lds.implementation_date </if>
FROM <if test="param.newModelImplementationDate == null or param.newModelImplementationDate == ''">
laws_domestic_standard lds standard.new_model_implementation_date,
WHERE </if>
lds.del_flag = 0 UNION <if test="param.onTheProductionDate != null and param.onTheProductionDate != ''">
SELECT SUBSTRING_INDEX( SUBSTRING_INDEX( standard.on_the_production_date, ',', n.digit + 1 ), ',', - 1 ) AS
'2' AS source, on_the_production_date,
los.id, </if>
los.standard_number, <if test="param.onTheProductionDate == null or param.onTheProductionDate == ''">
los.standard_name, standard.on_the_production_date,
los.responsible_department, </if>
los.on_the_production_date, standard.implementation_date
los.new_model_implementation_date, FROM
los.implementation_date (
FROM SELECT
laws_overseas_standard los '1' AS source,
WHERE lds.id,
los.del_flag = 0 lds.standard_number,
) AS standard lds.standard_name,
lds.responsible_department,
lds.on_the_production_date,
lds.new_model_implementation_date,
lds.implementation_date
FROM
laws_domestic_standard lds
WHERE WHERE
<if test="param.newModelImplementationDate != null and param.newModelImplementationDate != ''"> lds.del_flag = 0 UNION
standard.new_model_implementation_date IS NOT NULL AND SELECT
<foreach collection="param.dayStrings" separator=" or " open="(" close=")" item="item"> '2' AS source,
standard.new_model_implementation_date LIKE CONCAT('%', #{item}, '%') los.id,
</foreach> los.standard_number,
</if> los.standard_name,
<if test="param.onTheProductionDate != null and param.onTheProductionDate != ''"> los.responsible_department,
standard.on_the_production_date IS NOT NULL AND los.on_the_production_date,
<foreach collection="param.dayStrings" separator=" or " open="(" close=")" item="item"> los.new_model_implementation_date,
standard.on_the_production_date LIKE CONCAT('%', #{item}, '%') los.implementation_date
</foreach> FROM
</if> laws_overseas_standard los
<if test="param.source != null and param.source != ''"> WHERE
AND standard.source = #{param.source} los.del_flag = 0
</if> ) AS standard
<if test="param.responsibleDepartment != null and param.responsibleDepartment != ''"> JOIN ( SELECT 0 AS digit UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL
AND standard.responsible_department = #{param.responsibleDepartment} SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 ) AS n
</if> ON
<if test="param.standardNumberOrName != null and param.standardNumberOrName != ''"> <if test="param.newModelImplementationDate != null and param.newModelImplementationDate != ''">
AND (standard.standard_number LIKE CONCAT('%', #{param.standardNumberOrName}, '%') CHAR_LENGTH( standard.new_model_implementation_date ) - CHAR_LENGTH( REPLACE (
OR standard.new_model_implementation_date, ',', '' ) ) >= n.digit
standard.standard_name LIKE CONCAT('%', #{param.standardNumberOrName}, '%')) </if>
</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
<if test="param.newModelImplementationDate != null and param.newModelImplementationDate != ''">
standard.new_model_implementation_date IS NOT NULL AND
standard.new_model_implementation_date != ''
</if>
<if test="param.onTheProductionDate != null and param.onTheProductionDate != ''">
standard.on_the_production_date IS NOT NULL AND
standard.on_the_production_date != ''
</if>
<if test="param.source != null and param.source != ''">
AND standard.source = #{param.source}
</if>
<if test="param.responsibleDepartment != null and param.responsibleDepartment != ''">
AND standard.responsible_department = #{param.responsibleDepartment}
</if>
<if test="param.standardNumberOrName != null and param.standardNumberOrName != ''">
AND (standard.standard_number LIKE CONCAT('%', #{param.standardNumberOrName}, '%')
OR
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>
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;
} }