lanan-system/dl-module-repair/src/main/resources/mapper/tickets/DlTicketWaresMapper.xml
2024-10-16 22:39:03 +08:00

74 lines
2.8 KiB
XML

<?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="cn.iocoder.yudao.module.tickets.mapper.DlTicketWaresMapper">
<resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.tickets.entity.DlTicketWares">
<id property="id" column="id" jdbcType="VARCHAR"/>
<result property="no" column="no" jdbcType="VARCHAR"/>
<result property="ticketId" column="ticket_id" jdbcType="VARCHAR"/>
<result property="type" column="type" jdbcType="VARCHAR"/>
<result property="status" column="status" jdbcType="VARCHAR"/>
<result property="remark" column="remark" jdbcType="VARCHAR"/>
<result property="repairId" column="repair_id" />
<result property="repairName" column="repair_name" />
<result property="adviserId" column="adviser_id" />
<result property="adviserName" column="adviser_name" />
</resultMap>
<sql id="Base_SQL">
select
dtw.id as id,no,ticket_id,
type,status,dtw.remark as remark,
dtw.repair_id as repair_id,
dtw.repair_name as repair_name,
dtw.adviser_id as adviser_id,
dtw.adviser_name as adviser_name
from dl_ticket_wares dtw
left join dl_repair_tickets drt
on dtw.ticket_id = drt.id
where dtw.deleted = '0'
</sql>
<select id="getPage" resultMap="BaseResultMap">
<include refid="Base_SQL" />
<if test="map.query != null and map.query != ''">
and (
dtw.no like concat('%', #{map.query}, '%')
or
drt.ticket_no like concat('%', #{map.query}, '%')
or
drt.car_no like concat('%', #{map.query}, '%')
)
</if>
<if test="map.type != null and map.type != ''">
and (dtw.type = #{map.type})
</if>
<if test="map.status != null and map.status != ''">
and (dtw.status = #{map.status})
</if>
<if test="map.userIds != null and map.userIds.size > 0">
and (
dtw.repair_id in
<foreach collection="map.userIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
)
</if>
<if test="map.userRole != null">
and (
<choose>
<when test="map.userRole == 5">
dtw.status not in ('01', '05', '03')
</when>
</choose>
)
</if>
<if test="map.adviserId != null and map.adviserId != ''">
and (dtw.adviser_id = #{map.adviserId})
</if>
order by dtw.create_time desc
</select>
</mapper>