129 lines
4.1 KiB
XML
129 lines
4.1 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="com.adc.da.scheduled.dao.SarStandardWarningDao">
|
|
|
|
<insert id="ignoreInsert" parameterType="java.util.LinkedList">
|
|
|
|
REPLACE INTO sar_stand_warning (ID,STAND_ID,ITEM_ID,POLICY_ID,MARK,POWER)
|
|
VALUES
|
|
<if test="warningEOS !=null and warningEOS.size()!=0">
|
|
<foreach collection="warningEOS" item="item" index="index" separator=",">
|
|
(
|
|
#{item.id}
|
|
,#{item.standId}
|
|
,#{item.itemId}
|
|
,#{item.policyId}
|
|
,#{item.mark}
|
|
,#{item.power}
|
|
)
|
|
</foreach>
|
|
</if>
|
|
</insert>
|
|
<delete id="autoCancelWarning">
|
|
UPDATE sar_stand_warning
|
|
SET POWER ='0'
|
|
WHERE
|
|
STAND_ID IN ( SELECT law_id FROM warning_date WHERE DATE_FORMAT(SSRQ, '%Y-%m-%d') < DATE_FORMAT(now(), '%Y-%m-%d'))
|
|
OR
|
|
ITEM_ID IN ( SELECT ITEM_ID FROM warning_date WHERE DATE_FORMAT(SSRQ, '%Y-%m-%d') < DATE_FORMAT(now(), '%Y-%m-%d') AND ITEM_ID IS NOT NULL )
|
|
</delete>
|
|
|
|
|
|
<select id="getWarningId" resultType="com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO">
|
|
SELECT
|
|
law_id AS standId,
|
|
item_id AS itemId,
|
|
CASE
|
|
WHEN item_id = '-1' THEN
|
|
'stand'
|
|
WHEN
|
|
item_id IS NULL THEN
|
|
'stand'
|
|
ELSE
|
|
'item'
|
|
END AS mark,
|
|
'1' as power
|
|
FROM
|
|
warning_date AS warning
|
|
WHERE
|
|
DATE_FORMAT(warning.SSRQ,'%Y-%m-%d') BETWEEN DATE_FORMAT(#{startDate}, '%Y-%m-%d') AND DATE_FORMAT(#{endDate}, '%Y-%m-%d')
|
|
<!-- UNION
|
|
SELECT
|
|
STAND_ID,
|
|
ID AS itemsId,
|
|
'item' AS mark,
|
|
'1' as power
|
|
FROM
|
|
sar_stand_items AS item
|
|
WHERE
|
|
DATE_FORMAT(item.XCXSSRQ,'%Y-%m-%d') BETWEEN DATE_FORMAT(#{startDate}, '%Y-%m-%d') AND DATE_FORMAT(#{endDate}, '%Y-%m-%d')
|
|
OR
|
|
DATE_FORMAT(item.ZCCSSRQ,'%Y-%m-%d') BETWEEN DATE_FORMAT(#{startDate}, '%Y-%m-%d') AND DATE_FORMAT(#{endDate}, '%Y-%m-%d') -->
|
|
</select>
|
|
|
|
|
|
<select id="getWarningDate" resultType="com.adc.da.slrs.sarStandWarning.entity.WarningDate">
|
|
|
|
select A.* from
|
|
|
|
(
|
|
select attr.STAND_ID as lawId,'-1' as itemId,'SSRQ' as timeName,
|
|
SSRQ as SSRQ
|
|
from sar_stand_attr_info attr
|
|
WHERE
|
|
|
|
|
|
SSRQ REGEXP #{termStr}
|
|
|
|
UNION ALL
|
|
|
|
select attr.STAND_ID as lawId,'-1' as itemId,'XCXSSRQ' as timeName,
|
|
XCXSSRQ as SSRQ
|
|
from sar_stand_attr_info attr
|
|
WHERE
|
|
XCXSSRQ REGEXP #{termStr}
|
|
|
|
|
|
|
|
UNION ALL
|
|
select attr.STAND_ID as lawId,'-1' as itemId,'ZCCSSRQ' as timeName,
|
|
ZCCSSRQ as SSRQ
|
|
from sar_stand_attr_info attr
|
|
WHERE
|
|
ZCCSSRQ REGEXP #{termStr}
|
|
) AS A
|
|
left join sar_standards_info as sarInfo
|
|
on sarInfo.id=A.lawId
|
|
where sarInfo.valid_flag = '0'
|
|
|
|
|
|
</select>
|
|
|
|
<select id="getWarningDateOfItems" resultType="com.adc.da.slrs.sarStandWarning.entity.WarningDate">
|
|
select A.* from
|
|
(
|
|
select item.STAND_ID as lawId,item.ID as itemId,'ZCCSSRQ' as timeName,
|
|
ZCCSSRQ as SSRQ,item.FILE_TYPE AS fileType
|
|
from sar_stand_items item
|
|
WHERE
|
|
ZCCSSRQ REGEXP #{termStr}
|
|
UNION All
|
|
select item.STAND_ID as lawId,item.ID as itemId,'XCXSSRQ' as timeName,
|
|
XCXSSRQ as SSRQ,item.FILE_TYPE AS fileType
|
|
from sar_stand_items item
|
|
WHERE
|
|
XCXSSRQ REGEXP #{termStr}
|
|
) AS A
|
|
left join sar_standards_info as sarInfo
|
|
on sarInfo.id=A.lawId
|
|
where sarInfo.valid_flag = '0'
|
|
</select>
|
|
|
|
|
|
<select id="getStandTextStateByStandId" resultType="java.lang.String">
|
|
SELECT TEXT_STATUS FROM sar_standards_info WHERE ID = #{standId}
|
|
</select>
|
|
|
|
|
|
</mapper>
|