| <?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.ServiceRecordDao"> | 
|      | 
|     <resultMap type="ServiceRecord" id="ServiceRecordMap"> | 
|             <id property="id" column="id" /> | 
|             <result property="staffId" column="staff_id" /> | 
|             <result property="vipId" column="vip_id" /> | 
|             <result property="createTime" column="create_time" /> | 
|             <result property="followTime" column="follow_time" /> | 
|             <result property="info0" column="info0" /> | 
|             <result property="info1" column="info1" /> | 
|             <result property="info2" column="info2" /> | 
|             <result property="info3" column="info3" /> | 
|             <result property="info4" column="info4" /> | 
|             <result property="info5" column="info5" /> | 
|             <result property="info6" column="info6" /> | 
|             <result property="info7" column="info7" /> | 
|             <result property="info8" column="info8" /> | 
|             <result property="info9" column="info9" /> | 
|             <result property="images" column="images" /> | 
|             <result property="shopId" column="shop_id" /> | 
|   | 
|     </resultMap> | 
|     <!--  插入方法   --> | 
|     <insert id="insert" parameterType="ServiceRecord" | 
|         useGeneratedKeys="true" keyProperty="id"> | 
|         INSERT INTO service_record ( | 
|             id, | 
|             staff_id, | 
|             vip_id, | 
|             create_time, | 
|             content, | 
|             follow_time, | 
|             info0, | 
|             info1, | 
|             info2, | 
|             info3, | 
|             info4, | 
|             info5, | 
|             info6, | 
|             info7, | 
|             info8, | 
|             info9, | 
|             images, | 
|             shop_id | 
|         ) | 
|     VALUES ( | 
|             #{id}, | 
|             #{staffId}, | 
|             #{vipId}, | 
|             #{createTime}, | 
|             #{content}, | 
|             #{followTime}, | 
|             #{info0}, | 
|             #{info1}, | 
|             #{info2}, | 
|             #{info3}, | 
|             #{info4}, | 
|             #{info5}, | 
|             #{info6}, | 
|             #{info7}, | 
|             #{info8}, | 
|             #{info9}, | 
|             #{images}, | 
|             #{shopId} | 
|     ) | 
|     </insert> | 
|      | 
|      | 
|     <!--  根据id更新 部分更新   --> | 
|     <update id="update" > | 
|         UPDATE service_record | 
|         <set> | 
|                 <if test="staffId != null and staffId !='' "> | 
|                     staff_id = #{staffId}, | 
|                 </if>         | 
|                 <if test="vipId != null and vipId !='' "> | 
|                     vip_id = #{vipId}, | 
|                 </if>         | 
|                 <if test="createTime != null  "> | 
|                     create_time = #{createTime}, | 
|                 </if>         | 
|                 <if test="content != null and content !='' "> | 
|                     content = #{content}, | 
|                 </if>         | 
|                 <if test="followTime != null "> | 
|                     follow_time = #{followTime}, | 
|                 </if>         | 
|                 <if test="info0 != null "> | 
|                     info0 = #{info0}, | 
|                 </if> | 
|                 <if test="info1 != null "> | 
|                     info1 = #{info1}, | 
|                 </if> | 
|                 <if test="info2 != null "> | 
|                     info2 = #{info2}, | 
|                 </if> | 
|                 <if test="info3 != null "> | 
|                     info3 = #{info3}, | 
|                 </if> | 
|                 <if test="info4 != null "> | 
|                     info4 = #{info4}, | 
|                 </if> | 
|                 <if test="info5 != null "> | 
|                     info5 = #{info5}, | 
|                 </if> | 
|                 <if test="info6 != null "> | 
|                     info6 = #{info6}, | 
|                 </if> | 
|                 <if test="info7 != null "> | 
|                     info7 = #{info7}, | 
|                 </if> | 
|                 <if test="info8 != null "> | 
|                     info8 = #{info8}, | 
|                 </if> | 
|                 <if test="info9 != null "> | 
|                     info9 = #{info9}, | 
|                 </if> | 
|                 <if test="images != null "> | 
|                     images = #{images}, | 
|                 </if> | 
|                 <if test="shopId != null "> | 
|                     shop_id = #{shopId}, | 
|                 </if> | 
|         </set> | 
|         WHERE id=#{id} | 
|     </update> | 
|      | 
|      | 
|      | 
|     <!-- 批量删除 --> | 
|     <delete id="deleteByIds" parameterType="java.util.List"> | 
|         delete from service_record where  id in | 
|         <foreach collection="list" index="index" item="item" open="(" | 
|             separator="," close=")"> | 
|             #{item} | 
|         </foreach> | 
|     </delete> | 
|          | 
|     <!-- 根据id删除--> | 
|     <delete id="deleteById" > | 
|         DELETE FROM service_record | 
|         where  id=#{id}  | 
|     </delete> | 
|      | 
|      | 
|      | 
|     <!-- 分页查询 --> | 
|     <select id="selectInPage" resultMap="ServiceRecordMap"> | 
|         select * from service_record | 
|         where 1=1 | 
|         <if test="record!=null"> | 
|             <if test="record.staffId != null and record.staffId !='' "> | 
|                 and staff_id = ${record.staffId} | 
|             </if> | 
|             <if test="record.vipId != null and record.vipId !='' "> | 
|                 and vip_id  = ${record.vipId} | 
|             </if> | 
|         </if> | 
|         <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"    resultType="java.lang.Integer"> | 
|     select count(*) | 
|     from service_record | 
|         where 1=1 | 
|         <if test="record!=null"> | 
|             <if test="record.staffId != null and record.staffId !='' "> | 
|                 and staff_id = ${record.staffId} | 
|             </if> | 
|             <if test="record.vipId != null and record.vipId !='' "> | 
|                 and vip_id  = ${record.vipId} | 
|             </if> | 
|         </if> | 
|     </select> | 
|   | 
|     <!-- 根据id查询--> | 
|     <select id="selectById" resultMap="ServiceRecordMap"> | 
|         select  * from service_record | 
|         where  id=#{id}  | 
|     </select>     | 
|      | 
|      | 
|     <!-- 根据对象查询--> | 
|     <select id="selectByModel" resultMap="ServiceRecordMap"> | 
|         select * from service_record | 
|         where 1=1 | 
|         <if test="record!=null"> | 
|             <if test="record.staffId != null and record.staffId !='' "> | 
|                 and staff_id = ${record.staffId} | 
|             </if> | 
|             <if test="record.vipId != null and record.vipId !='' "> | 
|                 and vip_id  = ${record.vipId} | 
|             </if> | 
|         </if> | 
|     </select> | 
| </mapper> |