|  |  |  | 
|---|
|  |  |  | <!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" /> | 
|---|
|  |  |  | 
|---|
|  |  |  | </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" /> | 
|---|
|  |  |  | 
|---|
|  |  |  | </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> | 
|---|
|  |  |  | 
|---|
|  |  |  | </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> | 
|---|
|  |  |  | 
|---|
|  |  |  | 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> | 
|---|