1215 lines
49 KiB
XML
1215 lines
49 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="com.sqx.modules.artificer.dao.OrdersDao">
|
|
|
|
<insert id="insertOrders" useGeneratedKeys="true" keyProperty="ordersId" parameterType="com.sqx.modules.artificer.entity.Orders">
|
|
INSERT INTO orders
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="null != artificerId ">
|
|
artificer_id,
|
|
</if>
|
|
<if test="null != userId ">
|
|
user_id,
|
|
</if>
|
|
<if test="null != serveTime and '' != serveTime">
|
|
serve_time,
|
|
</if>
|
|
<if test="null != phone and '' != phone">
|
|
phone,
|
|
</if>
|
|
<if test="null != address and '' != address">
|
|
address,
|
|
</if>
|
|
<if test="null != remark and '' != remark">
|
|
remark,
|
|
</if>
|
|
<if test="null != payMoney ">
|
|
pay_money,
|
|
</if>
|
|
<if test="null != ordersNo and '' != ordersNo">
|
|
orders_no,
|
|
</if>
|
|
<if test="null != payTime and '' != payTime">
|
|
pay_time,
|
|
</if>
|
|
<if test="null != payWay ">
|
|
pay_way,
|
|
</if>
|
|
<if test="null != status ">
|
|
status,
|
|
</if>
|
|
<if test="null != createTime and '' != createTime">
|
|
create_time,
|
|
</if>
|
|
<if test="null != artificerMoney ">
|
|
artificer_money,
|
|
</if>
|
|
<if test="null != longitude and '' != longitude">
|
|
longitude,
|
|
</if>
|
|
<if test="null != latitude and '' != latitude">
|
|
latitude,
|
|
</if>
|
|
<if test="null != sumMoney ">
|
|
sum_money,
|
|
</if>
|
|
<if test="null != addNum">
|
|
add_num,
|
|
</if>
|
|
<if test="null != addTime and '' != addTime">
|
|
add_time,
|
|
</if>
|
|
<if test="null != taxiMoney ">
|
|
taxi_money,
|
|
</if>
|
|
<if test="null != parentId ">
|
|
parent_id,
|
|
</if>
|
|
<if test="null != startTime and '' != startTime">
|
|
start_time,
|
|
</if>
|
|
<if test="null != couponId ">
|
|
coupon_id,
|
|
</if>
|
|
<if test="null != couponName and '' != couponName">
|
|
coupon_name,
|
|
</if>
|
|
<if test="null != couponMoney ">
|
|
coupon_money,
|
|
</if>
|
|
<if test="null != addArtificerMoney ">
|
|
add_artificer_money,
|
|
</if>
|
|
<if test="null != addMoney ">
|
|
add_money,
|
|
</if>
|
|
<if test="null != price ">
|
|
price,
|
|
</if>
|
|
<if test="null != sumArtificerMoney ">
|
|
sum_artificer_money,
|
|
</if>
|
|
<if test="null != isSend ">
|
|
is_send,
|
|
</if>
|
|
<if test="null != endTime and '' != endTime">
|
|
end_time,
|
|
</if>
|
|
<if test="null != userName and '' != userName">
|
|
user_name,
|
|
</if>
|
|
<if test="null != oneUserMoney ">
|
|
one_user_money,
|
|
</if>
|
|
<if test="null != oneUserId ">
|
|
one_user_id,
|
|
</if>
|
|
<if test="null != oneUserName and '' != oneUserName">
|
|
one_user_name,
|
|
</if>
|
|
<if test="null != oneArtificerMoney ">
|
|
one_artificer_money,
|
|
</if>
|
|
<if test="null != oneArtificerUserId ">
|
|
one_artificer_user_id,
|
|
</if>
|
|
<if test="null != oneArtificerUserName and '' != oneArtificerUserName">
|
|
one_artificer_user_name,
|
|
</if>
|
|
<if test="null != pingMoney ">
|
|
ping_money,
|
|
</if>
|
|
<if test="null != massageTypeId ">
|
|
massage_type_id,
|
|
</if>
|
|
<if test="null != overTimeOrders ">
|
|
over_time_orders,
|
|
</if>
|
|
<if test="null != endTimes and '' != endTimes">
|
|
end_times,
|
|
</if>
|
|
<if test="null != tripWay and '' != tripWay">
|
|
trip_way,
|
|
</if>
|
|
<if test="null != userPackageId and '' != userPackageId">
|
|
user_package_id,
|
|
</if>
|
|
<if test="null != km and '' != km">
|
|
km
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="null != artificerId ">
|
|
#{artificerId},
|
|
</if>
|
|
<if test="null != userId ">
|
|
#{userId},
|
|
</if>
|
|
<if test="null != serveTime and '' != serveTime">
|
|
#{serveTime},
|
|
</if>
|
|
<if test="null != phone and '' != phone">
|
|
#{phone},
|
|
</if>
|
|
<if test="null != address and '' != address">
|
|
#{address},
|
|
</if>
|
|
<if test="null != remark and '' != remark">
|
|
#{remark},
|
|
</if>
|
|
<if test="null != payMoney ">
|
|
#{payMoney},
|
|
</if>
|
|
<if test="null != ordersNo and '' != ordersNo">
|
|
#{ordersNo},
|
|
</if>
|
|
<if test="null != payTime and '' != payTime">
|
|
#{payTime},
|
|
</if>
|
|
<if test="null != payWay ">
|
|
#{payWay},
|
|
</if>
|
|
<if test="null != status ">
|
|
#{status},
|
|
</if>
|
|
<if test="null != createTime and '' != createTime">
|
|
#{createTime},
|
|
</if>
|
|
<if test="null != artificerMoney ">
|
|
#{artificerMoney},
|
|
</if>
|
|
<if test="null != longitude and '' != longitude">
|
|
#{longitude},
|
|
</if>
|
|
<if test="null != latitude and '' != latitude">
|
|
#{latitude},
|
|
</if>
|
|
<if test="null != sumMoney ">
|
|
#{sumMoney},
|
|
</if>
|
|
<if test="null != addNum ">
|
|
#{addNum},
|
|
</if>
|
|
<if test="null != addTime and '' != addTime">
|
|
#{addTime},
|
|
</if>
|
|
<if test="null != taxiMoney ">
|
|
#{taxiMoney},
|
|
</if>
|
|
<if test="null != parentId ">
|
|
#{parentId},
|
|
</if>
|
|
<if test="null != startTime and '' != startTime">
|
|
#{startTime},
|
|
</if>
|
|
<if test="null != couponId ">
|
|
#{couponId},
|
|
</if>
|
|
<if test="null != couponName and '' != couponName">
|
|
#{couponName},
|
|
</if>
|
|
<if test="null != couponMoney ">
|
|
#{couponMoney},
|
|
</if>
|
|
<if test="null != addArtificerMoney ">
|
|
#{addArtificerMoney},
|
|
</if>
|
|
<if test="null != addMoney ">
|
|
#{addMoney},
|
|
</if>
|
|
<if test="null != price ">
|
|
#{price},
|
|
</if>
|
|
<if test="null != sumArtificerMoney ">
|
|
#{sumArtificerMoney},
|
|
</if>
|
|
<if test="null != isSend ">
|
|
#{isSend},
|
|
</if>
|
|
<if test="null != endTime and '' != endTime">
|
|
#{endTime},
|
|
</if>
|
|
<if test="null != userName and '' != userName">
|
|
#{userName},
|
|
</if>
|
|
<if test="null != oneUserMoney ">
|
|
#{oneUserMoney},
|
|
</if>
|
|
<if test="null != oneUserId ">
|
|
#{oneUserId},
|
|
</if>
|
|
<if test="null != oneUserName and '' != oneUserName">
|
|
#{oneUserName},
|
|
</if>
|
|
<if test="null != oneArtificerMoney ">
|
|
#{oneArtificerMoney},
|
|
</if>
|
|
<if test="null != oneArtificerUserId ">
|
|
#{oneArtificerUserId},
|
|
</if>
|
|
<if test="null != oneArtificerUserName and '' != oneArtificerUserName">
|
|
#{oneArtificerUserName},
|
|
</if>
|
|
<if test="null != pingMoney ">
|
|
#{pingMoney},
|
|
</if>
|
|
<if test="null != massageTypeId ">
|
|
#{massageTypeId},
|
|
</if>
|
|
<if test="null != overTimeOrders ">
|
|
#{overTimeOrders},
|
|
</if>
|
|
<if test="null != endTimes and '' != endTimes">
|
|
#{endTimes},
|
|
</if>
|
|
<if test="null != tripWay and '' != tripWay">
|
|
#{tripWay},
|
|
</if>
|
|
<if test="null != userPackageId and '' != userPackageId">
|
|
#{userPackageId},
|
|
</if>
|
|
<if test="null != km and '' != km">
|
|
#{km}
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<select id="selectOrdersList" resultType="com.sqx.modules.artificer.entity.Orders">
|
|
select o.*,a.artificer_name as artificerName,a.artificer_img as artificerImg,
|
|
a.user_id as artificerUserId,c.consortia_name as shopName,c.address as shopAddress,
|
|
c.phone as shopPhone
|
|
from orders o
|
|
left join artificer a on a.artificer_id=o.artificer_id
|
|
left join tb_user u on u.user_id=o.user_id
|
|
left join consortia c on c.consortia_id=o.consortia_id
|
|
where 1=1
|
|
<if test="userPackageId!=null">
|
|
and o.user_package_id = #{userPackageId}
|
|
</if>
|
|
<if test="classifyId!=null and classifyId!=''">
|
|
and o.orders_id in (select orders_id from orders_massage where massage_id in (select massage_type_id from massage_type where classify_id=#{classifyId} ))
|
|
</if>
|
|
<if test="title!=null and title!=''">
|
|
and o.orders_id in (select orders_id from orders_massage where massage_id in (select massage_type_id from massage_type where title like concat('%',#{title},'%') ))
|
|
</if>
|
|
<if test="userId!=null">
|
|
and o.user_id=#{userId}
|
|
</if>
|
|
<if test="shopId!=null">
|
|
and o.shop_user_id=#{shopId}
|
|
</if>
|
|
<if test="status!=null and status!=0 and status!=-1 and status!=2">
|
|
and o.status=#{status}
|
|
</if>
|
|
<if test="status!=null and status==2">
|
|
and o.status in (2,9)
|
|
</if>
|
|
<if test="status!=null and status==-1">
|
|
and o.status in (3,5)
|
|
</if>
|
|
<if test="overTimeOrders!=null and overTimeOrders!=0">
|
|
and o.over_time_orders=#{overTimeOrders}
|
|
</if>
|
|
<if test="warning!=null and warning==1">
|
|
and o.warning = #{warning}
|
|
</if>
|
|
<if test="warning!=null and warning==2">
|
|
and o.warning = null
|
|
</if>
|
|
<if test="city!=null and city!=''">
|
|
and o.address like concat('%',#{city},'%')
|
|
</if>
|
|
<if test="userName!=null and userName!=''">
|
|
and o.user_name like concat('%',#{userName},'%')
|
|
</if>
|
|
<if test="shopName!=null and shopName!=''">
|
|
and c.consortia_name like concat('%',#{shopName},'%')
|
|
</if>
|
|
<if test="phone!=null and phone!=''">
|
|
and o.phone like concat('%',#{phone},'%')
|
|
</if>
|
|
<if test="artificerId!=null and artificerId!=''">
|
|
and o.artificer_id = #{artificerId}
|
|
</if>
|
|
<if test="parentId!=null">
|
|
and o.parent_id = #{parentId}
|
|
</if>
|
|
<if test="parentId==null">
|
|
and o.parent_id = 0
|
|
</if>
|
|
<if test="ordersNo!=null and ordersNo!=''">
|
|
and o.orders_no = #{ordersNo}
|
|
</if>
|
|
<if test="artificerName!=null and artificerName!=''">
|
|
and a.artificer_name like concat('%',#{artificerName},'%')
|
|
</if>
|
|
<if test="oneUserName!=null and oneUserName!=''">
|
|
and o.one_user_name like concat('%',#{oneUserName},'%')
|
|
</if>
|
|
<if test="oneArtificerUserName!=null and oneArtificerUserName!=''">
|
|
and o.one_artificer_user_name like concat('%',#{oneArtificerUserName},'%')
|
|
</if>
|
|
<if test="startServeTime!=null and startServeTime!=''">
|
|
and date_format(o.serve_time,'%Y-%m-%d') >= date_format(#{startServeTime},'%Y-%m-%d')
|
|
</if>
|
|
<if test="endServeTime!=null and endServeTime!=''">
|
|
and date_format(o.serve_time,'%Y-%m-%d') <= date_format(#{endServeTime},'%Y-%m-%d')
|
|
</if>
|
|
<if test="startTime!=null and startTime!=''">
|
|
and date_format(o.create_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
|
|
</if>
|
|
<if test="endTime!=null and endTime!=''">
|
|
and date_format(o.create_time,'%Y-%m-%d') <= date_format(#{endTime},'%Y-%m-%d')
|
|
</if>
|
|
<if test="isAdd!=null and isAdd!=0">
|
|
<if test="isAdd==1">
|
|
and o.add_num>0
|
|
</if>
|
|
<if test="isAdd==2">
|
|
and (o.add_num=0 or o.add_num is null)
|
|
</if>
|
|
</if>
|
|
order by o.create_time desc
|
|
</select>
|
|
|
|
<select id="selectAppOrdersList" resultType="com.sqx.modules.artificer.entity.Orders">
|
|
select o1.*,
|
|
(case when o1.status = 4
|
|
then o1.pay_money + ifnull(o1.add_money,0)
|
|
else o1.pay_money + ifnull(o1.add_money,0) + ifnull(o2.pay_money,0) + ifnull(o2.add_money,0) + ifnull(o3.pay_money,0) + ifnull(o3.add_money,0)
|
|
end) as pay_money_total,
|
|
(case when o1.status = 4
|
|
then o1.artificer_money + ifnull(o1.add_artificer_money,0)
|
|
else o1.artificer_money + ifnull(o1.add_artificer_money,0) + ifnull(o2.artificer_money,0) + ifnull(o2.add_artificer_money,0) + ifnull(o3.artificer_money,0) + ifnull(o3.add_artificer_money,0)
|
|
end) as artificer_money_total,
|
|
a.artificer_name as artificerName,a.artificer_img as artificerImg,
|
|
a.user_id as artificerUserId,c.consortia_name as shopName,c.address as shopAddress,
|
|
c.phone as shopPhone
|
|
from orders o1
|
|
left join orders o2 on o1.old_orders_id = o2.orders_id and o2.status != 4
|
|
left join orders o3 on o2.old_orders_id = o3.orders_id and o3.status != 4
|
|
left join artificer a on a.artificer_id=o1.artificer_id
|
|
left join tb_user u on u.user_id=o1.user_id
|
|
left join consortia c on c.consortia_id=o1.consortia_id
|
|
where o1.old_orders_id is not null
|
|
and o1.status != 11
|
|
<if test="userPackageId!=null">
|
|
and o1.user_package_id = #{userPackageId}
|
|
</if>
|
|
<if test="userId!=null">
|
|
and o1.user_id=#{userId}
|
|
</if>
|
|
<if test="status!=null and status!=0 and status!=-1 and status!=2">
|
|
and o1.status=#{status}
|
|
</if>
|
|
<if test="status!=null and status==2">
|
|
and o1.status in (2,9)
|
|
</if>
|
|
union all
|
|
select o1.*,
|
|
(o1.pay_money + ifnull(o1.add_money,0)) as pay_money_total,
|
|
(o1.artificer_money + ifnull(o1.add_artificer_money,0)) as artificer_money_total,
|
|
a.artificer_name as artificerName,a.artificer_img as artificerImg,
|
|
a.user_id as artificerUserId,c.consortia_name as shopName,c.address as shopAddress,
|
|
c.phone as shopPhone
|
|
from orders o1
|
|
left join artificer a on a.artificer_id=o1.artificer_id
|
|
left join tb_user u on u.user_id=o1.user_id
|
|
left join consortia c on c.consortia_id=o1.consortia_id
|
|
where o1.parent_id = 0
|
|
and o1.status != 11
|
|
and o1.orders_id not in (
|
|
select orders_id from orders
|
|
where old_orders_id is not null
|
|
)
|
|
<if test="userPackageId!=null">
|
|
and o1.user_package_id = #{userPackageId}
|
|
</if>
|
|
<if test="userId!=null">
|
|
and o1.user_id=#{userId}
|
|
</if>
|
|
<if test="status!=null and status!=0 and status!=-1 and status!=2">
|
|
and o1.status=#{status}
|
|
</if>
|
|
<if test="status!=null and status==2">
|
|
and o1.status in (2,9)
|
|
</if>
|
|
order by serve_time desc
|
|
</select>
|
|
|
|
<select id="excelOrdersList" resultType="com.sqx.modules.artificer.entity.Orders">
|
|
select o.*,a.artificer_name as artificerName,a.artificer_img as artificerImg,
|
|
a.user_id as artificerUserId,c.consortia_name as shopName,c.address as shopAddress,
|
|
c.phone as shopPhone
|
|
from orders o
|
|
left join artificer a on a.artificer_id=o.artificer_id
|
|
left join tb_user u on u.user_id=o.user_id
|
|
left join consortia c on c.consortia_id=o.consortia_id
|
|
where 1=1
|
|
<if test="classifyId!=null and classifyId!=''">
|
|
and o.orders_id in (select orders_id from orders_massage where massage_id in (select massage_type_id from massage_type where classify_id=#{classifyId} ))
|
|
</if>
|
|
<if test="title!=null and title!=''">
|
|
and o.orders_id in (select orders_id from orders_massage where massage_id in (select massage_type_id from massage_type where title like concat('%',#{title},'%') ))
|
|
</if>
|
|
<if test="userId!=null">
|
|
and o.user_id=#{userId}
|
|
</if>
|
|
<if test="shopId!=null">
|
|
and o.shop_user_id=#{shopId}
|
|
</if>
|
|
<if test="status!=null and status!=0 and status!=-1">
|
|
and o.status=#{status}
|
|
</if>
|
|
<if test="status!=null and status==-1">
|
|
and o.status in (3,5)
|
|
</if>
|
|
<if test="overTimeOrders!=null and overTimeOrders!=0">
|
|
and o.over_time_orders=#{overTimeOrders}
|
|
</if>
|
|
<if test="warning!=null and warning==1">
|
|
and o.warning = #{warning}
|
|
</if>
|
|
<if test="warning!=null and warning==2">
|
|
and o.warning = null
|
|
</if>
|
|
<if test="city!=null and city!=''">
|
|
and o.address like concat('%',#{city},'%')
|
|
</if>
|
|
<if test="userName!=null and userName!=''">
|
|
and o.user_name like concat('%',#{userName},'%')
|
|
</if>
|
|
<if test="shopName!=null and shopName!=''">
|
|
and c.consortia_name like concat('%',#{shopName},'%')
|
|
</if>
|
|
<if test="phone!=null and phone!=''">
|
|
and o.phone like concat('%',#{phone},'%')
|
|
</if>
|
|
<if test="artificerId!=null and artificerId!=''">
|
|
and o.artificer_id = #{artificerId}
|
|
</if>
|
|
<if test="parentId!=null">
|
|
and o.parent_id = #{parentId}
|
|
</if>
|
|
<if test="parentId==null">
|
|
and o.parent_id = 0
|
|
</if>
|
|
<if test="ordersNo!=null and ordersNo!=''">
|
|
and o.orders_no = #{ordersNo}
|
|
</if>
|
|
<if test="artificerName!=null and artificerName!=''">
|
|
and a.artificer_name like concat('%',#{artificerName},'%')
|
|
</if>
|
|
<if test="oneUserName!=null and oneUserName!=''">
|
|
and o.one_user_name like concat('%',#{oneUserName},'%')
|
|
</if>
|
|
<if test="oneArtificerUserName!=null and oneArtificerUserName!=''">
|
|
and o.one_artificer_user_name like concat('%',#{oneArtificerUserName},'%')
|
|
</if>
|
|
<if test="startServeTime!=null and startServeTime!=''">
|
|
and date_format(o.serve_time,'%Y-%m-%d') >= date_format(#{startServeTime},'%Y-%m-%d')
|
|
</if>
|
|
<if test="endServeTime!=null and endServeTime!=''">
|
|
and date_format(o.serve_time,'%Y-%m-%d') <= date_format(#{endServeTime},'%Y-%m-%d')
|
|
</if>
|
|
<if test="startTime!=null and startTime!=''">
|
|
and date_format(o.create_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
|
|
</if>
|
|
<if test="endTime!=null and endTime!=''">
|
|
and date_format(o.create_time,'%Y-%m-%d') <= date_format(#{endTime},'%Y-%m-%d')
|
|
</if>
|
|
<if test="isAdd!=null and isAdd!=0">
|
|
<if test="isAdd==1">
|
|
and o.add_num>0
|
|
</if>
|
|
<if test="isAdd==2">
|
|
and (o.add_num=0 or o.add_num is null)
|
|
</if>
|
|
</if>
|
|
order by o.create_time desc
|
|
</select>
|
|
|
|
<select id="selectOrdersMoney" resultType="BigDecimal">
|
|
select
|
|
<if test="status==1 || status==2 || status==3">
|
|
ifnull(sum(pay_money),0.00)
|
|
</if>
|
|
<if test="status==4">
|
|
ifnull(sum(pay_money),0.00)-ifnull(sum(artificer_money),0.00)
|
|
</if>
|
|
from orders where 1=1
|
|
<if test="status!=null">
|
|
<if test="status==1">
|
|
and status in (2,3,5)
|
|
</if>
|
|
<if test="status==2">
|
|
and status=2
|
|
</if>
|
|
<if test="status==3">
|
|
and status in (3,5)
|
|
</if>
|
|
<if test="status==4">
|
|
and status in (2,3,5)
|
|
</if>
|
|
</if>
|
|
<if test="time!=null and time!='' and type==1">
|
|
and date_format(pay_time,'%Y-%m-%d') >= date_format(#{time},'%Y-%m-%d')
|
|
</if>
|
|
<if test="time!=null and time!='' and type==2">
|
|
and date_format(pay_time,'%Y-%m') >= date_format(#{time},'%Y-%m')
|
|
</if>
|
|
<if test="time!=null and time!='' and type==3">
|
|
and date_format(pay_time,'%Y') >= date_format(#{time},'%Y')
|
|
</if>
|
|
</select>
|
|
|
|
<select id="selectSumMoney" resultType="java.math.BigDecimal">
|
|
select ifnull(sum(sum_artificer_money), 0) from orders where artificer_id = #{userId} and status in (3,5)
|
|
<if test="startTime!=null and startTime!=''">
|
|
and date_format(pay_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
|
|
</if>
|
|
<if test="endTime!=null and endTime!=''">
|
|
and date_format(pay_time,'%Y-%m-%d') <= date_format(#{endTime},'%Y-%m-%d')
|
|
</if>
|
|
</select>
|
|
|
|
<select id="selectSumMoneyMonth" resultType="java.math.BigDecimal">
|
|
select ifnull(sum(sum_artificer_money), 0) from orders where artificer_id = #{userId} and status in (3,5)
|
|
and date_format(pay_time,'%Y-%m') = date_format(#{time},'%Y-%m')
|
|
</select>
|
|
|
|
<select id="selectEstimationSumMoneyBy" resultType="java.math.BigDecimal">
|
|
select ifnull(sum(sum_artificer_money), 0) from orders where artificer_id = #{userId} and status in (3,5)
|
|
<if test="time!=null and time!='' and type==1">
|
|
and date_format(pay_time,'%Y-%m-%d') >= date_format(#{time},'%Y-%m-%d')
|
|
</if>
|
|
<if test="time!=null and time!='' and type==2">
|
|
and date_format(pay_time,'%Y-%m') >= date_format(#{time},'%Y-%m')
|
|
</if>
|
|
<if test="time!=null and time!='' and type==3">
|
|
and date_format(pay_time,'%Y') >= date_format(#{time},'%Y')
|
|
</if>
|
|
</select>
|
|
|
|
|
|
<select id="selectCountOrderNum" resultType="int">
|
|
select ifnull(sum(massage_num), 0) as num from orders where artificer_id = #{userId} and status in (2,3,5,6,7,8,9,10)
|
|
<if test="startTime!=null and startTime!=''">
|
|
and date_format(pay_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
|
|
</if>
|
|
<if test="endTime!=null and endTime!=''">
|
|
and date_format(pay_time,'%Y-%m-%d') <= date_format(#{endTime},'%Y-%m-%d')
|
|
</if>
|
|
</select>
|
|
|
|
<select id="selectCountOrders" resultType="Integer">
|
|
select count(*) from orders
|
|
where 1=1
|
|
<if test="status!=null">
|
|
and status=#{status}
|
|
</if>
|
|
<if test="time!=null and time!='' and type==1">
|
|
and date_format(create_time,'%Y-%m-%d') >= date_format(#{time},'%Y-%m-%d')
|
|
</if>
|
|
<if test="time!=null and time!='' and type==2">
|
|
and date_format(create_time,'%Y-%m') >= date_format(#{time},'%Y-%m')
|
|
</if>
|
|
<if test="time!=null and time!='' and type==3">
|
|
and date_format(create_time,'%Y') >= date_format(#{time},'%Y')
|
|
</if>
|
|
</select>
|
|
|
|
<select id="selectCountOrderByUserId" resultType="int">
|
|
select count(*) from orders where user_id = #{userId} and parent_id = 0
|
|
and date_format(create_time,'%Y-%m') >= date_format(#{time},'%Y-%m')
|
|
<if test="status!=null">
|
|
and status = #{status}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="selectCountOrder" resultType="int">
|
|
select count(*) from orders where artificer_id = #{userId} and parent_id = 0
|
|
<if test="status!=null">
|
|
and status = #{status}
|
|
</if>
|
|
<if test="status==null">
|
|
and status in (2,3,5,6,7,8,9,10)
|
|
</if>
|
|
<if test="startTime!=null and startTime!=''">
|
|
and date_format(create_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
|
|
</if>
|
|
<if test="endTime!=null and endTime!=''">
|
|
and date_format(create_time,'%Y-%m-%d') <= date_format(#{endTime},'%Y-%m-%d')
|
|
</if>
|
|
</select>
|
|
|
|
<select id="selectTodayOrder" resultType="com.sqx.modules.artificer.entity.Orders">
|
|
select o.*,
|
|
(case when o.user_package_detail_id is null then m.title else bl.title end ) as title,
|
|
(case when o.user_package_detail_id is null then m.massage_img else bl.massage_img end ) as massageImg,
|
|
now() > DATE_ADD(STR_TO_DATE(o.serve_time, '%Y-%m-%d %H:%i'), INTERVAL #{minutes} MINUTE) as is_can_supplement,
|
|
(case when o.status = 4
|
|
then o.artificer_money + ifnull(o.add_artificer_money,0)
|
|
else o.artificer_money + ifnull(o.add_artificer_money,0) + ifnull(o2.artificer_money,0) + ifnull(o2.add_artificer_money,0) + ifnull(o3.artificer_money,0) + ifnull(o3.add_artificer_money,0)
|
|
end) as artificer_money_total
|
|
from orders o
|
|
left join orders o2 on o.old_orders_id = o2.orders_id and o2.status != 4
|
|
left join orders o3 on o2.old_orders_id = o3.orders_id and o3.status != 4
|
|
left join orders_massage om on om.orders_id=o.orders_id
|
|
left join massage_type m on m.massage_type_id=om.massage_id
|
|
LEFT JOIN bl_user_package_detail bl ON bl.id = om.massage_id
|
|
where o.artificer_id = #{artificerId}
|
|
and o.old_orders_id is not null
|
|
and o.status != 11
|
|
<if test="type==1">
|
|
and date_format(o.serve_time,'%Y-%m-%d %H:%i') >= date_format(DATE_ADD(now(), INTERVAL -8 HOUR),'%Y-%m-%d %H:%i')
|
|
and date_format(o.serve_time,'%Y-%m-%d %H:%i') <= date_format(DATE_ADD(now(), INTERVAL 8 HOUR),'%Y-%m-%d %H:%i')
|
|
and o.status in (2,3,5,6,7,8,9)
|
|
</if>
|
|
<if test="type==2">
|
|
and o.status=2
|
|
<if test="startTime!=null and startTime!=''">
|
|
and date_format(o.serve_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
|
|
</if>
|
|
<if test="endTime!=null and endTime!=''">
|
|
and date_format(o.serve_time,'%Y-%m-%d') <= date_format(#{endTime},'%Y-%m-%d')
|
|
</if>
|
|
</if>
|
|
<if test="type==3">
|
|
and o.status in (3,5)
|
|
<if test="startTime!=null and startTime!=''">
|
|
and date_format(o.serve_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
|
|
</if>
|
|
<if test="endTime!=null and endTime!=''">
|
|
and date_format(o.serve_time,'%Y-%m-%d') <= date_format(#{endTime},'%Y-%m-%d')
|
|
</if>
|
|
</if>
|
|
<if test="type==4">
|
|
and o.status in (2,3,4,5,6,7,8)
|
|
<if test="startTime!=null and startTime!=''">
|
|
and date_format(o.serve_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
|
|
</if>
|
|
<if test="endTime!=null and endTime!=''">
|
|
and date_format(o.serve_time,'%Y-%m-%d') <= date_format(#{endTime},'%Y-%m-%d')
|
|
</if>
|
|
</if>
|
|
<if test="type==5">
|
|
and date_format(o.serve_time,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d') and o.status=2
|
|
</if>
|
|
union all
|
|
select o.*,
|
|
(case when o.user_package_detail_id is null then m.title else bl.title end ) as title,
|
|
(case when o.user_package_detail_id is null then m.massage_img else bl.massage_img end ) as massageImg,
|
|
now() > DATE_ADD(STR_TO_DATE(o.serve_time, '%Y-%m-%d %H:%i'), INTERVAL #{minutes} MINUTE) as is_can_supplement,
|
|
o.artificer_money + ifnull(o.add_artificer_money,0) as artificer_money_total
|
|
from orders o
|
|
left join orders_massage om on om.orders_id=o.orders_id
|
|
left join massage_type m on m.massage_type_id=om.massage_id
|
|
LEFT JOIN bl_user_package_detail bl ON bl.id = om.massage_id
|
|
where o.artificer_id = #{artificerId}
|
|
and o.parent_id = 0
|
|
and o.status != 11
|
|
and o.orders_id not in (
|
|
select orders_id from orders
|
|
where old_orders_id is not null
|
|
)
|
|
<if test="type==1">
|
|
and date_format(o.serve_time,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d') and o.status in (2,3,5,6,7,8,9)
|
|
</if>
|
|
<if test="type==2">
|
|
and o.status=2
|
|
<if test="startTime!=null and startTime!=''">
|
|
and date_format(o.serve_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
|
|
</if>
|
|
<if test="endTime!=null and endTime!=''">
|
|
and date_format(o.serve_time,'%Y-%m-%d') <= date_format(#{endTime},'%Y-%m-%d')
|
|
</if>
|
|
</if>
|
|
<if test="type==3">
|
|
and o.status in (3,5)
|
|
<if test="startTime!=null and startTime!=''">
|
|
and date_format(o.serve_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
|
|
</if>
|
|
<if test="endTime!=null and endTime!=''">
|
|
and date_format(o.serve_time,'%Y-%m-%d') <= date_format(#{endTime},'%Y-%m-%d')
|
|
</if>
|
|
</if>
|
|
<if test="type==4">
|
|
and o.status in (2,3,4,5,6,7,8)
|
|
<if test="startTime!=null and startTime!=''">
|
|
and date_format(o.serve_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
|
|
</if>
|
|
<if test="endTime!=null and endTime!=''">
|
|
and date_format(o.serve_time,'%Y-%m-%d') <= date_format(#{endTime},'%Y-%m-%d')
|
|
</if>
|
|
</if>
|
|
<if test="type==5">
|
|
and date_format(o.serve_time,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d') and o.status=2
|
|
</if>
|
|
order by serve_time desc
|
|
</select>
|
|
|
|
<select id="selectArtificerOrder" resultType="com.sqx.modules.artificer.entity.Orders">
|
|
select o.*,a.artificer_name as artificerName,a.artificer_img as artificerImg,a.user_id as artificerUserId
|
|
from orders o
|
|
left join artificer a on a.artificer_id=o.artificer_id
|
|
left join tb_user u on u.user_id=o.user_id
|
|
where o.parent_id = 0
|
|
<if test="userId!=null">
|
|
and o.artificer_id=#{userId}
|
|
</if>
|
|
<if test="status!=null and status!=0">
|
|
and o.status=#{status}
|
|
</if>
|
|
<if test="status==null or status==0">
|
|
and o.status!=1
|
|
</if>
|
|
order by o.create_time desc
|
|
</select>
|
|
|
|
<select id="selectOrdersCountByUnderway" resultType="int">
|
|
select count(*) from orders where status=2 and artificer_id=#{artificerId}
|
|
</select>
|
|
|
|
|
|
<select id="selectTeamOrdersList" resultType="Map">
|
|
select o.*,a.artificer_name as artificerName,a.artificer_img as artificerImg,a.user_id as artificerUserId
|
|
from orders o
|
|
left join artificer a on a.artificer_id=o.artificer_id
|
|
left join tb_user u on u.user_id=o.user_id
|
|
where 1=1
|
|
<if test="status!=null and status!=0">
|
|
and o.status=#{status}
|
|
</if>
|
|
<if test="type==1">
|
|
and o.one_user_id=#{userId}
|
|
</if>
|
|
<if test="type==2">
|
|
and o.one_artificer_user_id=#{userId}
|
|
</if>
|
|
order by o.create_time desc
|
|
</select>
|
|
|
|
<select id="selectOrdersMoneyCountByUserId" resultType="Double">
|
|
select
|
|
<if test="type==1">
|
|
ifnull(sum(one_user_money),0.00)
|
|
</if>
|
|
<if test="type==2">
|
|
ifnull(sum(one_artificer_money),0.00)
|
|
</if>
|
|
from orders
|
|
where status in (3,5)
|
|
<if test="type==1">
|
|
and one_user_id=#{userId}
|
|
</if>
|
|
<if test="type==2">
|
|
and one_artificer_user_id=#{userId}
|
|
</if>
|
|
<if test="time!=null">
|
|
and end_time like concat('%',#{time},'%')
|
|
</if>
|
|
</select>
|
|
|
|
<select id="selectUserCountByInvitationCode" resultType="Integer">
|
|
select count(*) from tb_user
|
|
where
|
|
<if test="type==1">
|
|
inviter_code=#{invitationCode}
|
|
</if>
|
|
<if test="type==2">
|
|
inviter_code=#{invitationCode} and is_authentication=2
|
|
</if>
|
|
</select>
|
|
|
|
<select id="selectTeamUserList" resultType="Map">
|
|
select * from (
|
|
select u.user_id as userId,u.user_name as userName,u.avatar,u.create_time as createTime,
|
|
<if test="type==1">
|
|
(select ifnull(sum(o.one_user_money),0.00) from orders o where
|
|
o.user_id = u.user_id and o.status in (3,5) and one_user_id=#{userId} ) as money
|
|
</if>
|
|
<if test="type==2">
|
|
(select ifnull(sum(o.one_artificer_money),0.00) from orders o where
|
|
o.artificer_id = (select artificer_id from artificer a where a.user_id=u.user_id) and o.status in (3,5) and one_artificer_user_id=#{userId} ) as money
|
|
</if>
|
|
from tb_user u
|
|
where
|
|
<if test="type==1">
|
|
u.inviter_code=#{invitationCode}
|
|
</if>
|
|
<if test="type==2">
|
|
u.inviter_code=#{invitationCode} and u.is_authentication=2
|
|
</if>
|
|
) a order by money desc
|
|
</select>
|
|
|
|
<select id="selectOrdersByEndTime" resultType="com.sqx.modules.artificer.entity.Orders">
|
|
select * from orders where DATE_SUB( end_time, INTERVAL #{minute} MINUTE )<=now() and status=6 and is_send is null
|
|
</select>
|
|
|
|
<select id="selectOrdersCountStatisticsByYear" resultType="Integer">
|
|
select count(*) from orders
|
|
where 1=1
|
|
<if test="status!=null and status!=0">
|
|
and status=#{status}
|
|
</if>
|
|
<if test="flag!=null and flag==1">
|
|
and date_format(create_time,'%Y-%m-%d')=date_format(#{time},'%Y-%m-%d')
|
|
</if>
|
|
<if test="flag!=null and flag==2">
|
|
and date_format(create_time,'%Y-%m')=date_format(#{time},'%Y-%m')
|
|
</if>
|
|
<if test="flag!=null and flag==3">
|
|
and date_format(create_time,'%Y')=date_format(#{time},'%Y')
|
|
</if>
|
|
</select>
|
|
|
|
<select id="selectArtificerOrdersList" resultType="com.sqx.modules.artificer.entity.Orders">
|
|
select o.*,a.artificer_name as artificerName,u.phone as artificerPhone,a.address as artificerAddress,
|
|
a.longitude as artificerLongitude,a.latitude as artificerLatitude
|
|
from orders o
|
|
left join artificer a on a.artificer_id=o.artificer_id
|
|
left join tb_user u on u.user_id=a.user_id
|
|
where o.status in (6,7,8)
|
|
<if test="artificerName!=null and artificerName!=''">
|
|
and a.artificer_name like concat('%',#{artificerName},'%')
|
|
</if>
|
|
<if test="artificerPhone!=null and artificerPhone!=''">
|
|
and u.phone = #{artificerPhone}
|
|
</if>
|
|
<if test="userName!=null and userName!=''">
|
|
and o.user_name like concat('%',#{userName},'%')
|
|
</if>
|
|
<if test="phone!=null and phone!=''">
|
|
and o.phone = #{phone}
|
|
</if>
|
|
<if test="overTimeOrders!=null and overTimeOrders!=0">
|
|
and o.over_time_orders=#{overTimeOrders}
|
|
</if>
|
|
<if test="warning!=null and warning==1">
|
|
and o.warning = #{warning}
|
|
</if>
|
|
<if test="warning!=null and warning==2">
|
|
and o.warning = null
|
|
</if>
|
|
order by o.warning=1 desc,o.create_time desc
|
|
</select>
|
|
|
|
<update id="updateOrdersWarning">
|
|
update orders set warning=1 where now()>= DATE_ADD( end_time, INTERVAL #{time} MINUTE ) and status=6 and warning is null
|
|
</update>
|
|
|
|
<select id="selectOrdersStatusByTime" resultType="com.sqx.modules.artificer.entity.Orders">
|
|
select * from orders where now()>= DATE_ADD( create_time, INTERVAL #{time} MINUTE ) and status=1
|
|
</select>
|
|
|
|
<select id="selectShopMoney" resultType="Map">
|
|
select ifnull(sum(o.shop_money),0.00) as money,o.shop_user_name as userName,o.shop_user_id as userId
|
|
from orders o
|
|
left join tb_user u on u.user_id=o.shop_user_id
|
|
where u.user_id is not null
|
|
<if test="userName!=null and userName!=''">
|
|
and o.shop_user_name like concat('%',#{userName},'%')
|
|
</if>
|
|
<if test="phone!=null and phone!=''">
|
|
and u.phone like concat('%',#{phone},'%')
|
|
</if>
|
|
<if test="flag!=null and flag==1">
|
|
and date_format(o.create_time,'%Y-%m-%d')=date_format(#{time},'%Y-%m-%d')
|
|
</if>
|
|
<if test="flag!=null and flag==2">
|
|
and date_format(o.create_time,'%Y-%m')=date_format(#{time},'%Y-%m')
|
|
</if>
|
|
<if test="flag!=null and flag==3">
|
|
and date_format(o.create_time,'%Y')=date_format(#{time},'%Y')
|
|
</if>
|
|
group by o.shop_user_id
|
|
order by money desc
|
|
</select>
|
|
|
|
<select id="selectOneUserMoney" resultType="Map">
|
|
select ifnull(sum(o.one_user_money),0.00) as money,o.one_user_name as userName,o.one_user_id as userId
|
|
from orders o
|
|
left join tb_user u on u.user_id=o.one_user_id
|
|
where u.user_id is not null
|
|
<if test="userName!=null and userName!=''">
|
|
and o.one_user_name like concat('%',#{userName},'%')
|
|
</if>
|
|
<if test="phone!=null and phone!=''">
|
|
and u.phone like concat('%',#{phone},'%')
|
|
</if>
|
|
<if test="flag!=null and flag==1">
|
|
and date_format(o.create_time,'%Y-%m-%d')=date_format(#{time},'%Y-%m-%d')
|
|
</if>
|
|
<if test="flag!=null and flag==2">
|
|
and date_format(o.create_time,'%Y-%m')=date_format(#{time},'%Y-%m')
|
|
</if>
|
|
<if test="flag!=null and flag==3">
|
|
and date_format(o.create_time,'%Y')=date_format(#{time},'%Y')
|
|
</if>
|
|
group by o.one_user_id
|
|
order by money desc
|
|
</select>
|
|
|
|
<select id="selectOneArtificerMoney" resultType="Map">
|
|
select ifnull(sum(o.one_artificer_money),0.00) as money,o.one_artificer_user_name as userName,o.one_artificer_user_id as userId
|
|
from orders o
|
|
left join tb_user u on u.user_id=o.one_artificer_user_id
|
|
where u.user_id is not null
|
|
<if test="userName!=null and userName!=''">
|
|
and o.one_artificer_user_name like concat('%',#{userName},'%')
|
|
</if>
|
|
<if test="phone!=null and phone!=''">
|
|
and u.phone like concat('%',#{phone},'%')
|
|
</if>
|
|
<if test="flag!=null and flag==1">
|
|
and date_format(o.create_time,'%Y-%m-%d')=date_format(#{time},'%Y-%m-%d')
|
|
</if>
|
|
<if test="flag!=null and flag==2">
|
|
and date_format(o.create_time,'%Y-%m')=date_format(#{time},'%Y-%m')
|
|
</if>
|
|
<if test="flag!=null and flag==3">
|
|
and date_format(o.create_time,'%Y')=date_format(#{time},'%Y')
|
|
</if>
|
|
group by o.one_artificer_user_id
|
|
order by money desc
|
|
</select>
|
|
|
|
<select id="selectArtificerMoney" resultType="Map">
|
|
select ifnull(sum(o.sum_artificer_money),0.00) as money,a.artificer_name as userName,a.user_id as userId
|
|
from orders o
|
|
left join artificer a on a.artificer_id=o.artificer_id
|
|
left join tb_user u on u.user_id=a.user_id
|
|
where u.user_id is not null
|
|
<if test="userName!=null and userName!=''">
|
|
and o.artificer_name like concat('%',#{userName},'%')
|
|
</if>
|
|
<if test="phone!=null and phone!=''">
|
|
and u.phone like concat('%',#{phone},'%')
|
|
</if>
|
|
<if test="flag!=null and flag==1">
|
|
and date_format(o.create_time,'%Y-%m-%d')=date_format(#{time},'%Y-%m-%d')
|
|
</if>
|
|
<if test="flag!=null and flag==2">
|
|
and date_format(o.create_time,'%Y-%m')=date_format(#{time},'%Y-%m')
|
|
</if>
|
|
<if test="flag!=null and flag==3">
|
|
and date_format(o.create_time,'%Y')=date_format(#{time},'%Y')
|
|
</if>
|
|
group by o.one_artificer_user_id
|
|
order by money desc
|
|
</select>
|
|
|
|
<select id="selectNewUserOrdersCount" resultType="Map">
|
|
select u.user_id as userId,u.user_name as userName,u.phone,u.create_time as createTime,
|
|
(select count(*) from orders o where o.user_id=u.user_id and status in (3,5)) as counts from tb_user u
|
|
where date_format(DATE_ADD( u.create_time, INTERVAL 7 day ),'%Y-%m-%d')>=date_format(now(),'%Y-%m-%d')
|
|
<if test="userName!=null and userName!=''">
|
|
and u.user_name like concat('%',#{userName},'%')
|
|
</if>
|
|
<if test="phone!=null and phone!=''">
|
|
and u.phone like concat('%',#{phone},'%')
|
|
</if>
|
|
order by counts
|
|
</select>
|
|
|
|
<select id="selectNewUserOrdersRate" resultType="Double">
|
|
select counts / userCount
|
|
from (SELECT count(*) AS userCount,
|
|
sum((
|
|
SELECT count(*)
|
|
FROM orders o
|
|
WHERE o.user_id = u.user_id
|
|
AND STATUS IN (3, 5))) AS counts
|
|
FROM tb_user u
|
|
WHERE date_format(DATE_ADD(u.create_time, INTERVAL 7 DAY ), '%Y-%m-%d') >= date_format(now(),'%Y-%m-%d')) a
|
|
</select>
|
|
<!--当期业绩-->
|
|
<select id="selectOrdersArtificerIntegralEarnings" resultType="java.lang.Integer">
|
|
select
|
|
IFNULL( SUM(o.price ),0) AS currentPerformance
|
|
from orders o
|
|
left join artificer a on a.artificer_id=o.artificer_id
|
|
left join tb_user u on u.user_id=o.user_id
|
|
left join consortia c on c.consortia_id=o.consortia_id
|
|
where o.artificer_id=#{artificerId}
|
|
and o.end_times BETWEEN #{startDate} and #{endDate}
|
|
and o.status in (3,5)
|
|
</select>
|
|
<!-- 订单数-->
|
|
<select id="selectOrdersArtificerIntegral" resultType="java.lang.String">
|
|
select
|
|
IFNULL( count(o.orders_id ),'0') AS currentPeriodOrdersSum
|
|
from orders o
|
|
left join artificer a on a.artificer_id=o.artificer_id
|
|
left join tb_user u on u.user_id=o.user_id
|
|
left join consortia c on c.consortia_id=o.consortia_id
|
|
where o.artificer_id=#{artificerId}
|
|
and o.end_times BETWEEN #{startDate} and #{endDate}
|
|
and o.status in (3,5)
|
|
and o.parent_id = 0
|
|
</select>
|
|
<!-- 加钟率-->
|
|
<select id="selectOrdersArtificerIntegraladdNum" resultType="java.lang.String">
|
|
select
|
|
IFNULL( count(o.add_num ),'0') AS currentPeriodAddBellsSum
|
|
from orders o
|
|
left join artificer a on a.artificer_id=o.artificer_id
|
|
left join tb_user u on u.user_id=o.user_id
|
|
left join consortia c on c.consortia_id=o.consortia_id
|
|
where o.artificer_id=#{artificerId}
|
|
and o.end_times BETWEEN #{startDate} and #{endDate} and o.parent_id = 0
|
|
</select>
|
|
<!-- 充值率-->
|
|
<select id="selectOrdersCurrentPeriodRechargeSum" resultType="java.lang.String">
|
|
select
|
|
IFNULL( count(user_recharge ),'0') AS currentPeriodRechargeSum
|
|
from orders o
|
|
left join artificer a on a.artificer_id=o.artificer_id
|
|
left join tb_user u on u.user_id=o.user_id
|
|
left join consortia c on c.consortia_id=o.consortia_id
|
|
left join user_recharge uu on uu.orders_id = o.orders_id
|
|
where o.artificer_id=#{artificerId}
|
|
and o.end_times BETWEEN #{startDate} and #{endDate} and o.parent_id = 0
|
|
and uu.type = 2
|
|
</select>
|
|
<!-- 储值积分数-->
|
|
<select id="selectOrdersStoredValueIntegral" resultType="java.lang.String">
|
|
SELECT
|
|
IFNULL( SUM(user_recharge ),'0') AS storedValueIntegral
|
|
FROM
|
|
user_recharge
|
|
where artificer_id=#{artificerId}
|
|
and create_time BETWEEN #{startDate} and #{endDate}
|
|
and type = 2
|
|
</select>
|
|
<!-- 线积分数-->
|
|
<select id="selectOnlineCredits" resultType="java.lang.String">
|
|
SELECT
|
|
IFNULL( SUM(user_recharge ),'0') AS onlineCredits
|
|
FROM
|
|
user_recharge
|
|
where artificer_id=#{artificerId}
|
|
and create_time BETWEEN #{startDate} and #{endDate}
|
|
and type = 1
|
|
</select>
|
|
<!-- 打车费用-->
|
|
<select id="selectTaxiMoney" resultType="java.lang.String">
|
|
SELECT
|
|
IFNULL( SUM(taxi_money ),'0') AS taxiMoney
|
|
FROM
|
|
orders
|
|
where artificer_id=#{artificerId}
|
|
and create_time BETWEEN #{startDate} and #{endDate}
|
|
</select>
|
|
<!--当期收益-->
|
|
<select id="earnings" resultType="java.lang.String">
|
|
select
|
|
IFNULL( SUM(o.artificer_money ),'0.00') AS currentPerformance
|
|
from orders o
|
|
left join artificer a on a.artificer_id=o.artificer_id
|
|
left join tb_user u on u.user_id=o.user_id
|
|
left join consortia c on c.consortia_id=o.consortia_id
|
|
where o.artificer_id=#{artificerId}
|
|
and o.end_times BETWEEN #{startDate} and #{endDate}
|
|
and o.status in (3,5)
|
|
</select>
|
|
<!--在线时长-->
|
|
<select id="selectOrdersZxscNum" resultType="java.lang.String">
|
|
select IFNULL( SUM(user_recharge),0) AS zxsc from bl_user_zxsc
|
|
where artificer_id = #{artificerId}
|
|
and create_time >= #{startTime}
|
|
and create_time <= #{endTime}
|
|
</select>
|
|
|
|
<select id="selectTjpriceList" resultType="java.lang.String">
|
|
select
|
|
IFNULL( SUM(o.price ),'0.00') AS currentPerformance
|
|
from orders o
|
|
where o.artificer_id=#{artificerId}
|
|
and o.end_times BETWEEN #{startTime} and #{endTime}
|
|
and o.status in (3,5)
|
|
</select>
|
|
|
|
|
|
<select id="getDangqiList" resultType="com.sqx.modules.artificer.entity.Orders">
|
|
select a.*,b.massage_img from orders a
|
|
left join massage_type b on a.massage_type_id = b.massage_type_id
|
|
where a.status in (3,5)
|
|
and a.artificer_id = ${userId}
|
|
and a.end_times BETWEEN #{startTime} and #{endTime} and a.parent_id = 0
|
|
</select>
|
|
|
|
<select id="getJiazhongList" resultType="com.sqx.modules.artificer.entity.Orders">
|
|
select a.*,b.massage_img from orders a
|
|
left join massage_type b on a.massage_type_id = b.massage_type_id
|
|
where a.status in (3,5)
|
|
and a.artificer_id = ${userId}
|
|
and a.end_times BETWEEN #{startTime} and #{endTime} and a.parent_id = 0
|
|
<if test="isSfwc != null and isSfwc == 0">
|
|
and (a.add_num = 0 or a.add_num is null)
|
|
</if>
|
|
<if test="isSfwc != null and isSfwc == 1">
|
|
and a.add_num > 0
|
|
</if>
|
|
</select>
|
|
|
|
<select id="getChongzhiList" resultType="com.sqx.modules.artificer.entity.Orders">
|
|
select
|
|
o.*,uu.user_recharge as userRecharge,b.massage_img
|
|
from orders o
|
|
left join artificer a on a.artificer_id=o.artificer_id
|
|
left join user_recharge uu on uu.orders_id = o.orders_id
|
|
left join massage_type b on o.massage_type_id = b.massage_type_id
|
|
where o.artificer_id=#{userId} and o.parent_id = 0
|
|
and o.status in (3,5)
|
|
and o.end_times BETWEEN #{startTime} and #{endTime}
|
|
<if test="isSfwc != null and isSfwc == 0">
|
|
and uu.type is null
|
|
</if>
|
|
<if test="isSfwc != null and isSfwc == 1">
|
|
and uu.type = 2
|
|
</if>
|
|
</select>
|
|
<!-- 获取业绩积分-->
|
|
<select id="getYjjfList" resultType="com.sqx.modules.artificer.entity.Orders">
|
|
select a.*,a.price as jifen,a.end_times as jftime,b.massage_img from orders a
|
|
left join massage_type b on a.massage_type_id = b.massage_type_id
|
|
where a.status in (3,5)
|
|
and a.artificer_id = ${userId}
|
|
and a.end_times BETWEEN #{startTime} and #{endTime}
|
|
</select>
|
|
<!-- 获取储值积分(为他充值的)-->
|
|
<select id="getCzjfList" resultType="com.sqx.modules.artificer.entity.Orders">
|
|
select id,user_recharge as jifen,create_time as jftime from user_recharge
|
|
where type = 2 and orders_id is null
|
|
and artificer_id = ${userId}
|
|
and create_time BETWEEN #{startTime} and #{endTime}
|
|
</select>
|
|
<!-- 获取订单充值积分-->
|
|
<select id="getDdczList" resultType="com.sqx.modules.artificer.entity.Orders">
|
|
select id,user_recharge as jifen,a.create_time as jftime,b.* from user_recharge a , orders b
|
|
where a.orders_id = b.orders_id and type = 2
|
|
and a.artificer_id =${userId}
|
|
and a.create_time BETWEEN #{startTime} and #{endTime}
|
|
</select>
|
|
<!-- 获取在线时长积分-->
|
|
<select id="getZxscList" resultType="com.sqx.modules.artificer.entity.Orders">
|
|
select id,sum(user_recharge) as jifen,DATE_FORMAT(create_time,'%Y-%m-%d') as jftime from user_recharge
|
|
where type = 1
|
|
and artificer_id =${userId}
|
|
and create_time BETWEEN #{startTime} and #{endTime}
|
|
GROUP BY DATE_FORMAT(create_time,'%Y-%m-%d')
|
|
</select>
|
|
|
|
<select id="getParentOrders" resultType="com.sqx.modules.artificer.entity.Orders">
|
|
select o.*
|
|
from orders o
|
|
where parent_id = #{parentId}
|
|
</select>
|
|
|
|
|
|
|
|
</mapper> |