暴力UNION 去重

This commit is contained in:
zhaokaiyao@91isoft.com
2021-09-09 22:05:41 +08:00
parent 3c5c0e4847
commit 6cf59f9a45
@@ -122,6 +122,31 @@
#{item}
</foreach>
</where>
UNION
SELECT a.ID,a.STAND_NUMBER as standNumber,a.STAND_NAME as standName,a.STAND_EN_NAME,b.NYLX,b.SSRQ as SSRQ,b.XCXSSRQ as XCXSSRQGJ,b.ZCCSSRQ as ZCCSSRQGJ,
b.ZRBM,b.SYCPX,b.CYCVPPSBM,b.CYCVPPSCN,b.KCCVPPSBM,b.KCCVPPSCN,b.CLLX as typeApplicable,a.STAND_SORT as standSortShow,
a.STAND_YEAR as standYear,ISSUE_TIME as issueTime,a.STAND_TYPE as standType,a.TEXT_STATUS as textStatus
FROM sar_standards_info a LEFT JOIN sar_stand_attr_info b on
a.ID = b.STAND_ID
left join sar_stand_items ssi on ssi.stand_id = a.id
<where>
<if test="standName != null">
(a.STAND_NUMBER LIKE concat ('%',#{standName,jdbcType=VARCHAR},'%')
or a.STAND_NAME LIKE concat ('%',#{standName,jdbcType=VARCHAR},'%'))
and
</if>
<if test="fileType !=null">
ssi.FILE_TYPE = #{fileType} and
</if>
<if test="standType !=null">
a.STAND_TYPE = #{standType} and
</if>
a.ID IN
<foreach collection="param1" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</where>
limit #{start},#{end}
</select>
@@ -149,6 +174,30 @@
#{item}
</foreach>
</where>
UNION
SELECT a.ID,a.STAND_NUMBER as standNumber,a.STAND_NAME as standName,a.STAND_EN_NAME,b.NYLX,b.SSRQ as SSRQ,b.XCXSSRQ as XCXSSRQGJ,b.ZCCSSRQ as ZCCSSRQGJ,
b.ZRBM,b.SYCPX,b.CYCVPPSBM,b.CYCVPPSCN,b.KCCVPPSBM,b.KCCVPPSCN,b.CLLX as typeApplicable,a.STAND_SORT as standSortShow,
a.STAND_YEAR as standYear,ISSUE_TIME as issueTime,a.STAND_TYPE as standType,a.TEXT_STATUS as textStatus
FROM sar_standards_info a LEFT JOIN sar_stand_attr_info b on
a.ID = b.STAND_ID
left join sar_stand_items ssi on ssi.stand_id = a.id
<where>
<if test="standName != null">
(a.STAND_NUMBER LIKE concat ('%',#{standName,jdbcType=VARCHAR},'%')
or a.STAND_NAME LIKE concat ('%',#{standName,jdbcType=VARCHAR},'%'))
and
</if>
<if test="fileType !=null">
ssi.FILE_TYPE = #{fileType} and
</if>
<if test="standType !=null">
a.STAND_TYPE = #{standType} and
</if>
a.ID IN
<foreach collection="param1" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</where>
</select>
<select id="selectTimes" resultType="com.adc.da.slrs.sarLawsAttrDetailedList.entity.StandRegionalTimeDto">