123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- <?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.ourwill.module.sys.dao.SysRoleModuleDao">
- <resultMap type="cn.ourwill.module.sys.entity.SysRoleModule" id="baseMap">
- <result column="id" property="id"/>
- <result column="role_id" property="roleId"/>
- <result column="module_id" property="moduleId"/>
- <result column="module_url" property="moduleUrl"/>
- <result column="module_pid" property="modulePid"/>
- <result column="module_id" property="moduleId"/>
- <result column="module_enname" property="moduleEnname"/>
- <result column="module_type" property="moduleType"/>
- <result column="status" property="status"/>
- <result column="c_id" property="cId"/>
- <result column="c_time" property="cTime"/>
- <result column="version" property="version"/>
- <result column="sort" property="sort"/>
- </resultMap>
- <sql id="columns">
- a.id ,
- a.role_id ,
- a.module_id ,
- a.c_id ,
- a.c_time ,
- a.version,
- m.sort,
- m.name as module_name,
- m.url as module_url,
- m.pid as module_pid,
- m.enname as module_enname,
- m.type as module_type,
- m.status as status,
- r.name as role_name
- </sql>
- <sql id="joinCols">
- left join sys_module m on a.module_id=m.id
- left join sys_role r on a.role_id=r.id
- </sql>
- <select id="get" resultMap="baseMap">
- SELECT
- <include refid="columns"/>
- FROM sys_role_module a
- <include refid="joinCols"/>
- WHERE a.id = #{id}
- </select>
- <select id="findList" resultMap="baseMap">
- SELECT
- <include refid="columns"/>
- FROM sys_role_module a
- <include refid="joinCols"/>
- <where>
- m.status=1
- /* and m.pid=0*/
- <if test="id !=null">
- and id = #{id}
- </if>
- <if test="roleId !=null">
- and role_id = #{roleId}
- </if>
- <if test="moduleId !=null">
- and module_id = #{moduleId}
- </if>
- <if test="cId !=null">
- and c_id = #{cId}
- </if>
- <if test="cTime !=null">
- and c_time = #{cTime}
- </if>
- <if test="version !=null">
- and version = #{version}
- </if>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- </select>
- <select id="findAllList" resultMap="baseMap">
- SELECT
- <include refid="columns"/>
- FROM sys_role_module a
- <include refid="joinCols"/>
- <where>
- m.status=1
- <if test="id !=null">
- and id = #{id}
- </if>
- <if test="roleId !=null">
- and role_id = #{roleId}
- </if>
- <if test="moduleId !=null">
- and module_id = #{moduleId}
- </if>
- <if test="cId !=null">
- and c_id = #{cId}
- </if>
- <if test="version !=null">
- and version = #{version}
- </if>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- </select>
- <insert id="insert" keyColumn="id" keyProperty="id" useGeneratedKeys="true"
- parameterType="cn.ourwill.module.sys.entity.SysRoleModule">
- INSERT INTO sys_role_module
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test=" id != null">
- id,
- </if>
- <if test=" roleId != null">
- role_id,
- </if>
- <if test=" moduleId != null">
- module_id,
- </if>
- <if test=" cId != null">
- c_id,
- </if>
- <if test=" cTime != null">
- c_time,
- </if>
- <if test=" version != null">
- version
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test=" id != null">
- #{id}, </if>
- <if test=" roleId != null">
- #{roleId}, </if>
- <if test=" moduleId != null">
- #{moduleId}, </if>
- <if test=" cId != null">
- #{cId}, </if>
- <if test=" cTime != null">
- #{cTime}, </if>
- <if test=" version != null">
- #{version} </if>
- </trim>
- </insert>
- <update id="update" parameterType="cn.ourwill.module.sys.entity.SysRoleModule">
- UPDATE sys_role_module <set>
- <if test="id != null">
- id= #{id} ,
- </if>
- <if test="roleId != null">
- role_id= #{roleId} ,
- </if>
- <if test="moduleId != null">
- module_id= #{moduleId} ,
- </if>
- <if test="cId != null">
- c_id= #{cId} ,
- </if>
- <if test="cTime != null">
- c_time= #{cTime} ,
- </if>
- <if test="version != null">
- version= #{version}
- </if>
- </set>
- WHERE id = #{id}
- </update>
- <delete id="deleteById" parameterType="java.lang.Long">
- DELETE FROM sys_role_module WHERE id = #{id}
- </delete>
- <delete id="deleteByIds" parameterType="java.util.List">
- DELETE FROM sys_role_module WHERE id IN
- <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </delete>
- <delete id="deleteByRoleId" parameterType="java.lang.Long">
- DELETE FROM sys_role_module WHERE role_id = #{roleId}
- </delete>
- <delete id="deleteByModuleId" parameterType="java.lang.Long">
- DELETE FROM sys_role_module WHERE module_id= #{id}
- </delete>
- </mapper>
|