1234567891011121314151617181920212223242526272829303132 |
- <?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.com.ty.lift.system.user.dao.mapper.UserRoleMapper" >
- <resultMap id="BaseResultMap" type="cn.com.ty.lift.system.user.dao.entity.UserRole" >
- <id column="id" property="id" jdbcType="BIGINT" />
- <result column="user_id" property="userId" jdbcType="BIGINT" />
- <result column="role_id" property="roleId" jdbcType="BIGINT" />
- <result column="company_id" property="companyId" jdbcType="BIGINT"/>
- </resultMap>
- <sql id="Base_Column_List" >
- id, user_id, role_id, company_id
- </sql>
- <!-- 通过用户id和公司id获取角色用户关联关系 -->
- <select id="getByUserRole" parameterType="cn.com.ty.lift.system.user.dao.entity.UserRole" resultType="cn.com.ty.lift.system.user.dao.entity.UserRole">
- select
- <include refid="Base_Column_List"/>
- from user_role
- where true
- <if test="userId != null">
- and user_id = #{userId,jdbcType=BIGINT}
- </if>
- <if test="roleId != null">
- and role_id = #{roleId,jdbcType=BIGINT}
- </if>
- <if test="companyId != null">
- and company_id = #{companyId,jdbcType=BIGINT}
- </if>
- </select>
- </mapper>
|