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/RolesMapper.xml

98 lines
4.5 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.RolesMybatisDao">
<resultMap id="BaseResultMap" type="cn.jyjz.xiaoyao.admin.dataobject.Roles">
<id column="ID" property="id" jdbcType="BIGINT"/>
<result column="ROLENAME" property="rolename" jdbcType="VARCHAR"/>
<result column="ROLEDESC" property="roledesc" jdbcType="VARCHAR"/>
<result column="ENABLED" property="enabled" jdbcType="INTEGER"/>
<result column="ISSYS" property="issys" jdbcType="INTEGER"/>
<result column="OTHERTYPE" property="othertype" jdbcType="INTEGER"/>
<result column="SORTING" property="sorting" jdbcType="INTEGER"/>
<result column="SHOWLEAVEL" property="showleavel" jdbcType="INTEGER"/>
<result column="DEPTID" property="deptid" jdbcType="BIGINT"/>
<result column="CREATEUSER" property="createuser" jdbcType="VARCHAR"/>
<result column="CREATEDATE" property="createdate" jdbcType="BIGINT"/>
<result column="UPDATEUSER" property="updateuser" jdbcType="VARCHAR"/>
<result column="UPDATETIME" property="updatetime" jdbcType="BIGINT"/>
</resultMap>
<sql id="Base_Column_List">
ID AS id,
ROLENAME AS rolename,
ROLEDESC AS roledesc,
ENABLED AS enabled,
ISSYS AS issys,
OTHERTYPE AS othertype,
SORTING AS sorting,
SHOWLEAVEL AS showleavel,
DEPTID AS deptid,
CREATEUSER AS createuser,
CREATEDATE AS createdate,
UPDATEUSER AS updateuser,
UPDATETIME AS updatetime
</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="rolename != null"> and ROLENAME ${rolename.dataOp} ${rolename.likestar}#{rolename.value}${rolename.likeend}</if>
<if test="roledesc != null"> and ROLEDESC ${roledesc.dataOp} ${roledesc.likestar}#{roledesc.value}${roledesc.likeend}</if>
<if test="enabled != null"> and ENABLED ${enabled.dataOp} ${enabled.likestar}#{enabled.value}${enabled.likeend}</if>
<if test="issys != null"> and ISSYS ${issys.dataOp} ${issys.likestar}#{issys.value}${issys.likeend}</if>
<if test="othertype != null"> and OTHERTYPE ${othertype.dataOp} ${othertype.likestar}#{othertype.value}${othertype.likeend}</if>
<if test="sorting != null"> and SORTING ${sorting.dataOp} ${sorting.likestar}#{sorting.value}${sorting.likeend}</if>
<if test="showleavel != null"> and SHOWLEAVEL ${showleavel.dataOp} ${showleavel.likestar}#{showleavel.value}${showleavel.likeend}</if>
<if test="deptid != null"> and DEPTID ${deptid.dataOp} ${deptid.likestar}#{deptid.value}${deptid.likeend}</if>
<if test="createuser != null"> and CREATEUSER ${createuser.dataOp} ${createuser.likestar}#{createuser.value}${createuser.likeend}</if>
<if test="createdate != null"> and CREATEDATE ${createdate.dataOp} ${createdate.likestar}#{createdate.value}${createdate.likeend}</if>
<if test="updateuser != null"> and UPDATEUSER ${updateuser.dataOp} ${updateuser.likestar}#{updateuser.value}${updateuser.likeend}</if>
<if test="updatetime != null"> and UPDATETIME ${updatetime.dataOp} ${updatetime.likestar}#{updatetime.value}${updatetime.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="selectRolesList" resultType="cn.jyjz.xiaoyao.admin.dataobject.Roles" >
select
r.ID AS id,
r.ROLENAME AS rolename,
r.ROLEDESC AS roledesc,
r.ENABLED AS enabled,
r.SORTING AS sorting,
r.DEPTID AS deptid,
dept.DEPARTNAME AS deptname
from
S_ROLES_T r, S_DEPARTMENT_T dept
${ew.customSqlSegment}
</select>
<!-- 根据用户主键查询所属角色集合 -->
<select id="selectRolesByUserid" resultType="cn.jyjz.xiaoyao.admin.dataobject.Roles" parameterType="java.lang.Long">
select
r.ID AS id,
r.ROLENAME AS rolename,
r.ROLEDESC AS roledesc,
r.ENABLED AS enabled,
r.ISSYS AS issys,
r.OTHERTYPE AS othertype,
r.SORTING AS sorting,
r.SHOWLEAVEL AS showleavel,
r.DEPTID AS deptid,
ur.USERID AS userid
from
S_ROLES_T r, S_USERROLES_T ur where ur.ROLEID = r.ID and ur.USERID = #{id}
</select>
</mapper>