12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?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.zhyc.xps.sys.mapper.RoleMemberMapper">
- <resultMap id="RoleMeberDtoResultMap" type="com.zhyc.xps.sys.dto.RoleMemberDto">
- <result column="rm_id" property="rmId" jdbcType="BIGINT" /> <!--PK ID-->
- <result column="role_id" property="roleId" jdbcType="BIGINT" /> <!--角色ID-->
- <result column="role_type_id" property="roleTypeId" jdbcType="BIGINT" /> <!--角色 Type ID-->
- <result column="role_code" property="roleCode" jdbcType="VARCHAR"/> <!--角色 Code-->
- <result column="role_name" property="roleName" jdbcType="VARCHAR"/> <!--角色 Name-->
- <result column="account_id" property="accountId" jdbcType="BIGINT" /> <!--账号ID-->
- </resultMap>
- <sql id="Ext_Column_List">
- A.rm_id,
- A.role_id,
- B.role_type_id,
- B.role_code,
- B.role_name,
- A.account_id
- </sql>
- <!--根据ID获取信息-->
- <select id="getFirstRoleByAccountId" parameterType="java.lang.Long" resultMap="RoleMeberDtoResultMap">
- SELECT
- <include refid="Ext_Column_List"/>
- FROM s_role_member AS A
- LEFT JOIN s_role AS B ON (A.role_id = B.role_id)
- WHERE account_id = #{accountId, jdbcType=BIGINT}
- LIMIT 1
- </select>
- <!--新增-->
- <insert id="create" parameterType="com.zhyc.xps.sys.entity.RoleMember">
- INSERT INTO s_role_member
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="rmId != null">
- rm_id,
- </if>
- <if test="roleId != null">
- role_id,
- </if>
- <if test="ocId != null">
- oc_id,
- </if>
- <if test="accountId != null">
- account_id,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="rmId != null">
- #{rmId ,jdbcType=BIGINT},
- </if>
- <if test="roleId != null">
- #{roleId ,jdbcType=BIGINT},
- </if>
- <if test="ocId != null">
- #{ocId ,jdbcType=BIGINT},
- </if>
- <if test="accountId != null">
- #{accountId ,jdbcType=BIGINT},
- </if>
- </trim>
- </insert>
- <!--删除-->
- <delete id="delete" parameterType="java.util.Map">
- DELETE
- FROM s_role_member
- WHERE 1 = 1
- <if test="roleId != null">
- and role_id = #{roleId ,jdbcType=BIGINT}
- </if>
- <if test="accountId != null">
- and account_id = #{accountId ,jdbcType=BIGINT}
- </if>
- </delete>
- </mapper>
|