<?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.xzx.gc.role.mapper.CoreUserMapper"> 
 | 
    <select id="getUserByRole"   resultType="com.xzx.gc.entity.CoreUser"> 
 | 
         select u.* from core_user u,sys_role  r,core_user_role ur 
 | 
           where r.code= #{roleCode} and r.ID=ur.ROLE_ID and ur.USER_ID=u.ID 
 | 
    </select> 
 | 
    <select id="queryByCondtion" resultType="com.xzx.gc.role.model.CoreUserModel"> 
 | 
        select 
 | 
        u.id,u.code,u.name,u.password,u.create_time,u.org_id,u.state, 
 | 
        u.job_type1,u.job_type0,u.del_flag,u.update_time,u.attachment_id, 
 | 
        o.name org_name 
 | 
        from core_user u left join core_org o on u.org_id=o.id where 1=1 and u.del_flag = 0 
 | 
        <if test="orgId != null and orgId != ''"> 
 | 
            and u.org_id =#{orgId} 
 | 
        </if> 
 | 
        <if test="code != null and code != ''"> 
 | 
            and u.code like concat("%",#{code},"%") 
 | 
        </if> 
 | 
        <if test="name != null and name != ''"> 
 | 
            and u.name like concat("%",#{name},"%") 
 | 
        </if> 
 | 
        <if test="state != null and state != ''"> 
 | 
            and u.state = #{state} 
 | 
        </if> 
 | 
        <if test="jobType0 != null and jobType0 != ''"> 
 | 
            and u.job_type0= #{jobType0} 
 | 
        </if> 
 | 
        <if test="jobType1 != null and jobType1 != ''"> 
 | 
            and u.job_type1= #{jobType1} 
 | 
        </if> 
 | 
        <if test="startTime != null and startTime != ''"> 
 | 
            and u.create_time>= str_to_date(#{startTime},"%Y-%m-%d") 
 | 
        </if> 
 | 
        <if test="endTime != null and endTime != ''"> 
 | 
            and u.create_time<= str_to_date(#{endTime},"%Y-%m-%d") 
 | 
        </if> 
 | 
        union all 
 | 
        select a.id,a.account_no as code,a.partner_name as 
 | 
        name,a.password,a.create_time,a.org_id,a.state,a.job_type1,a.job_type0,a.del_flag, 
 | 
        a.update_time,a.attachment_id,o.name org_name from xzx_city_partner a 
 | 
        left join core_org o on a.org_id=o.id where 1=1 and a.del_flag = 0 
 | 
        <if test="orgId != null and orgId != ''"> 
 | 
            and a.org_id =#{orgId} 
 | 
        </if> 
 | 
        <if test="code != null and code != ''"> 
 | 
            and a.account_no like concat("%",#{code},"%") 
 | 
        </if> 
 | 
        <if test="name != null and name != ''"> 
 | 
            and a.partner_name like concat("%",#{name},"%") 
 | 
        </if> 
 | 
        <if test="state != null and state != ''"> 
 | 
            and a.state = #{state} 
 | 
        </if> 
 | 
        <if test="jobType0 != null and jobType0 != ''"> 
 | 
            and a.job_type0= #{jobType0} 
 | 
        </if> 
 | 
        <if test="jobType1 != null and jobType1 != ''"> 
 | 
            and a.job_type1= #{jobType1} 
 | 
        </if> 
 | 
        <if test="startTime != null and startTime != ''"> 
 | 
            and a.create_time>= str_to_date(#{startTime},"%Y-%m-%d") 
 | 
        </if> 
 | 
        <if test="endTime != null and endTime != ''"> 
 | 
            and a.create_time<=str_to_date(#{endTime},"%Y-%m-%d") 
 | 
        </if> 
 | 
    </select> 
 | 
    <delete id="batchDelUserByIds"> 
 | 
        update core_user set del_flag = 1 where id in 
 | 
        <foreach collection="ids" index="index" item="id" separator="," open="(" close=")"> 
 | 
            #{id} 
 | 
        </foreach> 
 | 
    </delete> 
 | 
</mapper> 
 | 
     
 | 
     
 | 
     
 | 
     
 | 
     
 |