标准预警查询

This commit is contained in:
zhaokaiyao@91isoft.com
2021-11-24 13:19:12 +08:00
parent f92cdd6dc3
commit cb06a54a3d
7 changed files with 217 additions and 25 deletions
@@ -3,31 +3,145 @@
<mapper namespace="com.adc.da.slrs.sarStandWarning.dao.EarlyWarningEODao">
<!-- Result Map-->
<resultMap id="resultMap" type="com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO" >
<id column="id" property="id" />
<result column="STAND_ID" property="standId" />
<result column="STAND_NAME" property="standName" />
<result column="STAND_TYPE" property="standType"/>
<result column="STAND_CODE" property="standCode"/>
<result column="XCXSSRQ" property="XCXSSRQ"/>
<result column="ZCCSSRQ" property="ZCCSSRQ"/>
<result column="SSRQ" property="SSRQ"/>
<result column="PUT_TIME" property="putTime" />
<result column="APPLY_TYPE" property="applyType" />
<result column="ITEMS_ID" property="itemsId" />
<result column="ITEMS_NUM" property="itemsNum" />
<result column="ITEMS_NAME" property="itemsName" />
<result column="POLICY_ID" property="policyId" />
<result column="POLICY_NAME" property="policyName" />
<result column="DUTY_ENGINEER" property="dutyEngineer" />
<result column="DUTY_ENGINEER" property="dutyEngineer" />
<result column="DUTY_ENGINEER" property="dutyEngineer" />
<result column="issue_time" property="issueTime" />
<resultMap id="resultMap" type="com.adc.da.slrs.sarStandWarning.entity.StandWarningEO" >
<id column="ID" property="id" />
<result column="STAND_ID" property="standId"></result>
<result column="STAND_TYPE" property="standType"></result>
<result column="STAND_CODE" property="standCode"></result>
<result column="STAND_NAME" property="standName"></result>
<result column="PUT_TIME" property="putTime"></result>
<result column="APPLY_TYPE" property="applyType"></result>
<result column="DUTY_ENGINEER" property="dutyEngineer"></result>
<result column="ITEMS_ID" property="itemsId"></result>
<result column="ITEMS_NUM" property="itemsNum"></result>
<result column="ITEMS_NAME" property="itemsName"></result>
<result column="POLICY_ID" property="policyId"></result>
<result column="POLICY_NAME" property="policyName"></result>
<result column="MARK" property="mark"></result>
<result column="POWER" property="power"></result>
<result column="XCXSSRQ" property="XCXSSRQ"></result>
<result column="ZCCSSRQ" property="ZCCSSRQ"></result>
<result column="SSRQ" property="SSRQ"></result>
</resultMap>
<sql id="stand_column">
sarInfo.ID,
sarInfo.STAND_TYPE,
CONCAT(sarInfo.STAND_SORT,' ',sarInfo.STAND_NUMBER,'-',sarInfo.STAND_YEAR) AS STAND_CODE,
sarInfo.STAND_NAME,
sarInfo.PUT_TIME,
attr.SSRQ as SSRQ
</sql>
<sql id="stand_where">
<if test="waringEO.standCode != null and waringEO.standCode != ''">
trim(replace(CONCAT(
sarInfo.STAND_SORT,
' ',
sarInfo.STAND_NUMBER,
'-',
sarInfo.STAND_YEAR
),' ','')) LIKE trim(replace(CONCAT('%',#{waringEO.standCode},'%'),' ',''))
</if>
<if test="waringEO.standName != null and waringEO.standName != ''">
sarInfo.STAND_NAME = #{waringEO.standName}
</if>
<if test="waringEO.putTime != null and waringEO.putTime != ''">
DATE_FORMAT( sarInfo.PUT_TIME, '%Y-%m-%d') = DATE_FORMAT(
#{waringEO.putTime},
'%Y-%m-%d'
)
</if>
<if test="waringEO.SSRQ != null and waringEO.SSRQ != ''">
DATE_FORMAT(attr.SSRQ, '%Y-%m-%d') = DATE_FORMAT(
#{waringEO.SSRQ},
'%Y-%m-%d'
)
</if>
</sql>
<select id="selectWarningPage" resultMap="resultMap">
SELECT
<include refid="stand_column"/> ,
attr.CLLX as APPLY_TYPE ,
attr.ZRGCS as DUTY_ENGINEER ,
NULL AS ITEMS_ID ,
NULL AS ITEMS_NUM ,
NULL as ITEMS_NAME ,
NULL as POLICY_ID ,
NULL as POLICY_NAME ,
MARK ,
POWE R ,
attr.XCXSSRQ as XCXSSRQ ,
attr.ZCCSSRQ as ZCCSSRQ
FROM sar_stand_warning as warning
LEFT JOIN sar_standards_info as sarInfo on sarInfo.id=warning.STAND_ID
LEFT JOIN sar_stand_attr_info as attr on attr.STAND_ID=warning.STAND_ID
<where>
<if test="waringEO.applyType != null and waringEO.applyType != ''">
attr.CLLX = #{waringEO.applyType}
</if>
<if test="waringEO.XCXSSRQ != null and waringEO.XCXSSRQ != ''">
DATE_FORMAT(attr.XCXSSRQ, '%Y-%m-%d') = DATE_FORMAT(
#{waringEO.XCXSSRQ},
'%Y-%m-%d'
)
</if>
<if test="waringEO.ZCCSSRQ != null and waringEO.ZCCSSRQ != ''">
DATE_FORMAT(attr.ZCCSSRQ, '%Y-%m-%d') = DATE_FORMAT(
#{waringEO.ZCCSSRQ},
'%Y-%m-%d'
)
</if>
</where>
UNION ALL
SELECT
<include refid="stand_column"/> ,
items.APPLY_ARCTIC AS APPLY_TYPE ,
items.DUTY_ENGINEER AS DUTY_ENGINEER ,
items.ID as ITEMS_ID ,
items.ITEMS_NUM ,
items.ITEMS_NAME ,
NULL as POLICY_ID ,
NULL as POLICY_NAME ,
MARK ,
POWER ,
items.XCXSSRQ as XCXSSRQ ,
items.ZCCSSRQ as ZCCSSRQ
FROM
sar_stand_warning AS warning
LEFT JOIN sar_standards_info AS sarInfo ON sarInfo.id = warning.STAND_ID
LEFT JOIN sar_stand_items AS items ON items.STAND_ID = warning.STAND_ID
LEFT JOIN sar_stand_attr_info AS attr ON attr.STAND_ID = warning.STAND_ID
<where>
<if test="waringEO.applyType != null and waringEO.applyType != ''">
items.APPLY_ARCTIC = #{waringEO.applyType}
</if>
<if test="waringEO.XCXSSRQ != null and waringEO.XCXSSRQ != ''">
DATE_FORMAT(items.XCXSSRQ, '%Y-%m-%d') = DATE_FORMAT(
#{waringEO.XCXSSRQ},
'%Y-%m-%d'
)
</if>
<if test="waringEO.ZCCSSRQ != null and waringEO.ZCCSSRQ != ''">
DATE_FORMAT(items.ZCCSSRQ, '%Y-%m-%d') = DATE_FORMAT(
#{waringEO.ZCCSSRQ},
'%Y-%m-%d'
)
</if>
</where>
</select>
</mapper>