79 lines
2.9 KiB
XML
79 lines
2.9 KiB
XML
<?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.adc.da.sys.dao.mysql.RoleMenuEODao" >
|
|
<!-- Result Map-->
|
|
<resultMap id="BaseResultMap" type="com.adc.da.sys.entity.RoleMenuEO" >
|
|
<result column="role_id" property="roleId" />
|
|
<result column="menu_id" property="menuId" />
|
|
</resultMap>
|
|
|
|
<!-- TR_ROLE_MENU table all fields -->
|
|
<sql id="Base_Column_List" >
|
|
role_id, menu_id
|
|
</sql>
|
|
|
|
<!-- 查询条件 -->
|
|
<sql id="Base_Where_Clause">
|
|
where 1=1
|
|
<trim suffixOverrides="," >
|
|
<if test="roleId != null" >
|
|
and role_id ${roleIdOperator} #{roleId}
|
|
</if>
|
|
<if test="menuId != null" >
|
|
and menu_id ${menuIdOperator} #{menuId}
|
|
</if>
|
|
</trim>
|
|
</sql>
|
|
|
|
<!-- 插入记录 -->
|
|
<insert id="insert" parameterType="com.adc.da.sys.entity.RoleMenuEO" >
|
|
insert into TR_ROLE_MENU(<include refid="Base_Column_List" />)
|
|
values (#{roleId, jdbcType=VARCHAR}, #{menuId, jdbcType=VARCHAR})
|
|
</insert>
|
|
|
|
<!-- 动态插入记录 主键是序列 -->
|
|
<insert id="insertSelective" parameterType="com.adc.da.sys.entity.RoleMenuEO" >
|
|
insert into TR_ROLE_MENU
|
|
<trim prefix="(" suffix=")" suffixOverrides="," >
|
|
<if test="roleId != null" >role_id,</if>
|
|
<if test="menuId != null" >menu_id,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
|
<if test="roleId != null" >#{roleId, jdbcType=VARCHAR},</if>
|
|
<if test="menuId != null" >#{menuId, jdbcType=VARCHAR},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<!-- TR_ROLE_MENU 列表总数-->
|
|
<select id="queryByCount" resultType="java.lang.Integer" parameterType="com.adc.da.base.page.BasePage">
|
|
select count(1) from TR_ROLE_MENU
|
|
<include refid="Base_Where_Clause"/>
|
|
</select>
|
|
|
|
<!-- 查询TR_ROLE_MENU列表 -->
|
|
<select id="queryByPage" resultMap="BaseResultMap" parameterType="com.adc.da.base.page.BasePage">
|
|
select <include refid="Base_Column_List" /> from
|
|
(select tmp_tb.* , rownum rn from
|
|
(select <include refid="Base_Column_List" /> from TR_ROLE_MENU
|
|
<include refid="Base_Where_Clause"/>
|
|
<if test="pager.orderCondition != null and pager.orderCondition != ''" >
|
|
${pager.orderCondition}
|
|
</if>
|
|
) tmp_tb where rownum <= ${pager.endIndex})
|
|
where rn >= ${pager.startIndex}
|
|
</select>
|
|
|
|
<select id="queryByList" resultMap="BaseResultMap" parameterType="com.adc.da.base.page.BasePage">
|
|
select <include refid="Base_Column_List"/> from TR_ROLE_MENU
|
|
<include refid="Base_Where_Clause"/>
|
|
<if test="pager.orderCondition != null and pager.orderCondition != ''" >
|
|
${pager.orderCondition}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="getRoleMenuList" resultMap="BaseResultMap">
|
|
select role_id,menu_id from TR_ROLE_MENU where role_id=#{roleId}
|
|
</select>
|
|
|
|
</mapper>
|