lanan-system/dl-module-inspection/src/main/resources/mapper/payment/OrderInfoMapper.xml
2024-10-11 18:53:33 +08:00

298 lines
11 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.payment.mapper.OrderInfoMapper">
<select id="orderList" resultType="cn.iocoder.yudao.module.payment.entity.OrderInfo">
SELECT
*
FROM
`order_info`
where user_id =#{userId} and order_status!='0'
and ((goods_type='jc' and partner_id=888) or goods_type!='jc')
<if test="status!=null and status!='' ">
and order_status = #{status}
</if>
<if test="title!=null and title!='' ">
and goods_title like concat('%',#{title},'%')
</if>
order by order_time desc
</select>
<select id="validationListWx" resultType="cn.iocoder.yudao.module.payment.entity.OrderInfo">
SELECT
*
FROM
`order_info`
where validation_user_id = #{validationUserId} and validation_time is not null and goods_type != 'sc'
order by validation_time desc
</select>
<select id="validationListPc" resultType="cn.iocoder.yudao.module.payment.entity.OrderInfo">
SELECT
*
FROM
`order_info`
where partner_id = #{partnerId} and validation_time is not null and goods_type = 'sc'
order by validation_time desc
</select>
<select id="orderListSystem" resultType="cn.iocoder.yudao.module.payment.entity.OrderInfo">
SELECT
oi.id,
oi.order_no,
oi.goods_title,
oi.goods_title,
oi.goods_type,
su.nickname AS realName,
su.mobile as phonenumber,
oi.goods_price,
oi.pay_money,
oi.order_time,
oi.balance,
oi.pay_time,
oi.order_status,
oi.comment_desc,
oi.comment_star,
suc.car_no
FROM
`order_info` oi
LEFT JOIN system_users su ON su.id = oi.user_id
left join shop_user_car suc on suc.car_id = oi.user_car_id
where 1=1
<if test="vo.orderStatus!=null and vo.orderStatus!='' ">
and oi.order_status = #{vo.orderStatus}
</if>
<if test="vo.validationTime!=null">
and oi.validation_time is not null
</if>
<if test="vo.realName!=null and vo.realName!='' ">
and oi.real_name like concat('%',#{vo.realName},'%')
</if>
<if test="vo.orderNo!=null and vo.orderNo!='' ">
and oi.order_no like concat('%',#{vo.orderNo},'%')
</if>
<if test="vo.goodsTitle!=null and vo.goodsTitle!='' ">
and oi.goods_title like concat('%',#{vo.goodsTitle},'%')
</if>
<if test="vo.validationRealName!=null and vo.validationRealName!='' ">
and oi.validation_real_name like concat('%',#{vo.validationRealName},'%')
</if>
<if test="vo.phonenumber!=null and vo.phonenumber!='' ">
and su.mobile like concat('%',#{vo.phonenumber},'%')
</if>
<if test="vo.realPayMoney!=null ">
and oi.pay_money <![CDATA[>=]]> #{vo.realPayMoney}
</if>
<if test="vo.startTime!=null ">
and oi.pay_time <![CDATA[>=]]> #{vo.startTime}
</if>
<if test="vo.endTime!=null ">
and oi.pay_time <![CDATA[<=]]> #{vo.endTime}
</if>
<if test="vo.partnerId!=null ">
and oi.partner_id = #{vo.partnerId}
</if>
order by order_time desc
</select>
<select id="orderListApp" resultType="cn.iocoder.yudao.module.payment.entity.OrderInfo">
SELECT
*
FROM
`order_info`
where user_id =#{userId} and order_status!= '0'
<if test="status!=null and status!='' ">
and order_status = #{status}
</if>
<if test="title!=null and title!='' ">
and goods_title like concat('%',#{title},'%')
</if>
<if test="type!=null and type!='' ">
and goods_type =#{type}
</if>
order by order_time desc
</select>
<select id="orderListPc" resultType="cn.iocoder.yudao.module.payment.entity.OrderInfo">
SELECT
*
FROM
`order_info`
where partner_id =#{partnerId} and goods_type='sc'
<if test="vo.orderStatus!=null and vo.orderStatus!='' ">
and order_status = #{vo.orderStatus}
</if>
<if test="vo.phonenumber!=null and vo.phonenumber!='' ">
and phonenumber like concat('%',#{vo.phonenumber},'%')
</if>
<if test="vo.goodsTitle!=null and vo.goodsTitle!='' ">
and goods_title like concat('%',#{vo.goodsTitle},'%')
</if>
order by order_time desc
</select>
<select id="inspectionList" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo">
SELECT
info.id,info.worker_name,info.worker_phone,info.worker_avatar,info.`status`,info.is_pass,info.start_time,info.end_time,step.title as lastTitle,
oi.goods_title as goodsName,info.car_num,oi.partner_name as partnerName
from
inspection_info info
LEFT JOIN inspection_step_info step ON info.id = step.inspection_info_id
left join order_info oi on oi.id = info.inspection_order_id
WHERE info.user_id = #{userId}
and info.status = #{status}
GROUP BY info.id
order by info.create_time desc
</select>
<select id="avgPartnerScore" resultType="java.lang.Double">
SELECT
avg(comment_star)
FROM
`order_info`
where partner_id =#{partnerId}
</select>
<select id="statisticsMid" resultType="com.alibaba.fastjson.JSONObject">
SELECT
cate.category_name as `name`,cate.image,COUNT(info.id) as value
FROM
shop_inspection_category cate
left JOIN inspection_info info on cate.id = info.category_id
GROUP BY cate.id
</select>
<select id="statisticsZXTDay" resultType="com.alibaba.fastjson.JSONObject">
SELECT
count(id) as total,IFNULL(SUM(is_pass='0'),0) as noPass,IFNULL(SUM(is_pass='1'),0) pass,SUBSTRING(info.`day`, 6, 5) as timeStr
FROM
inspection_info info
WHERE 1=1 and create_time between #{startTime} and #{endTime}
<if test="partnerId!=null">
and partner_id = #{partnerId}
</if>
GROUP BY info.`day`
ORDER BY timeStr desc
</select>
<select id="statisticsZXTMonth" resultType="com.alibaba.fastjson.JSONObject">
SELECT
count(id) as total,IFNULL(SUM(is_pass='0'),0) as noPass,IFNULL(SUM(is_pass='1'),0) pass,info.`month` as timeStr
FROM
inspection_info info
WHERE 1=1 and create_time between #{startTime} and #{endTime}
<if test="partnerId!=null">
and partner_id = #{partnerId}
</if>
ORDER BY timeStr desc
</select>
<select id="statisticsOrder" resultType="com.alibaba.fastjson.JSONObject">
SELECT
count(info.id) as total,partner.partner_name as partnerName,partner.partner_logo as logo
FROM
inspection_info info
inner join shop_mall_partners partner ON partner.partner_id = info.partner_id and partner.is_banned ='0'
GROUP BY partner.partner_id
ORDER BY total desc
</select>
<select id="getPartnerList" resultType="com.alibaba.fastjson.JSONObject">
SELECT
partner.partner_id as partnerId,partner.partner_name as partnerName,partner.partner_logo as logo
FROM
shop_mall_partners partner
where
partner.is_banned ='0'
<if test="partnerName !=null and partnerName!=''">
and partner.partner_name like concat('%',#{partnerName},'%')
</if>
ORDER BY partner.order_num
</select>
<select id="governmentInspectionList" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo">
SELECT
info.id,info.worker_name,info.worker_phone,info.worker_avatar,info.`status`,info.is_pass,info.start_time,info.end_time,step.title as lastTitle,
oi.goods_title as goodsName,info.car_num,oi.partner_name as partnerName
from
inspection_info info
LEFT JOIN inspection_step_info step ON info.id = step.inspection_info_id
left join order_info oi on oi.id = info.inspection_order_id
WHERE info.status = #{status}
<if test="carNum!=null and carNum!=''">
and info.car_num like concat('%',#{status},'%')
</if>
<if test="partnerId!=null and partnerId!=''">
and info.partner_id =#{partnerId}
</if>
GROUP BY info.id
order by info.create_time desc
</select>
<select id="getNoCommentOrder" resultType = "java.lang.Integer">
SELECT
count(1)
FROM
`order_info`
where user_id = #{userId} and ((goods_type='jc' and partner_id=888) or goods_type!='jc') and order_status = '2'
</select>
<select id="getCommentOrderList" resultType = "cn.iocoder.yudao.module.payment.entity.commentVo">
SELECT
real_name,comment_desc ,comment_star,comment_time,goods_title
FROM
order_info
where partner_id = #{partnerId} and comment_star is not null
ORDER BY comment_time desc
</select>
<select id="pageOrderListSystem" resultType="cn.iocoder.yudao.module.payment.entity.OrderInfo">
SELECT
oi.id,
oi.order_no,
oi.goods_title,
oi.goods_title,
oi.goods_type,
su.nickname AS realName,
su.mobile as phonenumber,
oi.goods_price,
oi.pay_money,
oi.order_time,
oi.balance,
oi.pay_time,
oi.order_status,
oi.comment_desc,
oi.comment_star,
suc.car_no
FROM
`order_info` oi
LEFT JOIN system_users su ON su.id = oi.user_id
left join shop_user_car suc on suc.car_id = oi.user_car_id
where 1=1
<if test="entity.orderStatus!=null and entity.orderStatus!='' ">
and oi.order_status = #{entity.orderStatus}
</if>
<if test="entity.validationTime!=null">
and oi.validation_time is not null
</if>
<if test="entity.realName!=null and entity.realName!='' ">
and oi.real_name like concat('%',#{entity.realName},'%')
</if>
<if test="entity.orderNo!=null and entity.orderNo!='' ">
and oi.order_no like concat('%',#{entity.orderNo},'%')
</if>
<if test="entity.goodsTitle!=null and entity.goodsTitle!='' ">
and oi.goods_title like concat('%',#{entity.goodsTitle},'%')
</if>
<if test="entity.validationRealName!=null and entity.validationRealName!='' ">
and oi.validation_real_name like concat('%',#{entity.validationRealName},'%')
</if>
<if test="entity.phonenumber!=null and entity.phonenumber!='' ">
and su.mobile like concat('%',#{entity.phonenumber},'%')
</if>
<if test="entity.realPayMoney!=null ">
and oi.pay_money <![CDATA[>=]]> #{entity.realPayMoney}
</if>
<if test="entity.startTime!=null ">
and oi.pay_time <![CDATA[>=]]> #{entity.startTime}
</if>
<if test="entity.endTime!=null ">
and oi.pay_time <![CDATA[<=]]> #{entity.endTime}
</if>
<if test="entity.partnerId!=null ">
and oi.partner_id = #{entity.partnerId}
</if>
order by oi.order_time desc
</select>
</mapper>