| <?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.SysFollowupCommentDao"> | 
|     <!-- 定义SysFollowupComment 的复杂关联map --> | 
|     <resultMap type="com.matrix.system.hive.bean.SysFollowupComment" id="SysFollowupCommentMap"> | 
|         <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="follId" column="foll_id" /> | 
|             <result property="staffId" column="staff_id" /> | 
|             <result property="content" column="content" /> | 
|     </resultMap> | 
|      | 
|      | 
|     <!-- 定义SysFollowupComment 的简单map  ,本map不添加其他的关联属性 --> | 
|     <resultMap type="com.matrix.system.hive.bean.SysFollowupComment" id="SysFollowupCommentSimpleMap"> | 
|         <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="follId" column="foll_id" /> | 
|             <result property="staffId" column="staff_id" /> | 
|             <result property="content" column="content" /> | 
|     </resultMap> | 
|      | 
|     <!-- 字段sql --> | 
|     <sql id="columns"> | 
|         create_by, | 
|         create_time, | 
|         update_by, | 
|         update_time, | 
|             id, | 
|             foll_id, | 
|             staff_id, | 
|             content | 
|     </sql> | 
|      | 
|     <!-- 属性sql --> | 
|     <sql id="propertys"> | 
|         #{item.createBy}, | 
|         now(), | 
|         #{item.updateBy}, | 
|         now(), | 
|             #{item.id}, | 
|             #{item.follId}, | 
|             #{item.staffId}, | 
|             #{item.content} | 
|     </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.follId!=null and record.follId!='') or  (record.follId!='' and record.follId==0)  "> | 
|                 and foll_id  = #{record.follId}  | 
|             </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.content!=null and record.content!='') or  (record.content!='' and record.content==0)  "> | 
|                 and content  = #{record.content}  | 
|             </if> | 
|         </if> | 
|           | 
|     </sql> | 
|      | 
|     <!--  插入方法   --> | 
|     <insert id="insert" parameterType="com.matrix.system.hive.bean.SysFollowupComment" | 
|         useGeneratedKeys="true" keyProperty="item.id"> | 
|         INSERT INTO sys_followup_comment ( | 
|              <include refid="columns"></include> | 
|         ) | 
|     VALUES ( | 
|          <include refid="propertys"></include> | 
|     ) | 
|     </insert> | 
|      | 
|      | 
|      | 
|     <!--  批量插入   --> | 
|     <insert id="batchInsert" parameterType="java.util.List"> | 
|         INSERT INTO sys_followup_comment ( | 
|         <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_comment | 
|         <set> | 
|             <if test="_parameter.containsKey('follId')"> | 
|                     foll_id = #{follId}, | 
|                 </if>         | 
|             <if test="_parameter.containsKey('staffId')"> | 
|                     staff_id = #{staffId}, | 
|                 </if>         | 
|             <if test="_parameter.containsKey('content')"> | 
|                     content = #{content}, | 
|                 </if>         | 
|         </set> | 
|         WHERE id=#{id}  | 
|     </update>  | 
|      | 
|      | 
|     <!--  根据对象更新 部分更新   --> | 
|     <update id="updateByModel" parameterType="Integer"> | 
|         UPDATE sys_followup_comment | 
|         <set> | 
|             <if test="record.follId != null "> | 
|                 foll_id  = #{record.follId},  | 
|             </if> | 
|             <if test="record.staffId != null "> | 
|                 staff_id  = #{record.staffId},  | 
|             </if> | 
|             <if test="record.content != null and record.content != '' "> | 
|                 content  = #{record.content},  | 
|             </if> | 
|         </set> | 
|         WHERE id=#{record.id}  | 
|     </update> | 
|      | 
|     <!-- 批量删除 --> | 
|     <delete id="deleteByIds" parameterType="java.util.List"> | 
|         delete from sys_followup_comment 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_comment | 
|         where  id=#{id}  | 
|     </delete> | 
|      | 
|     <!-- 根据对象删除--> | 
|     <delete id="deleteByModel" parameterType="com.matrix.system.hive.bean.SysFollowupComment"> | 
|         DELETE FROM sys_followup_comment | 
|         <where> | 
|         <include refid="where_sql" ></include> | 
|         </where> | 
|     </delete> | 
|      | 
|      | 
|      | 
|     <!-- 分页查询 --> | 
|     <select id="selectInPage" resultMap="SysFollowupCommentMap"> | 
|         select  | 
|         <include refid="columns" ></include> | 
|         from sys_followup_comment | 
|         <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_comment | 
|         <where> | 
|            <include refid="where_sql"></include> | 
|         </where> | 
|     </select> | 
|   | 
|     <!-- 根据id查询--> | 
|     <select id="selectById" resultMap="SysFollowupCommentMap"> | 
|         select  | 
|         <include refid="columns" ></include> | 
|         from sys_followup_comment | 
|         where  id=#{id}  | 
|     </select>     | 
|      | 
|      | 
|     <!-- 根据id 锁表查询--> | 
|     <select id="selectForUpdate" resultMap="SysFollowupCommentMap"> | 
|         select  | 
|         <include refid="columns" ></include> | 
|         from sys_followup_comment | 
|         where  id=#{id}  | 
|         for update | 
|     </select>     | 
|      | 
|      | 
|      | 
|     <!-- 根据对象查询--> | 
|     <select id="selectByModel" resultMap="SysFollowupCommentMap"> | 
|         select  | 
|         <include refid="columns" ></include> | 
|         from sys_followup_comment | 
|         <where> | 
|           <include refid="where_sql"></include> | 
|          </where> | 
|     </select> | 
|   | 
|     <select id="selectByfollId" resultMap="SysFollowupCommentMap"> | 
|         select | 
|         <include refid="columns" ></include> | 
|         from sys_followup_comment | 
|         where foll_id=#{follId} | 
|     </select> | 
| </mapper> |