Blame view

backend/column/src/main/resources/mapper/SysIndexColumnMapper.xml 6.77 KB
8ea9c133   陈威   初始化提交
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
<?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.column.persistence.dao.SysIndexColumnDao">
	<resultMap id="SysIndexColumn" type="com.hotent.column.model.SysIndexColumn">
		<id property="id" column="ID" jdbcType="VARCHAR"/>
		<result property="name" column="NAME" jdbcType="VARCHAR"/>
		<result property="alias" column="ALIAS" jdbcType="VARCHAR"/>
		<result property="catalog" column="CATALOG" jdbcType="VARCHAR"/>
		<result property="colType" column="COL_TYPE" jdbcType="VARCHAR"/>
		<result property="dataMode" column="DATA_MODE" jdbcType="NUMERIC"/>
		<result property="requestType" column="REQUEST_TYPE" jdbcType="VARCHAR"/>
		<result property="dataFrom" column="DATA_FROM" jdbcType="VARCHAR"/>
		<result property="dataParam" column="DATA_PARAM" jdbcType="LONGVARCHAR"/>
		<result property="dsAlias" column="DS_ALIAS" jdbcType="VARCHAR"/>
		<result property="dsName" column="DS_NAME" jdbcType="VARCHAR"/>
		<result property="colHeight" column="COL_HEIGHT" jdbcType="NUMERIC"/>
		<result property="colUrl" column="COL_URL" jdbcType="VARCHAR"/>
		<result property="templateHtml" column="TEMPLATE_HTML" jdbcType="LONGVARCHAR"/>
		<result property="templateJavaScript" column="TEMPLATE_JAVA_SCRIPT_" jdbcType="LONGVARCHAR"/>
		<result property="isPublic" column="IS_PUBLIC" jdbcType="NUMERIC"/>
		<result property="orgId" column="ORG_ID" jdbcType="NUMERIC"/>
		<result property="supportRefesh" column="SUPPORT_REFESH" jdbcType="NUMERIC"/>
		<result property="refeshTime" column="REFESH_TIME" jdbcType="NUMERIC"/>
		<result property="showEffect" column="SHOW_EFFECT" jdbcType="NUMERIC"/>
		<result property="memo" column="MEMO" jdbcType="VARCHAR"/>
		<result property="needPage" column="NEEDPAGE" jdbcType="NUMERIC"/>
		<result property="catalogName" column="CATALOG_NAME" jdbcType="VARCHAR"/>
		<result property="creator" column="CREATOR" jdbcType="VARCHAR"/>
		<result property="createBy" column="CREATE_BY_" jdbcType="VARCHAR"/>
		<result property="createOrgId" column="CREATE_ORG_ID_" jdbcType="VARCHAR"/>
		<result property="createTime" column="CREATE_TIME_" jdbcType="TIMESTAMP"/>
		<result property="updateBy" column="UPDATE_BY_" jdbcType="VARCHAR"/>
		<result property="updateTime" column="UPDATE_TIME_" jdbcType="TIMESTAMP"/>
		<result property="showTitle" column="SHOW_TITLE_" jdbcType="NUMERIC"/>
		<result property="containCol" column="CONTAIN_COL_" jdbcType="VARCHAR"/>
		<result property="appid" column="APPID_" jdbcType="VARCHAR"/>
		<result property="secret" column="SECRET_" jdbcType="VARCHAR"/>
        <result property="tenantId" column="tenant_id_" jdbcType="VARCHAR"/>
		<result property="style" column="STYLE_" jdbcType="LONGVARCHAR"/>
        <result property="isInit" column="is_init_" jdbcType="NUMERIC"/>
        <result property="snapshotId" column="SNAPSHOT_ID_" jdbcType="VARCHAR"/>
        <result property="templateStyle" column="TEMPLATE_STYLE_" jdbcType="VARCHAR"/>
	</resultMap>

	<sql id="columns">
		ID,NAME,ALIAS,CATALOG,COL_TYPE,DATA_MODE,REQUEST_TYPE,DATA_FROM,DATA_PARAM,DS_ALIAS,DS_NAME,COL_HEIGHT,COL_URL,TEMPLATE_HTML,TEMPLATE_JAVA_SCRIPT_,IS_PUBLIC,ORG_ID,SUPPORT_REFESH,REFESH_TIME,SHOW_EFFECT,MEMO,NEEDPAGE,CATALOG_NAME,CREATOR,CREATE_BY_,CREATE_ORG_ID_,CREATE_TIME_,UPDATE_BY_,UPDATE_TIME_,SHOW_TITLE_,CONTAIN_COL_,APPID_,SECRET_,TENANT_ID_,IS_INIT_,SNAPSHOT_ID_,TEMPLATE_STYLE_
	</sql>

	<sql id="listColumns">
		ID,NAME,ALIAS,IS_PUBLIC,IS_INIT_,COL_TYPE,DATA_FROM,DATA_MODE
	</sql>

	<delete id="delById" parameterType="java.lang.String">
		DELETE FROM portal_sys_column
		WHERE
		ID=#{id}
	</delete>

	<select id="getByColumnAlias" parameterType="java.lang.String" resultMap="SysIndexColumn">
		SELECT <include refid="columns"/>
		FROM portal_sys_column
		WHERE
		ALIAS=#{alias}
	</select>

	<select id="batchGetByColumnAliases" parameterType="java.util.Map" resultMap="SysIndexColumn">
		<if test="@com.hotent.base.ognl.Ognl@isNotEmpty(hasRightsColIds)">
			SELECT <include refid="columns"/>,
			CASE WHEN ID IN (${hasRightsColIds}) THEN 1 ELSE 0 END as displayRights
			FROM portal_sys_column
			WHERE
			ALIAS in
			<foreach collection="aliases"  item="alias" separator="," open="(" close=")">
				#{alias}
			</foreach>
		</if>
		<if test="@com.hotent.base.ognl.Ognl@isEmpty(hasRightsColIds)">
			SELECT <include refid="columns"/>, false as displayRights
			FROM portal_sys_column
			WHERE
			ALIAS in
			<foreach collection="aliases"  item="alias" separator="," open="(" close=")">
				#{alias}
			</foreach>
		</if>
	</select>

	<select id="getCounts" resultType="Integer">
    	 SELECT count(id) FROM portal_sys_column
    </select>

	<select id="isExistAlias" resultType="Integer" parameterType="java.util.Map">
	  SELECT count(*) amount FROM portal_sys_column where alias=#{alias}
	  <if test="@com.hotent.base.ognl.Ognl@isNotEmpty(id)">  AND id &lt;> #{id}  </if>
	</select>

	<select id="getAllByLayoutType" resultMap="SysIndexColumn" parameterType="java.util.Map">
	  SELECT <include refid="columns"/> FROM portal_sys_column where IS_PUBLIC=#{isPublic}
	</select>

	<select id="getByUserIdFilter" resultMap="SysIndexColumn"  parameterType="java.util.Map" >
		select <include refid="columns"/> from portal_sys_column  where ID in(
			select t.id from (
				<foreach collection="relationMap" index="key"  item="ent" separator="union">
					<if test="@com.hotent.base.ognl.Ognl@notEquals(key,'auth_org')">
					   select r.id from portal_sys_column r,portal_sys_auth_user rig where rig.AUTHORIZE_ID_=r.id and rig.RIGHT_TYPE_=#{key}  and rig.OBJ_TYPE_=#{objType}
					   <if test="@com.hotent.base.ognl.Ognl@isNotEmpty(isPublic)">
						   and IS_PUBLIC = #{isPublic}
						</if>
					   <if test="@com.hotent.base.ognl.Ognl@notEquals(key,'everyone') and @com.hotent.base.ognl.Ognl@isNotEmpty(ent)">
						        and rig.OWNER_ID_ in
								<foreach collection="ent"  item="id" separator="," open="(" close=")">
									#{id}
								</foreach>
						</if>
					</if>
					<if test="@com.hotent.base.ognl.Ognl@equals(key,'auth_org')">
					    select id from portal_sys_column where ORG_ID in
						<foreach collection="ent"  item="id" separator="," open="(" close=")">
							#{id}
						</foreach>
					</if>
				</foreach>
			) t
		)
		<if test="@com.hotent.base.ognl.Ognl@isNotEmpty(tenantIds)">
			and tenant_id_ in
			<foreach collection="tenantIds" item="tid" open="(" close=")" separator=",">
				#{tid}
			</foreach>
		</if>
		order by CREATE_TIME_ desc
	</select>
	<delete id="deleteByNewsParentId" parameterType="java.lang.String">
		delete from portal_sys_column where id in (select COLUMN_ID_ from portal_news_tree_ where PARENT_ID_ = #{parentId})
	</delete>

	<select id="queryList" resultMap="SysIndexColumn">
		select
		<include refid="listColumns"/>
		from
		portal_sys_column
		${ew.customSqlSegment}
	</select>
</mapper>