Files
foton-slrs-system-rest/adc-da-slrs/src/main/resources/mybatis/mapper/sarStandUnqualified/SarStandUnqualifiedMapper.xml
T
2022-07-18 16:39:53 +08:00

120 lines
6.4 KiB
XML
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?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.slrs.sarStandUnqualified.dao.SarStandUnqualifiedDao">
<select id="getAllDatasByPage" resultType="com.adc.da.slrs.sarStandUnqualified.entity.SarStandUnqualified">
SELECT
a.*,
b.UNAME AS qaEngineerName,
c.UNAME AS authEngineerName,
d.UNAME AS dutyEngineerName
FROM
sar_stand_unqualified a
LEFT JOIN ts_user b ON a.QA_ENGINEER = b.USID
LEFT JOIN ts_user c ON a.AUTH_ENGINEER = c.USID
LEFT JOIN ts_user d ON a.DUTY_ENGINEER = d.USID
WHERE
a.close_state = 1
<if test="sar.productName != null and sar.productName != '' ">
and a.product_name like concat(concat('%',#{sar.productName}),'%')
</if>
<if test="sar.standName != null and sar.standName != '' ">
and a.stand_name like concat(concat('%',#{sar.standName}),'%')
</if>
<if test="sar.productName != null and sar.productName != '' ">
and a.responsible_unit = #{responsibleUnit}
</if>
<if test="sar.standId != null and sar.standId != '' ">
and a.stand_id = #{standId}
</if>
</select>
<select id="getSarStandUnqualifiedPage" resultType="com.adc.da.slrs.sarStandUnqualified.entity.SarStandUnqualified">
SELECT
c.*
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
(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
sar_stand_unqualified.close_state = #{sar.closeState}
<if test="sar.standId != null and sar.standId != '' ">
and sar_stand_unqualified.STAND_ID = #{sar.standId}
</if>
<if test="sar.productName != null and sar.productName != '' ">
and sar_stand_unqualified.PRODUCT_NAME like concat(concat('%',#{sar.productName}),'%')
</if>
<if test="sar.responsibleUnit != null and sar.responsibleUnit != '' ">
and ts_institution.name like concat('%',#{sar.responsibleUnit},'%')
</if>
<if test="sar.standSerialNumber != null and sar.standSerialNumber != '' ">
and (REPLACE(REPLACE(sar_stand_unqualified.STAND_SERIAL_NUMBER,' ',''),' ','') like concat(concat('%',REPLACE(REPLACE(#{sar.standSerialNumber},' ',''),' ','')),'%')
or sar_stand_unqualified.STAND_NAME like concat(concat('%',#{sar.standSerialNumber}),'%'))
</if>
order by sar_stand_unqualified.ID,sar_stand_unqualified.STAND_ID ,sar_stand_unqualified.ITEMS_NUM asc
)c
ORDER BY c.STAND_ID, CONVERT(SUBSTRING(c.ITEMS_NUM,1,(SELECT LOCATE('.',CONCAT(c.ITEMS_NUM,'.')))),SIGNED) ,c.rows
limit #{start},#{end}
</select>
<select id="getSarStandUnqualifiedExcel" resultType="com.adc.da.slrs.sarStandUnqualified.entity.SarStandUnqualified">
SELECT
c.*
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
(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
sar_stand_unqualified.close_state = '1'
<if test="ids != null and ids.size()>0 ">
and sar_stand_unqualified.ID in
<foreach item="id" collection="ids" open="(" separator="," close=")" index="index">
#{id}
</foreach>
</if>
order by sar_stand_unqualified.ID,sar_stand_unqualified.STAND_ID ,sar_stand_unqualified.ITEMS_NUM asc
)c
ORDER BY c.STAND_ID, CONVERT(SUBSTRING(c.ITEMS_NUM,1,(SELECT LOCATE('.',CONCAT(c.ITEMS_NUM,'.')))),SIGNED) ,c.rows
</select>
<select id="getSarStandUnqualifiedCount" resultType="java.lang.Integer">
SELECT
count(*)
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
(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
sar_stand_unqualified.close_state = #{sar.closeState}
<if test="sar.standId != null and sar.standId != '' ">
and sar_stand_unqualified.STAND_ID = #{sar.standId}
</if>
<if test="sar.productName != null and sar.productName != '' ">
and sar_stand_unqualified.PRODUCT_NAME like concat(concat('%',#{sar.productName}),'%')
</if>
<if test="sar.responsibleUnit != null and sar.responsibleUnit != '' ">
and ts_institution.name like concat('%',#{sar.responsibleUnit},'%')
</if>
<if test="sar.standSerialNumber != null and 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}),'%'))
</if>
order by sar_stand_unqualified.ID,sar_stand_unqualified.STAND_ID ,sar_stand_unqualified.ITEMS_NUM asc
)c
ORDER BY c.STAND_ID, CONVERT(SUBSTRING(c.ITEMS_NUM,1,(SELECT LOCATE('.',CONCAT(c.ITEMS_NUM,'.')))),SIGNED) ,c.rows
</select>
</mapper>