Helius
2020-12-27 c0691d2302bbaed2a47b2b703b83ed5bc204e397
zq-erp/src/main/resources/mybatis/mapper/hive/SysProjServicesDao.xml
@@ -458,4 +458,87 @@
      </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="timeLength" column="timeLength" />
      <result property="status" column="status" />
      <result property="staffId" column="staffId" />
      <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,
         d.BED_NAME bed,
         e.VIP_NAME vipName,
         a.create_staff_id staffId,
         f.su_name beautyName,
         g.proj_name projName
      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>
      <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>