CenterRoleMapper.xml 2.31 KB
<?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="org.nafmii.admin.user.dao.CenterRoleMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="org.nafmii.admin.user.entity.CenterRolePO">
        <id column="ID" property="id" />
        <result column="R_NAME" property="rName" />
        <result column="CREAT_TIME" property="creatTime" />
        <result column="UPDATE_TIME" property="updateTime" />
        <result column="IS_ENABLE" property="isEnable" />
        <result column="CREATE_USER_ID" property="createUserId" />
        <result column="UPDATE_USER_ID" property="updateUserId" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        ID, R_NAME, CREAT_TIME, UPDATE_TIME, IS_ENABLE, CREATE_USER_ID, UPDATE_USER_ID
    </sql>
    <!-- 新增修改中心端角色 -->
    <update id="updateRoleById" parameterType="map" >
        update CENTER_ROLE
        <set >
            <if test="rName != null" >
                R_NAME = #{rName,jdbcType=VARCHAR},
            </if>
            <if test="updateTime != null" >
                UPDATE_TIME = #{updateTime,jdbcType=DATE},
            </if>
            <if test="isEnable != null" >
                IS_ENABLE = #{isEnable,jdbcType=VARCHAR},
            </if>
            <if test="updateUserId != null" >
                UPDATE_USER_ID = #{updateUserId,jdbcType=BIGINT},
            </if>
        </set>
        where ID = #{id,jdbcType=VARCHAR}
    </update>

    <!-- 查询中心端角色 -->
    <select id="queryRoles" resultType="org.nafmii.admin.user.vo.CenterRoleVO">
        select
        ID as id, R_NAME as rName, CREAT_TIME as creatTime, UPDATE_TIME as updateTime, IS_ENABLE as isEnable, CREATE_USER_ID as createUserId, UPDATE_USER_ID as updateUserId
        from CENTER_ROLE
    </select>

    <!-- 删除中心端角色 -->
    <delete id="deleteRoles">
        delete
        from CENTER_ROLE
        where ID IN
        <foreach collection="array" item="id" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>

    <!-- 中心端用户对应角色查询 -->
    <select id="queryRolesByUser" resultType="java.util.List">
        <!-- TODO -->
    </select>
</mapper>