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.InspectionInfoMapper">
|
|
|
|
|
|
|
|
<resultMap type="cn.iocoder.yudao.module.inspection.entity.InspectionInfo" id="InspectionInfoResult">
|
|
|
|
<result property="id" column="id" />
|
|
|
|
<result property="inspectionOrderId" column="inspection_order_id" />
|
|
|
|
<result property="workId" column="work_id" />
|
|
|
|
<result property="workerName" column="worker_name" />
|
|
|
|
<result property="workerPhone" column="worker_phone" />
|
|
|
|
<result property="isPass" column="is_pass" />
|
|
|
|
<result property="status" column="status" />
|
|
|
|
<result property="startTime" column="start_time" />
|
|
|
|
<result property="endTime" column="end_time" />
|
|
|
|
<result property="year" column="year" />
|
|
|
|
<result property="month" column="month" />
|
|
|
|
<result property="day" column="day" />
|
|
|
|
<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="selectInspectionInfoVo">
|
2024-08-31 00:08:49 +08:00
|
|
|
select id, inspection_order_id, work_id, worker_name, worker_phone, is_pass, status, start_time, end_time, year, month, day, create_time, creator, update_time, updater from inspection_info
|
2024-08-28 20:54:03 +08:00
|
|
|
</sql>
|
|
|
|
|
|
|
|
<select id="selectInspectionInfoList" parameterType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo" resultMap="InspectionInfoResult">
|
|
|
|
<include refid="selectInspectionInfoVo"/>
|
|
|
|
<where>
|
2024-10-11 18:53:33 +08:00
|
|
|
<if test="vo.inspectionOrderId != null "> and inspection_order_id = #{vo.inspectionOrderId}</if>
|
|
|
|
<if test="vo.workId != null "> and work_id = #{vo.workId}</if>
|
|
|
|
<if test="vo.workerName != null and vo.workerName != ''"> and worker_name like concat('%', #{vo.workerName}, '%')</if>
|
|
|
|
<if test="vo.workerPhone != null and vo.workerPhone != ''"> and worker_phone = #{vo.workerPhone}</if>
|
|
|
|
<if test="vo.isPass != null and vo.isPass != ''"> and is_pass = #{vo.isPass}</if>
|
|
|
|
<if test="vo.status != null and vo.status != ''"> and status = #{vo.status}</if>
|
|
|
|
<if test="vo.startTime != null "> and start_time = #{vo.startTime}</if>
|
|
|
|
<if test="vo.endTime != null "> and end_time = #{vo.endTime}</if>
|
|
|
|
<if test="vo.year != null and vo.year != ''"> and year = #{vo.year}</if>
|
|
|
|
<if test="vo.month != null and vo.month != ''"> and month = #{vo.month}</if>
|
|
|
|
<if test="vo.day != null and vo.day != ''"> and day = #{vo.day}</if>
|
2024-08-28 20:54:03 +08:00
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectInspectionInfoById" parameterType="Long" resultMap="InspectionInfoResult">
|
|
|
|
<include refid="selectInspectionInfoVo"/>
|
|
|
|
where id = #{id}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<insert id="insertInspectionInfo" parameterType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo">
|
|
|
|
insert into inspection_info
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="id != null">id,</if>
|
|
|
|
<if test="inspectionOrderId != null">inspection_order_id,</if>
|
|
|
|
<if test="workId != null">work_id,</if>
|
|
|
|
<if test="workerName != null">worker_name,</if>
|
|
|
|
<if test="workerPhone != null">worker_phone,</if>
|
|
|
|
<if test="isPass != null">is_pass,</if>
|
|
|
|
<if test="status != null">status,</if>
|
|
|
|
<if test="startTime != null">start_time,</if>
|
|
|
|
<if test="endTime != null">end_time,</if>
|
|
|
|
<if test="year != null">year,</if>
|
|
|
|
<if test="month != null">month,</if>
|
|
|
|
<if test="day != null">day,</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="inspectionOrderId != null">#{inspectionOrderId},</if>
|
|
|
|
<if test="workId != null">#{workId},</if>
|
|
|
|
<if test="workerName != null">#{workerName},</if>
|
|
|
|
<if test="workerPhone != null">#{workerPhone},</if>
|
|
|
|
<if test="isPass != null">#{isPass},</if>
|
|
|
|
<if test="status != null">#{status},</if>
|
|
|
|
<if test="startTime != null">#{startTime},</if>
|
|
|
|
<if test="endTime != null">#{endTime},</if>
|
|
|
|
<if test="year != null">#{year},</if>
|
|
|
|
<if test="month != null">#{month},</if>
|
|
|
|
<if test="day != null">#{day},</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="updateInspectionInfo" parameterType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo">
|
|
|
|
update inspection_info
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
<if test="inspectionOrderId != null">inspection_order_id = #{inspectionOrderId},</if>
|
|
|
|
<if test="workId != null">work_id = #{workId},</if>
|
|
|
|
<if test="workerName != null">worker_name = #{workerName},</if>
|
|
|
|
<if test="workerPhone != null">worker_phone = #{workerPhone},</if>
|
|
|
|
<if test="isPass != null">is_pass = #{isPass},</if>
|
|
|
|
<if test="status != null">status = #{status},</if>
|
|
|
|
<if test="startTime != null">start_time = #{startTime},</if>
|
|
|
|
<if test="endTime != null">end_time = #{endTime},</if>
|
|
|
|
<if test="year != null">year = #{year},</if>
|
|
|
|
<if test="month != null">month = #{month},</if>
|
|
|
|
<if test="day != null">day = #{day},</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="deleteInspectionInfoById" parameterType="Long">
|
|
|
|
delete from inspection_info where id = #{id}
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
<delete id="deleteInspectionInfoByIds" parameterType="String">
|
|
|
|
delete from inspection_info where id in
|
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
#{id}
|
|
|
|
</foreach>
|
|
|
|
</delete>
|
|
|
|
<select id="workOrder" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo">
|
2024-09-01 21:13:39 +08:00
|
|
|
select ins.*,oi.goods_title,su.nickname as buyName,su.mobile as buyPhone,oi.sku_name,oi.pay_money as realPayMoney
|
2024-08-28 20:54:03 +08:00
|
|
|
,oi.pay_type,oi.order_status as orderStatus,oi.goods_id,oi.sku_id,oi.pay_time,oi.goods_price,ins.create_time
|
|
|
|
from inspection_info ins
|
|
|
|
left join order_info oi on oi.id = ins.inspection_order_id
|
2024-09-01 21:13:39 +08:00
|
|
|
left join system_users su on su.id = ins.user_id
|
|
|
|
left join system_user_role sur on sur.user_id = su.id
|
2024-09-19 17:57:05 +08:00
|
|
|
where 1=1
|
2024-08-28 20:54:03 +08:00
|
|
|
<if test="carNum!=null and carNum!=''">
|
|
|
|
and ins.car_num like concat('%',#{carNum},'%')
|
|
|
|
</if>
|
|
|
|
<if test="goodsTitle!=null and goodsTitle!=''">
|
|
|
|
and oi.goods_title like concat('%',#{goodsTitle},'%')
|
|
|
|
</if>
|
|
|
|
<if test="roleId!=null and roleId!=''">
|
|
|
|
and sur.role_id = #{roleId}
|
|
|
|
</if>
|
|
|
|
|
|
|
|
<if test="customerSource!=null and customerSource!=''">
|
|
|
|
and ins.customer_source =#{customerSource}
|
|
|
|
</if>
|
|
|
|
<if test="payType!=null and payType!=''">
|
|
|
|
and oi.pay_type = #{payType}
|
|
|
|
</if>
|
|
|
|
<if test="startTime!=null and startTime!=''">
|
|
|
|
and ins.start_time between #{startTime} and #{endTime}
|
|
|
|
</if>
|
|
|
|
order by ins.start_time desc
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="delworkOrder" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo">
|
2024-09-01 21:13:39 +08:00
|
|
|
select ins.*,oi.goods_title,su.nickname as buyName,su.mobile as buyPhone,oi.sku_name,oi.pay_money as realPayMoney
|
2024-08-28 20:54:03 +08:00
|
|
|
,oi.pay_type,oi.order_status as orderStatus,oi.goods_id,oi.sku_id,oi.pay_time,oi.goods_price,ins.create_time
|
|
|
|
from del_inspection_info ins
|
|
|
|
left join del_order_info oi on oi.id = ins.inspection_order_id
|
2024-09-01 21:13:39 +08:00
|
|
|
left join system_users su on su.id = ins.user_id
|
|
|
|
left join system_user_role sur on sur.user_id = su.id
|
2024-09-19 17:57:05 +08:00
|
|
|
where 1=1
|
2024-08-28 20:54:03 +08:00
|
|
|
<if test="carNum!=null and carNum!=''">
|
|
|
|
and ins.car_num like concat('%',#{carNum},'%')
|
|
|
|
</if>
|
|
|
|
<if test="goodsTitle!=null and goodsTitle!=''">
|
|
|
|
and oi.goods_title like concat('%',#{goodsTitle},'%')
|
|
|
|
</if>
|
|
|
|
<if test="roleId!=null and roleId!=''">
|
|
|
|
and sur.role_id = #{roleId}
|
|
|
|
</if>
|
|
|
|
|
|
|
|
<if test="customerSource!=null and customerSource!=''">
|
|
|
|
and ins.customer_source =#{customerSource}
|
|
|
|
</if>
|
|
|
|
<if test="payType!=null and payType!=''">
|
|
|
|
and oi.pay_type = #{payType}
|
|
|
|
</if>
|
|
|
|
<if test="startTime!=null and startTime!=''">
|
|
|
|
and ins.start_time between #{startTime} and #{endTime}
|
|
|
|
</if>
|
|
|
|
order by ins.start_time desc
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="workOrderData" resultType="java.util.Map">
|
|
|
|
select ifnull(sum(oi.pay_money),0) as payMoneySum,ifnull(sum(oi.goods_price),0) goodsPriceSum
|
|
|
|
from inspection_info ins
|
|
|
|
left join order_info oi on oi.id = ins.inspection_order_id
|
2024-09-01 21:13:39 +08:00
|
|
|
left join system_users su on su.id = ins.user_id
|
|
|
|
left join system_user_role sur on sur.user_id = su.id
|
2024-09-19 17:57:05 +08:00
|
|
|
where 1=1
|
2024-08-28 20:54:03 +08:00
|
|
|
<if test="carNum!=null and carNum!=''">
|
|
|
|
and ins.car_num like concat('%',#{carNum},'%')
|
|
|
|
</if>
|
|
|
|
<if test="goodsTitle!=null and goodsTitle!=''">
|
|
|
|
and oi.goods_title like concat('%',#{goodsTitle},'%')
|
|
|
|
</if>
|
|
|
|
<if test="roleId!=null and roleId!=''">
|
|
|
|
and sur.role_id = #{roleId}
|
|
|
|
</if>
|
|
|
|
|
|
|
|
<if test="customerSource!=null and customerSource!=''">
|
|
|
|
and ins.customer_source =#{customerSource}
|
|
|
|
</if>
|
|
|
|
<if test="payType!=null and payType!=''">
|
|
|
|
and oi.pay_type = #{payType}
|
|
|
|
</if>
|
|
|
|
<if test="startTime!=null and startTime!=''">
|
|
|
|
and ins.start_time between #{startTime} and #{endTime}
|
|
|
|
</if>
|
|
|
|
</select>
|
2024-09-20 00:43:39 +08:00
|
|
|
<select id="pageWorkOrder" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo">
|
2024-10-23 23:25:04 +08:00
|
|
|
select distinct ins.*,oi.goods_title,su.nickname as buyName,su.mobile as buyPhone,oi.sku_name,oi.pay_money as realPayMoney
|
|
|
|
,oi.pay_type,oi.order_status as orderStatus,oi.goods_id,oi.sku_id,oi.pay_time,oi.goods_price
|
2024-09-20 00:43:39 +08:00
|
|
|
from inspection_info ins
|
|
|
|
left join order_info oi on oi.id = ins.inspection_order_id
|
|
|
|
left join system_users su on su.id = ins.user_id
|
|
|
|
left join system_user_role sur on sur.user_id = su.id
|
|
|
|
where 1=1
|
|
|
|
<if test="carNum!=null and carNum!=''">
|
|
|
|
and ins.car_num like concat('%',#{carNum},'%')
|
|
|
|
</if>
|
|
|
|
<if test="goodsTitle!=null and goodsTitle!=''">
|
|
|
|
and oi.goods_title like concat('%',#{goodsTitle},'%')
|
|
|
|
</if>
|
|
|
|
<if test="roleId!=null and roleId!=''">
|
|
|
|
and sur.role_id = #{roleId}
|
|
|
|
</if>
|
|
|
|
|
|
|
|
<if test="customerSource!=null and customerSource!=''">
|
|
|
|
and ins.customer_source =#{customerSource}
|
|
|
|
</if>
|
|
|
|
<if test="payType!=null and payType!=''">
|
|
|
|
and oi.pay_type = #{payType}
|
|
|
|
</if>
|
|
|
|
<if test="startTime!=null and startTime!=''">
|
|
|
|
and ins.start_time between #{startTime} and #{endTime}
|
|
|
|
</if>
|
|
|
|
order by ins.start_time desc
|
|
|
|
</select>
|
|
|
|
<select id="pageDelWorkOrder" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo">
|
|
|
|
select ins.*,oi.goods_title,su.nickname as buyName,su.mobile as buyPhone,oi.sku_name,oi.pay_money as realPayMoney
|
|
|
|
,oi.pay_type,oi.order_status as orderStatus,oi.goods_id,oi.sku_id,oi.pay_time,oi.goods_price,ins.create_time
|
|
|
|
from del_inspection_info ins
|
|
|
|
left join del_order_info oi on oi.id = ins.inspection_order_id
|
|
|
|
left join system_users su on su.id = ins.user_id
|
|
|
|
left join system_user_role sur on sur.user_id = su.id
|
|
|
|
where 1=1
|
|
|
|
<if test="carNum!=null and carNum!=''">
|
|
|
|
and ins.car_num like concat('%',#{carNum},'%')
|
|
|
|
</if>
|
|
|
|
<if test="goodsTitle!=null and goodsTitle!=''">
|
|
|
|
and oi.goods_title like concat('%',#{goodsTitle},'%')
|
|
|
|
</if>
|
|
|
|
<if test="roleId!=null and roleId!=''">
|
|
|
|
and sur.role_id = #{roleId}
|
|
|
|
</if>
|
|
|
|
|
|
|
|
<if test="customerSource!=null and customerSource!=''">
|
|
|
|
and ins.customer_source =#{customerSource}
|
|
|
|
</if>
|
|
|
|
<if test="payType!=null and payType!=''">
|
|
|
|
and oi.pay_type = #{payType}
|
|
|
|
</if>
|
|
|
|
<if test="startTime!=null and startTime!=''">
|
|
|
|
and ins.start_time between #{startTime} and #{endTime}
|
|
|
|
</if>
|
|
|
|
order by ins.start_time desc
|
|
|
|
</select>
|
2024-11-02 17:09:36 +08:00
|
|
|
<select id="selectByUser" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo">
|
|
|
|
SELECT
|
2024-11-02 18:04:35 +08:00
|
|
|
ii.*,
|
2024-11-04 18:05:07 +08:00
|
|
|
iwn.id AS workNodeId,
|
2024-11-05 18:04:02 +08:00
|
|
|
iwn.status AS workNodeStatus,
|
|
|
|
oi.order_no AS orderNo,
|
|
|
|
oi.phonenumber AS buyPhone
|
2024-11-02 17:09:36 +08:00
|
|
|
FROM
|
2024-11-02 18:04:35 +08:00
|
|
|
inspection_info ii
|
|
|
|
JOIN
|
|
|
|
inspection_work_node iwn ON ii.id = iwn.inspection_info_id
|
2024-11-05 18:04:02 +08:00
|
|
|
JOIN order_info oi ON ii.inspection_order_id = oi.id
|
2024-11-02 18:04:35 +08:00
|
|
|
<where>
|
|
|
|
-- ii.status = '0' -- 工单正在进行中
|
|
|
|
-- ii.now_order_num = iwn.order_num -- 当前工单步骤与流程节点顺序一致
|
|
|
|
-- AND iwn.status = '0' -- 流程节点状态为待开始
|
2024-11-12 16:39:21 +08:00
|
|
|
(ii.lead_man_id = #{inspectionInfo.leadManId}
|
|
|
|
OR iwn.role_id IN
|
2024-11-02 18:04:35 +08:00
|
|
|
<foreach collection="roleIds" item="roleId" open="(" separator="," close=")">
|
|
|
|
#{roleId}
|
2024-11-12 16:39:21 +08:00
|
|
|
</foreach>)
|
2024-11-02 18:04:35 +08:00
|
|
|
<if test="inspectionInfo.carNum != null">
|
|
|
|
AND ii.car_num like concat('%',#{inspectionInfo.carNum},'%')
|
|
|
|
</if>
|
|
|
|
-- 待接受
|
|
|
|
<if test="inspectionInfo.status == 1">
|
|
|
|
AND ii.status = '0' AND iwn.status = '0' AND ii.now_order_num = iwn.order_num
|
|
|
|
</if>
|
|
|
|
-- 进行中
|
|
|
|
<if test="inspectionInfo.status == 2">
|
|
|
|
AND ii.status = '0' AND iwn.status = '1' AND iwn.deal_user_id = #{inspectionInfo.dealUserId}
|
|
|
|
</if>
|
|
|
|
-- 已完成
|
|
|
|
<if test="inspectionInfo.status == 3">
|
|
|
|
AND iwn.status = '2' AND iwn.deal_user_id = #{inspectionInfo.dealUserId}
|
|
|
|
</if>
|
|
|
|
</where>
|
2024-11-05 18:04:02 +08:00
|
|
|
ORDER BY ii.create_time DESC
|
2024-11-02 17:09:36 +08:00
|
|
|
|
|
|
|
</select>
|
2024-08-28 20:54:03 +08:00
|
|
|
</mapper>
|