SysIndexLayoutManageMapper.xml
8.18 KB
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
<?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.hotent.portal.persistence.dao.SysIndexLayoutManageDao">
<resultMap id="SysIndexLayoutManage" type="com.hotent.portal.model.SysIndexLayoutManage">
<id property="id" column="ID" jdbcType="VARCHAR"/>
<result property="name" column="NAME" jdbcType="VARCHAR"/>
<result property="memo" column="MEMO" jdbcType="VARCHAR"/>
<result property="orgId" column="ORG_ID" jdbcType="VARCHAR"/>
<result property="templateHtml" column="TEMPLATE_HTML" jdbcType="LONGVARCHAR"/>
<result property="designHtml" column="DESIGN_HTML" jdbcType="LONGVARCHAR"/>
<result property="isDef" column="IS_DEF" jdbcType="NUMERIC"/>
<result property="orgName" column="org_name" jdbcType="VARCHAR"/>
<result property="type" column="TYPE_" jdbcType="VARCHAR"/>
<result property="layoutType" column="LAYOUT_TYPE" jdbcType="NUMERIC"/>
<result property="asTemplate" column="AS_TEMPLATE_" jdbcType="NUMERIC"/>
<result property="enable" column="ENABLE" jdbcType="NUMERIC"/>
<result property="rank" column="RANK_" jdbcType="NUMERIC"/>
<result property="alias" column="ALIAS" jdbcType="VARCHAR"/>
<result property="shareToSub" column="SHARE_TO_SUB" jdbcType="NUMERIC"/>
<result property="updateTime" column="UPDATE_TIME_" jdbcType="TIMESTAMP"/>
<result property="createBy" column="CREATE_BY_" jdbcType="VARCHAR"/>
<result property="updateBy" column="UPDATE_BY_" jdbcType="VARCHAR"/>
<result property="createOrgId" column="CREATE_ORG_ID_" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time_" jdbcType="TIMESTAMP"/>
<result property="screenCaptureId" column="SCREEN_CAPTURE_ID_" jdbcType="VARCHAR"/>
<result property="gutter" column="GUTTER_" jdbcType="NUMERIC"/>
<result property="managerId" column="MANAGER_ID_" jdbcType="VARCHAR"/>
<result property="managerName" column="MANAGER_NAME_" jdbcType="VARCHAR"/>
<result property="bannerTypeIds" column="banner_type_ids_" jdbcType="LONGNVARCHAR" typeHandler="com.hotent.base.typehandle.ListToVarcharTypeHandle"/>
<association property="pubMenuCount" select="findPubMenuCount" column="alias" fetchType="lazy"/>
<association property="pubMenuCountFront" select="findPubMenuCountFront" column="alias" fetchType="lazy"/>
<association property="pubMenuCountManage" select="findPubMenuCountManage" column="alias" fetchType="lazy"/>
</resultMap>
<select id="findPubMenuCount" resultType="int">
<!-- oracle concat 不支持多个拼接,所以用二个concat做兼容 -->
SELECT COUNT(1) FROM portal_sys_menu t WHERE t.ROUTE_EXTEND_ LIKE CONCAT(CONCAT('%?alias=',#{alias}),'",%')
</select>
<select id="findPubMenuCountFront" resultType="int">
<!-- oracle concat 不支持多个拼接,所以用二个concat做兼容 -->
SELECT COUNT(1) FROM portal_sys_menu t WHERE t.TYPE_ = 'page' and t.ROUTE_EXTEND_ LIKE CONCAT(CONCAT('%?alias=',#{alias}),'",%')
</select>
<select id="findPubMenuCountManage" resultType="int">
<!-- oracle concat 不支持多个拼接,所以用二个concat做兼容 -->
SELECT COUNT(1) FROM portal_sys_menu t WHERE t.TYPE_ = '' and t.ROUTE_EXTEND_ LIKE CONCAT(CONCAT('%?alias=',#{alias}),'",%')
</select>
<select id="selectPage" resultMap="SysIndexLayoutManage">
select * from portal_sys_layout_MANAGE ${ew.customSqlSegment}
</select>
<select id="getByUserIdFilter" resultMap="SysIndexLayoutManage" parameterType="java.util.Map" >
select * from portal_sys_layout_MANAGE where ID in(
select t.id from (
<foreach collection="relationMap" index="key" item="ent" separator="union">
select r.id from portal_sys_layout_MANAGE r,portal_sys_auth_user defUser where defUser.OWNER_ID_=r.id and defUser.RIGHT_TYPE_=#{key} and defUser.OBJ_TYPE_=#{objType}
<if test="@com.hotent.base.ognl.Ognl@notEquals(key,'everyone') and @com.hotent.base.ognl.Ognl@isNotEmpty(ent)">
and defUser.OWNER_ID_ in
<foreach collection="ent" item="id" separator="," open="(" close=")">
#{id}
</foreach>
</if>
</foreach>
) t
)
<where>
<if test="@com.hotent.base.ognl.Ognl@isNotEmpty(name)"> AND NAME LIKE #{name} </if>
<if test="@com.hotent.base.ognl.Ognl@isNotEmpty(memo)"> AND MEMO LIKE #{memo} </if>
</where>
<if test="@com.hotent.base.ognl.Ognl@isNotEmpty(orderField)">
order by ${orderField} ${orderSeq}
</if>
<if test="@com.hotent.base.ognl.Ognl@isEmpty(orderField)">
order by IS_DEF DESC
</if>
</select>
<select id="getManageLayout" resultMap="SysIndexLayoutManage">
SELECT *
FROM portal_sys_layout_MANAGE
<where>
<if test="@com.hotent.base.ognl.Ognl@isNotEmpty(orgIds)"> AND ORG_ID in (${orgIds}) </if>
<if test="@com.hotent.base.ognl.Ognl@isNotEmpty(isDef)"> AND IS_DEF =${isDef} </if>
<if test="@com.hotent.base.ognl.Ognl@isNotEmpty(isNullOrg)"> AND ORG_ID IS NULL </if>
<if test="@com.hotent.base.ognl.Ognl@isNotEmpty(layoutType)"> AND LAYOUT_TYPE=#{layoutType,jdbcType=NUMERIC} </if>
</where>
<if test="@com.hotent.base.ognl.Ognl@isNotEmpty(orderField)">
order by ${orderField} ${orderSeq}
</if>
<if test="@com.hotent.base.ognl.Ognl@isEmpty(orderField)">
order by ORG_ID
</if>
</select>
<update id="updateIsDef" parameterType="java.lang.String">
UPDATE portal_sys_layout_MANAGE SET
IS_DEF=0
WHERE
<if test="@com.hotent.base.ognl.Ognl@isNotEmpty(orgId)">
ORG_ID = #{orgId}
</if>
<if test="@com.hotent.base.ognl.Ognl@isEmpty(orgId)">
ORG_ID is null or org_id = ''
</if>
</update>
<select id="getEnableByOrgIdAndType" parameterType="java.util.Map" resultMap="SysIndexLayoutManage">
SELECT *
FROM portal_sys_layout_MANAGE
WHERE ORG_ID = #{orgId} AND LAYOUT_TYPE =#{layoutType} AND ENABLE = 1
</select>
<select id="getSharedByOrgIdAndType" parameterType="java.util.Map" resultMap="SysIndexLayoutManage">
SELECT *
FROM portal_sys_layout_MANAGE
WHERE ORG_ID = #{orgId} AND LAYOUT_TYPE =#{layoutType} AND ENABLE = 1 AND SHARE_TO_SUB = 1
</select>
<select id="getSharedByOrgIds" parameterType="java.util.Map" resultMap="SysIndexLayoutManage">
SELECT
*
FROM
portal_sys_layout_MANAGE
WHERE
ORG_ID IN
<foreach collection="orgIds" item="orgId" separator="," open="(" close=")">
#{orgId}
</foreach>
AND LAYOUT_TYPE = #{layoutType}
AND ENABLE = 1
AND SHARE_TO_SUB = 1
</select>
<select id="getByOrgIdAndLayoutType" parameterType="java.util.Map" resultMap="SysIndexLayoutManage">
SELECT *
FROM portal_sys_layout_MANAGE
WHERE ORG_ID = #{orgId} AND LAYOUT_TYPE = #{layoutType}
</select>
<select id="getByName" parameterType="java.lang.String" resultType="Integer">
SELECT count(*) as amount FROM portal_sys_layout_MANAGE where name=#{name}
</select>
<update id="cancelOrgIsDef" parameterType="java.util.Map" >
<![CDATA[
update portal_sys_layout_MANAGE set IS_DEF=0 where LAYOUT_TYPE = #{layoutType} and IS_DEF !=2
]]>
<if test="@com.hotent.base.ognl.Ognl@isNotEmpty(orgId)">
AND ORG_ID = #{orgId}
</if>
</update>
<select id="getByOrgIdAndLayoutTypeAndLayoutId" parameterType="java.util.Map" resultMap="SysIndexLayoutManage">
SELECT *
FROM portal_sys_layout_MANAGE
WHERE ORG_ID = #{orgId} AND LAYOUT_TYPE = #{layoutType} AND ID = #{layoutId}
</select>
<select id="getByIdAndType" parameterType="java.util.Map" resultMap="SysIndexLayoutManage">
SELECT *
FROM portal_sys_layout_MANAGE
WHERE ID = #{id} AND LAYOUT_TYPE = #{type}
</select>
<select id="isExistName" parameterType="java.lang.String" resultType="Integer">
SELECT count(*) amount FROM portal_sys_layout_MANAGE WHERE NAME = #{name}
</select>
<select id="getByAlias" parameterType="java.lang.String" resultMap="SysIndexLayoutManage">
SELECT *
FROM portal_sys_layout_MANAGE
WHERE ALIAS = #{alias}
</select>
<select id="getDatavByAlias" parameterType="java.lang.String" resultMap="SysIndexLayoutManage">
SELECT *
FROM portal_sys_layout_MANAGE
WHERE ALIAS = #{alias} AND type_ = 'datav'
</select>
<select id="selectAuthIds" resultType="String">
SELECT portal_sys_layout_manage.ID
FROM portal_sys_layout_manage
left join portal_sys_layout_auth auth on portal_sys_layout_manage.ID = auth.layout_id_ ${ew.customSqlSegment}
</select>
</mapper>