New file |
| | |
| | | <?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.matrix.system.hive.dao.SysFollowupDao" > |
| | | <!-- 定义SysFollowup 的复杂关联map --> |
| | | <resultMap type="com.matrix.system.hive.bean.SysFollowup" id="SysFollowupMap"> |
| | | <id property="id" column="id" /> |
| | | <result property="createBy" column="create_by" /> |
| | | <result property="createTime" column="create_time" /> |
| | | <result property="updateBy" column="update_by" /> |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="staffId" column="staff_id" /> |
| | | <result property="vipId" column="vip_id" /> |
| | | <result property="orderId" column="order_id" /> |
| | | <result property="serviceId" column="service_id" /> |
| | | <result property="shopId" column="shop_id" /> |
| | | <result property="companyId" column="company_id" /> |
| | | <result property="nextNotifyTime" column="next_notify_time" /> |
| | | <result property="content" column="content" /> |
| | | <result property="visible" column="visible" /> |
| | | <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> |
| | | |
| | | <collection property="zanUsers" column="{zans=zans}" select="selectUserByZaqns" ></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(su_id,#{zans}) |
| | | </select> |
| | | |
| | | <!-- 定义SysFollowup 的简单map ,本map不添加其他的关联属性 --> |
| | | <resultMap type="com.matrix.system.hive.bean.SysFollowup" id="SysFollowupSimpleMap"> |
| | | <id property="id" column="id" /> |
| | | <result property="createBy" column="create_by" /> |
| | | <result property="createTime" column="create_time" /> |
| | | <result property="updateBy" column="update_by" /> |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="staffId" column="staff_id" /> |
| | | <result property="vipId" column="vip_id" /> |
| | | <result property="orderId" column="order_id" /> |
| | | <result property="serviceId" column="service_id" /> |
| | | <result property="shopId" column="shop_id" /> |
| | | <result property="companyId" column="company_id" /> |
| | | <result property="nextNotifyTime" column="next_notify_time" /> |
| | | <result property="content" column="content" /> |
| | | <result property="visible" column="visible" /> |
| | | <result property="orderAbstract" column="order_abstract" /> |
| | | <result property="zans" column="zans" /> |
| | | </resultMap> |
| | | |
| | | <!-- 字段sql --> |
| | | <sql id="columns"> |
| | | create_by, |
| | | create_time, |
| | | update_by, |
| | | update_time, |
| | | id, |
| | | staff_id, |
| | | vip_id, |
| | | order_id, |
| | | service_id, |
| | | shop_id, |
| | | company_id, |
| | | next_notify_time, |
| | | content, |
| | | visible, |
| | | order_abstract, |
| | | zans |
| | | </sql> |
| | | |
| | | <!-- 属性sql --> |
| | | <sql id="propertys"> |
| | | #{item.createBy}, |
| | | now(), |
| | | #{item.updateBy}, |
| | | now(), |
| | | #{item.id}, |
| | | #{item.staffId}, |
| | | #{item.vipId}, |
| | | #{item.orderId}, |
| | | #{item.serviceId}, |
| | | #{item.shopId}, |
| | | #{item.companyId}, |
| | | #{item.nextNotifyTime}, |
| | | #{item.content}, |
| | | #{item.visible}, |
| | | #{item.orderAbstract}, |
| | | #{item.zans} |
| | | </sql> |
| | | |
| | | <!-- where sql --> |
| | | <sql id="where_sql"> |
| | | |
| | | <if test="record!=null"> |
| | | <if test="(record.id!=null and record.id!='') or (record.id!='' and record.id==0) "> |
| | | and id = #{record.id} |
| | | </if> |
| | | <if test="(record.staffId!=null and record.staffId!='') or (record.staffId!='' and record.staffId==0) "> |
| | | and staff_id = #{record.staffId} |
| | | </if> |
| | | <if test="(record.vipId!=null and record.vipId!='') or (record.vipId!='' and record.vipId==0) "> |
| | | and vip_id = #{record.vipId} |
| | | </if> |
| | | <if test="(record.orderId!=null and record.orderId!='') or (record.orderId!='' and record.orderId==0) "> |
| | | and order_id = #{record.orderId} |
| | | </if> |
| | | <if test="(record.serviceId!=null and record.serviceId!='') or (record.serviceId!='' and record.serviceId==0) "> |
| | | and service_id = #{record.serviceId} |
| | | </if> |
| | | <if test="(record.shopId!=null and record.shopId!='') or (record.shopId!='' and record.shopId==0) "> |
| | | and shop_id = #{record.shopId} |
| | | </if> |
| | | <if test="(record.companyId!=null and record.companyId!='') or (record.companyId!='' and record.companyId==0) "> |
| | | and company_id = #{record.companyId} |
| | | </if> |
| | | <if test="(record.nextNotifyTime!=null and record.nextNotifyTime!='') or (record.nextNotifyTime!='' and record.nextNotifyTime==0) "> |
| | | and next_notify_time = #{record.nextNotifyTime} |
| | | </if> |
| | | <if test="(record.content!=null and record.content!='') or (record.content!='' and record.content==0) "> |
| | | and content = #{record.content} |
| | | </if> |
| | | <if test="(record.visible!=null and record.visible!='') or (record.visible!='' and record.visible==0) "> |
| | | and visible = #{record.visible} |
| | | </if> |
| | | <if test="(record.orderAbstract!=null and record.orderAbstract!='') or (record.orderAbstract!='' and record.orderAbstract==0) "> |
| | | and order_abstract = #{record.orderAbstract} |
| | | </if> |
| | | <if test="(record.zans!=null and record.zans!='') or (record.zans!='' and record.zans==0) "> |
| | | and zans = #{record.zans} |
| | | </if> |
| | | </if> |
| | | |
| | | </sql> |
| | | |
| | | <!-- 插入方法 --> |
| | | <insert id="insert" parameterType="com.matrix.system.hive.bean.SysFollowup" |
| | | useGeneratedKeys="true" keyProperty="item.id"> |
| | | INSERT INTO sys_followup ( |
| | | <include refid="columns"></include> |
| | | ) |
| | | VALUES ( |
| | | <include refid="propertys"></include> |
| | | ) |
| | | </insert> |
| | | |
| | | |
| | | |
| | | <!-- 批量插入 --> |
| | | <insert id="batchInsert" parameterType="java.util.List"> |
| | | INSERT INTO sys_followup ( |
| | | <include refid="columns"></include> |
| | | ) |
| | | VALUES |
| | | <foreach collection="list" item="item" index="index" separator=",">( |
| | | <include refid="propertys"></include> |
| | | )</foreach> |
| | | </insert> |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | <!-- 根据Map更新 部分更新 --> |
| | | <update id="updateByMap" parameterType="java.util.HashMap" > |
| | | UPDATE sys_followup |
| | | <set> |
| | | <if test="_parameter.containsKey('staffId')"> |
| | | staff_id = #{staffId}, |
| | | </if> |
| | | <if test="_parameter.containsKey('vipId')"> |
| | | vip_id = #{vipId}, |
| | | </if> |
| | | <if test="_parameter.containsKey('orderId')"> |
| | | order_id = #{orderId}, |
| | | </if> |
| | | <if test="_parameter.containsKey('serviceId')"> |
| | | service_id = #{serviceId}, |
| | | </if> |
| | | <if test="_parameter.containsKey('shopId')"> |
| | | shop_id = #{shopId}, |
| | | </if> |
| | | <if test="_parameter.containsKey('companyId')"> |
| | | company_id = #{companyId}, |
| | | </if> |
| | | <if test="_parameter.containsKey('nextNotifyTime')"> |
| | | next_notify_time = #{nextNotifyTime}, |
| | | </if> |
| | | <if test="_parameter.containsKey('content')"> |
| | | content = #{content}, |
| | | </if> |
| | | <if test="_parameter.containsKey('visible')"> |
| | | visible = #{visible}, |
| | | </if> |
| | | <if test="_parameter.containsKey('orderAbstract')"> |
| | | order_abstract = #{orderAbstract}, |
| | | </if> |
| | | <if test="_parameter.containsKey('zans')"> |
| | | zans = #{zans}, |
| | | </if> |
| | | </set> |
| | | WHERE id=#{id} |
| | | </update> |
| | | |
| | | |
| | | <!-- 根据对象更新 部分更新 --> |
| | | <update id="updateByModel" parameterType="Integer"> |
| | | UPDATE sys_followup |
| | | <set> |
| | | <if test="record.staffId != null "> |
| | | staff_id = #{record.staffId}, |
| | | </if> |
| | | <if test="record.vipId != null "> |
| | | vip_id = #{record.vipId}, |
| | | </if> |
| | | <if test="record.orderId != null "> |
| | | order_id = #{record.orderId}, |
| | | </if> |
| | | <if test="record.serviceId != null "> |
| | | service_id = #{record.serviceId}, |
| | | </if> |
| | | <if test="record.shopId != null "> |
| | | shop_id = #{record.shopId}, |
| | | </if> |
| | | <if test="record.companyId != null "> |
| | | company_id = #{record.companyId}, |
| | | </if> |
| | | <if test="record.nextNotifyTime != null "> |
| | | next_notify_time = #{record.nextNotifyTime}, |
| | | </if> |
| | | <if test="record.content != null and record.content != '' "> |
| | | content = #{record.content}, |
| | | </if> |
| | | <if test="record.visible != null "> |
| | | visible = #{record.visible}, |
| | | </if> |
| | | <if test="record.orderAbstract != null and record.orderAbstract != '' "> |
| | | order_abstract = #{record.orderAbstract}, |
| | | </if> |
| | | <if test="record.zans != null and record.zans != '' "> |
| | | zans = #{record.zans}, |
| | | </if> |
| | | </set> |
| | | WHERE id=#{record.id} |
| | | </update> |
| | | |
| | | <!-- 更新点赞人数 --> |
| | | <update id="updateZan"> |
| | | update sys_followup set zans=#{zans} where id=#{id} |
| | | </update> |
| | | |
| | | <!-- 批量删除 --> |
| | | <delete id="deleteByIds" parameterType="java.util.List"> |
| | | delete from sys_followup where id in |
| | | <foreach collection="list" index="index" item="item" open="(" |
| | | separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <!-- 根据id删除--> |
| | | <delete id="deleteById" parameterType="Integer"> |
| | | DELETE FROM sys_followup |
| | | where id=#{id} |
| | | </delete> |
| | | |
| | | <!-- 根据对象删除--> |
| | | <delete id="deleteByModel" parameterType="com.matrix.system.hive.bean.SysFollowup"> |
| | | DELETE FROM sys_followup |
| | | <where> |
| | | <include refid="where_sql" ></include> |
| | | </where> |
| | | </delete> |
| | | |
| | | |
| | | |
| | | <!-- 分页查询 --> |
| | | <select id="selectInPage" resultMap="SysFollowupMap"> |
| | | select |
| | | <include refid="columns" ></include> |
| | | from sys_followup |
| | | <where> |
| | | <include refid="where_sql"></include> |
| | | </where> |
| | | <if test="pageVo !=null"><!-- 判断pageVo对象是否为空 --> |
| | | <if test="pageVo.sort !=null and pageVo.order !=null"> |
| | | order by |
| | | ${pageVo.sort} ${pageVo.order} |
| | | </if> |
| | | <if test="pageVo.offset >=0 and pageVo.limit >0"> |
| | | limit |
| | | #{pageVo.offset},#{pageVo.limit} |
| | | </if> |
| | | </if> |
| | | </select> |
| | | |
| | | <!-- 查询总条数 --> |
| | | <select id="selectTotalRecord" parameterType="long" resultType="java.lang.Integer"> |
| | | select count(*) |
| | | from sys_followup |
| | | <where> |
| | | <include refid="where_sql"></include> |
| | | </where> |
| | | </select> |
| | | |
| | | <!-- 根据id查询--> |
| | | <select id="selectById" resultMap="SysFollowupMap"> |
| | | select |
| | | <include refid="columns" ></include> |
| | | from sys_followup |
| | | where id=#{id} |
| | | </select> |
| | | |
| | | |
| | | <!-- 根据id 锁表查询--> |
| | | <select id="selectForUpdate" resultMap="SysFollowupMap"> |
| | | select |
| | | <include refid="columns" ></include> |
| | | from sys_followup |
| | | where id=#{id} |
| | | for update |
| | | </select> |
| | | |
| | | |
| | | |
| | | <!-- 根据对象查询--> |
| | | <select id="selectByModel" resultMap="SysFollowupMap"> |
| | | select |
| | | <include refid="columns" ></include> |
| | | from sys_followup |
| | | <where> |
| | | <include refid="where_sql"></include> |
| | | </where> |
| | | </select> |
| | | |
| | | |
| | | <select id="selectByAppDto" 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} |
| | | |
| | | <if test="shopId != null "> |
| | | and a.shop_id=#{shopId} |
| | | </if> |
| | | <if test="queryType == 1 "> |
| | | and (visible=1 or ( visible!=1 and a.staff_id=#{selfStaff})) |
| | | </if> |
| | | <if test="queryType == 2 "> |
| | | and a.staff_id=#{selfStaff} |
| | | </if> |
| | | <if test="queryType == 3 "> |
| | | and( visible=1 and a.staff_id!=#{selfStaff}) |
| | | </if> |
| | | |
| | | <if test="startTime != null "> |
| | | and a.create_time <![CDATA[ >= ]]> #{startTime} |
| | | </if> |
| | | <if test="endTime != null "> |
| | | and a.create_time <![CDATA[ <= ]]> #{endTime} |
| | | </if> |
| | | |
| | | <if test="vipIds!=null and vipIds.size()!=0"> |
| | | and a.vip_id in |
| | | <foreach collection="vipIds" index="index" item="item" open="(" |
| | | separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | |
| | | <if test="staffIds!=null and staffIds.size()!=0"> |
| | | and a.staff_id in |
| | | <foreach collection="staffIds" index="index" item="item" open="(" |
| | | separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | |
| | | |
| | | </where> |
| | | |
| | | |
| | | order by a.create_time desc |
| | | |
| | | |
| | | limit ${offset},${limit} |
| | | </select> |
| | | |
| | | |
| | | </mapper> |