| <?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.MyBeaticianDao"> | 
|     <resultMap type="MyBeatician" id="MyBeaticianMap"> | 
|             <id property="id" column="id" /> | 
|             <result property="beauticainId" column="beauticain_id" /> | 
|             <result property="vipId" column="vip_id" /> | 
|             <result property="type" column="type" /> | 
|             <result property="remark" column="remark" /> | 
|             <result property="name" column="name" /> | 
|     </resultMap> | 
|      | 
|      | 
|     <resultMap type="MyBeatician" id="MyBeaticianSimpleMap"> | 
|             <id property="id" column="id" /> | 
|             <result property="beauticainId" column="beauticain_id" /> | 
|             <result property="vipId" column="vip_id" /> | 
|             <result property="type" column="type" /> | 
|             <result property="remark" column="remark" /> | 
|     </resultMap> | 
|      | 
|      | 
|      | 
|     <insert id="insert" parameterType="MyBeatician" | 
|         useGeneratedKeys="true" keyProperty="id"> | 
|         INSERT INTO my_beatician ( | 
|             id, | 
|             beauticain_id, | 
|             vip_id, | 
|             type, | 
|             remark | 
|         ) | 
|     VALUES ( | 
|             #{id}, | 
|             #{beauticainId}, | 
|             #{vipId}, | 
|             #{type}, | 
|             #{remark} | 
|     ) | 
|     </insert> | 
|      | 
|     <insert id="insertAll"> | 
|         INSERT INTO my_beatician ( | 
|             beauticain_id, | 
|             vip_id, | 
|             type, | 
|             remark | 
|         ) | 
|     VALUES  | 
|     <foreach collection="list" item="item" separator=","> | 
|         ( | 
|         #{item.beauticainId}, | 
|         #{vipId}, | 
|         #{item.type}, | 
|         #{item.remark}) | 
|     </foreach> | 
|      | 
|     </insert> | 
|     <update id="update" > | 
|         UPDATE my_beatician | 
|         <set> | 
|                 <if test="(beauticainId != null and beauticainId !='') or beauticainId==0  "> | 
|                     beauticain_id = #{beauticainId}, | 
|                 </if>         | 
|                 <if test="(vipId != null and vipId !='') or vipId==0  "> | 
|                     vip_id = #{vipId}, | 
|                 </if>         | 
|                 <if test="(type != null and type !='') or type==0  "> | 
|                     type = #{type}, | 
|                 </if>         | 
|                 <if test="(remark != null and remark !='') or remark==0  "> | 
|                     remark = #{remark}, | 
|                 </if>         | 
|         </set> | 
|         WHERE id=#{id}  | 
|     </update> | 
|      | 
|      | 
|      | 
|     <delete id="deleteByIds" parameterType="java.util.List"> | 
|         delete from my_beatician where  id in | 
|         <foreach collection="list" index="index" item="item" open="(" | 
|             separator="," close=")"> | 
|             #{item} | 
|         </foreach> | 
|     </delete> | 
|          | 
|     <delete id="deleteById" > | 
|         DELETE FROM my_beatician | 
|         where  id=#{id}  | 
|     </delete> | 
|      | 
|     <delete id="deleteByModel" > | 
|         DELETE FROM my_beatician | 
|         where 1=1 | 
|         <if test="record!=null"> | 
|             <if test="(record.id != null and record.id !='') or record.id==0 "> | 
|                 and id = #{record.id}  | 
|             </if> | 
|             <if test="(record.beauticainId != null and record.beauticainId !='') or record.beauticainId==0 "> | 
|                 and beauticain_id = #{record.beauticainId}  | 
|             </if> | 
|             <if test="(record.vipId != null and record.vipId !='') or record.vipId==0 "> | 
|                 and vip_id = #{record.vipId}  | 
|             </if> | 
|             <if test="(record.type != null and record.type !='') or record.type==0 "> | 
|                 and type = #{record.type}  | 
|             </if> | 
|             <if test="(record.remark != null and record.remark !='') or record.remark==0 "> | 
|                 and remark = #{record.remark}  | 
|             </if> | 
|         </if> | 
|     </delete> | 
|      | 
|     <select id="selectByVipId" resultMap="MyBeaticianMap"> | 
|       select  | 
|             id, | 
|             beauticain_id, | 
|             vip_id, | 
|             type, | 
|             remark, | 
|             (select su_name FROM sys_users WHERE | 
|                 su_id = a.beauticain_id | 
|             ) name | 
|         from my_beatician a | 
|         where vip_id=#{vipId} | 
|     </select> | 
|      | 
|      | 
|     <select id="selectInPage" resultMap="MyBeaticianMap"> | 
|         select  | 
|             id, | 
|             beauticain_id, | 
|             vip_id, | 
|             type, | 
|             remark, | 
|             (select su_name FROM sys_users WHERE | 
|                 su_id = a.beauticain_id | 
|             ) name | 
|         from my_beatician a | 
|         where 1=1 | 
|         <if test="record!=null"> | 
|             <if test="(record.id != null and record.id !='') or record.id==0 "> | 
|                 and id  = #{record.id}  | 
|             </if> | 
|             <if test="(record.beauticainId != null and record.beauticainId !='') or record.beauticainId==0 "> | 
|                 and beauticain_id  = #{record.beauticainId}  | 
|             </if> | 
|             <if test="(record.vipId != null and record.vipId !='') or record.vipId==0 "> | 
|                 and vip_id  = #{record.vipId}  | 
|             </if> | 
|             <if test="(record.type != null and record.type !='') or record.type==0 "> | 
|                 and type  = #{record.type}  | 
|             </if> | 
|             <if test="(record.remark != null and record.remark !='') or record.remark==0 "> | 
|                 and remark  = #{record.remark}  | 
|             </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 my_beatician | 
|         where 1=1 | 
|         <if test="record!=null"> | 
|             <if test="(record.id != null and record.id !='') or record.id==0 "> | 
|             and id = #{record.id}  | 
|             </if> | 
|             <if test="(record.beauticainId != null and record.beauticainId !='') or record.beauticainId==0 "> | 
|             and beauticain_id = #{record.beauticainId}  | 
|             </if> | 
|             <if test="(record.vipId != null and record.vipId !='') or record.vipId==0 "> | 
|             and vip_id = #{record.vipId}  | 
|             </if> | 
|             <if test="(record.type != null and record.type !='') or record.type==0 "> | 
|             and type = #{record.type}  | 
|             </if> | 
|             <if test="(record.remark != null and record.remark !='') or record.remark==0 "> | 
|             and remark = #{record.remark}  | 
|             </if> | 
|         </if> | 
|     </select> | 
|   | 
|     <select id="selectById" resultMap="MyBeaticianMap"> | 
|         select  | 
|             id, | 
|             beauticain_id, | 
|             vip_id, | 
|             type, | 
|             remark, | 
|             (select su_name FROM sys_users WHERE | 
|                 su_id = a.beauticain_id | 
|             ) name | 
|         from my_beatician a | 
|         where  id=#{id}  | 
|     </select>     | 
|      | 
|      | 
|     <select id="selectByModel" resultMap="MyBeaticianMap"> | 
|         select  | 
|             id, | 
|             beauticain_id, | 
|             vip_id, | 
|             type, | 
|             remark, | 
|             (select su_name FROM sys_users WHERE | 
|                 su_id = a.beauticain_id | 
|             ) name | 
|         from my_beatician a | 
|         where 1=1 | 
|         <if test="record!=null"> | 
|             <if test="(record.id != null and record.id !='') or record.id==0 "> | 
|                 and id = #{record.id}  | 
|             </if> | 
|             <if test="(record.beauticainId != null and record.beauticainId !='') or record.beauticainId==0 "> | 
|                 and beauticain_id = #{record.beauticainId}  | 
|             </if> | 
|             <if test="(record.vipId != null and record.vipId !='') or record.vipId==0 "> | 
|                 and vip_id = #{record.vipId}  | 
|             </if> | 
|             <if test="(record.type != null and record.type !='') or record.type==0 "> | 
|                 and type = #{record.type}  | 
|             </if> | 
|             <if test="(record.remark != null and record.remark !='') or record.remark==0 "> | 
|                 and remark = #{record.remark}  | 
|             </if> | 
|         </if> | 
|     </select> | 
| </mapper> |