You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ocr/jyjz-system/jyjz-system-admin/src/main/resources/mapper/admin/ResourcesMapper.xml

203 lines
10 KiB

<?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="cn.jyjz.xiaoyao.admin.dataDao.ResourcesMybatisDao">
<resultMap id="BaseResultMap" type="cn.jyjz.xiaoyao.admin.dataobject.Resources">
<id column="ID" property="id" jdbcType="BIGINT"/>
<result column="RESOURCENAME" property="resourcename" jdbcType="VARCHAR"/>
<result column="RPARENTID" property="rparentid" jdbcType="BIGINT"/>
<result column="ROOTID" property="rootid" jdbcType="BIGINT"/>
<result column="RESOURCETYPE" property="resourcetype" jdbcType="INTEGER"/>
<result column="PRIORITYPE" property="prioritype" jdbcType="INTEGER"/>
<result column="RESOURCE" property="resource" jdbcType="VARCHAR"/>
<result column="RESOURCELIST" property="resourcelist" jdbcType="VARCHAR"/>
<result column="RESOURCEDESC" property="resourcedesc" jdbcType="VARCHAR"/>
<result column="ENABLED" property="enabled" jdbcType="INTEGER"/>
<result column="RIOCNIMAGE" property="riocnimage" jdbcType="VARCHAR"/>
<result column="OTHERSHOW" property="othershow" jdbcType="INTEGER"/>
</resultMap>
<resultMap id="BaseResultMapTree" type="cn.jyjz.xiaoyao.admin.dataobject.Resources">
<id column="ID" property="id" jdbcType="BIGINT"/>
<result column="RESOURCENAME" property="resourcename" jdbcType="VARCHAR"/>
<result column="RPARENTID" property="rparentid" jdbcType="VARCHAR"/>
<result column="ROOTID" property="rootid" jdbcType="VARCHAR"/>
<result column="RESOURCETYPE" property="resourcetype" jdbcType="INTEGER"/>
<result column="PRIORITYPE" property="prioritype" jdbcType="INTEGER"/>
<result column="RESOURCE" property="resource" jdbcType="VARCHAR"/>
<result column="RESOURCELIST" property="resourcelist" jdbcType="VARCHAR"/>
<result column="RESOURCEDESC" property="resourcedesc" jdbcType="VARCHAR"/>
<result column="ENABLED" property="enabled" jdbcType="INTEGER"/>
<result column="RIOCNIMAGE" property="riocnimage" jdbcType="VARCHAR"/>
<result column="OTHERSHOW" property="othershow" jdbcType="INTEGER"/>
<collection property="methodList" column="ID" select="cn.jyjz.xiaoyao.admin.dataDao.SysmethodMybatisDao.listSysmethod"></collection>
<collection property="childListResource" column="{rparentid=ID}" select="selectListChildTree"></collection>
</resultMap>
<resultMap id="BaseResultMapTreeRoles" type="cn.jyjz.xiaoyao.admin.dataobject.Resources">
<id column="ID" property="id" jdbcType="BIGINT"/>
<result column="RESOURCENAME" property="resourcename" jdbcType="VARCHAR"/>
<result column="RPARENTID" property="rparentid" jdbcType="VARCHAR"/>
<result column="ROOTID" property="rootid" jdbcType="VARCHAR"/>
<result column="RESOURCETYPE" property="resourcetype" jdbcType="INTEGER"/>
<result column="PRIORITYPE" property="prioritype" jdbcType="INTEGER"/>
<result column="RESOURCE" property="resource" jdbcType="VARCHAR"/>
<result column="RESOURCELIST" property="resourcelist" jdbcType="VARCHAR"/>
<result column="RESOURCEDESC" property="resourcedesc" jdbcType="VARCHAR"/>
<result column="ENABLED" property="enabled" jdbcType="INTEGER"/>
<result column="RIOCNIMAGE" property="riocnimage" jdbcType="VARCHAR"/>
<result column="OTHERSHOW" property="othershow" jdbcType="INTEGER"/>
<result column="rolesid" property="rolesid" jdbcType="BIGINT"/>
<association property="parentResource" column="{rparentid=RPARENTID}" select="selectListParent"/>
<collection property="methodList" column="{resourceid=ID,roleid=rolesid}" select="cn.jyjz.xiaoyao.admin.dataDao.SysmethodMybatisDao.listSysmethodByRoleId"></collection>
</resultMap>
<resultMap id="BaseResultMapParent" type="cn.jyjz.xiaoyao.admin.dataobject.Resources">
<id column="ID" property="id" jdbcType="BIGINT"/>
<result column="RESOURCENAME" property="resourcename" jdbcType="VARCHAR"/>
<result column="RPARENTID" property="rparentid" jdbcType="VARCHAR"/>
<result column="ROOTID" property="rootid" jdbcType="VARCHAR"/>
<result column="RESOURCETYPE" property="resourcetype" jdbcType="INTEGER"/>
<result column="PRIORITYPE" property="prioritype" jdbcType="INTEGER"/>
<result column="RESOURCE" property="resource" jdbcType="VARCHAR"/>
<result column="RESOURCELIST" property="resourcelist" jdbcType="VARCHAR"/>
<result column="RESOURCEDESC" property="resourcedesc" jdbcType="VARCHAR"/>
<result column="ENABLED" property="enabled" jdbcType="INTEGER"/>
<result column="RIOCNIMAGE" property="riocnimage" jdbcType="VARCHAR"/>
<result column="OTHERSHOW" property="othershow" jdbcType="INTEGER"/>
<association property="parentResource" column="{rparentid=RPARENTID}" select="selectListParent"></association>
</resultMap>
<sql id="Base_Column_List">
ID AS id,
RESOURCENAME AS resourcename,
RPARENTID AS rparentid,
ROOTID AS rootid,
RESOURCETYPE AS resourcetype,
PRIORITYPE AS prioritype,
RESOURCE AS resource,
RESOURCELIST AS resourcelist,
RESOURCEDESC AS resourcedesc,
ENABLED AS enabled,
RIOCNIMAGE AS riocnimage,
OTHERSHOW AS othershow
</sql>
<sql id="Base_Where">
<where>
<trim prefixOverrides="and|or">
<if test="id != null"> and ID ${id.dataOp} ${id.likestar}#{id.value}${id.likeend}</if>
<if test="resourcename != null"> and RESOURCENAME ${resourcename.dataOp} ${resourcename.likestar}#{resourcename.value}${resourcename.likeend}</if>
<if test="rparentid != null"> and RPARENTID ${rparentid.dataOp} ${rparentid.likestar}#{rparentid.value}${rparentid.likeend}</if>
<if test="rootid != null"> and ROOTID ${rootid.dataOp} ${rootid.likestar}#{rootid.value}${rootid.likeend}</if>
<if test="resourcetype != null"> and RESOURCETYPE ${resourcetype.dataOp} ${resourcetype.likestar}#{resourcetype.value}${resourcetype.likeend}</if>
<if test="prioritype != null"> and PRIORITYPE ${prioritype.dataOp} ${prioritype.likestar}#{prioritype.value}${prioritype.likeend}</if>
<if test="resource != null"> and RESOURCE ${resource.dataOp} ${resource.likestar}#{resource.value}${resource.likeend}</if>
<if test="resourcelist != null"> and RESOURCELIST ${resourcelist.dataOp} ${resourcelist.likestar}#{resourcelist.value}${resourcelist.likeend}</if>
<if test="resourcedesc != null"> and RESOURCEDESC ${resourcedesc.dataOp} ${resourcedesc.likestar}#{resourcedesc.value}${resourcedesc.likeend}</if>
<if test="enabled != null"> and ENABLED ${enabled.dataOp} ${enabled.likestar}#{enabled.value}${enabled.likeend}</if>
<if test="riocnimage != null"> and RIOCNIMAGE ${riocnimage.dataOp} ${riocnimage.likestar}#{riocnimage.value}${riocnimage.likeend}</if>
<if test="othershow != null"> and OTHERSHOW ${othershow.dataOp} ${othershow.likestar}#{othershow.value}${othershow.likeend}</if>
<if test="userid != null"> and USERID ${userid.dataOp} ${userid.likestar}#{userid.value}${userid.likeend}</if>
<if test="listdept != null">
and DEPARTID in
<foreach collection="listdept.value" item="item" index="index" open="(" separator="," close=")" >
#{item}
</foreach>
</if>
</trim>
</where>
<if test="page != null">
<if test="page.sortname != null"> order by ${page.sortname} ${page.sortorder}</if>
limit ${page.start}, ${page.Pagesize}
</if>
</sql>
<select id="selectListTree" resultMap="BaseResultMapTree" >
select
re.ID AS id,
re.RESOURCENAME AS resourcename,
re.RPARENTID AS rparentid,
re.ROOTID AS rootid,
re.RESOURCETYPE AS resourcetype,
re.PRIORITYPE AS prioritype,
re.RESOURCE AS resource,
re.RESOURCELIST AS resourcelist,
re.RESOURCEDESC AS resourcedesc,
re.ENABLED AS enabled,
re.RIOCNIMAGE AS riocnimage,
re.OTHERSHOW AS othershow
from S_RESOURCES_T re
WHERE re.ENABLED=1 AND re.ROOTID='0' AND re.RPARENTID='0' order by re.PRIORITYPE
</select>
<select id="selectListOtherShowTree" resultMap="BaseResultMapTree" >
select
re.ID AS id,
re.RESOURCENAME AS resourcename,
re.RPARENTID AS rparentid,
re.ROOTID AS rootid,
re.RESOURCETYPE AS resourcetype,
re.PRIORITYPE AS prioritype,
re.RESOURCE AS resource,
re.RESOURCELIST AS resourcelist,
re.RESOURCEDESC AS resourcedesc,
re.ENABLED AS enabled,
re.RIOCNIMAGE AS riocnimage,
re.OTHERSHOW AS othershow
from S_RESOURCES_T re
WHERE re.OTHERSHOW=1 AND re.ENABLED=1 AND re.ROOTID='0' AND re.RPARENTID='0' order by re.PRIORITYPE
</select>
<select id="selectListOtherShowResourceByRolesid" resultMap="BaseResultMapTreeRoles" parameterType="java.lang.Long">
select
re.ID AS id,
re.RESOURCENAME AS resourcename,
re.RPARENTID AS rparentid,
re.ROOTID AS rootid,
re.RESOURCETYPE AS resourcetype,
re.PRIORITYPE AS prioritype,
re.RESOURCE AS resource,
re.RESOURCELIST AS resourcelist,
re.RESOURCEDESC AS resourcedesc,
re.ENABLED AS enabled,
re.RIOCNIMAGE AS riocnimage,
re.OTHERSHOW AS othershow,
userremth.ROLEID AS rolesid
from S_RESOURCES_T re
RIGHT JOIN(
select DISTINCT rr.RESOURCEID as resourceid,rr.ROLEID AS roleid
from S_ROLESRESOURCE_T rr
where rr.ROLEID = #{roleid}
) as userremth ON userremth.resourceid = re.ID
WHERE re.OTHERSHOW=1 AND re.ENABLED=1
</select>
<select id="selectListResourceByRolesid" resultMap="BaseResultMapTreeRoles" parameterType="java.lang.Long">
select
re.ID AS id,
re.RESOURCENAME AS resourcename,
re.RPARENTID AS rparentid,
re.ROOTID AS rootid,
re.RESOURCETYPE AS resourcetype,
re.PRIORITYPE AS prioritype,
re.RESOURCE AS resource,
re.RESOURCELIST AS resourcelist,
re.RESOURCEDESC AS resourcedesc,
re.ENABLED AS enabled,
re.RIOCNIMAGE AS riocnimage,
re.OTHERSHOW AS othershow,
userremth.ROLEID AS rolesid
from S_RESOURCES_T re
RIGHT JOIN(
select DISTINCT rr.RESOURCEID as resourceid,rr.ROLEID AS roleid
from S_ROLESRESOURCE_T rr
where rr.ROLEID = #{roleid}
) as userremth ON userremth.resourceid = re.ID
WHERE re.ENABLED=1
</select>
<select id="selectListChildTree" resultMap="BaseResultMapTree" parameterType="java.util.Map">
select
*
from S_RESOURCES_T WHERE ENABLED=1 AND RPARENTID = '${rparentid}' order by PRIORITYPE
</select>
<select id="selectListParent" resultMap="BaseResultMapParent" parameterType="java.util.Map">
select
*
from S_RESOURCES_T WHERE ENABLED=1 AND ID = '${rparentid}' order by PRIORITYPE
</select>
</mapper>