提成优化修改、订单列表增加进粉字段、调理项目
This commit is contained in:
@ -87,15 +87,14 @@
|
||||
|
||||
<select id="selectSysCustomerList" parameterType="SysCustomer" resultMap="SysCustomerResult">
|
||||
<include refid="selectSysCustomerVo"/>
|
||||
<where>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="phone != null and phone != ''"> and phone like concat('%', #{phone}, '%')</if>
|
||||
</where>
|
||||
where del_flag = 0
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="phone != null and phone != ''"> and phone like concat('%', #{phone}, '%')</if>
|
||||
</select>
|
||||
|
||||
<select id="selectSysCustomerById" parameterType="Long" resultMap="SysCustomerResult">
|
||||
<include refid="selectSysCustomerVo"/>
|
||||
where id = #{id}
|
||||
where id = #{id} and del_flag = 0
|
||||
</select>
|
||||
|
||||
<insert id="insertSysCustomer" parameterType="SysCustomer" useGeneratedKeys="true" keyProperty="id">
|
||||
@ -167,21 +166,21 @@
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSysCustomerById" parameterType="Long">
|
||||
delete from sys_customer where id = #{id}
|
||||
</delete>
|
||||
<update id="deleteSysCustomerById" parameterType="Long">
|
||||
update sys_customer set del_flag = 1 where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSysCustomerByIds" parameterType="String">
|
||||
delete from sys_customer where id in
|
||||
<update id="deleteSysCustomerByIds" parameterType="String">
|
||||
update sys_customer set del_flag = 1 where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</update>
|
||||
|
||||
<!-- 根据手机号查询客户 -->
|
||||
<select id="getCustomerByPhone" parameterType="String" resultMap="SysCustomerResult">
|
||||
<include refid="selectSysCustomerVo"/>
|
||||
where phone = #{phone}
|
||||
where phone = #{phone} and del_flag = 0
|
||||
</select>
|
||||
|
||||
<sql id="selectSysCustomerAndSign">
|
||||
@ -190,7 +189,7 @@
|
||||
select sc.id, sc.name, sc.phone, sc.create_time, sc.create_by, sc.update_time, sc.update_by,
|
||||
<include refid="selectSysCustomerPhysicalSigns"></include>
|
||||
from sys_customer sc
|
||||
left join sys_customer_physical_signs scps on scps.customer_id = sc.id
|
||||
left join sys_customer_physical_signs scps on scps.customer_id = sc.id and scps.del_flag = 0
|
||||
</sql>
|
||||
|
||||
<sql id="selectSysCustomerPhysicalSigns">
|
||||
@ -201,12 +200,10 @@
|
||||
</sql>
|
||||
|
||||
<select id="selectSysCustomerAndSignList" parameterType="SysCustomer" resultMap="SysCustomerSignResult">
|
||||
<include refid="selectSysCustomerAndSign"/>
|
||||
<where>
|
||||
<if test="id != null"> and sc.id = #{id} </if>
|
||||
<if test="name != null and name != ''"> and sc.name like concat('%', #{name}, '%')</if>
|
||||
<if test="phone != null and phone != ''"> and sc.phone like concat('%', #{phone}, '%')</if>
|
||||
</where>
|
||||
<include refid="selectSysCustomerAndSign"/> where sc.del_flag = 0
|
||||
<if test="id != null"> and sc.id = #{id} </if>
|
||||
<if test="name != null and name != ''"> and sc.name like concat('%', #{name}, '%')</if>
|
||||
<if test="phone != null and phone != ''"> and sc.phone like concat('%', #{phone}, '%')</if>
|
||||
order by sc.create_time desc
|
||||
</select>
|
||||
|
||||
|
@ -38,50 +38,49 @@
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="comments" column="comments"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysCustomerPhysicalSignsVo">
|
||||
select id, customer_id, sex, age, tall, weight, physical_signs_id, dishes_ingredient_id, photo, constipation, stayLate, motion, make_food_type, make_food_taste, walk, difficulty, weakness, rebound, crux, position, sleep_time, getup_time, connect_time, remarks, blood_data, moisture_date, vocation,
|
||||
night, experience, create_time, create_by, update_time, update_by from sys_customer_physical_signs
|
||||
night, experience, comments, create_time, create_by, update_time, update_by from sys_customer_physical_signs
|
||||
</sql>
|
||||
|
||||
<select id="selectSysCustomerPhysicalSignsList" parameterType="SysCustomerPhysicalSigns" resultMap="SysCustomerPhysicalSignsResult">
|
||||
<include refid="selectSysCustomerPhysicalSignsVo"/>
|
||||
<where>
|
||||
<if test="customerId != null "> and customer_id = #{customerId}</if>
|
||||
<if test="sex != null "> and sex = #{sex}</if>
|
||||
<if test="age != null "> and age = #{age}</if>
|
||||
<if test="tall != null "> and tall = #{tall}</if>
|
||||
<if test="weight != null "> and weight = #{weight}</if>
|
||||
<if test="physicalSignsId != null and physicalSignsId != ''"> and physical_signs_id = #{physicalSignsId}</if>
|
||||
<if test="dishesIngredientId != null and dishesIngredientId != ''"> and dishes_ingredient_id = #{dishesIngredientId}</if>
|
||||
<if test="photo != null and photo != ''"> and photo = #{photo}</if>
|
||||
<if test="constipation != null "> and constipation = #{constipation}</if>
|
||||
<if test="staylate != null "> and stayLate = #{staylate}</if>
|
||||
<if test="motion != null "> and motion = #{motion}</if>
|
||||
<if test="makeFoodType != null "> and make_food_type = #{makeFoodType}</if>
|
||||
<if test="makeFoodTaste != null "> and make_food_taste = #{makeFoodTaste}</if>
|
||||
<if test="walk != null "> and walk = #{walk}</if>
|
||||
<if test="difficulty != null and difficulty != ''"> and difficulty = #{difficulty}</if>
|
||||
<if test="weakness != null "> and weakness = #{weakness}</if>
|
||||
<if test="rebound != null "> and rebound = #{rebound}</if>
|
||||
<if test="crux != null "> and crux = #{crux}</if>
|
||||
<if test="position != null "> and position = #{position}</if>
|
||||
<if test="sleepTime != null "> and sleep_time = #{sleepTime}</if>
|
||||
<if test="getupTime != null "> and getup_time = #{getupTime}</if>
|
||||
<if test="connectTime != null "> and connect_time = #{connectTime}</if>
|
||||
<if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
|
||||
<if test="bloodData != null and bloodData != ''"> and blood_data = #{bloodData}</if>
|
||||
<if test="moistureDate != null and moistureDate != ''"> and moisture_date = #{moistureDate}</if>
|
||||
<if test="vocation != null and vocation != ''"> and vocation = #{vocation}</if>
|
||||
<if test="night != null "> and night = #{night}</if>
|
||||
<if test="experience != null and experience != ''"> and experience = #{experience}</if>
|
||||
</where>
|
||||
<include refid="selectSysCustomerPhysicalSignsVo"/> where del_flag = 0
|
||||
<if test="customerId != null "> and customer_id = #{customerId}</if>
|
||||
<if test="sex != null "> and sex = #{sex}</if>
|
||||
<if test="age != null "> and age = #{age}</if>
|
||||
<if test="tall != null "> and tall = #{tall}</if>
|
||||
<if test="weight != null "> and weight = #{weight}</if>
|
||||
<if test="physicalSignsId != null and physicalSignsId != ''"> and physical_signs_id = #{physicalSignsId}</if>
|
||||
<if test="dishesIngredientId != null and dishesIngredientId != ''"> and dishes_ingredient_id = #{dishesIngredientId}</if>
|
||||
<if test="photo != null and photo != ''"> and photo = #{photo}</if>
|
||||
<if test="constipation != null "> and constipation = #{constipation}</if>
|
||||
<if test="staylate != null "> and stayLate = #{staylate}</if>
|
||||
<if test="motion != null "> and motion = #{motion}</if>
|
||||
<if test="makeFoodType != null "> and make_food_type = #{makeFoodType}</if>
|
||||
<if test="makeFoodTaste != null "> and make_food_taste = #{makeFoodTaste}</if>
|
||||
<if test="walk != null "> and walk = #{walk}</if>
|
||||
<if test="difficulty != null and difficulty != ''"> and difficulty = #{difficulty}</if>
|
||||
<if test="weakness != null "> and weakness = #{weakness}</if>
|
||||
<if test="rebound != null "> and rebound = #{rebound}</if>
|
||||
<if test="crux != null "> and crux = #{crux}</if>
|
||||
<if test="position != null "> and position = #{position}</if>
|
||||
<if test="sleepTime != null "> and sleep_time = #{sleepTime}</if>
|
||||
<if test="getupTime != null "> and getup_time = #{getupTime}</if>
|
||||
<if test="connectTime != null "> and connect_time = #{connectTime}</if>
|
||||
<if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
|
||||
<if test="bloodData != null and bloodData != ''"> and blood_data = #{bloodData}</if>
|
||||
<if test="moistureDate != null and moistureDate != ''"> and moisture_date = #{moistureDate}</if>
|
||||
<if test="vocation != null and vocation != ''"> and vocation = #{vocation}</if>
|
||||
<if test="night != null "> and night = #{night}</if>
|
||||
<if test="experience != null and experience != ''"> and experience = #{experience}</if>
|
||||
</select>
|
||||
|
||||
<select id="selectSysCustomerPhysicalSignsById" parameterType="Long" resultMap="SysCustomerPhysicalSignsResult">
|
||||
<include refid="selectSysCustomerPhysicalSignsVo"/>
|
||||
where id = #{id}
|
||||
where id = #{id} and del_flag = 0
|
||||
</select>
|
||||
|
||||
<insert id="insertSysCustomerPhysicalSigns" parameterType="SysCustomerPhysicalSigns" useGeneratedKeys="true" keyProperty="id">
|
||||
@ -113,10 +112,9 @@
|
||||
<if test="bloodData != null">blood_data,</if>
|
||||
<if test="moistureDate != null">moisture_date,</if>
|
||||
<if test="vocation != null">vocation,</if>
|
||||
<if test="
|
||||
night != null">
|
||||
night,</if>
|
||||
<if test="night != null">night,</if>
|
||||
<if test="experience != null">experience,</if>
|
||||
<if test="comments != null">comments,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
@ -151,6 +149,7 @@ night != null">
|
||||
<if test="vocation != null">#{vocation},</if>
|
||||
<if test="night != null">#{night},</if>
|
||||
<if test="experience != null">#{experience},</if>
|
||||
<if test="comments != null">#{comments},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
@ -189,6 +188,7 @@ night != null">
|
||||
<if test="vocation != null">vocation = #{vocation},</if>
|
||||
<if test="night != null">night = #{night},</if>
|
||||
<if test="experience != null">experience = #{experience},</if>
|
||||
<if test="comments != null">comments = #{comments},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
@ -197,16 +197,16 @@ night != null">
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSysCustomerPhysicalSignsById" parameterType="Long">
|
||||
delete from sys_customer_physical_signs where id = #{id}
|
||||
</delete>
|
||||
<update id="deleteSysCustomerPhysicalSignsById" parameterType="Long">
|
||||
update sys_customer_physical_signs set del_flag = 0 where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSysCustomerPhysicalSignsByIds" parameterType="String">
|
||||
delete from sys_customer_physical_signs where id in
|
||||
<update id="deleteSysCustomerPhysicalSignsByIds" parameterType="String">
|
||||
update sys_customer_physical_signs set del_flag = 0 where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</update>
|
||||
|
||||
<!-- 根据客户id更新体征信息 -->
|
||||
<update id="updateSysCustomerPhysicalSignsByCustomerId" parameterType="SysCustomerPhysicalSigns">
|
||||
@ -239,6 +239,7 @@ night != null">
|
||||
<if test="vocation != null">vocation = #{vocation},</if>
|
||||
<if test="night != null">night = #{night},</if>
|
||||
<if test="experience != null">experience = #{experience},</if>
|
||||
<if test="comments != null">comments = #{comments},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
@ -247,11 +248,11 @@ night != null">
|
||||
where customer_id = #{customerId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSysCustomerPhysicalSignsByCustomerIds" parameterType="String">
|
||||
delete from sys_customer_physical_signs where customer_id in
|
||||
<update id="deleteSysCustomerPhysicalSignsByCustomerIds" parameterType="String">
|
||||
update sys_customer_physical_signs set del_flag = 0 where customer_id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</update>
|
||||
|
||||
</mapper>
|
@ -36,19 +36,24 @@
|
||||
<result property="serveTimeId" column="serve_time_id"/>
|
||||
<result property="reviewStatus" column="review_status"/>
|
||||
<result property="giveServeDay" column="give_serve_day"/>
|
||||
<result property="conditioningProjectId" column="conditioning_project_id"/>
|
||||
<result property="serverEndTime" column="server_end_time"/>
|
||||
<result property="becomeFanTime" column="become_fan_time"/>
|
||||
<!-- 非持久化字段 -->
|
||||
<result property="afterSale" column="afterSale_name"></result><!-- 售后名称 -->
|
||||
<result property="nutritionist" column="nutritionist_name"></result><!-- 营养师名称 -->
|
||||
<result property="conditioningProject" column="conditioning_project"></result><!-- 调理项目 -->
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysOrderVo">
|
||||
select o.order_id, o.review_status, o.customer, o.phone, o.amount, o.start_time, o.pause_time, o.status, o.weight, ser.dict_label as serve_time,
|
||||
o.serve_time_id, o.pay_type_id, pay.dict_label as pay_type, o.pre_sale_id, o.create_by, o.create_time, o.after_sale_id, o.update_by, o.update_time,
|
||||
o.nutritionist_id, o.remark, o.nutri_assis_id, o.account_id, acc.dict_label as account, o.planner_id, o.planner_assis_id, o.operator_id, o.operator_assis_id,
|
||||
o.recommender, o.order_time,o.give_serve_day from sys_order o
|
||||
o.recommender, o.order_time,o.give_serve_day,o.conditioning_project_id,cp.dict_label as conditioning_project,o.server_end_time,o.become_fan_time from sys_order o
|
||||
LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'cus_pay_type') AS pay ON pay.dict_value = o.pay_type_id
|
||||
LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'cus_account') AS acc ON acc.dict_value = o.account_id
|
||||
LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'cus_serve_time') AS ser ON ser.dict_value = o.serve_time_id
|
||||
LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'conditioning_project') AS cp ON cp.dict_value = o.conditioning_project_id
|
||||
</sql>
|
||||
|
||||
<select id="selectAllOrderAmount" parameterType="SysOrder" resultType="BigDecimal">
|
||||
@ -138,6 +143,9 @@
|
||||
<if test="serveTimeId != null">serve_time_id,</if>
|
||||
<if test="reviewStatus != null">review_status,</if>
|
||||
<if test="giveServeDay != null">give_serve_day,</if>
|
||||
<if test="conditioningProjectId != null">conditioning_project_id,</if>
|
||||
<if test="serverEndTime != null">server_end_time,</if>
|
||||
<if test="becomeFanTime != null">become_fan_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="orderId != null and orderId != ''">#{orderId},</if>
|
||||
@ -168,6 +176,9 @@
|
||||
<if test="serveTimeId != null">#{serveTimeId},</if>
|
||||
<if test="reviewStatus != null">#{reviewStatus},</if>
|
||||
<if test="giveServeDay != null">#{giveServeDay},</if>
|
||||
<if test="conditioningProjectId != null">#{conditioningProjectId},</if>
|
||||
<if test="serverEndTime != null">#{serverEndTime},</if>
|
||||
<if test="becomeFanTime != null">#{becomeFanTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@ -201,6 +212,9 @@
|
||||
<if test="serveTimeId != null">serve_time_id = #{serveTimeId},</if>
|
||||
<if test="reviewStatus != null">review_status = #{reviewStatus},</if>
|
||||
<if test="giveServeDay != null">give_serve_day = #{giveServeDay},</if>
|
||||
<if test="conditioningProjectId != null">conditioning_project_id = #{conditioningProjectId},</if>
|
||||
<if test="serverEndTime != null">server_end_time = #{serverEndTime},</if>
|
||||
<if test="becomeFanTime != null">become_fan_time = #{becomeFanTime},</if>
|
||||
</trim>
|
||||
where order_id = #{orderId}
|
||||
</update>
|
||||
@ -248,6 +262,9 @@
|
||||
<result property="serveTimeId" column="serve_time_id"/>
|
||||
<result property="reviewStatus" column="review_status"/>
|
||||
<result property="giveServeDay" column="give_serve_day"/>
|
||||
<result property="conditioningProjectId" column="conditioning_project_id"/>
|
||||
<result property="serverEndTime" column="server_end_time"/>
|
||||
<result property="becomeFanTime" column="become_fan_time"/>
|
||||
<!-- 非持久化字段 -->
|
||||
<result property="afterSale" column="afterSale_name"></result><!-- 售后名称 -->
|
||||
<result property="nutritionist" column="nutritionist_name"></result><!-- 营养师名称 -->
|
||||
@ -275,11 +292,10 @@
|
||||
|
||||
<!-- 查询订单信息(用于计算提成) -->
|
||||
<select id="selectSimpleOrderMessage" resultMap="SysOrderResultExtended">
|
||||
select o.order_id,o.order_time,o.customer,o.review_status,o.amount,o.serve_time_id,o.give_serve_day,o.after_sale_id,su_sale.nick_name as afterSale_name,o.nutritionist_id,su_nutritionist.nick_name as nutritionist_name,sc.create_time as start_time
|
||||
select o.order_id,o.order_time,o.start_time,o.customer,o.review_status,o.amount,o.serve_time_id,o.give_serve_day,o.after_sale_id,su_sale.nick_name as afterSale_name,o.nutritionist_id,su_nutritionist.nick_name as nutritionist_name
|
||||
from sys_order o
|
||||
left join sys_user su_sale on su_sale.user_id = o.after_sale_id and su_sale.del_flag = 0
|
||||
left join sys_user su_nutritionist on su_nutritionist.user_id = o.nutritionist_id and su_nutritionist.del_flag = 0
|
||||
left join sys_customer sc on sc.phone = o.phone and sc.del_flag = 0
|
||||
where o.order_time >= '2021-01-01'
|
||||
<if test="userId != null">
|
||||
and (su_sale.user_id = #{userId} or su_nutritionist.user_id = #{userId})
|
||||
|
Reference in New Issue
Block a user