SysAppMapper.xml 2.64 KB
<?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.sys.persistence.dao.SysAppDao">
	<resultMap id="SysApp" type="com.hotent.sys.persistence.model.SysApp">
		<id property="id" column="ID_" jdbcType="VARCHAR"/>
		<result property="name" column="NAME_" jdbcType="VARCHAR"/>
		<result property="icon" column="ICON_" jdbcType="VARCHAR"/>
		<result property="iconColor" column="ICON_COLOR_" jdbcType="VARCHAR"/>
		<result property="type" column="TYPE_" jdbcType="NUMERIC"/>
		<result property="menuId" column="MENU_ID_" jdbcType="VARCHAR"/>
		<result property="sn" column="SN_" jdbcType="NUMERIC"/>
		<result property="isPublish" column="IS_PUBLISH_" jdbcType="NUMERIC"/>
		<result property="content" column="CONTENT_" jdbcType="VARCHAR"/>
		<result property="createTime" column="CREATE_TIME_" jdbcType="TIMESTAMP"/>
		<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="desc" column="DESC_" jdbcType="VARCHAR"/>
		<result property="menuName" column="menuName" jdbcType="VARCHAR"/>

	</resultMap>
	<select id="customQuery" parameterType="java.util.Map" resultMap="SysApp">
		select * from (
			select app.*,m.name_ as menuName
			from portal_sys_app app
			left join portal_sys_menu m on app.menu_id_ = m.id_) t
			${ew.customSqlSegment}
	</select>

	<select id="queryByFilter" parameterType="java.util.Map" resultMap="SysApp">
		SELECT
			*
		FROM
			portal_sys_app app
		<where>
			is_publish_ = 1
			<if test="@com.hotent.base.ognl.Ognl@isNotEmpty(ew.menuId)">
				and menu_id_ = #{ew.menuId}
			</if>
			<if test="@com.hotent.base.ognl.Ognl@isNotEmpty(ew.searchWord)">
				and name_ like '%${ew.searchWord}%'
			</if>
			<if test="@com.hotent.base.ognl.Ognl@isNotEmpty(ew.authIds)">
				and (
					<if test="@com.hotent.base.ognl.Ognl@isNotEmpty(ew.authIds)">
						(id_ in (${ew.authIds})) or
					</if>
					(CREATE_BY_ = #{ew.userId})
				)
			</if>
			<if test="@com.hotent.base.ognl.Ognl@isNotEmpty(ew.tagIds)">
				and EXISTS (
					SELECT
						app_id_
					FROM
						portal_app_tags_relation rel
					WHERE
					rel.APP_ID_ = app.ID_
					AND rel.TAG_ID_ in (${ew.tagIds})
				)
			</if>
		</where>
		order by sn_
	</select>

	<select id="getValidMenu" resultType="java.lang.String">
		select id_ from portal_sys_menu menu where path_ like '-1.4.%.'
		and exists (
		select menu_id_ from portal_sys_app app where app.menu_id_ = menu.id_ and app.is_publish_ = 1
		)
	</select>


</mapper>