From e971ea090aa1f320f3c3f78c3a2a8d50f16dd4d0 Mon Sep 17 00:00:00 2001
From: 935090232@qq.com <ak473600000>
Date: Fri, 15 Jan 2021 23:38:19 +0800
Subject: [PATCH] 小程序预约接口修改

---
 zq-erp/src/main/resources/mybatis/mapper/hive/SysProjServicesDao.xml |  109 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 109 insertions(+), 0 deletions(-)

diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjServicesDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjServicesDao.xml
index e608194..8092043 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjServicesDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjServicesDao.xml
@@ -458,4 +458,113 @@
 		</if>
 	</select>
 
+	<resultMap id="ServiceOrderListVoMap" type="com.matrix.system.app.vo.ServiceOrderListVo">
+		<id column="id" property="id" />
+		<result column="serviceNo" property="serviceNo"/>
+		<result property="time" column="time"/>
+		<result property="bed" column="bed" />
+		<result property="vipName" column="vipName" />
+		<result property="vipId" column="vipId" />
+		<result property="timeLength" column="timeLength" />
+		<result property="status" column="status" />
+		<result property="createStaffId" column="createStaffId" />
+		<result property="shopName" column="shop_short_name" />
+		<collection property="projs" ofType="com.matrix.system.app.vo.ServiceOrderListProjVo">
+			<result property="projName" column="projName" />
+			<result property="beautyName" column="beautyName" />
+			<result property="id" column="staffId" />
+		</collection>
+	</resultMap>
+
+
+	<select id="selectApiServiceOrderListInPage" resultMap="ServiceOrderListVoMap">
+		select
+		   a.id id,
+		   a.SERVICE_NO serviceNo,
+		   a.YY_TIME time,
+		   a.TOTAL_TIME timeLength,
+		   a.state status,
+		   a.create_staff_id createStaffId,
+		   d.BED_NAME bed,
+		   e.VIP_NAME vipName,
+		   e.id vipId,
+		   b.staff_id staffId,
+		   f.su_name beautyName,
+		   g.proj_name projName,
+		   h.shop_short_name
+		from sys_proj_services a
+		left join sys_beautician_state b on a.ID=b.SERVICES_ID
+		left join sys_bed_state c on a.ID = c.SERVICE_ID
+		left join sys_bed_info d on c.BED_ID=d.ID
+		left join sys_vip_info e on a.VIP_ID=e.ID
+		left join sys_users f on f.su_id=b.STAFF_ID
+		left join sys_proj_use g on b.puse_id=g.ID
+		left join sys_shop_info h on a.SHOP_ID=h.ID
+		<where>
+			<if test="record.queryKey != null and record.queryKey != ''">
+				and (instr(a.SERVICE_NO, #{record.queryKey}) or instr(e.phone, #{record.queryKey}) or instr(e.vip_name, #{record.queryKey}) )
+			</if>
+			<if test="record.vipId != null and record.vipId != ''">
+				and a.vip_id = #{record.vipId}
+			</if>
+			<if test="record.status != null and record.status != ''">
+				and a.state = #{record.status}
+			 </if>
+			<if test="record.shopId != null">
+				and a.shop_id=#{record.shopId}
+			</if>
+			<if test="record.userId!=null">
+				and (a.create_staff_id=#{record.userId} or b.staff_id=#{record.userId})
+			</if>
+			<if test="record.vipStatus != null and record.vipStatus != '' and record.vipStatus!=0 ">
+				<if test="record.vipStatus == 1">
+					and a.state = '待确认'
+				</if>
+				<if test="record.vipStatus == 2">
+					and a.state in ( '预约成功待处理' ,'需配料','配料完成','服务中')
+				</if>
+				<if test="record.vipStatus == 3">
+					and ( a.state in ( '服务完成' ,'服务单结束') and a.comment is  null)
+				</if>
+				<if test="record.vipStatus == 4">
+					and a.comment is not null
+				</if>
+				<if test="record.vipStatus == 5">
+					and a.state = '预约取消'
+				</if>
+			</if>
+		</where>
+		<if test="pageVo !=null"><!-- 判断pageVo对象是否为空 -->
+			order by a.yy_time desc
+			<if test="pageVo.offset >=0  and pageVo.limit >0">
+				limit
+				#{pageVo.offset},#{pageVo.limit}
+			</if>
+		</if>
+	</select>
+
+	<select id="selectApiServiceOrderListTotal" resultType="java.lang.Integer">
+		select count(1)
+		from sys_proj_services a
+		left join sys_beautician_state b on a.ID=b.SERVICES_ID
+		left join sys_bed_state c on a.ID = c.SERVICE_ID
+		left join sys_bed_info d on c.BED_ID=d.ID
+		left join sys_vip_info e on a.VIP_ID=e.ID
+		left join sys_users f on f.su_id=b.STAFF_ID
+		left join sys_proj_use g on b.puse_id=g.ID
+		<where>
+			<if test="record.queryKey != null and record.queryKey != ''">
+				and (instr(a.SERVICE_NO, #{record.queryKey}) or instr(e.phone, #{record.queryKey}) or instr(e.vip_name, #{record.queryKey}) )
+			</if>
+			<if test="record.status != null and record.status != ''">
+				and a.state = #{record.status}
+			</if>
+			<if test="record.shopId != null">
+				and a.shop_id=#{record.shopId}
+			</if>
+			<if test="record.userId!=null">
+				and (a.create_staff_id=#{record.userId} or b.staff_id=#{record.userId})
+			</if>
+		</where>
+	</select>
 </mapper>

--
Gitblit v1.9.1