Helius
2021-06-16 4e51778362c2130598a4c73ec4cebe6629dbc53f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?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&lt;= 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&lt;=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>