forest/src/main/java/mapper/RoleMapper.xml
2020-03-13 10:38:21 +08:00

30 lines
1.5 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.rymcu.vertical.mapper.RoleMapper">
<resultMap id="BaseResultMap" type="com.rymcu.vertical.entity.Role">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="idRole"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="input_code" jdbcType="VARCHAR" property="inputCode"/>
<result column="weights" jdbcType="TINYINT" property="weights"/>
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime"/>
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime"/>
<result column="status" jdbcType="INTEGER" property="status"/>
</resultMap>
<update id="updateStatus">
update vertical_role set status = #{status},updated_time = sysdate() where id = #{idRole}
</update>
<update id="update">
update vertical_role set name = #{name}, input_code = #{inputCode}, weights = #{weights}, updated_time = sysdate() where id = #{idRole}
</update>
<select id="selectRoleByIdUser" resultMap="BaseResultMap">
select sr.* from vertical_user_role sur left join vertical_role sr on sur.id_role = sr.id where id_user = #{id}
</select>
<select id="selectRoleByInputCode" resultMap="BaseResultMap">
select * from vertical_role where input_code = #{inputCode}
</select>
</mapper>