You've already forked FrameTour-BE
推客直接收益,调整顺序
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ycwl.basic.mapper.BrokerMapper">
|
||||
<insert id="add">
|
||||
insert into broker(scenic_id, `name`, phone, status, broker_enable, broker_rate, create_at, update_at) values (#{scenicId}, #{name}, #{phone}, 0, #{brokerEnable}, #{brokerRate}, now(), now())
|
||||
insert into broker(scenic_id, `name`, phone, status, broker_enable, broker_rate, create_at, update_at) values (#{scenicId}, #{name}, #{phone}, 1, #{brokerEnable}, #{brokerRate}, now(), now())
|
||||
</insert>
|
||||
<update id="update">
|
||||
update broker set `name` = #{name}, phone = #{phone}, broker_enable = #{brokerEnable}, broker_rate = #{brokerRate}, update_at = now() where id = #{id}
|
||||
@ -35,11 +35,13 @@
|
||||
delete from broker where id = #{id}
|
||||
</delete>
|
||||
<select id="list" resultType="com.ycwl.basic.model.pc.broker.resp.BrokerRespVO">
|
||||
select b.id, scenic_id, s.name as scenicName, b.`name`, b.phone, b.broker_enable, b.broker_rate, b.status, b.create_at, b.update_at,
|
||||
select b.id, scenic_id, s.name as scenicName, b.`name`, b.phone, b.broker_enable, b.broker_rate, b.status,
|
||||
(select count(1) from statistics s where s.type = 20 and s.morph_id = b.id) as broker_scan_count,
|
||||
(select count(1) from broker_record r where r.broker_id = b.id) as broker_order_count,
|
||||
(select sum(order_price) from broker_record r where r.broker_id = b.id) as broker_order_amount,
|
||||
create_at, update_at
|
||||
(select min(r.create_time) from broker_record r where r.broker_id = b.id) as first_broker_date,
|
||||
(select max(r.create_time) from broker_record r where r.broker_id = b.id) as last_broker_date,
|
||||
b.create_at, b.update_at
|
||||
from broker b left join scenic s on b.scenic_id = s.id
|
||||
<where>
|
||||
<if test="scenicId!= null">
|
||||
|
@ -31,23 +31,26 @@
|
||||
|
||||
<select id="getDailySummaryByBrokerId" resultType="com.ycwl.basic.model.pc.broker.resp.DailySummaryRespVO">
|
||||
SELECT date_series.date AS date,
|
||||
COALESCE(COUNT(br.id), 0) AS recordCount,
|
||||
COALESCE(SUM(br.order_price), 0) AS totalOrderPrice
|
||||
COALESCE(COUNT(s.id), 0) AS scanCount,
|
||||
COALESCE(COUNT(br.id), 0) AS orderCount,
|
||||
COALESCE(SUM(br.order_price), 0) AS totalOrderPrice,
|
||||
COALESCE(SUM(br.broker_price), 0) AS totalBrokerPrice
|
||||
FROM (
|
||||
SELECT DATE_ADD(#{startTime}, INTERVAL (units.i + tens.i * 10 + hundreds.i * 100) DAY) AS date
|
||||
FROM (SELECT 0 AS i UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) units
|
||||
CROSS JOIN (SELECT 0 AS i UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) tens
|
||||
CROSS JOIN (SELECT 0 AS i UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) hundreds
|
||||
WHERE DATE_ADD(#{startTime}, INTERVAL (units.i + tens.i * 10) DAY) <= #{endTime}
|
||||
WHERE DATE_ADD(#{startTime}, INTERVAL (units.i + tens.i * 10 + hundreds.i * 100) DAY) <= #{endTime}
|
||||
) date_series
|
||||
LEFT JOIN broker_record br ON DATE(br.create_time) = date_series.date AND br.broker_id = #{brokerId}
|
||||
LEFT JOIN statistics s ON s.type = 20 and DATE(s.create_time) = date_series.date and s.morph_id = #{brokerId}
|
||||
GROUP BY date_series.date
|
||||
ORDER BY date_series.date
|
||||
</select>
|
||||
|
||||
<insert id="add">
|
||||
insert into broker_record(broker_id, order_id, order_price, broker_rate, broker_price, reason, create_time)
|
||||
values (#{brokerId}, #{orderId}, #{orderPrice}, #{brokerRate}, #{brokerPrice}, #{reason}, now())
|
||||
insert into broker_record(broker_id, order_id, order_price, broker_rate, broker_price, direct_price, reason, create_time)
|
||||
values (#{brokerId}, #{orderId}, #{orderPrice}, #{brokerRate}, #{brokerPrice}, #{directPrice}, #{reason}, now())
|
||||
</insert>
|
||||
|
||||
<delete id="deleteById">
|
||||
|
@ -103,7 +103,10 @@
|
||||
image_source_store_day=#{imageSourceStoreDay},
|
||||
user_source_expire_day=#{userSourceExpireDay},
|
||||
face_score_threshold=#{faceScoreThreshold},
|
||||
force_finish_time=#{forceFinishTime}
|
||||
force_finish_time=#{forceFinishTime},
|
||||
store_type=#{storeType},
|
||||
store_config_json=#{storeConfigJson},
|
||||
broker_direct_rate=#{brokerDirectRate}
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
Reference in New Issue
Block a user