姜友瑶
2022-05-05 c41e8d372cdabbe1fd5973c9322e38a40bfa1a39
zq-erp/src/main/resources/mybatis/mapper/hive/SysFollowupDao.xml
@@ -2,9 +2,9 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.matrix.system.hive.dao.SysFollowupDao" >
<mapper namespace="com.matrix.beauty.followup.dao.SysFollowupDao" >
   <!-- 定义SysFollowup 的复杂关联map -->
   <resultMap type="com.matrix.system.hive.bean.SysFollowup" id="SysFollowupMap">
   <resultMap type="com.matrix.beauty.followup.entry.SysFollowup" id="SysFollowupMap">
      <id property="id" column="id" />
      <result property="createBy" column="create_by" />
      <result property="createTime" column="create_time" />
@@ -22,6 +22,10 @@
         <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>
@@ -32,11 +36,11 @@
   </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不添加其他的关联属性 -->
   <resultMap type="com.matrix.system.hive.bean.SysFollowup" id="SysFollowupSimpleMap">
   <resultMap type="com.matrix.beauty.followup.entry.SysFollowup" id="SysFollowupSimpleMap">
      <id property="id" column="id" />
      <result property="createBy" column="create_by" />
      <result property="createTime" column="create_time" />
@@ -138,9 +142,9 @@
      </if>
       
   </sql>
   <!--  插入方法   -->
   <insert id="insert" parameterType="com.matrix.system.hive.bean.SysFollowup"
   <insert id="insert" parameterType="com.matrix.beauty.followup.entry.SysFollowup"
      useGeneratedKeys="true" keyProperty="item.id">
      INSERT INTO sys_followup (
          <include refid="columns"></include>
@@ -271,7 +275,7 @@
   </delete>
   
   <!-- 根据对象删除-->
   <delete id="deleteByModel" parameterType="com.matrix.system.hive.bean.SysFollowup">
   <delete id="deleteByModel" parameterType="com.matrix.beauty.followup.entry.SysFollowup">
      DELETE FROM sys_followup
      <where>
      <include refid="where_sql" ></include>
@@ -341,32 +345,38 @@
   <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}
@@ -374,7 +384,7 @@
         </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}
@@ -385,11 +395,29 @@
      </where>
      order by a.create_time desc
        limit ${offset},${limit}
   </select>
<select id="findVipFollowuByPage" resultMap="SysFollowupMap">
      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 a.company_id=#{companyId}
         and (visible=1 or ( visible!=1 and a.staff_id=#{selfStaff}))
         <if test="vipId!=null">
            and   a.vip_id = #{vipId}
         </if>
      </where>
      order by a.create_time desc
        limit ${offset},${limit}
   </select>
</mapper>