| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.moral.mapper.RoleMapper"> |
| | | |
| | | <resultMap id="ResultMap" type="com.moral.entity.Role"> |
| | | <resultMap id="BaseResultMap" type="com.moral.entity.Role"> |
| | | <id column="id" property="id" jdbcType="INTEGER" /> |
| | | <result column="role_code" property="roleCode" jdbcType="VARCHAR" /> |
| | | <result column="role_name" property="roleName" jdbcType="VARCHAR" /> |
| | | <result column="channel_id" property="channelId" jdbcType="INTEGER" /> |
| | | <result column="is_delete" property="isDelete" jdbcType="CHAR" /> |
| | | <result column="role_remark" property="roleRemark" jdbcType="VARCHAR" /> |
| | | <result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> |
| | |
| | | <result column="update_user" property="updateUser" jdbcType="VARCHAR" /> |
| | | </resultMap> |
| | | |
| | | <resultMap id="BaseResultMap" type="com.moral.entity.Role" extends="ResultMap"> |
| | | <association property="channel" javaType="com.moral.entity.Channel"> |
| | | <result column="channel_id" jdbcType="INTEGER" property="id" /> |
| | | <result column="channel_name" jdbcType="VARCHAR" property="channelName" /> |
| | | </association> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List" > |
| | | id, role_code, role_name, channel_id, is_delete, role_remark, create_time, create_user, |
| | | id, role_code, role_name, is_delete, role_remark, create_time, create_user, |
| | | update_time, update_user |
| | | </sql> |
| | | |
| | |
| | | </where> |
| | | </sql> |
| | | |
| | | <select id="getRoleListByName" resultMap="ResultMap"> |
| | | <select id="getRoleList" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from role |
| | | where is_delete=0 |
| | | <if test="roleName != 'null'"> |
| | | and role_name like concat('%',#{roleName},'%') |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="getRoleList" resultMap="BaseResultMap"> |
| | | select |
| | | r.*, |
| | | c.channel_name |
| | | from role r |
| | | left join channel c on r.channel_id = c.id |
| | | <if test="_parameter != null" > |
| | | <include refid="Example_Where_Clause" /> |
| | | </if> |
| | |
| | | order by ${orderByClause} |
| | | </if> |
| | | </select> |
| | | |
| | | <update id="updateByPrimaryKey" parameterType="com.moral.entity.Role" > |
| | | update role |
| | | <set > |
| | | <if test="roleCode != null" > |
| | | role_code = #{roleCode,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="roleName != null" > |
| | | role_name = #{roleName,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="channelId != null" > |
| | | channel_id = #{channelId,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="isDelete != null" > |
| | | is_delete = #{isDelete,jdbcType=CHAR}, |
| | | </if> |
| | | <if test="roleRemark != null" > |
| | | role_remark = #{roleRemark,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="createTime != null" > |
| | | create_time = #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="createUser != null" > |
| | | create_user = #{createUser,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="updateTime != null" > |
| | | update_time = #{updateTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="updateUser != null" > |
| | | update_user = #{updateUser,jdbcType=VARCHAR}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=INTEGER} |
| | | </update> |
| | | |
| | | </mapper> |