From 95f9ea7eb339c36cade6c67d0385c49ec2d81477 Mon Sep 17 00:00:00 2001
From: 935090232@qq.com <ak473600000>
Date: Wed, 14 Apr 2021 19:39:45 +0800
Subject: [PATCH] Merge branch 'score_shop' into api_score_meger

---
 zq-erp/src/main/resources/mybatis/mapper/fenxiao/ShopSalesmanOrderDao.xml |  174 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 174 insertions(+), 0 deletions(-)

diff --git a/zq-erp/src/main/resources/mybatis/mapper/fenxiao/ShopSalesmanOrderDao.xml b/zq-erp/src/main/resources/mybatis/mapper/fenxiao/ShopSalesmanOrderDao.xml
new file mode 100644
index 0000000..a594e68
--- /dev/null
+++ b/zq-erp/src/main/resources/mybatis/mapper/fenxiao/ShopSalesmanOrderDao.xml
@@ -0,0 +1,174 @@
+<?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.matrix.system.fenxiao.dao.ShopSalesmanOrderDao">
+	<!-- 定义ShopSalesmanOrder 的复杂关联map -->
+	<resultMap type="com.matrix.system.fenxiao.entity.ShopSalesmanOrder" id="ShopSalesmanOrderMap">
+		<id property="id" column="id" />
+		<result property="createBy" column="create_by" />
+		<result property="createTime" column="create_time" />
+		<result property="updateBy" column="update_by" />
+		<result property="updateTime" column="update_time" />
+			<result property="orderId " column="order_id " />
+			<result property="userId" column="user_id" />
+			<result property="salesUserId" column="sales_user_id" />
+			<result property="revenueType" column="revenue_type" />
+			<result property="amount" column="amount" />
+			<result property="orderStatus" column="order_status" />
+			<result property="settlementId" column="settlement_id" />
+			<result property="companyId" column="company_id" />
+	</resultMap>
+	
+	
+	<!-- 定义ShopSalesmanOrder 的简单map  ,本map不添加其他的关联属性 -->
+	<resultMap type="com.matrix.system.fenxiao.entity.ShopSalesmanOrder" id="ShopSalesmanOrderSimpleMap">
+		<id property="id" column="id" />
+		<result property="createBy" column="create_by" />
+		<result property="createTime" column="create_time" />
+		<result property="updateBy" column="update_by" />
+		<result property="updateTime" column="update_time" />
+			<result property="orderId " column="order_id " />
+			<result property="userId" column="user_id" />
+			<result property="salesUserId" column="sales_user_id" />
+			<result property="revenueType" column="revenue_type" />
+			<result property="amount" column="amount" />
+			<result property="orderStatus" column="order_status" />
+			<result property="settlementId" column="settlement_id" />
+			<result property="companyId" column="company_id" />
+	</resultMap>
+
+    <select id="selectSalesManOrder" resultType="com.matrix.system.shopXcx.vo.SalesOrderVo">
+		select
+			a.order_id,
+			a.create_time,
+			a.amount,
+			a.revenue_type,
+			a.order_status,
+			b.nick_name,
+			b.avatar_url,
+			c.order_no,
+			c.order_money
+		from shop_salesman_order a
+				 left join sys_vip_info b on b.id=a.user_id
+				 left join shop_order c on a.order_id=c.id
+		where
+			a.sales_user_id=#{record.userId}
+			and	a.revenue_type=#{record.revenueType}
+		<if test="record.orderStatus!=null" >
+			and a.order_status=#{record.orderStatus}
+		</if>
+		<if test="record.sort!=null and record.order!=null" >
+		order by ${record.sort} ${record.order}
+		</if>
+
+	</select>
+
+	<select id="selectFenxiaoOrderBasicByCompanyId" resultType="com.matrix.system.fenxiao.vo.LoadFenxiaoOrderBasicVo">
+		SELECT
+			COUNT(*) num,
+			(SELECT IFNULL(sum(IFNULL(amount, 0)), 0)
+				FROM shop_salesman_order
+				WHERE order_status = 1 and company_id=#{companyId}) balance,
+			(SELECT COUNT(*) FROM
+					(SELECT DISTINCT user_id
+						FROM shop_salesman_order
+						WHERE order_status = 1 and company_id=#{companyId} ) a) waitNum,
+			(SELECT COUNT(*)
+				FROM shop_salesman_order
+				WHERE order_status = 1 and company_id=#{companyId}) waitOrderNum
+		FROM
+			shop_salesman_order
+		where company_id=#{companyId}
+	</select>
+
+	<select id="findFenxiaoOrderList" resultType="com.matrix.system.fenxiao.vo.LoadFenxiaoOrderListVo">
+		SELECT
+		a.id id,
+		d.order_no,
+		d.order_money actualBalance,
+		f.shop_name address,
+		d.order_status orderState,
+		b.nick_name custom,
+		b.id customUserId,
+		e.nick_name parentSale,
+		a.revenue_type profitType,
+		a.amount profitBalance,
+		a.order_status settleType,
+		c.order_no settleNo,
+		c.create_time settleTime,
+		g.su_name settler
+		FROM
+		shop_salesman_order a
+		LEFT JOIN sys_vip_info b on a.user_id = b.id
+		LEFT JOIN shop_saleman_settlement c on a.settlement_id = c.id
+		LEFT JOIN shop_order d on d.id = a.order_id
+		LEFT JOIN sys_vip_info e on a.sales_user_id = e.id
+		LEFT JOIN sys_shop_info f on f.id = d.store_id
+		LEFT JOIN sys_users g on c.user_id = g.su_id
+		<where>
+			a.company_id = #{record.companyId}
+			<if test="record.userName != null and record.userName != ''">
+				and b.nick_name like concat('%',#{record.userName},'%')
+			</if>
+			<if test="record.ddType != null and record.ddType != ''">
+				and d.order_status = #{record.ddType}
+			</if>
+			<if test="record.startTime != null ">
+				and a.create_time >= #{record.startTime}
+			</if>
+			<if test="record.endTime != null">
+				and  #{record.endTime} >= a.create_time
+			</if>
+			<if test="record.tgy != null and record.tgy != ''">
+				and e.nick_name like concat('%',#{record.tgy},'%')
+			</if>
+			<if test="record.orderType != null and record.orderType != ''">
+				and a.order_status = #{record.orderType}
+			</if>
+			<if test="record.jsbh != null and record.jsbh != ''">
+				and c.order_no = #{record.jsbh}
+			</if>
+			<if test="record.ddh != null and record.ddh != ''">
+				and d.order_no = #{record.ddh}
+			</if>
+		</where>
+		<if test="record.sort !=null">
+			order by
+			a.${record.sort} ${record.order}
+		</if>
+	</select>
+
+	<select id="findSetOrderList" resultType="com.matrix.system.fenxiao.vo.LoadSetOrderListDtoVo">
+		select
+		a.id id,
+		a.order_no orderNo,
+		a.amount actualBalance,
+		a.order_count setNum,
+		a.man_count setManNum,
+		a.create_time setTime,
+		b.su_name setMan,
+		a.settlement_way settlementWay,
+		a.remark remark
+		from
+		shop_saleman_settlement a
+		left join sys_users b on a.user_id = b.su_id
+		<where>
+			a.company_id = #{record.companyId}
+			<if test="record.userName != null and record.userName != ''">
+				and b.su_name like concat('%',#{record.userName},'%')
+			</if>
+			<if test="record.startTime != null ">
+				and a.create_time >= #{record.startTime}
+			</if>
+			<if test="record.endTime != null">
+				and  #{record.endTime} >= a.create_time
+			</if>
+		</where>
+		<if test="record.sort !=null">
+			order by
+			a.${record.sort} ${record.order}
+		</if>
+	</select>
+
+</mapper>
\ No newline at end of file

--
Gitblit v1.9.1