ah_sz_gqj/src/main/resources/mappers/basis/ToolsManageMapper.xml

76 lines
2.6 KiB
XML

<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.aqgqj.basis.dao.ToolsManageDao">
<select id="list" resultType="com.bonus.aqgqj.basis.entity.dto.ToolsManageDto">
SELECT
tsd.id,
tsd.dev_type_name as sampleTools,
tsd.dev_code as devCode,
tsd.customer_code as customerCode,
tsd.dev_module as devModule,
tc.custom_name as customName,
tcs.custom_name as sampleDepartment,
ted.manufacture_date as manufactureDate,
te.exper_time as experTime,
te.exper_conclu as experConclu,
te.next_exper_time as nextExperTime,
te.submit_location as submitLocation,
su.user_name as experUser
FROM
tb_sample_device tsd
LEFT JOIN tb_sample ts on ts.id=tsd.sample_id and ts.del_flag=0
LEFT JOIN tb_custom tc on tc.id=ts.custom_id and tc.del_flag=0
LEFT JOIN tb_custom tcs on tcs.id=tsd.department_id and tcs.del_flag=0
LEFT JOIN tb_exper_dev ted on ted.dev_id=tsd.id
LEFT JOIN tb_exper te on te.id=ted.exper_id and te.del_flag=0
LEFT JOIN sys_user su on su.id=te.create_user and su.del_flag=0
WHERE
tsd.del_falg=0
<if test="sampleTools != null and sampleTools != ''">
and tsd.dev_type_name like concat('%',#{sampleTools}, '%')
</if>
<if test="keyWord != null and keyWord != ''">
AND (
tsd.dev_code like concat('%', #{keyWord}, '%') OR
tsd.customer_code like concat('%', #{keyWord}, '%') OR
tsd.dev_module like concat('%', #{keyWord}, '%') OR
tc.custom_name like concat('%', #{keyWord}, '%') OR
tcs.custom_name like concat('%', #{keyWord}, '%') OR
te.exper_conclu like concat('%', #{keyWord}, '%')
)
</if>
</select>
<select id="getSampleTools" resultType="java.lang.String">
SELECT GROUP_CONCAT(aa.dev_type_name SEPARATOR '、') AS sampleTools
FROM (SELECT DISTINCT tsd.dev_type_name
FROM tb_sample_device tsd
LEFT JOIN tb_sample ts ON ts.id = tsd.sample_id
WHERE tsd.sample_id = #{id}
AND tsd.del_falg = '0') aa
</select>
<select id="getDetailsList" resultType="com.bonus.aqgqj.basis.entity.dto.ToolsManageDto">
select
tsd.id,
tsd.dev_type_name as sampleTools,
tsd.dev_type_code as devTypeCode,
tsd.dev_module as devModule
from
tb_sample_device tsd
where tsd.del_falg = 0
and tsd.sample_id = #{id}
<if test="sampleTools != null and sampleTools != ''">
and tsd.dev_type_name like concat('%',#{sampleTools}, '%')
</if>
</select>
<select id="listTools" resultType="com.bonus.aqgqj.basis.entity.dto.ToolsManageDto">
select
id,
dict_name as name
from
sys_distinct
where
p_id = 92
and del_flag = 0
</select>
</mapper>