118 lines
		
	
	
		
			4.9 KiB
		
	
	
	
		
			XML
		
	
		
		
			
		
	
	
			118 lines
		
	
	
		
			4.9 KiB
		
	
	
	
		
			XML
		
	
|  | <?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.hcy.common.mapper.staff.StaffMapper"> | ||
|  |     <!-- 通用查询映射结果 --> | ||
|  |     <resultMap id="BaseResultMap" type="com.hcy.common.entity.staff.Staff"> | ||
|  |         <!-- <id column="id" property="id"/>
 | ||
|  |          <result column="create_id" property="createId"/> | ||
|  |          <result column="create_time" property="createTime"/> | ||
|  |          <result column="update_id" property="updateId"/> | ||
|  |          <result column="update_time" property="updateTime"/> | ||
|  |          <result column="company_id" property="companyId"/> | ||
|  |          <result column="account_id" property="accountId"/> | ||
|  |          <result column="account_chart_id" property="accountChartId"/> | ||
|  |          <result column="is_add_next_level" property="isAddNextLevel"/> | ||
|  |          <result column="is_reallocate" property="isReallocate"/> | ||
|  |          <result column="tenant_id" property="tenantId"/>--> | ||
|  |     </resultMap> | ||
|  | 
 | ||
|  |     <select id="page" resultType="com.hcy.common.dto.result.StaffResultDto"> | ||
|  |         select a.*, | ||
|  |                b.sn           as userSn, | ||
|  |                b.avatar       as avatarUri, | ||
|  |                b.nickname, | ||
|  |                b.username, | ||
|  |                b.mobile | ||
|  |         from la_staff a | ||
|  |                      left join la_user b on a.user_id = b.id | ||
|  |         <where> | ||
|  |             a.is_delete = 0 | ||
|  |             <if test="form.status != null"> | ||
|  |                 and a.status = #{form.status} | ||
|  |             </if> | ||
|  |             <if test="form.userInfo != null and form.userInfo != ''"> | ||
|  |                 and (b.nickname like concat('%', #{form.userInfo}, '%') or | ||
|  |                      b.mobile like concat('%', #{form.userInfo}, '%')) | ||
|  |             </if> | ||
|  |             <if test="form.staffInfo != null and form.staffInfo != ''"> | ||
|  |                 and (a.sn like concat('%', #{form.staffInfo}, '%') | ||
|  |                         or a.name like concat('%', #{form.staffInfo}, '%') | ||
|  |                         or a.mobile like concat('%', #{form.staffInfo}, '%')) | ||
|  |             </if> | ||
|  |             <if test="form.isRecommend != null"> | ||
|  |                 and a.is_recommend = #{form.isRecommend} | ||
|  |             </if> | ||
|  |             <if test="form.provinceId != null"> | ||
|  |                 and a.province_id = #{form.provinceId} | ||
|  |             </if> | ||
|  |             <if test="form.cityId != null"> | ||
|  |                 and a.city_id = #{form.cityId } | ||
|  |             </if> | ||
|  |             <if test="form.districtId != null"> | ||
|  |                 and a.district_id = #{form.districtId} | ||
|  |             </if> | ||
|  |             <if test="form.userInfo != null and form.userInfo != ''"> | ||
|  |                 and (b.nickname like concat('%', #{form.userInfo}, '%') or | ||
|  |                 b.mobile like concat('%', #{form.userInfo}, '%')) | ||
|  |             </if> | ||
|  |             <if test="form.isReceiveOrder != null"> | ||
|  |                 and a.is_receive_order = #{form.isReceiveOrder} | ||
|  |             </if> | ||
|  |             <if test="form.isOrder != null"> | ||
|  |                 and a.is_order = #{form.isOrder} | ||
|  |             </if> | ||
|  |             <if test="form.isReceiveOrder != null and form.isOrder != null"> | ||
|  |                 and ((a.id NOT IN ( | ||
|  |                 SELECT DISTINCT | ||
|  |                 staff_id | ||
|  |                 FROM | ||
|  |                 la_order | ||
|  |                 WHERE | ||
|  |                 is_delete = 0 | ||
|  |                 AND ( order_status = 1 OR order_status = 2 ) | ||
|  |                 AND is_dispatch = 1 | ||
|  |                 AND ( appoint_time_start > ${form.appointTimeStart} AND appoint_time_end < ${form.appointTimeEnd} )) or a.is_operational = 1) | ||
|  |                 or a.is_operational = 1) | ||
|  |             </if> | ||
|  |         </where> | ||
|  |         order by a.create_time desc | ||
|  |     </select> | ||
|  | 
 | ||
|  |     <select id="getReceiveOrderStaffByOrderId" resultType="com.hcy.common.entity.staff.Staff"> | ||
|  |         SELECT | ||
|  |             * | ||
|  |         FROM | ||
|  |             la_staff | ||
|  |         WHERE | ||
|  |             is_delete = 0 | ||
|  |           and FIND_IN_SET(( | ||
|  |               SELECT | ||
|  |                   gc.id | ||
|  |               FROM | ||
|  |                   la_order AS o | ||
|  |                       LEFT JOIN la_order_goods AS og ON o.id = og.order_id | ||
|  |                       LEFT JOIN la_goods AS g ON g.id = og.goods_id | ||
|  |                       LEFT JOIN la_goods_category AS gc ON gc.id = g.category_id | ||
|  |               WHERE | ||
|  |                   o.id = #{orderId} | ||
|  |           ), | ||
|  |           goods_category_ids) | ||
|  |     </select> | ||
|  | 
 | ||
|  |     <select id="getNotPhysicalExaminationStaff" resultType="com.hcy.common.entity.staff.Staff"> | ||
|  |         SELECT | ||
|  |             s.* | ||
|  |         FROM | ||
|  |             la_staff AS s | ||
|  |             LEFT JOIN la_staff_physical_examination AS spe ON spe.staff_id = s.id | ||
|  |         <where> | ||
|  |             s.is_delete = 0 | ||
|  |             AND (s.physical_examination is null or s.physical_examination = '') | ||
|  |             AND (spe.`status` != 0 or spe.`status` is null) | ||
|  |             <if test="keyword != null and keyword != ''"> | ||
|  |                 AND (s.name like CONCAT('%',#{keyword},'%') or s.sn like CONCAT('%',#{keyword},'%') or s.mobile like CONCAT('%',#{keyword},'%')) | ||
|  |             </if> | ||
|  |         </where> | ||
|  |     </select> | ||
|  | </mapper> |