未符合项整改加排序

This commit is contained in:
yuezhihang
2021-12-07 09:21:14 +08:00
committed by zhaokaiyao@91isoft.com
parent 995891757d
commit 0ce4df7252
@@ -31,7 +31,7 @@
</select>
<select id="getSarStandUnqualifiedPage" resultType="com.adc.da.slrs.sarStandUnqualified.entity.SarStandUnqualified">
<select id="getSarStandUnqualifiedPageNew" resultType="com.adc.da.slrs.sarStandUnqualified.entity.SarStandUnqualified">
SELECT
sar_stand_unqualified.*, sar_standards_info.STAND_TYPE as standType
from
@@ -49,14 +49,45 @@
and RESPONSIBLE_UNIT = #{sar.responsibleUnit}
</if>
<if test="sar.standSerialNumber != null and sar.standSerialNumber != '' ">
and STAND_SERIAL_NUMBER like concat(concat('%',#{sar.standSerialNumber}),'%')
or sar_stand_unqualified.STAND_NAME like concat(concat('%',#{sar.standSerialNumber}),'%')
and (REPLACE(STAND_SERIAL_NUMBER,' ','') like concat(concat('%',REPLACE(#{sar.standSerialNumber},' ','')),'%')
or sar_stand_unqualified.STAND_NAME like concat(concat('%',#{sar.standSerialNumber}),'%'))
</if>
order by sar_stand_unqualified.STAND_ID ,sar_stand_unqualified.ITEMS_NUM asc
limit #{start},#{end}
</select>
<select id="getSarStandUnqualifiedCount" resultType="java.lang.Integer">
<select id="getSarStandUnqualifiedPage" resultType="com.adc.da.slrs.sarStandUnqualified.entity.SarStandUnqualified">
SELECT
c.*
FROM
(
SELECT b.*,sar_standards_info.STAND_TYPE as standType FROM (
SELECT (@i:=@i+1) as rows,sar_stand_unqualified.* FROM
sar_stand_unqualified,(SELECT @i:=0)j
WHERE
close_state = 1
<if test="sar.standId != null and sar.standId != '' ">
and STAND_ID = #{standId}
</if>
<if test="sar.productName != null and sar.productName != '' ">
and PRODUCT_NAME like concat(concat('%',#{sar.productName}),'%')
</if>
<if test="sar.responsibleUnit != null and sar.responsibleUnit != '' ">
and RESPONSIBLE_UNIT = #{sar.responsibleUnit}
</if>
<if test="sar.standSerialNumber != null and sar.standSerialNumber != '' ">
and (REPLACE(STAND_SERIAL_NUMBER,' ','') like concat(concat('%',REPLACE(#{sar.standSerialNumber},' ','')),'%')
or sar_stand_unqualified.STAND_NAME like concat(concat('%',#{sar.standSerialNumber}),'%'))
</if>
order by sar_stand_unqualified.STAND_ID ,sar_stand_unqualified.ITEMS_NUM asc
limit #{start},#{end}
)b
left join sar_standards_info on b.STAND_ID = sar_standards_info.id
)c
ORDER BY c.STAND_ID, CONVERT(SUBSTRING(c.ITEMS_NUM,1,(SELECT LOCATE('.',CONCAT(c.ITEMS_NUM,'.')))),SIGNED) ,c.rows
</select>
<select id="getSarStandUnqualifiedCountNew" resultType="java.lang.Integer">
SELECT
count(sar_stand_unqualified.ID)
from
@@ -74,8 +105,38 @@
and RESPONSIBLE_UNIT = #{sar.responsibleUnit}
</if>
<if test="sar.standSerialNumber != null and sar.standSerialNumber != '' ">
and STAND_SERIAL_NUMBER like concat(concat('%',#{sar.standSerialNumber}),'%')
or sar_stand_unqualified.STAND_NAME like concat(concat('%',#{sar.standSerialNumber}),'%')
and (REPLACE(STAND_SERIAL_NUMBER,' ','') like concat(concat('%',REPLACE(#{sar.standSerialNumber},' ','')),'%')
or sar_stand_unqualified.STAND_NAME like concat(concat('%',#{sar.standSerialNumber}),'%'))
</if>
</select>
<select id="getSarStandUnqualifiedCount" resultType="java.lang.Integer">
SELECT
count(c.ID)
FROM
(
SELECT b.*,sar_standards_info.STAND_TYPE as standType FROM (
SELECT (@i:=@i+1) as rows,sar_stand_unqualified.* FROM
sar_stand_unqualified,(SELECT @i:=0)j
WHERE
close_state = 1
<if test="sar.standId != null and sar.standId != '' ">
and STAND_ID = #{standId}
</if>
<if test="sar.productName != null and sar.productName != '' ">
and PRODUCT_NAME like concat(concat('%',#{sar.productName}),'%')
</if>
<if test="sar.responsibleUnit != null and sar.responsibleUnit != '' ">
and RESPONSIBLE_UNIT = #{sar.responsibleUnit}
</if>
<if test="sar.standSerialNumber != null and sar.standSerialNumber != '' ">
and (REPLACE(STAND_SERIAL_NUMBER,' ','') like concat(concat('%',REPLACE(#{sar.standSerialNumber},' ','')),'%')
or sar_stand_unqualified.STAND_NAME like concat(concat('%',#{sar.standSerialNumber}),'%'))
</if>
order by sar_stand_unqualified.STAND_ID ,sar_stand_unqualified.ITEMS_NUM asc
)b
left join sar_standards_info on b.STAND_ID = sar_standards_info.id
)c
ORDER BY c.STAND_ID, CONVERT(SUBSTRING(c.ITEMS_NUM,1,(SELECT LOCATE('.',CONCAT(c.ITEMS_NUM,'.')))),SIGNED) ,c.rows
</select>
</mapper>