1
13693261870
2022-09-16 762f2fb45db004618ba099aa3c0bd89dba1eb843
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.landtool.lanbase.modules.sys.dao.SysSysteminfoApplyDao">
 
    <!-- 可根据自己的需求,是否要使用 -->
    <resultMap type="com.landtool.lanbase.modules.sys.entity.SysSysteminfoApply" id="systeminfoapplyMap">
        <result property="id" column="ID"/>
        <result property="appid" column="APPID"/>
        <result property="userid" column="USERID"/>
        <result property="applytime" column="APPLYTIME"/>
        <result property="auditresult" column="AUDITRESULT"/>
        <result property="auditopinion" column="AUDITOPINION"/>
    </resultMap>
    <insert id="add" parameterType="com.landtool.lanbase.modules.sys.entity.SysSysteminfoApply">
        <selectKey keyProperty="id" resultType="java.lang.Integer" order="BEFORE">
            select NEXTVAL('SYS_SYSTEMINFO_APPLY_INS_SEQ') from dual
        </selectKey>
        insert into SYS_SYSTEMINFO_APPLY
        <trim prefix="(" suffix=")" suffixOverrides="," >
            <if test="id != null" >
                ID,
            </if>
            <if test="appid != null" >
                APPID,
            </if>
            <if test="userid != null" >
                USERID,
            </if>
            <if test="applytime != null" >
                APPLYTIME,
            </if>
            <if test="auditresult != null" >
                AUDITRESULT,
            </if>
            <if test="auditopinion != null" >
                AUDITOPINION,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides="," >
            <if test="id != null" >
                #{id,jdbcType=DECIMAL},
            </if>
            <if test="appid != null" >
                #{appid,jdbcType=DECIMAL},
            </if>
            <if test="userid != null" >
                #{userid,jdbcType=DECIMAL},
            </if>
            <if test="applytime != null" >
                #{applytime,jdbcType=TIMESTAMP},
            </if>
            <if test="auditresult != null" >
                #{auditresult,jdbcType=DECIMAL},
            </if>
            <if test="auditopinion != null" >
                #{auditopinion,jdbcType=VARCHAR},
            </if>
        </trim>
    </insert>
    <select id="byId" resultType="com.landtool.lanbase.modules.sys.entity.SysSysteminfoApply">
        SELECT * FROM SYS_SYSTEMINFO_APPLY where appid = #{appid} and userid = #{userid}
    </select>
    <select id="queryListByAppid" resultType="com.landtool.lanbase.modules.sys.entity.SysSysteminfoApplyJoinOrgUser">
        select * from (
        SELECT *
        FROM(
        SELECT ROW_NUMBER() OVER(ORDER BY B.id) AS rownumber,B.*
        FROM (
        select a.*,b.CHINESENAME,c.UNITNAME from SYS_SYSTEMINFO_APPLY a
        left join ORG_USER b on a.userid =  b.userid
        left join (
        SELECT
        ouu.USERID,
        max(ou.UNITNAME) AS UNITNAME,
        max(ouu.RCREATEDATE) AS RCREATEDATE
        FROM ORG_USERUNIT ouu
        LEFT JOIN ORG_UNIT ou ON ouu.unitid=ou.unitid where ouu.WORKTYPE = 1
        GROUP BY ouu.USERID
        )c ON a.USERID = c.USERID
        where appid = #{appid}
        <if test="auditresult != null">
            and auditresult = #{auditresult}
        </if>
        ) B
        ) A
        WHERE rownumber > #{lowerOffset} AND  <![CDATA[ rownumber <= ${upperOffset} ]]>
        )a order by id
    </select>
 
    <select id="queryTotalByAppid" resultType="java.lang.Integer">
        select count(*) from SYS_SYSTEMINFO_APPLY
        where appid = #{appid}
        <if test="auditresult != null">
            and auditresult = #{auditresult}
        </if>
    </select>
 
    <select id="selectCount" resultType="java.lang.Integer">
        select count(*) appcount from SYS_SYSTEMINFO_APPLY where appid = #{appid}
        <if test="auditresult != null">
          and auditresult = #{auditresult}
        </if>
    </select>
 
    <update id="updateResult">
        update SYS_SYSTEMINFO_APPLY set auditresult = #{auditresult}, auditopinion = #{auditopinion} where id = #{id}
    </update>
</mapper>