<?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.thhy.usercore.modules.sys.sysbutton.mapper.SysRoleButtonMapper">
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
role_button_id as roleButtonId,
|
menu_id as menuId,
|
role_id as roleId,
|
button_id as buttonId,
|
</sql>
|
|
<sql id="condition_query">
|
<where>
|
<trim suffixOverrides=" AND ">
|
<if test="buttonId!=null">
|
button_id = #{buttonId} AND
|
</if>
|
<if test="roleId!=null">
|
role_id = #{roleId} AND
|
</if>
|
</trim>
|
</where>
|
</sql>
|
|
<select id="queryById" resultType="com.thhy.usercore.modules.sys.sysbutton.entity.SysRoleButton">
|
select <include refid="Base_Column_List" />
|
from sys_role_button where id = #{id}
|
</select>
|
|
<select id="queryVersionById" resultType="integer">
|
select version from sys_departs where id = #{id}
|
</select>
|
|
<!--查询列表-->
|
<select id="findList" resultType="com.thhy.usercore.modules.sys.sysbutton.entity.SysRoleButton">
|
SELECT
|
<include refid="Base_Column_List" />
|
from sys_role_button
|
<include refid="condition_query" />
|
</select>
|
|
<!--查询列表-->
|
<select id="findAll" resultType="com.thhy.usercore.modules.sys.sysbutton.entity.SysRoleButton">
|
SELECT
|
<include refid="Base_Column_List" />
|
from sys_role_button
|
</select>
|
|
<!--插入操作-->
|
<insert id="insert">
|
insert into sys_role_button
|
<trim prefix="(" suffix=")" suffixOverrides="," >
|
<if test="roleButtonId != null">
|
role_button_id,
|
</if>
|
<if test="buttonId != null">
|
button_id,
|
</if>
|
<if test="roleId != null">
|
role_id,
|
</if>
|
<if test="menuId != null">
|
menu_id,
|
</if>
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
<if test="roleButtonId != null">
|
#{roleButtonId},
|
</if>
|
<if test="buttonId != null">
|
#{buttonId},
|
</if>
|
<if test="roleId != null">
|
#{roleId},
|
</if>
|
<if test="menuId != null">
|
#{menuId},
|
</if>
|
</trim>
|
</insert>
|
|
|
<!--更新操作-->
|
<update id="update">
|
update sys_role_button
|
<set>
|
<if test="roleButtonId != null">
|
role_button_id=#{roleButtonId},
|
</if>
|
<if test="buttonId != null">
|
button_id=#{buttonId},
|
</if>
|
<if test="roleId != null">
|
role_id=#{roleId},
|
</if>
|
</set>
|
where id=#{id}
|
</update>
|
|
<!--更新操作-->
|
<update id="deletelogic">
|
update sys_role_button
|
SET delFlag = 0
|
where id=#{id}
|
</update>
|
|
<!--根据ID删除-->
|
<delete id="deleteByRoleId">
|
Delete from sys_role_button where role_id = #{roleId}
|
</delete>
|
|
</mapper>
|