123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- <?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.RoleMapper">
- <resultMap id="BaseResultMap" type="com.zhyc.xps.sys.entity.Role">
- <result column="role_id" property="roleId" jdbcType="BIGINT" />
- <result column="role_name" property="roleName" jdbcType="VARCHAR" />
- <result column="role_desc" property="roleDesc" jdbcType="VARCHAR" />
- <result column="sort_no" property="sortNo" jdbcType="BIGINT" />
- <result column="is_fixed" property="isFixed" jdbcType="BIGINT" />
- <result column="role_type_id" property="roleTypeId" jdbcType="BIGINT" />
- </resultMap>
- <sql id="Base_Column_List">
- role_id,
- role_name,
- role_code,
- role_desc,
- role_type_id,
- sort_no,
- is_fixed
- </sql>
- <!--基于ID查询-->
- <select id="getById" parameterType="java.lang.Long" resultMap="BaseResultMap">
- SELECT
- <include refid="Base_Column_List"/>
- FROM s_role
- WHERE role_id = #{roleId, jdbcType=BIGINT}
- </select>
- <!--分页查询-->
- <select id="getByPage" parameterType="java.util.Map" resultMap="BaseResultMap">
- SELECT
- <include refid="Base_Column_List"/>
- FROM s_role
- WHERE 1 = 1 AND deleted_flag = 0
- <if test="keywords != null and keywords != ''">
- and role_name like "%"#{keywords}"%"
- </if>
- ORDER BY role_id ASC
- </select>
- <!--列表查询-->
- <select id="getByList" parameterType="java.util.Map" resultMap="BaseResultMap" >
- SELECT
- <include refid="Base_Column_List"/>
- FROM s_role
- WHERE deleted_flag = 0
- <if test="keywords != null and keywords != ''">
- and role_name like "%"#{keywords}"%"
- </if>
- ORDER BY role_id ASC
- </select>
- <!--新增-->
- <insert id="create" useGeneratedKeys="true" keyProperty="roleId" parameterType="com.zhyc.xps.sys.entity.Role">
- INSERT INTO s_role
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="roleId != null">
- role_id,
- </if>
- <if test="roleName != null and roleName != ''">
- role_name,
- </if>
- <if test="roleCode != null and roleCode != ''">
- role_code,
- </if>
- <if test="roleDesc != null and roleDesc != ''">
- role_desc,
- </if>
- <if test="isFixed != null">
- is_fixed,
- </if>
- <if test="roleTypeId != null">
- role_type_id,
- </if>
- <if test="sortNo != null">
- sort_no,
- </if>
- <if test="createdBy != null">
- created_by,
- </if>
- <if test="createdAt != null">
- created_at,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="roleId != null">
- #{roleId,jdbcType=BIGINT},
- </if>
- <if test="roleName != null and roleName != ''">
- #{roleName,jdbcType=VARCHAR},
- </if>
- <if test="roleCode != null and roleCode != ''">
- #{roleCode,jdbcType=VARCHAR},
- </if>
- <if test="roleDesc != null and roleDesc != ''">
- #{roleDesc,jdbcType=VARCHAR},
- </if>
- <if test="isFixed != null">
- #{isFixed,jdbcType=BIGINT},
- </if>
- <if test="roleTypeId != null">
- #{roleTypeId,jdbcType=BIGINT},
- </if>
- <if test="sortNo != null">
- #{sortNo,jdbcType=BIGINT},
- </if>
- <if test="createdBy != null">
- #{createdBy,jdbcType=BIGINT},
- </if>
- <if test="createdAt != null">
- #{createdAt,jdbcType=DATE},
- </if>
- </trim>
- </insert>
- <!--更新-->
- <update id="update" parameterType="com.zhyc.xps.sys.entity.Role">
- UPDATE s_role
- <trim suffixOverrides=",">
- <set>
- <if test="roleName != null and roleName != ''">
- role_name = #{roleName,jdbcType=VARCHAR},
- </if>
- <if test="roleCode != null and roleCode != ''">
- role_code = #{roleCode,jdbcType=VARCHAR},
- </if>
- <if test="roleDesc != null">
- role_desc = #{roleDesc,jdbcType=VARCHAR},
- </if>
- <if test="sortNo != null">
- sort_no = #{sortNo,jdbcType=BIGINT},
- </if>
- <if test="isFixed != null">
- is_fixed = #{isFixed,jdbcType=BIGINT},
- </if>
- <if test="roleTypeId != null">
- role_type_id = #{roleTypeId,jdbcType=BIGINT},
- </if>
- <if test="updatedBy != null">
- updated_by = #{updatedBy,jdbcType=BIGINT},
- </if>
- <if test="updatedAt != null">
- updated_at = #{updatedAt,jdbcType=DATE},
- </if>
- </set>
- </trim>
- WHERE role_id = #{roleId, jdbcType=BIGINT}
- </update>
- <!--删除 -->
- <update id="delete" parameterType="java.util.Map">
- UPDATE s_role
- <trim suffixOverrides=",">
- <set>
- <if test="deletedBy != null">
- deleted_by = #{deletedBy ,jdbcType=BIGINT},
- </if>
- <if test="deletedAt != null">
- deleted_at = #{deletedAt ,jdbcType=DATE},
- </if>
- <if test="deletedFlag != null">
- deleted_flag = #{deletedFlag ,jdbcType=BIGINT},
- </if>
- </set>
- </trim>
- WHERE role_id = #{roleId, jdbcType=BIGINT}
- </update>
- </mapper>
|