ludc
2023-07-12 18997e6de96f7be5b55a94168c80103e6363cb0e
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?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.vci.ubcs.system.mapper.StrategyMapper">
 
    <resultMap type="com.vci.ubcs.system.entity.Strategy" id="StrategyMap">
        <result property="id" column="ID" jdbcType="VARCHAR"/>
        <result property="strategyName" column="STRATEGY_NAME" jdbcType="VARCHAR"/>
        <result property="minPwdLen" column="MIN_PWD_LEN" jdbcType="VARCHAR"/>
        <result property="maxPwdLen" column="MAX_PWD_LEN" jdbcType="VARCHAR"/>
        <result property="combinationIds" column="COMBINATION_IDS" jdbcType="VARCHAR"/>
        <result property="requiredType" column="REQUIRED_TYPE" jdbcType="VARCHAR"/>
        <result property="expirationTime" column="EXPIRATION_TIME" jdbcType="TIMESTAMP"/>
        <result property="reminderTime" column="REMINDER_TIME" jdbcType="TIMESTAMP"/>
        <result property="lockingNum" column="LOCKING_NUM" jdbcType="VARCHAR"/>
        <result property="lockingTime" column="LOCKING_TIME" jdbcType="TIMESTAMP"/>
        <result property="desc" column="DESC" jdbcType="VARCHAR"/>
        <result property="isDefault" column="IS_DEFAULT" jdbcType="VARCHAR"/>
        <result property="createTime" column="CREATE_TIME" jdbcType="TIMESTAMP"/>
        <result property="createUser" column="CREATE_USER" jdbcType="TIMESTAMP"/>
        <result property="updateTime" column="UPDATE_TIME" jdbcType="TIMESTAMP"/>
        <result property="updateUser" column="UPDATE_USER" jdbcType="TIMESTAMP"/>
        <result property="combinationNames" column="COMBINATIONNAMES"/>
    </resultMap>
 
    <!--查询指定行数据-->
    <select id="queryAllByPage" resultMap="StrategyMap">
        select pss.*,
               (SELECT listagg(psc.NAME,',') within GROUP(ORDER BY psc.NAME asc)
                from PL_SYS_COMBINATION psc
                where instr(pss.COMBINATION_IDS,psc.ID) > 0) COMBINATIONNAMES
        from PL_SYS_PWDSTRATEGY pss
    </select>
 
    <!--统计总行数-->
    <select id="count" resultType="java.lang.Long">
        select count(1)
        from PL_SYS_PWDSTRATEGY
        <where>
            <if test="id != null and id != ''">
                and ID = #{id}
            </if>
            <if test="strategyName != null and strategyName != ''">
                and STRATEGY_NAME = #{strategyName}
            </if>
            <if test="minPwdLen != null and minPwdLen != ''">
                and MIN_PWD_LEN = #{minPwdLen}
            </if>
            <if test="maxPwdLen != null and maxPwdLen != ''">
                and MAX_PWD_LEN = #{maxPwdLen}
            </if>
            <if test="combination  != null and combination  != ''">
                and COMBINATION  = #{combination }
            </if>
            <if test="requiredType != null and requiredType != ''">
                and REQUIRED_TYPE = #{requiredType}
            </if>
            <if test="expirationTime != null">
                and EXPIRATION_TIME = #{expirationTime}
            </if>
            <if test="reminderTime != null">
                and REMINDER_TIME = #{reminderTime}
            </if>
            <if test="lockingNum != null and lockingNum != ''">
                and LOCKING_NUM = #{lockingNum}
            </if>
            <if test="lockingTime != null">
                and LOCKING_TIME = #{lockingTime}
            </if>
            <if test="desc != null and desc != ''">
                and DESC = #{desc}
            </if>
            <if test="isDefault != null and isDefault != ''">
                and IS_DEFAULT = #{isDefault}
            </if>
            <if test="createDate != null">
                and CREATE_DATE = #{createDate}
            </if>
            <if test="createUser != null">
                and CREATE_USER = #{createUser}
            </if>
            <if test="updateDate != null">
                and UPDATE_DATE = #{updateDate}
            </if>
            <if test="updateUser != null">
                and UPDATE_USER = #{updateUser}
            </if>
        </where>
    </select>
 
 
    <select id="queryByNameAndTenantId" resultMap="StrategyMap">
        SELECT PSS.*,(SELECT listagg(psc.NAME,',') within GROUP(ORDER BY psc.NAME asc)
                      from PL_SYS_COMBINATION psc
                      where instr(pss.COMBINATION_IDS,psc.ID) > 0) COMBINATIONNAMES
        FROM PL_SYS_PWDSTRATEGY PSS
              LEFT JOIN PL_SYS_USER_PWDSTRATEGY PSUP ON PSS.ID=PSUP.PWDSTRATEGY_ID
              LEFT JOIN PL_ORG_USER POU ON POU.ID=PSUP.USER_ID
        WHERE POU.TENANT_ID = #{tenantId} AND POU.ACCOUNT=#{name} AND POU.IS_DELETED = 0;
    </select>
 
    <select id="queryByUserId" resultMap="StrategyMap">
        SELECT PSS.*,(SELECT listagg(psc.NAME,',') within GROUP(ORDER BY psc.NAME asc)
                      from PL_SYS_COMBINATION psc
                      where instr(pss.COMBINATION_IDS,psc.ID) > 0) COMBINATIONNAMES
        FROM PL_SYS_PWDSTRATEGY PSS LEFT JOIN PL_SYS_USER_PWDSTRATEGY PSUP ON PSS.ID=psup.PWDSTRATEGY_ID
        WHERE PSUP.USER_ID = #{userId}
    </select>
 
    <select id="queryByIsDefault" resultType="com.vci.ubcs.system.entity.Strategy">
        SELECT PSS.*,(SELECT listagg(psc.NAME,',') within GROUP(ORDER BY psc.NAME asc)
                      FROM PL_SYS_COMBINATION psc
                      WHERE instr(pss.COMBINATION_IDS, psc.ID) > 0) COMBINATIONNAMES
        FROM PL_SYS_PWDSTRATEGY PSS
        WHERE is_default = 1
    </select>
 
</mapper>