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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
<?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.SysSysteminfoDao">
 
    <!-- 可根据自己的需求,是否要使用 -->
    <resultMap type="com.landtool.lanbase.modules.sys.entity.SysSysteminfo" id="systeminfoMap">
        <result property="appid" column="APPID"/>
        <result property="appfullname" column="APPFULLNAME"/>
        <result property="appname" column="APPNAME"/>
        <result property="appcode" column="APPCODE"/>
        <result property="systype" column="SYSTYPE"/>
        <result property="version" column="VERSION"/>
        <result property="sysaddress" column="SYSADDRESS"/>
        <result property="sysimgurl" column="SYSIMGURL"/>
        <result property="sysdescription" column="SYSDESCRIPTION"/>
        <result property="sysstatus" column="SYSSTATUS"/>
        <result property="logintimes" column="LOGINTIMES"/>
        <result property="magunitname" column="MAGUNITNAME"/>
        <result property="maguser" column="MAGUSER"/>
        <result property="magtechuser" column="MAGTECHUSER"/>
        <result property="techusertel" column="TECHUSERTEL"/>
        <result property="rcreateuser" column="RCREATEUSER"/>
        <result property="rcreatedate" column="RCREATEDATE"/>
        <result property="rlasteditdate" column="RLASTEDITDATE"/>
        <result property="remark" column="REMARK"/>
        <result property="iscaslogin" column="ISCASLOGIN"/>
        <result property="isnavigationshow" column="ISNAVIGATIONSHOW"/>
        <result property="orderid" column="ORDERID"/>
        <result property="referenceurl" column="REFERENCEURL"/>
        <result property="browser" column="BROWSER"/>
    </resultMap>
 
    <resultMap type="com.landtool.lanbase.modules.sys.entity.SysUserApplist" id="userAppMap">
        <result property="userId" column="USERID"/>
        <result property="appId" column="APPID"/>
        <result property="rcreateUser" column="RCREATEUSER"/>
        <result property="rcreateDate" column="RCREATEDATE"/>
        <result property="remark" column="REMARK"/>
    </resultMap>
 
    <select id="queryObject" resultType="com.landtool.lanbase.modules.sys.entity.SysSysteminfo">
        select a.*,b.unitname,c.chinesename from SYS_SYSTEMINFO a
        left join ORG_UNIT b on a.magunitname = b.unitid
        left join ORG_USER c on a.maguser = c.userid
        where APPID = #{value}
    </select>
 
    <select id="queryList" resultType="com.landtool.lanbase.modules.sys.entity.SysSysteminfo">
        select * from (
        SELECT *
        FROM(
        SELECT ROW_NUMBER() OVER(ORDER BY B.orderid) AS rownumber,B.*
        FROM (
 
        SELECT a.*,b.unitname,c.chinesename FROM SYS_SYSTEMINFO a
        left join ORG_UNIT b on a.magunitname = b.unitid
        left join ORG_USER c on a.maguser = c.userid
        <where>
            <if test="isadmin != 1">
                AND (a.maguser =#{userid} or a.rcreateuser = #{userid}
                or (#{userid} in (select userid from ORG_USERUNIT where unitid = b.unitid))
                or (#{userid} in (select userid from ORG_UNITMANAGER where ORG_UNITMANAGER.unitid = b.unitid)))
            </if>
            <if test="appfullName != null and appfullName!=''">
                AND a.appfullname LIKE ('%' || #{appfullName} || '%')
            </if>
            <if test="systype != null and systype!=''">
                AND a.systype LIKE ('%' || #{systype} || '%')
            </if>
            <if test="iscaslogin != null and iscaslogin != '' and (iscaslogin==0 ? '0' : iscaslogin)">
                and a.iscaslogin = #{iscaslogin}
            </if>
        </where>
 
        ) B
        ) A
        WHERE rownumber > #{lowerOffset} AND  <![CDATA[ rownumber <= ${upperOffset} ]]>
        )a order by
        <choose>
            <when test="sidx != null and sidx != ''">
                ${sidx} ${order}
            </when>
            <otherwise>
                orderid
            </otherwise>
        </choose>
    </select>
 
    <select id="queryTotal" resultType="int">
        SELECT count(*) FROM SYS_SYSTEMINFO a
        left join ORG_UNIT b on a.magunitname = b.unitid
        left join ORG_USER c on a.maguser = c.userid
        <where>
            <if test="isadmin != 1">
                AND (a.maguser =#{userid} or a.rcreateuser = #{userid}
                or (#{userid} in (select userid from ORG_USERUNIT where unitid = b.unitid))
                or (#{userid} in (select userid from ORG_UNITMANAGER where ORG_UNITMANAGER.unitid = b.unitid)))
            </if>
            <if test="appfullName != null and appfullName!=''">
                AND a.appfullname LIKE ('%' || #{appfullName} || '%')
            </if>
            <if test="systype != null and systype!=''">
                AND a.systype LIKE ('%' || #{systype} || '%')
            </if>
            <if test="iscaslogin != null and iscaslogin != '' and (iscaslogin==0 ? '0' : iscaslogin)">
                and a.iscaslogin = #{iscaslogin}
            </if>
        </where>
    </select>
 
    <insert id="save" parameterType="com.landtool.lanbase.modules.sys.entity.SysSysteminfo">
        insert into SYS_SYSTEMINFO
        (
            APPFULLNAME, 
            APPNAME,
            APPCODE, 
            SYSTYPE, 
            VERSION, 
            SYSADDRESS, 
            SYSIMGURL,
            SYSDESCRIPTION, 
            SYSSTATUS, 
            LOGINTIMES, 
            MAGUNITNAME, 
            MAGUSER, 
            MAGTECHUSER, 
            TECHUSERTEL, 
            RCREATEUSER, 
            RCREATEDATE, 
            RLASTEDITDATE,
            REMARK,
            ISCASLOGIN,
            ISNAVIGATIONSHOW,
            ORDERID,
            REFERENCEURL,
            BROWSER
        )
        values
        (
            #{appfullname,jdbcType=VARCHAR}, 
            #{appname,jdbcType=VARCHAR},
            #{appcode,jdbcType=VARCHAR}, 
            #{systype,jdbcType=VARCHAR}, 
            #{version,jdbcType=VARCHAR}, 
            #{sysaddress,jdbcType=VARCHAR}, 
            #{sysimgurl,jdbcType=VARCHAR},
            #{sysdescription,jdbcType=VARCHAR}, 
            1, 
            #{logintimes,jdbcType=BIGINT}, 
            #{magunitname,jdbcType=BIGINT}, 
            #{maguser,jdbcType=BIGINT}, 
            #{magtechuser,jdbcType=VARCHAR}, 
            #{techusertel,jdbcType=VARCHAR}, 
            #{rcreateuser,jdbcType=BIGINT}, 
            now(),
            now(),
            #{remark,jdbcType=VARCHAR},
            #{iscaslogin},
            #{isnavigationshow},
            #{orderid,jdbcType=BIGINT},
            #{referenceurl,jdbcType=VARCHAR},
            #{browser,jdbcType=VARCHAR}
        )
    </insert>
 
    <update id="update" parameterType="com.landtool.lanbase.modules.sys.entity.SysSysteminfo">
        update SYS_SYSTEMINFO
        <set>
            RLASTEDITDATE=now(),
            <if test="appfullname != null">APPFULLNAME = #{appfullname},</if>
            <if test="appname != null">APPNAME = #{appname},</if>
            <if test="appcode != null">APPCODE = #{appcode},</if>
            <if test="systype != null">SYSTYPE = #{systype},</if>
            <if test="version != null">VERSION = #{version},</if>
            <if test="sysaddress != null">SYSADDRESS = #{sysaddress},</if>
            <if test="sysimgurl != null">SYSIMGURL = #{sysimgurl},</if>
            <if test="sysdescription != null">SYSDESCRIPTION = #{sysdescription},</if>
            <if test="syslanguagetype != null">SYSLANGUAGETYPE = #{syslanguagetype},</if>
            <if test="sysstatus != null">SYSSTATUS = #{sysstatus},</if>
            <if test="logintimes != null">LOGINTIMES = #{logintimes},</if>
            <if test="magunitname != null">MAGUNITNAME = #{magunitname},</if>
            <if test="maguser != null">MAGUSER = #{maguser},</if>
            <if test="magtechuser != null">MAGTECHUSER = #{magtechuser},</if>
            <if test="techusertel != null">TECHUSERTEL = #{techusertel},</if>
            <if test="rcreateuser != null">RCREATEUSER = #{rcreateuser},</if>
            <if test="rcreatedate != null">RCREATEDATE = #{rcreatedate},</if>
            <if test="remark != null">REMARK = #{remark},</if>
            <if test="iscaslogin != null">ISCASLOGIN = #{iscaslogin},</if>
            <if test="orderid != null">ORDERID = #{orderid},</if>
            <if test="isnavigationshow != null">ISNAVIGATIONSHOW = #{isnavigationshow},</if>
            <if test="referenceurl != null">REFERENCEURL = #{referenceurl},</if>
            <if test="browser != null">BROWSER = #{browser}</if>
        </set>
        where APPID = #{appid}
    </update>
 
    <delete id="delete">
        delete from SYS_SYSTEMINFO where APPID = #{value}
    </delete>
 
    <delete id="deleteBatch">
        delete from SYS_SYSTEMINFO where APPID in
        <foreach item="appid" collection="array" open="(" separator="," close=")">
            #{appid}
        </foreach>
    </delete>
 
    <select id="findList" resultType="com.landtool.lanbase.modules.sys.entity.SysSysteminfo">
   select * from SYS_SYSTEMINFO where SYSSTATUS = 1 order by orderid
  </select>
 
    <select id="queryListByUserId" resultType="com.landtool.lanbase.modules.sys.entity.SysUserApplist">
    SELECT
      su.USERID,
       su.APPID,
         su.RCREATEDATE,
       su.RCREATEUSER,
        su.REMARK
     FROM SYS_USERAPPLIST su
    INNER JOIN ORG_USER ou ON su.USERID = ou.USERID
    WHERE 1=1
    AND ou.USERID = #{userId}
  </select>
 
    <select id="getInfoById" resultType="com.landtool.lanbase.modules.sys.entity.SysSysteminfo">
     select * from SYS_SYSTEMINFO where appid=#{appid} order by orderid
  </select>
 
    <select id="queryListAll" resultType="com.landtool.lanbase.modules.sys.entity.SysSysteminfo">
     select APPID,APPFULLNAME from SYS_SYSTEMINFO order by orderid
  </select>
 
    <select id="querySysteminfoWithSEQ" resultType="int">
        SELECT currval('SYS_SYSTEMINFO_SEQ') FROM DUAL
    </select>
    <insert id="addUserList">
   insert into SYS_USERAPPLIST (appId,userId,rcreatedate)
   values(#{appId,jdbcType=BIGINT},
          #{userId,jdbcType=BIGINT},
           now()
          )
 </insert>
 
    <delete id="deleteUserList">
      delete SYS_USERAPPLIST where appid=#{appid}
    </delete>
    <select id="queryTopList" resultType="com.landtool.lanbase.modules.sys.entity.SysSysteminfo">
        select * from (
            select A.*,row_number() over() as rownumber from SYS_SYSTEMINFO A where isnavigationshow = 1
            <if test="type != null and type.size() > 0">
                and systype in
                <foreach collection="type" index="index" item="item" open="(" separator="," close=")">
                    #{item}
                </foreach>
            </if>
        ) A where  <![CDATA[ rownumber <= ${num} ]]> order by orderid
    </select>
    <select id="queryTopUserList" resultType="com.landtool.lanbase.modules.sys.entity.SysSysteminfo">
        select * from (
            select tmp.*,row_number() over() as rownumber from (
            select b.*,a.id from SYS_DIYAPP a
            left join SYS_SYSTEMINFO b on a.appid=b.appid
            where a.userid=#{userid} and isnavigationshow = 1
            <if test="type != null">
                and type = #{type}
            </if>
            order by b.orderid
            ) tmp
        ) A where <![CDATA[ rownumber <= ${num} ]]>
    </select>
    <select id="getSysListByUserId" resultType="com.landtool.lanbase.modules.sys.entity.SysSysteminfo">
      select * from SYS_SYSTEMINFO WHERE maguser=#{userId} order by orderid
    </select>
 
    <select id="queryAllList" resultType="com.landtool.lanbase.modules.sys.entity.SysSysteminfo">
        SELECT a.*,c.chinesename,b.unitname FROM SYS_SYSTEMINFO a
        left join ORG_UNIT b on a.magunitname = b.unitid
        left join ORG_USER c on a.maguser = c.userid
        <where>
            <if test="isadmin != 1">
                AND (a.maguser =#{userid} or a.rcreateuser = #{userid}
                or (#{userid} in (select userid from ORG_USERUNIT where unitid = b.unitid))
                or (#{userid} in (select userid from ORG_UNITMANAGER where org_unitmanager.unitid = b.unitid)))
            </if>
            <if test="appfullname != null and appfullname!=''">
                AND a.appfullname LIKE ('%' || #{appfullname} || '%')
            </if>
            <if test="systype != null and systype!=''">
                AND a.systype LIKE ('%' || #{systype} || '%')
            </if>
            <if test="sysstatus != null and sysstatus!=0">
                AND a.sysstatus = #{sysstatus}
            </if>
            <if test="iscaslogin != null ">
                AND a.iscaslogin = #{iscaslogin}
            </if>
            <if test="currentsystemid != null and currentsystemid != 0">
                and a.appid != #{currentsystemid}
            </if>
        </where>
        order by isnavigationshow desc, orderid asc --客户建议应用程序-更多页面,前面8个要和平台门户顺序一样,所以用isnavigationshow优先排序 ccr modify 2019-01-23
    </select>
 
    <update id="updateRorder" parameterType="com.landtool.lanbase.modules.sys.entity.SysSysteminfo">
        update SYS_SYSTEMINFO
        <set>
            RLASTEDITDATE=now(),
            <if test="orderid != null">orderid = #{orderid}</if>
        </set>
        where appid = #{appid}
    </update>
 
    <select id="queryMaxOrderid" resultType="int">
        select case when max(orderid) > 0 then max(orderid) else 0 end as orderid from SYS_SYSTEMINFO
    </select>
 
    <select id="getSysListIgnoredUserId" resultType="com.landtool.lanbase.modules.sys.entity.SysSysteminfo">
        select * from (
        SELECT *
        FROM(
        SELECT ROW_NUMBER() OVER(ORDER BY B.appid) AS rownumber,B.*
        FROM (
          select * from SYS_SYSTEMINFO
          WHERE isnavigationshow = 1
          and sysstatus = 1
        <if test="otherids != null and otherids != ''">
          and appid not in( ${otherids} )
        </if>
          <if test="appfullname != null and appfullname != ''">
              and appfullname like ('%' || #{appfullname} || '%')
          </if>
          <if test="systype != null and systype != ''">
              and systype = #{systype}
          </if>
        ) B
        ) A
        WHERE rownumber > #{lowerOffset} AND  <![CDATA[ rownumber <= ${upperOffset} ]]>
        )a order by
        <choose>
            <when test="sidx != null and sidx != ''">
                ${sidx} ${order}
            </when>
            <otherwise>
                orderid
            </otherwise>
        </choose>
    </select>
    <select id="querySysListIgnoredUserIdTotal" resultType="int">
        select COUNT(*)
        from SYS_SYSTEMINFO
        WHERE isnavigationshow = 1
        and sysstatus = 1
        <if test="otherids != null and otherids != ''">
        and appid not in( ${otherids} )
        </if>
        <if test="appfullname != null and appfullname != ''">
            and appfullname like ('%' || #{appfullname} || '%')
        </if>
        <if test="systype != null and systype != ''">
            and systype = #{systype}
        </if>
    </select>
 
    <select id="queryAppByUrl" resultType="com.landtool.lanbase.modules.sys.entity.SysSysteminfo">
        SELECT * from SYS_SYSTEMINFO where SYSADDRESS LIKE (#{appurl} || '%')
    </select>
 
    <select id="queryNavigAtionShowCount" resultType="int">
         SELECT count(*) from SYS_SYSTEMINFO where isnavigationshow = 1 and appid != #{appid}
    </select>
    
    <select id="isAdmitSysByUserid" resultType="int" parameterType="hashmap">
        /** modified by qufangxu**/
        SELECT count(*) FROM SYS_SYSTEMINFO_APPLY
    </select>
</mapper>