2024-08-28 20:54:03 +08:00
<?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.inspection.mapper.InspectionAppointmentMapper" >
<resultMap type= "cn.iocoder.yudao.module.inspection.entity.InspectionAppointment" id= "InspectionAppointmentResult" >
<result property= "id" column= "id" />
<result property= "partnerId" column= "partner_id" />
<result property= "orderId" column= "order_id" />
<result property= "goodsTitle" column= "goods_title" />
<result property= "appointmentDay" column= "appointment_day" />
<result property= "appointmentPeriod" column= "appointment_period" />
<result property= "createTime" column= "create_time" />
2024-08-31 00:08:49 +08:00
<result property= "creator" column= "creator" />
2024-08-28 20:54:03 +08:00
<result property= "updateTime" column= "update_time" />
2024-08-31 00:08:49 +08:00
<result property= "updater" column= "updater" />
2024-08-28 20:54:03 +08:00
</resultMap>
<sql id= "selectInspectionAppointmentVo" >
2024-08-31 00:08:49 +08:00
select id, partner_id, order_id, goods_title, appointment_day, appointment_period, create_time, creator, update_time, updater from inspection_appointment
2024-08-28 20:54:03 +08:00
</sql>
<select id= "selectInspectionAppointmentList" parameterType= "cn.iocoder.yudao.module.inspection.entity.InspectionAppointment" resultMap= "InspectionAppointmentResult" >
<include refid= "selectInspectionAppointmentVo" />
<where >
2024-10-11 18:53:33 +08:00
<if test= "vo.partnerId != null " > and partner_id = #{vo.partnerId}</if>
<if test= "vo.orderId != null " > and order_id = #{vo.orderId}</if>
<if test= "vo.goodsTitle != null and vo.goodsTitle != ''" > and goods_title = #{vo.goodsTitle}</if>
<if test= "vo.appointmentDay != null " > and appointment_day = #{vo.appointmentDay}</if>
<if test= "vo.appointmentPeriod != null and vo.appointmentPeriod != ''" > and appointment_period = #{vo.appointmentPeriod}</if>
2024-08-28 20:54:03 +08:00
</where>
</select>
2025-04-28 15:21:05 +08:00
<select id= "selectInspectionAppointmentById" parameterType= "Long" >
select ia.*,su.nickname as buyName, su.mobile as buyPhoneNum,su2.nickname as meetName,imco.is_meet,ic.appointment_day as pickCarAppointmentDay,ic.appointment_time as pickCarAppointmentTime,ic.adress_detail,ia.is_use
2025-03-25 14:55:51 +08:00
from inspection_appointment ia
left join system_users su on su.id = ia.user_id
2025-04-28 15:21:05 +08:00
LEFT JOIN inspection_meet_car_order imco ON imco.id = ia.meet_order_id
LEFT JOIN system_users su2 on su2.id = imco.meet_man_id
LEFT JOIN inspection_pick_car ic on ic.id = ia.pick_car_id
2025-03-25 14:55:51 +08:00
where ia.id = #{id}
2024-08-28 20:54:03 +08:00
</select>
<insert id= "insertInspectionAppointment" parameterType= "cn.iocoder.yudao.module.inspection.entity.InspectionAppointment" >
insert into inspection_appointment
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
<if test= "id != null" > id,</if>
<if test= "partnerId != null" > partner_id,</if>
<if test= "orderId != null" > order_id,</if>
<if test= "goodsTitle != null" > goods_title,</if>
<if test= "appointmentDay != null" > appointment_day,</if>
<if test= "appointmentPeriod != null" > appointment_period,</if>
<if test= "createTime != null" > create_time,</if>
2024-08-31 00:08:49 +08:00
<if test= "creator != null" > creator,</if>
2024-08-28 20:54:03 +08:00
<if test= "updateTime != null" > update_time,</if>
2024-08-31 00:08:49 +08:00
<if test= "updater != null" > updater,</if>
2024-08-28 20:54:03 +08:00
</trim>
<trim prefix= "values (" suffix= ")" suffixOverrides= "," >
<if test= "id != null" > #{id},</if>
<if test= "partnerId != null" > #{partnerId},</if>
<if test= "orderId != null" > #{orderId},</if>
<if test= "goodsTitle != null" > #{goodsTitle},</if>
<if test= "appointmentDay != null" > #{appointmentDay},</if>
<if test= "appointmentPeriod != null" > #{appointmentPeriod},</if>
<if test= "createTime != null" > #{createTime},</if>
2024-08-31 00:08:49 +08:00
<if test= "creator != null" > #{creator},</if>
2024-08-28 20:54:03 +08:00
<if test= "updateTime != null" > #{updateTime},</if>
2024-08-31 00:08:49 +08:00
<if test= "updater != null" > #{updater},</if>
2024-08-28 20:54:03 +08:00
</trim>
</insert>
<update id= "updateInspectionAppointment" parameterType= "cn.iocoder.yudao.module.inspection.entity.InspectionAppointment" >
update inspection_appointment
<trim prefix= "SET" suffixOverrides= "," >
<if test= "partnerId != null" > partner_id = #{partnerId},</if>
<if test= "orderId != null" > order_id = #{orderId},</if>
<if test= "goodsTitle != null" > goods_title = #{goodsTitle},</if>
<if test= "appointmentDay != null" > appointment_day = #{appointmentDay},</if>
<if test= "appointmentPeriod != null" > appointment_period = #{appointmentPeriod},</if>
<if test= "createTime != null" > create_time = #{createTime},</if>
2024-08-31 00:08:49 +08:00
<if test= "creator != null" > creator = #{creator},</if>
2024-08-28 20:54:03 +08:00
<if test= "updateTime != null" > update_time = #{updateTime},</if>
2024-08-31 00:08:49 +08:00
<if test= "updater != null" > updater = #{updater},</if>
2024-08-28 20:54:03 +08:00
</trim>
where id = #{id}
</update>
<delete id= "deleteInspectionAppointmentById" parameterType= "Long" >
delete from inspection_appointment where id = #{id}
</delete>
<delete id= "deleteInspectionAppointmentByIds" parameterType= "String" >
delete from inspection_appointment where id in
<foreach item= "id" collection= "array" open= "(" separator= "," close= ")" >
#{id}
</foreach>
</delete>
<select id= "getAppointmentList" resultType= "cn.iocoder.yudao.module.inspection.entity.InspectionAppointment" >
SELECT
2024-09-01 21:13:39 +08:00
ip.*,su.mobile as buyPhoneNum,su.nickname as buyName,ip.goods_title as goodsTitle,
2025-02-21 16:42:37 +08:00
suc.car_nature,suc.car_brand,suc.car_model,suc.car_no,igs.sku_name
2024-08-28 20:54:03 +08:00
FROM
inspection_appointment ip
2024-09-01 21:13:39 +08:00
INNER JOIN system_users su ON ip.user_id = su.id
2024-09-04 22:34:29 +08:00
left JOIN order_info oi ON ip.order_id = oi.id and oi.deleted=0
left join shop_user_car suc on suc.car_id = oi.user_car_id and suc.deleted=0
2025-02-21 16:42:37 +08:00
LEFT JOIN inspection_goods_sku igs on igs.id = ip.sku_id
2025-03-21 11:14:12 +08:00
where ip.deleted=0 and oi.validation_time IS NULL
2024-08-28 20:54:03 +08:00
<if test= "phoneNum!=null and phoneNum!=''" >
2025-04-10 17:57:04 +08:00
and (su.mobile like concat('%',#{phoneNum},'%') OR ip.car_no like concat('%',#{phoneNum},'%'))
2024-08-28 20:54:03 +08:00
</if>
2025-03-21 11:14:12 +08:00
<if test= "partnerId!=null and partnerId!=''" >
and ip.partner_id = #{partnerId}
</if>
2025-04-10 17:57:04 +08:00
<if test= "carNo != null and carNo != ''" >
and ip.car_no like concat('%',#{carNo},'%')
</if>
2025-04-11 17:57:48 +08:00
<if test= "startTime != null and startTime != '' and endTime != null and endTime != ''" >
and ip.appointment_day between #{startTime} and #{endTime}
</if>
2024-08-28 20:54:03 +08:00
order by ip.create_time desc
</select>
<select id= "getAppointmentOwn" resultType= "cn.iocoder.yudao.module.inspection.entity.InspectionAppointment" >
SELECT
2024-09-01 21:13:39 +08:00
ip.*,su.mobile as buyPhoneNum,su.nickname as buyName,ip.goods_title as goodsTitle,
suc.car_nature,suc.car_brand,suc.car_model,suc.car_no
2024-08-28 20:54:03 +08:00
FROM
2024-09-01 21:13:39 +08:00
inspection_appointment ip
INNER JOIN system_users su ON ip.user_id = su.id
left JOIN order_info oi ON ip.order_id = oi.id
left join shop_user_car suc on suc.car_id = oi.user_car_id
2024-09-04 22:34:29 +08:00
where ip.deleted=0 and ip.user_id = #{userId}
2024-08-28 20:54:03 +08:00
order by ip.create_time desc
</select>
</mapper>