| <?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.SysBeauticianStateDao"> | 
|   | 
|     <resultMap type="SysBeauticianState" id="SysBeauticianStateMap"> | 
|         <id property="id" column="ID"/> | 
|         <result property="staffId" column="STAFF_ID"/> | 
|         <result property="state" column="STATE"/> | 
|         <result property="beginTime" column="BEGIN_TIME"/> | 
|         <result property="endTime" column="END_TIME"/> | 
|         <result property="servicesId" column="SERVICES_ID"/> | 
|         <result property="excTime" column="EXC_TIME"/> | 
|         <result property="extract" column="extract"/> | 
|         <result property="projId" column="proj_id"/> | 
|         <result property="puseId" column="puse_id"/> | 
|         <result property="count" column="count"/> | 
|   | 
|         <!--扩展字段 --> | 
|         <result property="createTime" column="createTime"/> | 
|         <result property="bedName" column="bedName"/> | 
|         <result property="vipName" column="vipName"/> | 
|         <association property="beautiStaffInfo" resultMap="com.matrix.system.common.dao.SysUsersDao.SysUsersMap"/> | 
|         <association property="projInfo" resultMap="com.matrix.system.hive.dao.ShoppingGoodsDao.ShoppingGoodsMap" | 
|         columnPrefix="goods_"/> | 
|         <association property="projUse" resultMap="com.matrix.system.hive.dao.SysProjUseDao.SysProjUseMap" | 
|                      columnPrefix="pu_"/> | 
|   | 
|     </resultMap> | 
|   | 
|   | 
|     <!--  插入方法   --> | 
|     <insert id="insert" parameterType="SysBeauticianState" | 
|             useGeneratedKeys="true" keyProperty="id"> | 
|         INSERT INTO sys_beautician_state ( | 
|             ID, | 
|             STAFF_ID, | 
|             STATE, | 
|             BEGIN_TIME, | 
|             END_TIME, | 
|             SERVICES_ID, | 
|             EXC_TIME, | 
|             extract, | 
|             puse_id, | 
|             count, | 
|             proj_id | 
|         ) | 
|     VALUES ( | 
|             #{id}, | 
|             #{staffId}, | 
|             #{state}, | 
|             #{beginTime}, | 
|             #{endTime}, | 
|             #{servicesId}, | 
|             #{excTime}, | 
|             #{extract}, | 
|             #{puseId}, | 
|             #{count}, | 
|             #{projId} | 
|     ) | 
|     </insert> | 
|   | 
|   | 
|     <!-- 根据美疗师的占用情况的开始时间 和结束时间查看该时段是否冲突 --> | 
|     <select id="checkBeauticianClash" resultType="java.lang.Integer"> | 
|         SELECT | 
|         count(*) | 
|         FROM | 
|         sys_beautician_state | 
|         WHERE 1=1 | 
|         <if test="record!=null"> | 
|             <if test="record.beginTime != null   "> | 
|                 AND | 
|                 STAFF_ID=#{record.staffId} | 
|                 AND | 
|                 (STATE = '服务中' OR STATE='已预约') | 
|                 AND | 
|                 ( | 
|                 #{record.beginTime} BETWEEN BEGIN_TIME and END_TIME | 
|                 OR | 
|                 #{record.endTime} BETWEEN BEGIN_TIME and END_TIME | 
|                 OR | 
|                 BEGIN_TIME BETWEEN #{record.beginTime} and #{record.endTime} | 
|                 OR | 
|                 END_TIME BETWEEN #{record.beginTime} and #{record.endTime} | 
|                 ) | 
|                 AND | 
|                 SERVICES_ID != #{record.servicesId} | 
|             </if> | 
|         </if> | 
|     </select> | 
|   | 
|     <!-- 根据时间段查询 --> | 
|     <select id="selectByTimeAndStaff" resultMap="SysBeauticianStateMap"> | 
|         select  | 
|         a.ID, | 
|             a.STAFF_ID, | 
|             a.STATE, | 
|             a.BEGIN_TIME, | 
|             a.END_TIME, | 
|             a.SERVICES_ID, | 
|             a.puse_id, | 
|             a.count, | 
|             b.STATE AS serviceOrderStatu, | 
|             a.extract | 
|             from sys_beautician_state a | 
|             left join sys_proj_services b on a.SERVICES_ID=b.ID | 
|          WHERE (a.STATE='服务中' or a.STATE='服务结束' or a.STATE='已预约') | 
|          AND  a.STAFF_ID =#{staffId} | 
|          AND  a.BEGIN_TIME BETWEEN  #{beginTime} and #{endTime} | 
|          order by a.BEGIN_TIME | 
|     </select> | 
|   | 
|   | 
|     <!-- 根据服务人id与 服务单id查询 被占用美疗师 | 
|   | 
|   | 
|     --> | 
|     <select id="selectBySerIds" resultMap="SysBeauticianStateMap"> | 
|         select | 
|             a.ID, | 
|             a.STAFF_ID, | 
|             a.STATE, | 
|             a.BEGIN_TIME, | 
|             a.END_TIME, | 
|             a.SERVICES_ID, | 
|             a.EXC_TIME, | 
|             a.extract, | 
|             a.puse_id, | 
|             a.count, | 
|             a.proj_id, | 
|             b.su_name, | 
|             c.name as goods_name, | 
|             c.seal_pice as goods_seal_pice, | 
|             c.TIME_LENGTH as goods_time_length, | 
|             d.id as pu_id, | 
|             d.SURPLUS_COUNT as pu_SURPLUS_COUNT, | 
|             d.ASSEMBLE_ID as pu_ASSEMBLE_ID, | 
|             d.price as pu_price, | 
|             d.taocan_id as pu_taocan_id | 
|   | 
|   | 
|         from sys_beautician_state a | 
|         left join sys_users b on a.staff_id= b.su_id | 
|         left  join  shopping_goods c on a.proj_id=c.id | 
|         left  join sys_proj_use d on a.puse_id=d.id | 
|          where  a.SERVICES_ID =#{serId} | 
|     </select> | 
|   | 
|     <!-- EXC_TIME =TIMESTAMPDIFF(MINUTE,BEGIN_TIME,now()) --> | 
|     <update id="chengItemState"> | 
|         update sys_beautician_state set  state=#{record.state} | 
|         where 1=1 | 
|         <if test="record.staffId != null"> | 
|             and STAFF_ID=#{record.staffId} | 
|         </if> | 
|           and SERVICES_ID =#{record.servicesId} | 
|     </update> | 
|   | 
|     <!--  根据id更新 部分更新   --> | 
|     <update id="update"> | 
|         UPDATE sys_beautician_state | 
|         <set> | 
|             <if test="staffId != null and staffId !='' "> | 
|                 STAFF_ID = #{staffId}, | 
|             </if> | 
|             <if test="state != null and state !='' "> | 
|                 STATE = #{state}, | 
|             </if> | 
|             <if test="beginTime != null  "> | 
|                 BEGIN_TIME = #{beginTime}, | 
|             </if> | 
|             <if test="endTime != null  "> | 
|                 END_TIME = #{endTime}, | 
|             </if> | 
|             <if test="servicesId != null and servicesId !='' "> | 
|                 SERVICES_ID = #{servicesId}, | 
|             </if> | 
|             <if test="excTime != null and excTime !='' "> | 
|                 EXC_TIME = #{excTime}, | 
|             </if> | 
|   | 
|             <if test="extract != null and extract !='' "> | 
|                 extract = #{extract}, | 
|             </if> | 
|             <if test="puseId != null and puseId !='' "> | 
|                 puse_id = #{puseId}, | 
|             </if> | 
|   | 
|             <if test="count != null and count !='' "> | 
|                 count = #{count}, | 
|             </if> | 
|             <if test="projId != null and projId !='' "> | 
|                 proj_id = #{projId}, | 
|             </if> | 
|         </set> | 
|         WHERE ID=#{id} | 
|     </update> | 
|   | 
|   | 
|     <!-- 批量删除 --> | 
|     <delete id="deleteByIds" parameterType="java.util.List"> | 
|         delete from sys_beautician_state where ID in | 
|         <foreach collection="list" index="index" item="item" open="(" | 
|                  separator="," close=")"> | 
|             #{item} | 
|         </foreach> | 
|     </delete> | 
|   | 
|     <!-- 根据id删除--> | 
|     <delete id="deleteById"> | 
|         DELETE FROM sys_beautician_state | 
|         where  ID=#{id}  | 
|     </delete> | 
|   | 
|   | 
|     <!-- 分页查询 --> | 
|     <select id="selectInPage" resultMap="SysBeauticianStateMap"> | 
|         <include refid="select1"></include> | 
|         <include refid="from1"></include> | 
|         <include refid="where1"></include> | 
|         <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(*) | 
|         <include refid="from1"></include> | 
|         <include refid="where1"></include> | 
|     </select> | 
|   | 
|     <sql id="select1"> | 
|             select *, | 
|             svi.VIP_NAME vipName, | 
|             ssi.SHOP_NAME shopName, | 
|             si.su_name staffName, | 
|             sps.service_no serviceNo, | 
|             sc.service service, | 
|             sc.environment environment, | 
|             sc.suggestion suggestion, | 
|             sc.create_time createTime | 
|     </sql> | 
|     <sql id="from1"> | 
|         from sys_beautician_state  sbs | 
|         LEFT JOIN service_comment sc on sc.service_id=sbs.SERVICES_ID | 
|         LEFT JOIN sys_proj_services sps on sps.id=sbs.SERVICES_ID | 
|         LEFT JOIN sys_vip_info svi on svi.id=sps.vip_id | 
|         LEFT JOIN sys_shop_info ssi on ssi.id=sps.shop_id  | 
|         LEFT JOIN sys_users si on si.su_id=sbs.STAFF_ID | 
|     </sql> | 
|   | 
|     <sql id="where1"> | 
|         where 1=1 | 
|         <if test="record!=null"> | 
|             <if test="record.serviceNo != null and record.serviceNo !='' "> | 
|                 and sps.service_no =#{record.serviceNo} | 
|             </if> | 
|             <if test="record.shopName != null and record.shopName !='' "> | 
|                 and ssi.SHOP_NAME =#{record.shopName} | 
|             </if> | 
|             <if test="record.vipName != null and record.vipName !='' "> | 
|                 and svi.VIP_NAME =#{record.vipName} | 
|             </if> | 
|             <if test="record.staffName!= null and record.staffName !='' "> | 
|                 and si.su_name =#{record.staffName} | 
|             </if> | 
|             <if test="record.projServiceState!= null and record.projServiceState !='' "> | 
|                 and sps.STATE =#{record.projServiceState} | 
|             </if> | 
|   | 
|             <if test="record.id != null and record.id !='' "> | 
|                 and sbs.ID =#{record.id} | 
|             </if> | 
|             <if test="record.staffId != null and record.staffId !='' "> | 
|                 and sbs.STAFF_ID =#{record.staffId} | 
|             </if> | 
|             <if test="record.state != null and record.state !='' "> | 
|                 and sbs.STATE =#{record.state} | 
|             </if> | 
|             <if test="record.beginTime != null  "> | 
|                 and sbs.BEGIN_TIME =#{record.beginTime} | 
|             </if> | 
|             <if test="record.endTime != null  "> | 
|                 and sbs.END_TIME =#{record.endTime} | 
|             </if> | 
|             <if test="record.servicesId != null and record.servicesId !='' "> | 
|                 and sbs.SERVICES_ID =#{record.servicesId} | 
|             </if> | 
|   | 
|   | 
|         </if> | 
|         order by sc.create_time desc | 
|     </sql> | 
|   | 
|   | 
|     <!-- 根据id查询--> | 
|     <select id="selectById" resultMap="SysBeauticianStateMap"> | 
|         <include refid="select"></include> | 
|         <include refid="from"></include> | 
|         where ID=#{id} | 
|     </select> | 
|   | 
|   | 
|     <!-- 根据对象查询--> | 
|     <select id="selectByModel" resultMap="SysBeauticianStateMap"> | 
|         <include refid="select"></include> | 
|         <include refid="from"></include> | 
|         <include refid="where"></include> | 
|     </select> | 
|   | 
|     <select id="selectByTimeAndUset" resultMap="SysBeauticianStateMap"> | 
|         select a.*, | 
|          c.VIP_NAME as vipName, | 
|          d.PROJ_NAME as pu_proj_name, | 
|          e.BED_NAME as bedName | 
|          from sys_beautician_state a | 
|         left join sys_proj_services b on  a.SERVICES_ID =b.ID | 
|         left join sys_vip_info c on b.VIP_ID=c.ID | 
|         left join sys_proj_use d on a.puse_id=d.id | 
|         left join sys_bed_info e on b.BED_ID=e.id | 
|         where | 
|        <![CDATA[ a.BEGIN_TIME > #{beginTime} | 
|         and a.END_TIME < #{endTime} | 
|         and a.STAFF_ID = #{suId} ]]> | 
|         and  a.STATE !='预约取消' | 
|         and  a.STATE !='待确认' | 
|         and  a.STATE !='待预约' | 
|         order by a.BEGIN_TIME asc | 
|   | 
|     </select> | 
|   | 
|   | 
|     <select id="selectItemByTime" resultMap="SysBeauticianStateMap"> | 
|        select a.*, | 
|        c.PRICE as pu_PRICE , | 
|        c.SOURCE as pu_SOURCE, | 
|        c.ASSEMBLE_ID as pu_ASSEMBLE_ID | 
| from sys_beautician_state a | 
|          left join sys_proj_services b on  a.SERVICES_ID =b.ID | 
|          left join sys_proj_use c on a.puse_id=c.id | 
| where b.SHOP_ID=#{shopId} | 
|       and to_days(b.consume_time)=to_days(#{time}) | 
|     </select> | 
|   | 
|   | 
|     <sql id="select"> | 
|             select  | 
|             ID, | 
|             STAFF_ID, | 
|             STATE, | 
|             BEGIN_TIME, | 
|             END_TIME, | 
|             SERVICES_ID, | 
|             EXC_TIME, | 
|             extract, | 
|             puse_id, | 
|             count, | 
|             proj_id | 
|     </sql> | 
|     <sql id="from"> | 
|         from sys_beautician_state  | 
|     </sql> | 
|     <sql id="where"> | 
|         where 1=1 | 
|         <if test="record!=null"> | 
|             <if test="record.excTime != null  "> | 
|                 and EXC_TIME =#{record.excTime} | 
|             </if> | 
|             <if test="record.id != null and record.id !='' "> | 
|                 and ID =#{record.id} | 
|             </if> | 
|             <if test="record.staffId != null and record.staffId !='' "> | 
|                 and STAFF_ID =#{record.staffId} | 
|             </if> | 
|             <if test="record.state != null and record.state !='' "> | 
|                 and STATE =#{record.state} | 
|             </if> | 
|             <if test="record.beginTime != null  "> | 
|                 and BEGIN_TIME =#{record.beginTime} | 
|             </if> | 
|             <if test="record.endTime != null  "> | 
|                 and END_TIME =#{record.endTime} | 
|             </if> | 
|             <if test="record.servicesId != null and record.servicesId !='' "> | 
|                 and SERVICES_ID =#{record.servicesId} | 
|             </if> | 
|   | 
|             <if test="record.extract != null and record.extract !='' "> | 
|                 and extract = #{record.extract} | 
|             </if> | 
|             <if test="record.puseId != null and record.puseId !='' "> | 
|                 and puse_id = #{record.puseId} | 
|             </if> | 
|             <if test="record.count != null and record.count !='' "> | 
|                 and count = #{record.count} | 
|             </if> | 
|             <if test="record.projId != null and record.projId !='' "> | 
|                 and proj_id = #{record.projId} | 
|             </if> | 
|         </if> | 
|     </sql> | 
|   | 
|   | 
|     <!-- 服务明细查询--> | 
|     <select id="selectItemDetail" resultType="java.util.HashMap" parameterType="java.util.HashMap"> | 
|         select | 
|         f.SHOP_NAME, | 
|         b.yy_time, | 
|         b.consume_time, | 
|         b.SERVICE_NO, | 
|         d.su_name, | 
|         e.VIP_NAME, | 
|         h.PROJ_NAME, | 
|         c.id, | 
|         g.NAME as TYPE_NAME, | 
|         a.COUNT, | 
|         h.PRICE, | 
|         h.SOURCE, | 
|         a.STATE, | 
|         a.extract | 
|         from sys_beautician_state a | 
|         left join sys_proj_services b on a.SERVICES_ID=b.ID | 
|         left join shopping_goods c on a.proj_id=c.id | 
|         left join sys_users d on d.su_id=a.STAFF_ID | 
|         left join sys_vip_info e on e.ID=b.VIP_ID | 
|         left join sys_shop_info f on f.ID=b.SHOP_ID | 
|         left join shopping_goods_category g on c.cate_id=g.id | 
|         left join sys_proj_use h on h.id=a.puse_id | 
|         <where> | 
|             <if test="shopId != null and  shopId != ''"> | 
|                 and f.id =#{shopId} | 
|             </if> | 
|             <if test="beginTime != null and beginTime != '' "> | 
|                 and b.consume_time  <![CDATA[>=]]> #{beginTime} | 
|             </if> | 
|             <if test="endTime != null and endTime !='' "> | 
|                 and b.consume_time <![CDATA[<=]]> #{endTime} | 
|             </if> | 
|   | 
|             <if test="vipQueryKey != null and vipQueryKey != ''  "> | 
|                 and | 
|                 ( | 
|                 e.VIP_NAME like concat('%',#{vipQueryKey},'%') | 
|                 or e.VIP_NO like concat('%',#{vipQueryKey},'%') | 
|                 or e.PHONE like concat('%',#{vipQueryKey},'%') | 
|                 ) | 
|             </if> | 
|   | 
|             <if test="projName != null and projName != ''  "> | 
|                 and   h.proj_name like concat('%',#{projName},'%') | 
|             </if> | 
|   | 
|             <if test="shopId != null and shopId != ''  "> | 
|                 and   f.id=#{shopId} | 
|             </if> | 
|   | 
|             <if test="cateId != null and cateId != ''  "> | 
|                 and  c.cate_id=#{cateId} | 
|             </if> | 
|   | 
|   | 
|             <if test="staffId != null and staffId != ''  "> | 
|                 and  a.STAFF_ID=#{staffId} | 
|             </if> | 
|   | 
|             <if test="state != null and state != ''  "> | 
|                 and  a.STATE=#{state} | 
|             </if> | 
|   | 
|   | 
|         </where> | 
|   | 
|         <if test="sort !=null and sort!=''"> order by ${sort} ${order}</if> | 
|         <if test="(offset !=null and offset!='') or offset==0 "> | 
|             limit ${offset},${limit} | 
|         </if> | 
|     </select> | 
|   | 
|     <select id="selectItemDetailTotal" resultType="java.lang.Integer"> | 
|         select count(a.id) | 
|         from sys_beautician_state a | 
|         left join sys_proj_services b on a.SERVICES_ID=b.ID | 
|         left join shopping_goods c on a.proj_id=c.id | 
|         left join sys_users d on d.su_id=a.STAFF_ID | 
|         left join sys_vip_info e on e.ID=b.VIP_ID | 
|         left join sys_shop_info f on f.ID=b.SHOP_ID | 
|         left join shopping_goods_category g on c.cate_id=g.id | 
|         left join sys_proj_use h on h.id=a.puse_id | 
|         <where> | 
|             <if test="shopId != null and  shopId != ''"> | 
|                 and f.id =#{shopId} | 
|             </if> | 
|             <if test="beginTime != null and beginTime != '' "> | 
|                 and b.consume_time  <![CDATA[>=]]> #{beginTime} | 
|             </if> | 
|             <if test="endTime != null and endTime !='' "> | 
|                 and b.consume_time <![CDATA[<=]]> #{endTime} | 
|             </if> | 
|             <if test="vipQueryKey != null and vipQueryKey != ''  "> | 
|                 and | 
|                 ( | 
|                 e.VIP_NAME like concat('%',#{vipQueryKey},'%') | 
|                 or e.VIP_NO like concat('%',#{vipQueryKey},'%') | 
|                 or e.PHONE like concat('%',#{vipQueryKey},'%') | 
|                 ) | 
|             </if> | 
|   | 
|             <if test="projName != null and projName != ''  "> | 
|                 and   h.proj_name like concat('%',#{projName},'%') | 
|             </if> | 
|   | 
|             <if test="shopId != null and shopId != ''  "> | 
|                 and  f.id=#{shopId} | 
|             </if> | 
|   | 
|             <if test="cateId != null and cateId != ''  "> | 
|                 and  c.cate_id=#{cateId} | 
|             </if> | 
|   | 
|   | 
|             <if test="staffId != null and staffId != ''  "> | 
|                 and  a.STAFF_ID=#{staffId} | 
|             </if> | 
|             <if test="state != null and state != ''  "> | 
|                 and  a.STATE=#{state} | 
|             </if> | 
|         </where> | 
|     </select> | 
|   | 
|   | 
|     <select id="summaryItemDetail" resultType="java.util.HashMap" parameterType="java.util.HashMap"> | 
|         select | 
|         f.SHOP_NAME, | 
|         h.PROJ_NAME, | 
|         c.id, | 
|         g.name as TYPE_NAME, | 
|         SUM(a.COUNT) as COUNT, | 
|         ROUND(SUM(h.PRICE*a.count),2) as PRICE | 
|         from sys_beautician_state a | 
|         left join sys_proj_services b on a.SERVICES_ID=b.ID | 
|         left join shopping_goods c on a.proj_id=c.id | 
|         left join sys_users d on d.su_id=a.STAFF_ID | 
|         left join sys_vip_info e on e.ID=b.VIP_ID | 
|         left join sys_shop_info f on f.ID=b.SHOP_ID | 
|         left join shopping_goods_category g on c.cate_id=g.id | 
|         left join sys_proj_use h on h.id=a.puse_id | 
|         <where> | 
|             <if test="shopId != null and  shopId != ''"> | 
|                 and f.id =#{shopId} | 
|             </if> | 
|             <if test="beginTime != null and beginTime != '' "> | 
|                 and b.consume_time  <![CDATA[>=]]> #{beginTime} | 
|             </if> | 
|             <if test="endTime != null and endTime !='' "> | 
|                 and b.consume_time <![CDATA[<=]]> #{endTime} | 
|             </if> | 
|             <if test="projName != null   "> | 
|                 and   h.proj_name like concat('%',#{projName},'%') | 
|             </if> | 
|             <if test="shopId != null and shopId != ''  "> | 
|                 and   f.id=#{shopId} | 
|             </if> | 
|   | 
|             <if test="cateId != null and cateId != ''  "> | 
|                 and   c.cate_id=#{cateId} | 
|             </if> | 
|             <if test="state != null and state != ''  "> | 
|                 and  a.STATE=#{state} | 
|             </if> | 
|         </where> | 
|         group by c.id,f.id | 
|   | 
|         <if test="sort !=null and sort!=''"> order by ${sort} ${order}</if> | 
|         <if test="(offset !=null and offset!='') or offset==0 "> | 
|             limit ${offset},${limit} | 
|         </if> | 
|     </select> | 
|   | 
|     <select id="summaryItemDetailTotal" resultType="java.lang.Integer"> | 
|         select count(1) from ( | 
|         select count(1) | 
|         from sys_beautician_state a | 
|         left join sys_proj_services b on a.SERVICES_ID=b.ID | 
|         left join shopping_goods c on a.proj_id=c.id | 
|         left join sys_users d on d.su_id=a.STAFF_ID | 
|         left join sys_vip_info e on e.ID=b.VIP_ID | 
|         left join sys_shop_info f on f.ID=b.SHOP_ID | 
|         left join shopping_goods_category g on c.cate_id=g.id | 
|         left join sys_proj_use h on h.id=a.puse_id | 
|         <where> | 
|             <if test="shopId != null and  shopId != ''"> | 
|                 and f.id =#{shopId} | 
|             </if> | 
|             <if test="beginTime != null and beginTime != '' "> | 
|                 and b.consume_time  <![CDATA[>=]]> #{beginTime} | 
|             </if> | 
|             <if test="endTime != null and endTime !='' "> | 
|                 and b.consume_time <![CDATA[<=]]> #{endTime} | 
|             </if> | 
|             <if test="projName != null and projName != ''  "> | 
|                 and   h.proj_name like concat('%',#{projName},'%') | 
|             </if> | 
|             <if test="shopId != null and shopId != ''  "> | 
|                 and   f.id=#{shopId} | 
|             </if> | 
|   | 
|             <if test="cateId != null and cateId != ''  "> | 
|                 and   c.cate_id=#{cateId} | 
|             </if> | 
|             <if test="state != null and state != ''  "> | 
|                 and  a.STATE=#{state} | 
|             </if> | 
|         </where> | 
|         group by c.id,f.id) t | 
|     </select> | 
|   | 
|     <select id="selectByProjUse" resultMap="SysBeauticianStateMap"> | 
|         select * from sys_beautician_state | 
|         where state!=#{state} and puse_id in | 
|         <foreach collection="list" index="index" item="item" open="(" | 
|                  separator="," close=")"> | 
|             #{item.id} | 
|         </foreach> | 
|     </select> | 
|   | 
|     <select id="selectBeauticianStateByPuseIdAndNoStatus" resultMap="SysBeauticianStateMap"> | 
|         select * from sys_beautician_state | 
|         where puse_id=#{puseId} and state!=#{state} | 
|     </select> | 
| </mapper> |