未符合项查询
This commit is contained in:
+12
-12
@@ -66,30 +66,30 @@
|
|||||||
|
|
||||||
<select id="getSarStandUnqualifiedCount" resultType="java.lang.Integer">
|
<select id="getSarStandUnqualifiedCount" resultType="java.lang.Integer">
|
||||||
SELECT
|
SELECT
|
||||||
count(c.ID)
|
count(*)
|
||||||
FROM
|
FROM
|
||||||
(
|
(
|
||||||
SELECT b.*,sar_standards_info.STAND_TYPE as standType FROM (
|
SELECT (@i:=@i+1) as rows,sar_stand_unqualified.* ,sar_standards_info.STAND_TYPE as standType , concat(ts_user.UNAME,concat('(',concat(ts_user.USID,')'))) as dutyEngineerName , ts_institution.name as responsibleUnit FROM
|
||||||
SELECT (@i:=@i+1) as rows,sar_stand_unqualified.* FROM
|
(sar_stand_unqualified,(SELECT @i:=0)j)
|
||||||
sar_stand_unqualified,(SELECT @i:=0)j
|
left join sar_standards_info on sar_stand_unqualified.STAND_ID = sar_standards_info.id
|
||||||
|
left join ts_user on ts_user.USID = sar_stand_unqualified.DUTY_ENGINEER
|
||||||
|
left join ts_institution on ts_institution.id=ts_user.INSTITUTION_ID
|
||||||
WHERE
|
WHERE
|
||||||
close_state = #{sar.closeState}
|
sar_stand_unqualified.close_state = #{sar.closeState}
|
||||||
<if test="sar.standId != null and sar.standId != '' ">
|
<if test="sar.standId != null and sar.standId != '' ">
|
||||||
and STAND_ID = #{sar.standId}
|
and sar_stand_unqualified.STAND_ID = #{sar.standId}
|
||||||
</if>
|
</if>
|
||||||
<if test="sar.productName != null and sar.productName != '' ">
|
<if test="sar.productName != null and sar.productName != '' ">
|
||||||
and PRODUCT_NAME like concat(concat('%',#{sar.productName}),'%')
|
and sar_stand_unqualified.PRODUCT_NAME like concat(concat('%',#{sar.productName}),'%')
|
||||||
</if>
|
</if>
|
||||||
<if test="sar.responsibleUnit != null and sar.responsibleUnit != '' ">
|
<if test="sar.responsibleUnit != null and sar.responsibleUnit != '' ">
|
||||||
and RESPONSIBLE_UNIT = #{sar.responsibleUnit}
|
and ts_institution.name like concat('%',#{sar.responsibleUnit},'%')
|
||||||
</if>
|
</if>
|
||||||
<if test="sar.standSerialNumber != null and sar.standSerialNumber != '' ">
|
<if test="sar.standSerialNumber != null and sar.standSerialNumber != '' ">
|
||||||
and (REPLACE(STAND_SERIAL_NUMBER,' ','') like concat(concat('%',REPLACE(#{sar.standSerialNumber},' ','')),'%')
|
and (REPLACE(sar_stand_unqualified.STAND_SERIAL_NUMBER,' ','') like concat(concat('%',REPLACE(#{sar.standSerialNumber},' ','')),'%')
|
||||||
or sar_stand_unqualified.STAND_NAME like concat(concat('%',#{sar.standSerialNumber}),'%'))
|
or sar_stand_unqualified.STAND_NAME like concat(concat('%',#{sar.standSerialNumber}),'%'))
|
||||||
</if>
|
</if>
|
||||||
order by sar_stand_unqualified.STAND_ID ,sar_stand_unqualified.ITEMS_NUM asc
|
order by sar_stand_unqualified.ID,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
|
)c
|
||||||
ORDER BY c.STAND_ID, CONVERT(SUBSTRING(c.ITEMS_NUM,1,(SELECT LOCATE('.',CONCAT(c.ITEMS_NUM,'.')))),SIGNED) ,c.rows
|
ORDER BY c.STAND_ID, CONVERT(SUBSTRING(c.ITEMS_NUM,1,(SELECT LOCATE('.',CONCAT(c.ITEMS_NUM,'.')))),SIGNED) ,c.rows
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
Reference in New Issue
Block a user