| <?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.common.dao.SysUsersDao"> | 
|     <!-- 定义SysUsers 的复杂关联map --> | 
|     <resultMap type="com.matrix.system.common.bean.SysUsers" | 
|                id="SysUsersMap"> | 
|         <id property="suId" column="su_id"/> | 
|         <result property="suName" column="su_name"/> | 
|         <result property="suTel" column="su_tel"/> | 
|         <result property="suAddress" column="su_address"/> | 
|         <result property="suPhoto" column="su_photo"/> | 
|         <result property="suSex" column="su_sex"/> | 
|         <result property="suEmail" column="su_email"/> | 
|         <result property="suAccount" column="su_account"/> | 
|         <result property="suPassword" column="su_password"/> | 
|         <result property="suRegisterTime" column="su_register_time"/> | 
|         <result property="suQqId" column="su_qq_id"/> | 
|         <result property="suWeixinId" column="su_weixin_id"/> | 
|         <result property="suGrade" column="su_grade"/> | 
|         <result property="parentUserId" column="parent_user_id"/> | 
|         <result property="suDeptId" column="su_dept_id"/> | 
|         <result property="suUserType" column="su_user_type"/> | 
|         <result property="suWeiboId" column="su_weibo_id"/> | 
|         <result property="suIdcard" column="su_idcard"/> | 
|         <result property="suJobTitle" column="su_job_title"/> | 
|         <result property="suAliases" column="su_aliases"/> | 
|         <result property="suJobNo" column="su_job_no"/> | 
|         <result property="companyId" column="company_id"/> | 
|         <result property="suTel2" column="su_tel2"/> | 
|         <result property="suAccountStatus" column="su_account_status"/> | 
|         <result property="suValidateCode" column="su_validate_code"/> | 
|         <result property="suValidateEndTime" | 
|                 column="su_validate_end_time"/> | 
|         <result property="suValid" column="su_valid"/> | 
|         <result property="suBirthday" column="su_birthday"/> | 
|         <result property="suUuid" column="su_uuid"/> | 
|         <result property="suPostId" column="su_post_id"/> | 
|   | 
|         <result property="roleIds" column="role_ids"/> | 
|         <result property="shopRole" column="shopRole"/> | 
|   | 
|         <result property="companyName" column="company_name"/> | 
|         <result property="shopId" column="shop_id"/> | 
|   | 
|         <result property="shopId" column="SHOP_ID"/> | 
|         <result property="degree" column="DEGREE"/> | 
|         <result property="workExp" column="WORK_EXP"/> | 
|         <result property="entryDate" column="ENTRY_DATE"/> | 
|         <result property="emergTel" column="EMERG_TEL"/> | 
|         <result property="wxNo" column="WX_NO"/> | 
|         <result property="enName" column="EN_NAME"/> | 
|         <result property="isDisabled" column="IS_DISABLED"/> | 
|         <result property="serviceSignature" column="SERVICE_SIGNATURE"/> | 
|         <result property="signOrder" column="SIGN_ORDER"/> | 
|         <result property="signDate" column="SIGN_DATE"/> | 
|         <result property="salarGrad" column="salarGrad"/> | 
|         <result property="allCustomer" column="allCustomer"/> | 
|   | 
|         <!-- 扩展属性 --> | 
|         <result property="shopName" column="SHOP_NAME"/> | 
|         <result property="departName" column="DEPART_NAME"/> | 
|         <result property="parDirectName" column="PARDIRECT_NAME"/> | 
|   | 
|   | 
|     </resultMap> | 
|   | 
|   | 
|     <!-- 插入方法 --> | 
|     <insert id="insert" | 
|             parameterType="com.matrix.system.common.bean.SysUsers" | 
|             useGeneratedKeys="true" keyProperty="suId"> | 
|         INSERT INTO sys_users ( | 
|         create_by, | 
|         create_time, | 
|         update_by, | 
|         update_time, | 
|         su_id, | 
|         su_name, | 
|         su_tel, | 
|         su_address, | 
|         su_photo, | 
|         su_sex, | 
|         su_email, | 
|         su_account, | 
|         su_password, | 
|         su_register_time, | 
|         su_qq_id, | 
|         su_weixin_id, | 
|         su_grade, | 
|         parent_user_id, | 
|         su_dept_id, | 
|         su_user_type, | 
|         su_weibo_id, | 
|         su_idcard, | 
|         su_job_title, | 
|         su_aliases, | 
|         su_job_no, | 
|         company_id, | 
|         su_tel2, | 
|         su_account_status, | 
|         su_validate_code, | 
|         su_validate_end_time, | 
|         su_valid, | 
|         su_birthday, | 
|         su_uuid, | 
|         su_post_id, | 
|         role_ids, | 
|         shop_id, | 
|   | 
|   | 
|   | 
|         degree, | 
|         work_exp, | 
|         entry_date, | 
|         emerg_tel, | 
|         wx_no, | 
|         en_name, | 
|         service_signature, | 
|         sign_order | 
|         ) | 
|         VALUES ( | 
|         #{createBy}, | 
|         now(), | 
|         #{updateBy}, | 
|         now(), | 
|         #{suId}, | 
|         #{suName}, | 
|         #{suTel}, | 
|         #{suAddress}, | 
|         #{suPhoto}, | 
|         #{suSex}, | 
|         #{suEmail}, | 
|         #{suAccount}, | 
|         #{suPassword}, | 
|         #{suRegisterTime}, | 
|         #{suQqId}, | 
|         #{suWeixinId}, | 
|         #{suGrade}, | 
|         #{parentUserId}, | 
|         #{suDeptId}, | 
|         #{suUserType}, | 
|         #{suWeiboId}, | 
|         #{suIdcard}, | 
|         #{suJobTitle}, | 
|         #{suAliases}, | 
|         #{suJobNo}, | 
|         #{companyId}, | 
|         #{suTel2}, | 
|         #{suAccountStatus}, | 
|         #{suValidateCode}, | 
|         #{suValidateEndTime}, | 
|         #{suValid}, | 
|         #{suBirthday}, | 
|         #{suUuid}, | 
|         #{suPostId}, | 
|         #{roleIds}, | 
|         #{shopId}, | 
|   | 
|   | 
|   | 
|         #{degree}, | 
|         #{workExp}, | 
|         #{entryDate}, | 
|         #{emergTel}, | 
|         #{wxNo}, | 
|         #{enName}, | 
|         #{serviceSignature}, | 
|         #{signOrder} | 
|         ) | 
|     </insert> | 
|   | 
|   | 
|     <!-- 根据Map更新 部分更新 --> | 
|     <update id="updateByMap" parameterType="java.util.HashMap"> | 
|         UPDATE sys_users | 
|         <set> | 
|             update_time=now(), | 
|             <if test="_parameter.containsKey('updateBy')"> | 
|                 update_by=#{updateBy}, | 
|             </if> | 
|             <if test="_parameter.containsKey('suName')"> | 
|                 su_name = #{suName}, | 
|             </if> | 
|             <if test="_parameter.containsKey('suTel')"> | 
|                 su_tel = #{suTel}, | 
|             </if> | 
|             <if test="_parameter.containsKey('suAddress')"> | 
|                 su_address = #{suAddress}, | 
|             </if> | 
|             <if test="_parameter.containsKey('suPhoto')"> | 
|                 su_photo = #{suPhoto}, | 
|             </if> | 
|             <if test="_parameter.containsKey('suSex')"> | 
|                 su_sex = #{suSex}, | 
|             </if> | 
|   | 
|             <if test="_parameter.containsKey('suEmail')"> | 
|                 su_email = #{suEmail}, | 
|             </if> | 
|             <if test="_parameter.containsKey('suAccount')"> | 
|                 su_account = #{suAccount}, | 
|             </if> | 
|             <if test="_parameter.containsKey('suPassword')"> | 
|                 su_password = #{suPassword}, | 
|             </if> | 
|             <if test="_parameter.containsKey('suRegisterTime')"> | 
|                 su_register_time = #{suRegisterTime}, | 
|             </if> | 
|             <if test="_parameter.containsKey('suQqId')"> | 
|                 su_qq_id = #{suQqId}, | 
|             </if> | 
|             <if test="_parameter.containsKey('suWeixinId')"> | 
|                 su_weixin_id = #{suWeixinId}, | 
|             </if> | 
|             <if test="_parameter.containsKey('suGrade')"> | 
|                 su_grade = #{suGrade}, | 
|             </if> | 
|             <if test="_parameter.containsKey('parentUserId')"> | 
|                 parent_user_id = #{parentUserId}, | 
|             </if> | 
|             <if test="_parameter.containsKey('suDeptId')"> | 
|                 su_dept_id = #{suDeptId}, | 
|             </if> | 
|             <if test="_parameter.containsKey('suUserType')"> | 
|                 su_user_type = #{suUserType}, | 
|             </if> | 
|             <if test="_parameter.containsKey('suWeiboId')"> | 
|                 su_weibo_id = #{suWeiboId}, | 
|             </if> | 
|             <if test="_parameter.containsKey('suIdcard')"> | 
|                 su_idcard = #{suIdcard}, | 
|             </if> | 
|             <if test="_parameter.containsKey('suJobTitle')"> | 
|                 su_job_title = #{suJobTitle}, | 
|             </if> | 
|             <if test="_parameter.containsKey('suAliases')"> | 
|                 su_aliases = #{suAliases}, | 
|             </if> | 
|             <if test="_parameter.containsKey('suJobNo')"> | 
|                 su_job_no = #{suJobNo}, | 
|             </if> | 
|             <if test="_parameter.containsKey('companyId')"> | 
|                 company_id = #{companyId}, | 
|             </if> | 
|             <if test="_parameter.containsKey('suTel2')"> | 
|                 su_tel2 = #{suTel2}, | 
|             </if> | 
|             <if test="_parameter.containsKey('suAccountStatus')"> | 
|                 su_account_status = #{suAccountStatus}, | 
|             </if> | 
|             <if test="_parameter.containsKey('suValidateCode')"> | 
|                 su_validate_code = #{suValidateCode}, | 
|             </if> | 
|             <if test="_parameter.containsKey('suValidateEndTime')"> | 
|                 su_validate_end_time = #{suValidateEndTime}, | 
|             </if> | 
|             <if test="_parameter.containsKey('suValid')"> | 
|                 su_valid = #{suValid}, | 
|             </if> | 
|             <if test="_parameter.containsKey('suBirthday')"> | 
|                 su_birthday = #{suBirthday}, | 
|             </if> | 
|             <if test="_parameter.containsKey('suUuid')"> | 
|                 su_uuid = #{suUuid}, | 
|             </if> | 
|             <if test="_parameter.containsKey('suPostId')"> | 
|                 su_post_id = #{suPostId}, | 
|             </if> | 
|             <if test="_parameter.containsKey('roleIds')"> | 
|                 role_ids = #{roleIds}, | 
|             </if> | 
|             <if test="_parameter.containsKey('shopId')"> | 
|                 shop_id = #{shopId}, | 
|             </if> | 
|   | 
|   | 
|             <if test="_parameter.containsKey('shopId') "> | 
|                 shop_id = #{shopId}, | 
|             </if> | 
|   | 
|   | 
|             <if test="_parameter.containsKey('degree')"> | 
|                 degree = #{degree}, | 
|             </if> | 
|             <if test="_parameter.containsKey('workExp')"> | 
|                 work_exp = #{workExp}, | 
|             </if> | 
|             <if test="_parameter.containsKey('entryDate')"> | 
|                 entry_date = #{entryDate}, | 
|             </if> | 
|             <if test="_parameter.containsKey('emergTel')"> | 
|                 emerg_tel = #{emergTel}, | 
|             </if> | 
|   | 
|             <if test="_parameter.containsKey('wxNo')"> | 
|                 wx_no = #{wxNo}, | 
|             </if> | 
|             <if test="_parameter.containsKey('enName')"> | 
|                 en_name = #{enName}, | 
|             </if> | 
|   | 
|             <if test="_parameter.containsKey('serviceSignature')"> | 
|                 service_signature = #{serviceSignature}, | 
|             </if> | 
|   | 
|   | 
|             <if test="_parameter.containsKey('signOrder')"> | 
|                 sign_order = #{signOrder}, | 
|             </if> | 
|             <if test="_parameter.containsKey('signDate')"> | 
|                 sign_date = #{signDate} | 
|             </if> | 
|   | 
|         </set> | 
|         WHERE su_id=#{suId} | 
|     </update> | 
|   | 
|   | 
|     <!-- 根据对象更新 部分更新 --> | 
|     <update id="updateByModel" parameterType="Long"> | 
|         UPDATE sys_users | 
|         <set> | 
|             update_time=now(), | 
|             <if test="updateBy!=null"> | 
|                 update_by = #{updateBy}, | 
|             </if> | 
|             <if | 
|                     test="(suName!=null and suName!='') or (suName!='' and suName==0)"> | 
|                 su_name = #{suName}, | 
|             </if> | 
|             <if test="(suTel!=null and suTel!='') or (suTel!='' and suTel==0)"> | 
|                 su_tel = #{suTel}, | 
|             </if> | 
|             <if | 
|                     test="(suAddress!=null and suAddress!='') or (suAddress!='' and suAddress==0)"> | 
|                 su_address = #{suAddress}, | 
|             </if> | 
|             <if | 
|                     test="(suPhoto!=null and suPhoto!='') or (suPhoto!='' and suPhoto==0)"> | 
|                 su_photo = #{suPhoto}, | 
|             </if> | 
|             <if test="(suSex!=null and suSex!='') or (suSex!='' and suSex==0)"> | 
|                 su_sex = #{suSex}, | 
|             </if> | 
|   | 
|             <if | 
|                     test="(suEmail!=null and suEmail!='') or (suEmail!='' and suEmail==0)"> | 
|                 su_email = #{suEmail}, | 
|             </if> | 
|             <if | 
|                     test="(suAccount!=null and suAccount!='') or (suAccount!='' and suAccount==0)"> | 
|                 su_account = #{suAccount}, | 
|             </if> | 
|             <if | 
|                     test="(suPassword!=null and suPassword!='') or (suPassword!='' and suPassword==0)"> | 
|                 su_password = #{suPassword}, | 
|             </if> | 
|             <if test="suRegisterTime!=null"> | 
|                 su_register_time = #{suRegisterTime}, | 
|             </if> | 
|             <if | 
|                     test="(suQqId!=null and suQqId!='') or (suQqId!='' and suQqId==0)"> | 
|                 su_qq_id = #{suQqId}, | 
|             </if> | 
|             <if | 
|                     test="(suWeixinId!=null and suWeixinId!='') or (suWeixinId!='' and suWeixinId==0)"> | 
|                 su_weixin_id = #{suWeixinId}, | 
|             </if> | 
|             <if | 
|                     test="(suGrade!=null and suGrade!='') or (suGrade!='' and suGrade==0)"> | 
|                 su_grade = #{suGrade}, | 
|             </if> | 
|             <if | 
|                     test="(parentUserId!=null and parentUserId!='') or (parentUserId!='' and parentUserId==0)"> | 
|                 parent_user_id = #{parentUserId}, | 
|             </if> | 
|             <if | 
|                     test="(suDeptId!=null and suDeptId!='') or (suDeptId!='' and suDeptId==0)"> | 
|                 su_dept_id = #{suDeptId}, | 
|             </if> | 
|             <if | 
|                     test="(suUserType!=null and suUserType!='') or (suUserType!='' and suUserType==0)"> | 
|                 su_user_type = #{suUserType}, | 
|             </if> | 
|             <if | 
|                     test="(suWeiboId!=null and suWeiboId!='') or (suWeiboId!='' and suWeiboId==0)"> | 
|                 su_weibo_id = #{suWeiboId}, | 
|             </if> | 
|             <if | 
|                     test="(suIdcard!=null and suIdcard!='') or (suIdcard!='' and suIdcard==0)"> | 
|                 su_idcard = #{suIdcard}, | 
|             </if> | 
|             <if | 
|                     test="(suJobTitle!=null and suJobTitle!='') or (suJobTitle!='' and suJobTitle==0)"> | 
|                 su_job_title = #{suJobTitle}, | 
|             </if> | 
|             <if | 
|                     test="(suAliases!=null and suAliases!='') or (suAliases!='' and suAliases==0)"> | 
|                 su_aliases = #{suAliases}, | 
|             </if> | 
|             <if | 
|                     test="(suJobNo!=null and suJobNo!='') or (suJobNo!='' and suJobNo==0)"> | 
|                 su_job_no = #{suJobNo}, | 
|             </if> | 
|             <if | 
|                     test="(companyId!=null and companyId!='') or (companyId!='' and companyId==0)"> | 
|                 company_id = #{companyId}, | 
|             </if> | 
|             <if | 
|                     test="(suTel2!=null and suTel2!='') or (suTel2!='' and suTel2==0)"> | 
|                 su_tel2 = #{suTel2}, | 
|             </if> | 
|             <if | 
|                     test="(suAccountStatus!=null and suAccountStatus!='') or (suAccountStatus!='' and suAccountStatus==0)"> | 
|                 su_account_status = #{suAccountStatus}, | 
|             </if> | 
|             <if | 
|                     test="(suValidateCode!=null and suValidateCode!='') or (suValidateCode!='' and suValidateCode==0)"> | 
|                 su_validate_code = #{suValidateCode}, | 
|             </if> | 
|             <if | 
|                     test="suValidateEndTime!=null "> | 
|                 su_validate_end_time = #{suValidateEndTime}, | 
|             </if> | 
|             <if | 
|                     test="(suValid!=null and suValid!='') or (suValid!='' and suValid==0)"> | 
|                 su_valid = #{suValid}, | 
|             </if> | 
|             <if | 
|                     test="suBirthday!=null"> | 
|                 su_birthday = #{suBirthday}, | 
|             </if> | 
|             <if | 
|                     test="(suUuid!=null and suUuid!='') or (suUuid!='' and suUuid==0)"> | 
|                 su_uuid = #{suUuid}, | 
|             </if> | 
|             <if | 
|                     test="(suPostId!=null and suPostId!='') or (suPostId!='' and suPostId==0)"> | 
|                 su_post_id = #{suPostId}, | 
|             </if> | 
|             <if | 
|                     test="(roleIds!=null and roleIds!='') or (roleIds!='' and roleIds==0)"> | 
|                 role_ids = #{roleIds}, | 
|             </if> | 
|   | 
|             <if test="(shopId!=null and shopId!='') or (shopId!='' and shopId==0)"> | 
|                 shop_id = #{shopId}, | 
|             </if> | 
|   | 
|   | 
|             <if test="shopId != null and shopId !='' "> | 
|                 shop_id = #{shopId}, | 
|             </if> | 
|   | 
|   | 
|             <if test="degree != null and degree !='' "> | 
|                 DEGREE = #{degree}, | 
|             </if> | 
|             <if test="workExp != null and workExp !='' "> | 
|                 work_exp = #{workExp}, | 
|             </if> | 
|             <if test="entryDate != null "> | 
|                 entry_date = #{entryDate}, | 
|             </if> | 
|             <if test="emergTel != null and emergTel !='' "> | 
|                 emerg_tel = #{emergTel}, | 
|             </if> | 
|   | 
|             <if test="wxNo != null and wxNo !='' "> | 
|                 wx_no = #{wxNo}, | 
|             </if> | 
|             <if test="enName != null and enName !='' "> | 
|                 en_name = #{enName}, | 
|             </if> | 
|   | 
|             <if test="serviceSignature != null and serviceSignature !='' "> | 
|                 service_signature = #{serviceSignature}, | 
|             </if> | 
|   | 
|   | 
|             <if test="signOrder != null and signOrder !='' "> | 
|                 sign_order = #{signOrder}, | 
|             </if> | 
|             <if test="signDate != null and signDate !='' "> | 
|                 sign_date = #{signDate} | 
|             </if> | 
|             <if test="openIds != null and openIds !='' "> | 
|                 open_ids = #{openIds} | 
|             </if> | 
|   | 
|         </set> | 
|         WHERE su_id=#{suId} | 
|     </update> | 
|   | 
|     <update id="changeUserStatus"> | 
|         update sys_users set su_account_status = | 
|         #{suAccountStatus} where su_account=#{suAccount}; | 
|     </update> | 
|   | 
|     <!-- 批量删除 --> | 
|     <update id="deleteByIds" parameterType="java.util.List"> | 
|         update  sys_users set su_valid='N' where su_id in | 
|         <foreach collection="list" index="index" item="item" open="(" | 
|                  separator="," close=")"> | 
|             #{item} | 
|         </foreach> | 
|     </update> | 
|   | 
|     <!-- 根据id删除 --> | 
|     <update id="deleteById" parameterType="Long"> | 
|         update  sys_users set su_valid='N' | 
|         where su_id=#{suId} | 
|     </update> | 
|   | 
|     <!-- 根据对象删除 --> | 
|     <delete id="deleteByModel" parameterType="Long"> | 
|         DELETE FROM sys_users | 
|         <where> | 
|             <if test="record!=null"> | 
|                 <if | 
|                         test="(record.suId!=null and record.suId!='') or (record.suId!='' and record.suId==0)"> | 
|                     and su_id = #{record.suId} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suName!=null and record.suName!='') or (record.suName!='' and record.suName==0)"> | 
|                     and su_name like concat ('%',#{record.suName},'%') | 
|                 </if> | 
|                 <if | 
|                         test="(record.suTel!=null and record.suTel!='') or (record.suTel!='' and record.suTel==0)"> | 
|                     and su_tel = #{record.suTel} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suAddress!=null and record.suAddress!='') or (record.suAddress!='' and record.suAddress==0)"> | 
|                     and su_address = #{record.suAddress} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suPhoto!=null and record.suPhoto!='') or (record.suPhoto!='' and record.suPhoto==0)"> | 
|                     and su_photo = #{record.suPhoto} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suSex!=null and record.suSex!='') or (record.suSex!='' and record.suSex==0)"> | 
|                     and su_sex = #{record.suSex} | 
|                 </if> | 
|   | 
|                 <if | 
|                         test="(record.suEmail!=null and record.suEmail!='') or (record.suEmail!='' and record.suEmail==0)"> | 
|                     and su_email = #{record.suEmail} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suAccount!=null and record.suAccount!='') or (record.suAccount!='' and record.suAccount==0)"> | 
|                     and su_account = #{record.suAccount} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suPassword!=null and record.suPassword!='') or (record.suPassword!='' and record.suPassword==0)"> | 
|                     and su_password = #{record.suPassword} | 
|                 </if> | 
|                 <if | 
|                         test="record.suRegisterTime!=null"> | 
|                     and su_register_time = #{record.suRegisterTime} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suQqId!=null and record.suQqId!='') or (record.suQqId!='' and record.suQqId==0)"> | 
|                     and su_qq_id = #{record.suQqId} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suWeixinId!=null and record.suWeixinId!='') or (record.suWeixinId!='' and record.suWeixinId==0)"> | 
|                     and su_weixin_id = #{record.suWeixinId} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suGrade!=null and record.suGrade!='') or (record.suGrade!='' and record.suGrade==0)"> | 
|                     and su_grade = #{record.suGrade} | 
|                 </if> | 
|                 <if | 
|                         test="(record.parentUserId!=null and record.parentUserId!='') or (record.parentUserId!='' and record.parentUserId==0)"> | 
|                     and parent_user_id = #{record.parentUserId} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suDeptId!=null and record.suDeptId!='') or (record.suDeptId!='' and record.suDeptId==0)"> | 
|                     and su_dept_id = #{record.suDeptId} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suUserType!=null and record.suUserType!='') or (record.suUserType!='' and record.suUserType==0)"> | 
|                     and su_user_type = #{record.suUserType} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suWeiboId!=null and record.suWeiboId!='') or (record.suWeiboId!='' and record.suWeiboId==0)"> | 
|                     and su_weibo_id = #{record.suWeiboId} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suIdcard!=null and record.suIdcard!='') or (record.suIdcard!='' and record.suIdcard==0)"> | 
|                     and su_idcard = #{record.suIdcard} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suJobTitle!=null and record.suJobTitle!='') or (record.suJobTitle!='' and record.suJobTitle==0)"> | 
|                     and su_job_title = #{record.suJobTitle} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suAliases!=null and record.suAliases!='') or (record.suAliases!='' and record.suAliases==0)"> | 
|                     and su_aliases = #{record.suAliases} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suJobNo!=null and record.suJobNo!='') or (record.suJobNo!='' and record.suJobNo==0)"> | 
|                     and su_job_no = #{record.suJobNo} | 
|                 </if> | 
|                 <if | 
|                         test="(record.companyId!=null and record.companyId!='') or (record.companyId!='' and record.companyId==0)"> | 
|                     and company_id = #{record.companyId} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suTel2!=null and record.suTel2!='') or (record.suTel2!='' and record.suTel2==0)"> | 
|                     and su_tel2 = #{record.suTel2} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suAccountStatus!=null and record.suAccountStatus!='') or (record.suAccountStatus!='' and record.suAccountStatus==0)"> | 
|                     and su_account_status = #{record.suAccountStatus} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suValidateCode!=null and record.suValidateCode!='') or (record.suValidateCode!='' and record.suValidateCode==0)"> | 
|                     and su_validate_code = #{record.suValidateCode} | 
|                 </if> | 
|                 <if | 
|                         test="record.suValidateEndTime!=null"> | 
|                     and su_validate_end_time = #{record.suValidateEndTime} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suValid!=null and record.suValid!='') or (record.suValid!='' and record.suValid==0)"> | 
|                     and su_valid = #{record.suValid} | 
|                 </if> | 
|                 <if | 
|                         test="record.suBirthday!=null "> | 
|                     and su_birthday = #{record.suBirthday} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suUuid!=null and record.suUuid!='') or (record.suUuid!='' and record.suUuid==0)"> | 
|                     and su_uuid = #{record.suUuid} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suPostId!=null and record.suPostId!='') or (record.suPostId!='' and record.suPostId==0)"> | 
|                     and su_post_id = #{record.suPostId} | 
|                 </if> | 
|             </if> | 
|             <if | 
|                     test="(record.roleIds!=null and record.roleIds!='') or (record.roleIds!='' and record.roleIds==0)"> | 
|                 and role_ids = #{record.roleIds} | 
|             </if> | 
|   | 
|             <if | 
|                     test="(record.shopId!=null and record.shopId!='') or (record.shopId!='' and record.shopId==0)"> | 
|                 and shop_id = #{record.shopId} | 
|             </if> | 
|         </where> | 
|     </delete> | 
|   | 
|   | 
|     <!-- 分页查询 --> | 
|     <select id="selectInPage" resultMap="SysUsersMap"> | 
|         select *, | 
|         (SELECT IF(COUNT(1)>0,'Y','N') FROM sys_role a WHERE FIND_IN_SET(a.role_id,role_ids) AND role_remark ='是') | 
|         shopRole, | 
|         (SELECT IF(COUNT(1)>0,'Y','N') FROM sys_role a WHERE FIND_IN_SET(a.role_id,role_ids) AND customer ='是') | 
|         allCustomer, | 
|         (select GROUP_CONCAT(role_name separator ',') from sys_role where find_in_set(role_id,role_ids) ) roleName, | 
|         (select com_name from sys_company where com_id=company_id) as company_name, | 
|         (select shop_name from sys_shop_info where shop_id=id) as SHOP_NAME | 
|         from sys_users | 
|         <where> | 
|             <if test="record!=null"> | 
|                 <if | 
|                         test="(record.suId!=null and record.suId!='') or (record.suId!='' and record.suId==0)"> | 
|                     and su_id = #{record.suId} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suName!=null and record.suName!='') or (record.suName!='' and record.suName==0)"> | 
|                     and su_name like concat('%',#{record.suName},'%') | 
|                 </if> | 
|                 <if | 
|                         test="(record.suTel!=null and record.suTel!='') or (record.suTel!='' and record.suTel==0)"> | 
|                     and su_tel = #{record.suTel} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suAddress!=null and record.suAddress!='') or (record.suAddress!='' and record.suAddress==0)"> | 
|                     and su_address = #{record.suAddress} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suPhoto!=null and record.suPhoto!='') or (record.suPhoto!='' and record.suPhoto==0)"> | 
|                     and su_photo = #{record.suPhoto} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suSex!=null and record.suSex!='') or (record.suSex!='' and record.suSex==0)"> | 
|                     and su_sex = #{record.suSex} | 
|                 </if> | 
|   | 
|                 <if | 
|                         test="(record.suEmail!=null and record.suEmail!='') or (record.suEmail!='' and record.suEmail==0)"> | 
|                     and su_email = #{record.suEmail} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suAccount!=null and record.suAccount!='') or (record.suAccount!='' and record.suAccount==0)"> | 
|                     and su_account = #{record.suAccount} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suPassword!=null and record.suPassword!='') or (record.suPassword!='' and record.suPassword==0)"> | 
|                     and su_password = #{record.suPassword} | 
|                 </if> | 
|                 <if | 
|                         test="record.suRegisterTime!=null"> | 
|                     and su_register_time = #{record.suRegisterTime} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suQqId!=null and record.suQqId!='') or (record.suQqId!='' and record.suQqId==0)"> | 
|                     and su_qq_id = #{record.suQqId} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suWeixinId!=null and record.suWeixinId!='') or (record.suWeixinId!='' and record.suWeixinId==0)"> | 
|                     and su_weixin_id = #{record.suWeixinId} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suGrade!=null and record.suGrade!='') or (record.suGrade!='' and record.suGrade==0)"> | 
|                     and su_grade = #{record.suGrade} | 
|                 </if> | 
|                 <if | 
|                         test="(record.parentUserId!=null and record.parentUserId!='') or (record.parentUserId!='' and record.parentUserId==0)"> | 
|                     and parent_user_id = #{record.parentUserId} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suDeptId!=null and record.suDeptId!='') or (record.suDeptId!='' and record.suDeptId==0)"> | 
|                     and su_dept_id = #{record.suDeptId} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suUserType!=null and record.suUserType!='') or (record.suUserType!='' and record.suUserType==0)"> | 
|                     and su_user_type = #{record.suUserType} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suWeiboId!=null and record.suWeiboId!='') or (record.suWeiboId!='' and record.suWeiboId==0)"> | 
|                     and su_weibo_id = #{record.suWeiboId} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suIdcard!=null and record.suIdcard!='') or (record.suIdcard!='' and record.suIdcard==0)"> | 
|                     and su_idcard = #{record.suIdcard} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suJobTitle!=null and record.suJobTitle!='') or (record.suJobTitle!='' and record.suJobTitle==0)"> | 
|                     and su_job_title = #{record.suJobTitle} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suAliases!=null and record.suAliases!='') or (record.suAliases!='' and record.suAliases==0)"> | 
|                     and su_aliases = #{record.suAliases} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suJobNo!=null and record.suJobNo!='') or (record.suJobNo!='' and record.suJobNo==0)"> | 
|                     and su_job_no = #{record.suJobNo} | 
|                 </if> | 
|                 <if   test="(record.companyId!=null and record.companyId!='') or (record.companyId!='' and record.companyId==0)"> | 
|                     and company_id = #{record.companyId} | 
|                 </if> | 
|                 <if test="record.shopId != null and record.shopId !='' "> | 
|                     and shop_id = #{record.shopId} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suTel2!=null and record.suTel2!='') or (record.suTel2!='' and record.suTel2==0)"> | 
|                     and su_tel2 = #{record.suTel2} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suAccountStatus!=null and record.suAccountStatus!='') or (record.suAccountStatus!='' and record.suAccountStatus==0)"> | 
|                     and su_account_status = #{record.suAccountStatus} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suValidateCode!=null and record.suValidateCode!='') or (record.suValidateCode!='' and record.suValidateCode==0)"> | 
|                     and su_validate_code = #{record.suValidateCode} | 
|                 </if> | 
|                 <if | 
|                         test="record.suValidateEndTime!=null"> | 
|                     and su_validate_end_time = #{record.suValidateEndTime} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suValid!=null and record.suValid!='') or (record.suValid!='' and record.suValid==0)"> | 
|                     and su_valid = #{record.suValid} | 
|                 </if> | 
|                 <if | 
|                         test="record.suBirthday!=null "> | 
|                     and su_birthday = #{record.suBirthday} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suUuid!=null and record.suUuid!='') or (record.suUuid!='' and record.suUuid==0)"> | 
|                     and su_uuid = #{record.suUuid} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suPostId!=null and record.suPostId!='') or (record.suPostId!='' and record.suPostId==0)"> | 
|                     and su_post_id = #{record.suPostId} | 
|                 </if> | 
|             </if> | 
|         </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_users | 
|         <where> | 
|             <if test="record!=null"> | 
|                 <if | 
|                         test="(record.suId!=null and record.suId!='') or (record.suId!='' and record.suId==0)"> | 
|                     and su_id = #{record.suId} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suName!=null and record.suName!='') or (record.suName!='' and record.suName==0)"> | 
|                     and su_name like concat('%',#{record.suName},'%') | 
|                 </if> | 
|                 <if | 
|                         test="(record.suTel!=null and record.suTel!='') or (record.suTel!='' and record.suTel==0)"> | 
|                     and su_tel = #{record.suTel} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suAddress!=null and record.suAddress!='') or (record.suAddress!='' and record.suAddress==0)"> | 
|                     and su_address = #{record.suAddress} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suPhoto!=null and record.suPhoto!='') or (record.suPhoto!='' and record.suPhoto==0)"> | 
|                     and su_photo = #{record.suPhoto} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suSex!=null and record.suSex!='') or (record.suSex!='' and record.suSex==0)"> | 
|                     and su_sex = #{record.suSex} | 
|                 </if> | 
|   | 
|                 <if | 
|                         test="(record.suEmail!=null and record.suEmail!='') or (record.suEmail!='' and record.suEmail==0)"> | 
|                     and su_email = #{record.suEmail} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suAccount!=null and record.suAccount!='') or (record.suAccount!='' and record.suAccount==0)"> | 
|                     and su_account =#{record.suAccount} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suPassword!=null and record.suPassword!='') or (record.suPassword!='' and record.suPassword==0)"> | 
|                     and su_password = #{record.suPassword} | 
|                 </if> | 
|                 <if | 
|                         test="record.suRegisterTime!=null"> | 
|                     and su_register_time = #{record.suRegisterTime} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suQqId!=null and record.suQqId!='') or (record.suQqId!='' and record.suQqId==0)"> | 
|                     and su_qq_id = #{record.suQqId} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suWeixinId!=null and record.suWeixinId!='') or (record.suWeixinId!='' and record.suWeixinId==0)"> | 
|                     and su_weixin_id = #{record.suWeixinId} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suGrade!=null and record.suGrade!='') or (record.suGrade!='' and record.suGrade==0)"> | 
|                     and su_grade = #{record.suGrade} | 
|                 </if> | 
|                 <if | 
|                         test="(record.parentUserId!=null and record.parentUserId!='') or (record.parentUserId!='' and record.parentUserId==0)"> | 
|                     and parent_user_id = #{record.parentUserId} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suDeptId!=null and record.suDeptId!='') or (record.suDeptId!='' and record.suDeptId==0)"> | 
|                     and su_dept_id = #{record.suDeptId} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suUserType!=null and record.suUserType!='') or (record.suUserType!='' and record.suUserType==0)"> | 
|                     and su_user_type = #{record.suUserType} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suWeiboId!=null and record.suWeiboId!='') or (record.suWeiboId!='' and record.suWeiboId==0)"> | 
|                     and su_weibo_id = #{record.suWeiboId} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suIdcard!=null and record.suIdcard!='') or (record.suIdcard!='' and record.suIdcard==0)"> | 
|                     and su_idcard = #{record.suIdcard} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suJobTitle!=null and record.suJobTitle!='') or (record.suJobTitle!='' and record.suJobTitle==0)"> | 
|                     and su_job_title = #{record.suJobTitle} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suAliases!=null and record.suAliases!='') or (record.suAliases!='' and record.suAliases==0)"> | 
|                     and su_aliases = #{record.suAliases} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suJobNo!=null and record.suJobNo!='') or (record.suJobNo!='' and record.suJobNo==0)"> | 
|                     and su_job_no = #{record.suJobNo} | 
|                 </if> | 
|                 <if | 
|                         test="(record.companyId!=null and record.companyId!='') or (record.companyId!='' and record.companyId==0)"> | 
|                     and company_id = #{record.companyId} | 
|                 </if> | 
|                 <if test="record.shopId != null and record.shopId !='' "> | 
|                     and shop_id = #{record.shopId} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suTel2!=null and record.suTel2!='') or (record.suTel2!='' and record.suTel2==0)"> | 
|                     and su_tel2 = #{record.suTel2} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suAccountStatus!=null and record.suAccountStatus!='') or (record.suAccountStatus!='' and record.suAccountStatus==0)"> | 
|                     and su_account_status = #{record.suAccountStatus} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suValidateCode!=null and record.suValidateCode!='') or (record.suValidateCode!='' and record.suValidateCode==0)"> | 
|                     and su_validate_code = #{record.suValidateCode} | 
|                 </if> | 
|                 <if | 
|                         test="record.suValidateEndTime!=null "> | 
|                     and su_validate_end_time = #{record.suValidateEndTime} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suValid!=null and record.suValid!='') or (record.suValid!='' and record.suValid==0)"> | 
|                     and su_valid = #{record.suValid} | 
|                 </if> | 
|                 <if | 
|                         test="record.suBirthday!=null "> | 
|                     and su_birthday = #{record.suBirthday} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suUuid!=null and record.suUuid!='') or (record.suUuid!='' and record.suUuid==0)"> | 
|                     and su_uuid = #{record.suUuid} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suPostId!=null and record.suPostId!='') or (record.suPostId!='' and record.suPostId==0)"> | 
|                     and su_post_id = #{record.suPostId} | 
|                 </if> | 
|             </if> | 
|         </where> | 
|     </select> | 
|   | 
|     <!-- 根据id查询 --> | 
|     <select id="selectById" resultMap="SysUsersMap"> | 
|         select *, | 
|         (SELECT IF(COUNT(1)>0,'Y','N') FROM sys_role a WHERE FIND_IN_SET(a.role_id,role_ids) AND role_remark ='是') shopRole, | 
|                (SELECT IF(COUNT(1)>0,'Y','N') FROM sys_role a WHERE FIND_IN_SET(a.role_id,role_ids) AND customer ='是') | 
|                    allCustomer, | 
|         (select GROUP_CONCAT(role_name separator ',') from sys_role where find_in_set(role_id,role_ids) ) roleName, | 
|         role_ids | 
|         from sys_users | 
|         where su_id=#{suId} | 
|     </select> | 
|   | 
|   | 
|     <!-- 根据对象查询 --> | 
|     <select id="selectByModel" resultMap="SysUsersMap"> | 
|         select *, | 
|         (SELECT IF(COUNT(1)>0,'Y','N') FROM sys_role a WHERE FIND_IN_SET(a.role_id,role_ids) AND role_remark ='是') | 
|         shopRole, | 
|         (SELECT IF(COUNT(1)>0,'Y','N') FROM sys_role a WHERE FIND_IN_SET(a.role_id,role_ids) AND customer ='是') | 
|         allCustomer, | 
|         (select GROUP_CONCAT(role_name separator ',') from sys_role where find_in_set(role_id,role_ids) ) roleName, | 
|         role_ids | 
|         from sys_users | 
|         <where> | 
|             <if test="record!=null"> | 
|                 <if | 
|                         test="(record.suId!=null and record.suId!='') or (record.suId!='' and record.suId==0)"> | 
|                     and su_id = #{record.suId} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suName!=null and record.suName!='') or (record.suName!='' and record.suName==0)"> | 
|                     and (su_name like concat('%',concat(#{record.suName},'%')) or su_tel = #{record.suName}) | 
|                 </if> | 
|                 <if | 
|                         test="(record.suTel!=null and record.suTel!='') or (record.suTel!='' and record.suTel==0)"> | 
|                     and su_tel = #{record.suTel} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suAddress!=null and record.suAddress!='') or (record.suAddress!='' and record.suAddress==0)"> | 
|                     and su_address = #{record.suAddress} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suPhoto!=null and record.suPhoto!='') or (record.suPhoto!='' and record.suPhoto==0)"> | 
|                     and su_photo = #{record.suPhoto} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suSex!=null and record.suSex!='') or (record.suSex!='' and record.suSex==0)"> | 
|                     and su_sex = #{record.suSex} | 
|                 </if> | 
|   | 
|                 <if | 
|                         test="(record.suEmail!=null and record.suEmail!='') or (record.suEmail!='' and record.suEmail==0)"> | 
|                     and su_email = #{record.suEmail} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suAccount!=null and record.suAccount!='') or (record.suAccount!='' and record.suAccount==0)"> | 
|                     and su_account = #{record.suAccount} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suPassword!=null and record.suPassword!='') or (record.suPassword!='' and record.suPassword==0)"> | 
|                     and su_password = #{record.suPassword} | 
|                 </if> | 
|                 <if | 
|                         test="record.suRegisterTime!=null "> | 
|                     and su_register_time = #{record.suRegisterTime} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suQqId!=null and record.suQqId!='') or (record.suQqId!='' and record.suQqId==0)"> | 
|                     and su_qq_id = #{record.suQqId} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suWeixinId!=null and record.suWeixinId!='') or (record.suWeixinId!='' and record.suWeixinId==0)"> | 
|                     and su_weixin_id = #{record.suWeixinId} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suGrade!=null and record.suGrade!='') or (record.suGrade!='' and record.suGrade==0)"> | 
|                     and su_grade = #{record.suGrade} | 
|                 </if> | 
|                 <if | 
|                         test="(record.parentUserId!=null and record.parentUserId!='') or (record.parentUserId!='' and record.parentUserId==0)"> | 
|                     and parent_user_id = #{record.parentUserId} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suDeptId!=null and record.suDeptId!='') or (record.suDeptId!='' and record.suDeptId==0)"> | 
|                     and su_dept_id = #{record.suDeptId} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suUserType!=null and record.suUserType!='') or (record.suUserType!='' and record.suUserType==0)"> | 
|                     and su_user_type = #{record.suUserType} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suWeiboId!=null and record.suWeiboId!='') or (record.suWeiboId!='' and record.suWeiboId==0)"> | 
|                     and su_weibo_id = #{record.suWeiboId} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suIdcard!=null and record.suIdcard!='') or (record.suIdcard!='' and record.suIdcard==0)"> | 
|                     and su_idcard = #{record.suIdcard} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suJobTitle!=null and record.suJobTitle!='') or (record.suJobTitle!='' and record.suJobTitle==0)"> | 
|                     and su_job_title = #{record.suJobTitle} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suAliases!=null and record.suAliases!='') or (record.suAliases!='' and record.suAliases==0)"> | 
|                     and su_aliases = #{record.suAliases} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suJobNo!=null and record.suJobNo!='') or (record.suJobNo!='' and record.suJobNo==0)"> | 
|                     and su_job_no = #{record.suJobNo} | 
|                 </if> | 
|   | 
|                 <if | 
|                         test="(record.companyId!=null and record.companyId!='') or (record.companyId!='' and record.companyId==0)"> | 
|                     and company_id = #{record.companyId} | 
|                 </if> | 
|                 <if test="record.shopId != null and record.shopId !='' "> | 
|                     and shop_id = #{record.shopId} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suTel2!=null and record.suTel2!='') or (record.suTel2!='' and record.suTel2==0)"> | 
|                     and su_tel2 = #{record.suTel2} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suAccountStatus!=null and record.suAccountStatus!='') or (record.suAccountStatus!='' and record.suAccountStatus==0)"> | 
|                     and su_account_status = #{record.suAccountStatus} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suValidateCode!=null and record.suValidateCode!='') or (record.suValidateCode!='' and record.suValidateCode==0)"> | 
|                     and su_validate_code = #{record.suValidateCode} | 
|                 </if> | 
|                 <if | 
|                         test="record.suValidateEndTime!=null "> | 
|                     and su_validate_end_time = #{record.suValidateEndTime} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suValid!=null and record.suValid!='') or (record.suValid!='' and record.suValid==0)"> | 
|                     and su_valid = #{record.suValid} | 
|                 </if> | 
|                 <if | 
|                         test="record.suBirthday!=null "> | 
|                     and su_birthday = #{record.suBirthday} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suUuid!=null and record.suUuid!='') or (record.suUuid!='' and record.suUuid==0)"> | 
|                     and su_uuid = #{record.suUuid} | 
|                 </if> | 
|                 <if | 
|                         test="(record.suPostId!=null and record.suPostId!='') or (record.suPostId!='' and record.suPostId==0)"> | 
|                     and su_post_id = #{record.suPostId} | 
|                 </if> | 
|   | 
|             </if> | 
|         </where> | 
|     </select> | 
|   | 
|     <!-- 查询当天的登录错误次数 --> | 
|     <select id="countUserTodayErrorLoginTimes" | 
|             resultType="java.lang.Integer"> | 
|         select | 
|         count(*) from sys_user_login_record | 
|         where | 
|         user_account=#{suAccount} and | 
|         lr_result=2 and lr_valid='Y' and | 
|         date(lr_login_time) =curdate(); | 
|     </select> | 
|   | 
|     <update id="cleanUserTodayErrorLoginTime"> | 
|         update sys_user_login_record set update_time=now() | 
|         ,lr_valid='N' | 
|         where user_account=#{suAccount} and lr_result=2 and | 
|         lr_valid='Y' and | 
|         date(lr_login_time) =curdate(); | 
|     </update> | 
|   | 
|     <insert id="insertLoginRecord" | 
|             parameterType="com.matrix.system.common.bean.SysUserLoginRecord"> | 
|         insert into | 
|         sys_user_login_record ( | 
|         create_by, | 
|         create_time, | 
|         update_by, | 
|         update_time, | 
|         lr_id, | 
|         user_account, | 
|         lr_result, | 
|         lr_remark, | 
|         lr_ip, | 
|         lr_login_time, | 
|         lr_valid | 
|         )VALUES ( | 
|         #{createBy}, | 
|         now(), | 
|         #{updateBy}, | 
|         now(), | 
|         #{lrId}, | 
|         #{userAccount}, | 
|         #{lrResult}, | 
|         #{lrRemark}, | 
|         #{lrIp}, | 
|         #{lrLoginTime}, | 
|         #{lrValid}) | 
|     </insert> | 
|     <resultMap | 
|             type="com.matrix.system.common.bean.SysUserLoginRecord" | 
|             id="SysUserLoginRecordMap"> | 
|         <id property="lrId" column="lr_id"/> | 
|         <result property="userAccount" column="user_account"/> | 
|         <result property="lrResult" column="lr_result"/> | 
|         <result property="lrIp" column="lr_ip"/> | 
|         <result property="lrLoginTime" column="lr_login_time"/> | 
|     </resultMap> | 
|     <select id="selectLoginRecordList" | 
|             resultMap="SysUserLoginRecordMap"> | 
|         select * from sys_user_login_record | 
|         <where> | 
|             <if test="record!=null"> | 
|                 <if | 
|                         test="(record.userAccount!=null and  record.userAccount!='' )"> | 
|                     and user_account=#{record.userAccount} | 
|                 </if> | 
|                 <if test="(record.beginTime!=null  )"> | 
|                     and lrLoginTime <![CDATA[ > ]]> | 
|                     #{record.beginTime} | 
|                 </if> | 
|                 <if test="(record.endTime!=null  )"> | 
|                     and lrLoginTime <![CDATA[ < ]]> | 
|                     #{record.endTime} | 
|                 </if> | 
|             </if> | 
|         </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="selectLoginRecordTotal" | 
|             resultType="java.lang.Integer"> | 
|         select count(*) from sys_user_login_record | 
|         <where> | 
|             <if test="record!=null"> | 
|                 <if | 
|                         test="(record.userAccount!=null and  record.userAccount!='' )"> | 
|                     and user_account=#{record.userAccount} | 
|                 </if> | 
|                 <if test="(record.beginTime!=null  )"> | 
|                     and lrLoginTime <![CDATA[ > ]]> | 
|                     #{record.beginTime} | 
|                 </if> | 
|                 <if test="(record.endTime!=null  )"> | 
|                     and lrLoginTime <![CDATA[ < ]]> | 
|                     #{record.endTime} | 
|                 </if> | 
|             </if> | 
|         </where> | 
|     </select> | 
|   | 
|   | 
|     <update id="updateUserPassword" parameterType="java.util.HashMap"> | 
|         update sys_users set su_password = #{suPassword} where su_id = #{suId} | 
|     </update> | 
|   | 
|   | 
|     <!-- 查询空闲的美疗师--> | 
|     <select id="findByCodeBeaStateShop" resultMap="SysUsersMap"> | 
|         SELECT | 
|         DISTINCT | 
|         b.su_id, | 
|         b.su_name, | 
|         b.su_photo | 
|         FROM | 
|         sys_work_beatuistaff a | 
|         LEFT JOIN sys_users b ON a.STAFF_ID = b.su_id | 
|         WHERE | 
|           a.SHOP_ID =#{shopId} | 
|         AND a.PAIBAN_CODE =#{codes} | 
|         AND a.STAFF_ID NOT IN ( | 
|         SELECT | 
|         STAFF_ID | 
|         FROM | 
|         sys_beautician_state | 
|         WHERE | 
|         SERVICES_ID <![CDATA[<>]]> #{beaState.servicesId} | 
|         AND | 
|         (STATE='服务中' OR STATE='已预约') | 
|         AND | 
|         ( | 
|         #{beaState.beginTime} BETWEEN BEGIN_TIME AND END_TIME | 
|         OR | 
|         #{beaState.endTime} BETWEEN BEGIN_TIME     AND END_TIME | 
|         OR | 
|         BEGIN_TIME BETWEEN #{beaState.beginTime} AND #{beaState.endTime} | 
|         OR | 
|         END_TIME  BETWEEN #{beaState.beginTime} AND #{beaState.endTime} | 
|         ) | 
|         ) | 
|     </select> | 
|   | 
|     <!-- 查询空闲的美疗师 数量--> | 
|     <select id="findByCodeBeaStateShopCount" resultType="java.lang.Integer"> | 
|         SELECT count(DISTINCT b.su_id) | 
|   | 
|         FROM | 
|         sys_work_beatuistaff a | 
|         LEFT JOIN sys_users b ON a.STAFF_ID = b.su_id | 
|         WHERE | 
|         b.su_valid ='Y' AND | 
|         a.SHOP_ID =#{shopId} | 
|         AND | 
|         <foreach collection="codes" index="index" item="item" open="(" | 
|                  separator="OR" close=")"> | 
|             a.PAIBAN_CODE =#{item} | 
|         </foreach> | 
|         AND a.STAFF_ID NOT IN ( | 
|         SELECT | 
|         STAFF_ID | 
|         FROM | 
|         sys_beautician_state | 
|         WHERE | 
|         (STATE='服务中' OR STATE='已预约') | 
|         AND | 
|         ( | 
|         #{projService.startTime} BETWEEN BEGIN_TIME AND END_TIME | 
|         OR | 
|         #{projService.endTime} BETWEEN BEGIN_TIME AND END_TIME | 
|         OR | 
|         BEGIN_TIME BETWEEN #{projService.startTime} AND #{projService.endTime} | 
|         OR | 
|         END_TIME BETWEEN #{projService.startTime} AND #{projService.endTime} | 
|         ) | 
|         ) | 
|     </select> | 
|   | 
|   | 
|     <select id="selectByRoleName" resultMap="SysUsersMap"> | 
|   | 
|         SELECT | 
|         distinct a.* | 
|         FROM | 
|         sys_users a | 
|         LEFT JOIN sys_role r ON FIND_IN_SET(r.role_id, a.role_ids) | 
|   | 
|         WHERE a.su_user_type = 'employee' and a.su_valid='Y' | 
|   | 
|         and a.company_id = #{users.companyId} | 
|   | 
|   | 
|         <if test="users.roleName !=null and users.roleName !=''"> | 
|             and r.role_name LIKE CONCAT('%',#{users.roleName},'%') | 
|         </if> | 
|   | 
|         <if test="users.shopId !=null and users.shopId !=''"> | 
|             AND a.SHOP_ID = #{users.shopId} | 
|         </if> | 
|         ORDER BY | 
|         a.SIGN_ORDER IS NULL, | 
|         a.SIGN_ORDER | 
|   | 
|     </select> | 
|   | 
|     <!-- 获取当天签到的最大数 --> | 
|     <select id="selectMaxSignOrder" resultType="java.lang.Integer"> | 
|      select SIGN_ORDER as SIGN_ORDER from sys_users | 
|      where sign_date=current_date() | 
|      and shop_id =#{shopId} | 
|      order by sign_order desc | 
|      limit 0,1 | 
|    </select> | 
|     <!-- 不是当天的,签到和签到时间清空 --> | 
|     <update id="setOldSignDateNull" parameterType="java.lang.Integer"> | 
|    update sys_users | 
|    set sign_order=null ,sign_date=null | 
|    where sign_date!=current_date() | 
|     and shop_id =#{shopId} | 
|    </update> | 
|   | 
|     <update id="emptySignInfoById" parameterType="java.lang.Long"> | 
|    update sys_users | 
|    set sign_order=null ,sign_date=null | 
|    where id=#{id} | 
|    </update> | 
|   | 
|     <select id="selectAppVersion" resultType="com.matrix.system.hive.bean.AppVersion"> | 
|         select * from app_version | 
|     </select> | 
|   | 
|     <select id="selectUserByOpenId" resultMap="SysUsersMap"> | 
|         select *, | 
|         (select GROUP_CONCAT(role_name separator ',') from sys_role where find_in_set(role_id,role_ids) ) roleName | 
|         from sys_users where find_in_set(#{openId}, open_ids) | 
|         <if test="companyId != null"> | 
|             and company_id=#{companyId} | 
|         </if> | 
|     </select> | 
|   | 
| </mapper> |