|  |  |  | 
|---|
|  |  |  | <result property="orderAbstract" column="order_abstract" /> | 
|---|
|  |  |  | <result property="zans" column="zans" /> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <result property="staffPhoto" column="staffPhoto" /> | 
|---|
|  |  |  | <result property="staffName" column="staffName" /> | 
|---|
|  |  |  | <result property="vipName" column="vipName" /> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <collection property="albums" column="{sourceId=id}" select="com.matrix.system.hive.dao.SysVipAlbumDao.selectBySourceId"  /> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <collection property="followupComments" column="{follId=id}"  select="com.matrix.system.hive.dao.SysFollowupCommentDao.selectByfollId" ></collection> | 
|---|
|  |  |  | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="selectUserByZaqns" resultMap="com.matrix.system.common.dao.SysUsersDao.SysUsersMap" > | 
|---|
|  |  |  | select su_id,su_name from sys_users where  FIND_IN_SET(#{zans}, su_id) | 
|---|
|  |  |  | select su_id,su_name from sys_users where  FIND_IN_SET(su_id,#{zans}) | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!-- 定义SysFollowup 的简单map  ,本map不添加其他的关联属性 --> | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="selectByAppDto" resultMap="SysFollowupMap"> | 
|---|
|  |  |  | select * from sys_followup | 
|---|
|  |  |  | select a.*, | 
|---|
|  |  |  | b.su_photo as staffPhoto, | 
|---|
|  |  |  | b.su_name as staffName, | 
|---|
|  |  |  | c.vip_name as vipName | 
|---|
|  |  |  | from sys_followup  a | 
|---|
|  |  |  | left join  sys_users b on a.staff_id= b.su_id | 
|---|
|  |  |  | left join  sys_vip_info c on a.vip_id=c.id | 
|---|
|  |  |  | <where> | 
|---|
|  |  |  | and company_id=#{companyId} | 
|---|
|  |  |  | and a.company_id=#{companyId} | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <if test="shopId != null "> | 
|---|
|  |  |  | and shop_id=#{shopId} | 
|---|
|  |  |  | and a.shop_id=#{shopId} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="queryType == 1 "> | 
|---|
|  |  |  | and (visible=1 or ( visible!=1 and staff_id=#{selfStaff})) | 
|---|
|  |  |  | and (visible=1 or ( visible!=1 and a.staff_id=#{selfStaff})) | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="queryType == 2 "> | 
|---|
|  |  |  | and staff_id=#{selfStaff} | 
|---|
|  |  |  | and a.staff_id=#{selfStaff} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="queryType == 3 "> | 
|---|
|  |  |  | and( visible=1 and staff_id!=#{selfStaff}) | 
|---|
|  |  |  | and( visible=1 and a.staff_id!=#{selfStaff}) | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <if test="startTime != null "> | 
|---|
|  |  |  | and create_time <![CDATA[ >= ]]> #{startTime} | 
|---|
|  |  |  | and a.create_time <![CDATA[ >= ]]> #{startTime} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="endTime != null "> | 
|---|
|  |  |  | and create_time <![CDATA[ <= ]]> #{endTime} | 
|---|
|  |  |  | and a.create_time <![CDATA[ <= ]]> #{endTime} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <if test="vipIds!=null and vipIds.size()!=0"> | 
|---|
|  |  |  | and   vip_id in | 
|---|
|  |  |  | and   a.vip_id in | 
|---|
|  |  |  | <foreach collection="vipIds" index="index" item="item" open="(" | 
|---|
|  |  |  | separator="," close=")"> | 
|---|
|  |  |  | #{item} | 
|---|
|  |  |  | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <if test="staffIds!=null and staffIds.size()!=0"> | 
|---|
|  |  |  | and   staff_id in | 
|---|
|  |  |  | and   a.staff_id in | 
|---|
|  |  |  | <foreach collection="staffIds" index="index" item="item" open="(" | 
|---|
|  |  |  | separator="," close=")"> | 
|---|
|  |  |  | #{item} | 
|---|
|  |  |  | 
|---|
|  |  |  | </where> | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | order by a.create_time desc | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | limit ${offset},${limit} | 
|---|