|
|
<?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.tianbo.warehouse.dao.UserRoleMapper" >
|
|
|
<resultMap id="BaseResultMap" type="com.tianbo.warehouse.model.UserRole" >
|
|
|
<id column="id" property="id" jdbcType="INTEGER" />
|
|
|
<result column="user_id" property="userId" jdbcType="INTEGER" />
|
|
|
<result column="role_id" property="roleId" jdbcType="INTEGER" />
|
|
|
</resultMap>
|
|
|
<sql id="Base_Column_List" >
|
|
|
id, user_id, role_id
|
|
|
</sql>
|
|
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
|
|
|
select
|
|
|
<include refid="Base_Column_List" />
|
|
|
from user_role
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
</select>
|
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
|
|
|
delete from user_role
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
</delete>
|
|
|
<delete id="deleteByUserId" parameterType="java.lang.Integer" >
|
|
|
delete from user_role
|
|
|
where user_id = #{userId,jdbcType=INTEGER}
|
|
|
</delete>
|
|
|
<insert id="insert" parameterType="com.tianbo.warehouse.model.UserRole" >
|
|
|
insert into user_role (id, user_id, role_id
|
|
|
)
|
|
|
values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{roleId,jdbcType=INTEGER}
|
|
|
)
|
|
|
</insert>
|
|
|
<insert id="insertSelective" parameterType="com.tianbo.warehouse.model.UserRole" >
|
|
|
insert into user_role
|
|
|
<trim prefix="(" suffix=")" suffixOverrides="," >
|
|
|
<if test="id != null" >
|
|
|
id,
|
|
|
</if>
|
|
|
<if test="userId != null" >
|
|
|
user_id,
|
|
|
</if>
|
|
|
<if test="roleId != null" >
|
|
|
role_id,
|
|
|
</if>
|
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
|
|
<if test="id != null" >
|
|
|
#{id,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
<if test="userId != null" >
|
|
|
#{userId,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
<if test="roleId != null" >
|
|
|
#{roleId,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
</trim>
|
|
|
</insert>
|
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.tianbo.warehouse.model.UserRole" >
|
|
|
update user_role
|
|
|
<set >
|
|
|
<if test="userId != null" >
|
|
|
user_id = #{userId,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
<if test="roleId != null" >
|
|
|
role_id = #{roleId,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
</set>
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
</update>
|
|
|
<update id="updateByPrimaryKey" parameterType="com.tianbo.warehouse.model.UserRole" >
|
|
|
update user_role
|
|
|
set user_id = #{userId,jdbcType=INTEGER},
|
|
|
role_id = #{roleId,jdbcType=INTEGER}
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
</update>
|
|
|
</mapper> |
|
|
\ No newline at end of file |
...
|
...
|
|