69 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			XML
		
	
		
		
			
		
	
	
			69 lines
		
	
	
		
			2.8 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.StaffReassignmentMapper"> | ||
|  |     <!-- 通用查询映射结果 --> | ||
|  |     <resultMap id="BaseResultMap" type="com.hcy.common.entity.staff.StaffReassignment"> | ||
|  |     </resultMap> | ||
|  | 
 | ||
|  |     <select id="list" resultType="com.hcy.common.dto.result.StaffReassignmentResultDto"> | ||
|  |         SELECT | ||
|  |             sr.*, | ||
|  |             o.sn, | ||
|  |             og.goods_name as goodsName, | ||
|  |             s.sn as staffSn, | ||
|  |             s.name as staffName, | ||
|  |             s.head_portrait as headPortrait | ||
|  |         FROM | ||
|  |             la_staff_reassignment AS sr | ||
|  |             LEFT JOIN la_order as o ON o.id = sr.order_id | ||
|  |             LEFT JOIN la_order_goods AS og ON og.order_id = o.id | ||
|  |             LEFT JOIN la_staff AS s ON s.id = sr.staff_id | ||
|  |             LEFT JOIN la_user as u ON u.id = sr.user_id | ||
|  |         <where> | ||
|  |             sr.is_delete = 0 | ||
|  |             <if test="form.orderSn != null and form.orderSn != ''"> | ||
|  |                 AND o.sn = #{form.orderSn} | ||
|  |             </if> | ||
|  |             <if test="form.userMobile != null and form.userMobile != ''"> | ||
|  |                 AND u.mobile = #{form.userMobile} | ||
|  |             </if> | ||
|  |             <if test="form.goodsName != null and form.goodsName != ''"> | ||
|  |                 AND og.goods_name like concat('%', #{form.goodsName}, '%') | ||
|  |             </if> | ||
|  |             <if test="form.staffInfo != null and form.staffInfo != ''"> | ||
|  |                 AND s.sn like concat('%', #{form.staffInfo}, '%') or s.name like concat('%',#{form.staffInfo},'%') | ||
|  |             </if> | ||
|  |             <if test="form.createTimeStart != null and form.createTimeStart != ''"> | ||
|  |                 AND sr.create_time >= #{form.createTimeStart} | ||
|  |             </if> | ||
|  |             <if test="form.createTimeEnd != null and form.createTimeEnd != ''"> | ||
|  |                 AND sr.create_time <= #{form.createTimeEnd} | ||
|  |             </if> | ||
|  |             <if test="form.status != null"> | ||
|  |                 AND sr.status = #{form.status} | ||
|  |             </if> | ||
|  |         </where> | ||
|  |         order by sr.create_time desc | ||
|  |     </select> | ||
|  | 
 | ||
|  |     <select id="getStaffReassignmentByStaffId" resultType="com.hcy.common.dto.result.StaffReassignmentResultDto"> | ||
|  |         SELECT | ||
|  |             sr.*, | ||
|  |             o.sn | ||
|  |         FROM | ||
|  |             la_staff_reassignment AS sr | ||
|  |             LEFT JOIN la_order as o ON o.id = sr.order_id | ||
|  |             LEFT JOIN la_staff AS s ON s.id = sr.staff_id | ||
|  |         <where> | ||
|  |             sr.is_delete = 0 | ||
|  |             <if test="form.staffId != null"> | ||
|  |                 AND sr.staff_id = ${form.staffId} | ||
|  |             </if> | ||
|  |             <if test="form.date != null and form.date != ''"> | ||
|  |                 AND DATE_FORMAT( sr.create_time, '%Y-%m' ) = #{form.date} | ||
|  |             </if> | ||
|  |         </where> | ||
|  |         order by sr.status asc,sr.create_time desc | ||
|  |     </select> | ||
|  | </mapper> |