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
standard.source,
standard.id,
standard.standard_number,
standard.standard_name,
standard.responsible_department,
standard.on_the_production_date,
standard.new_model_implementation_date
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
'1' AS source,
lds.id,
lds.standard_number,
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
lds.del_flag = 0 UNION
SELECT
'2' AS source,
los.id,
los.standard_number,
los.standard_name,
los.responsible_department,
los.on_the_production_date,
los.new_model_implementation_date,
los.implementation_date
FROM
laws_overseas_standard los
WHERE
los.del_flag = 0
) AS standard
(SELECT DISTINCT
standard.source,
standard.id,
standard.standard_number,
standard.standard_name,
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,
</if>
standard.implementation_date
FROM
(
SELECT
'1' AS source,
lds.id,
lds.standard_number,
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
<if test="param.newModelImplementationDate != null and param.newModelImplementationDate != ''">
standard.new_model_implementation_date IS NOT NULL AND
<foreach collection="param.dayStrings" separator=" or " open="(" close=")" item="item">
standard.new_model_implementation_date LIKE CONCAT('%', #{item}, '%')
</foreach>
</if>
<if test="param.onTheProductionDate != null and param.onTheProductionDate != ''">
standard.on_the_production_date IS NOT NULL AND
<foreach collection="param.dayStrings" separator=" or " open="(" close=")" item="item">
standard.on_the_production_date LIKE CONCAT('%', #{item}, '%')
</foreach>
</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>
lds.del_flag = 0 UNION
SELECT
'2' AS source,
los.id,
los.standard_number,
los.standard_name,
los.responsible_department,
los.on_the_production_date,
los.new_model_implementation_date,
los.implementation_date
FROM
laws_overseas_standard los
WHERE
los.del_flag = 0
) 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
<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
standard.implementation_date DESC
dataInfo.implementation_date DESC
</select>
</mapper>
@@ -64,7 +64,7 @@ public class LawsStandardEarlyWarningServiceImpl implements ILawsStandardEarlyWa
standardEarlyWarning.setDayStrings(dayStrings);
Page<StandardEarlyWarning> page = new Page<>(pageNo, pageSize);
IPage<StandardEarlyWarning> pageList = lawsStandardEarlyWarningMapper.pageList(page, standardEarlyWarning);
pageList.getRecords().forEach(warning -> {
/*pageList.getRecords().forEach(warning -> {
// 新车型实施日期
if (StringUtils.isNotBlank(standardEarlyWarning.getNewModelImplementationDate())) {
List<String> eStrings = Arrays.asList(warning.getNewModelImplementationDate().split(","));
@@ -87,7 +87,7 @@ public class LawsStandardEarlyWarningServiceImpl implements ILawsStandardEarlyWa
}
warning.setOnTheProductionDate(intersection.get(0));
}
});
});*/
return pageList;
}