ludc
2023-06-13 5569ff5c185797bb159ea2c58a52a92815e18db9
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
<?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.CombinationMapper">
 
    <resultMap type="com.vci.ubcs.system.entity.Combination" id="CombinationMap">
        <result property="id" column="ID" jdbcType="VARCHAR"/>
        <result property="name" column="NAME" jdbcType="VARCHAR"/>
        <result property="desc" column="DESC" jdbcType="VARCHAR"/>
        <result property="createTime" column="CREATETIME" jdbcType="TIMESTAMP"/>
        <result property="createUser" column="CREATEUSER" jdbcType="VARCHAR"/>
        <result property="updateTime" column="UPDATETIME" jdbcType="TIMESTAMP"/>
        <result property="updateUser" column="UPDATEUSER" jdbcType="VARCHAR"/>
        <result property="licensors" column="LICENSORS" jdbcType="VARCHAR"/>
    </resultMap>
 
    <!--查询单个-->
    <select id="queryById" resultMap="CombinationMap">
        select ID,
               NAME, DESC, CREATETIME, CREATEUSER, UPDATETIME, UPDATEUSER, LICENSORS
        from PL_SYS_COMBINATION
        where ID = #{id}
    </select>
 
    <!--统计总行数-->
    <select id="count" resultType="java.lang.Long">
        select count(1)
        from PL_SYS_COMBINATION
        <where>
            <if test="id != null and id != ''">
                and ID = #{id}
            </if>
            <if test="name != null and name != ''">
                and NAME = #{name}
            </if>
            <if test="desc != null and desc != ''">
                and DESC = #{desc}
            </if>
            <if test="createtime != null">
                and CREATETIME = #{createtime}
            </if>
            <if test="createuser != null and createuser != ''">
                and CREATEUSER = #{createuser}
            </if>
            <if test="updatetime != null">
                and UPDATETIME = #{updatetime}
            </if>
            <if test="updateuser != null and updateuser != ''">
                and UPDATEUSER = #{updateuser}
            </if>
            <if test="licensors != null and licensors != ''">
                and LICENSORS = #{licensors}
            </if>
        </where>
    </select>
 
    <!--分页查询-->
    <select id="selectCombinationPage" resultMap="CombinationMap">
        select
        ID, NAME, DESC, CREATETIME, CREATEUSER, UPDATETIME, UPDATEUSER, LICENSORS
        from PL_SYS_COMBINATION
        <where>
            <if test="id != null and id != ''">
                and ID = #{id}
            </if>
            <if test="name != null and name != ''">
                and NAME = #{name}
            </if>
            <if test="desc != null and desc != ''">
                and DESC = #{desc}
            </if>
            <if test="createtime != null">
                and CREATETIME = #{createtime}
            </if>
            <if test="createuser != null and createuser != ''">
                and CREATEUSER = #{createuser}
            </if>
            <if test="updatetime != null">
                and UPDATETIME = #{updatetime}
            </if>
            <if test="updateuser != null and updateuser != ''">
                and UPDATEUSER = #{updateuser}
            </if>
            <if test="licensors != null and licensors != ''">
                and LICENSORS = #{licensors}
            </if>
        </where>
        limit #{pageable.offset}, #{pageable.pageSize}
    </select>
 
    <select id="queryRegex" resultType="java.lang.String">
        SELECT REPLACE(listagg(psc.REGEX,'],') within group ( order by psc.REGEX) || ']','],[','') FROM PL_SYS_COMBINATION psc
        WHERE psc.ID IN (
        <foreach collection="combinationIds" item="id" separator=",">
            #{id}
        </foreach>
        )
    </select>
 
    <select id="queryRegexList" resultType="java.lang.String">
        SELECT concat(psc.REGEX,']{1,}') from PL_SYS_COMBINATION psc
        WHERE psc.ID IN (
        <foreach collection="combinationIds" item="id" separator=",">
            #{id}
        </foreach>
        )
    </select>
 
</mapper>