123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220 |
- <?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.RolePermitMapper">
- <resultMap id="RolePermitDtoResultMap" type="com.zhyc.xps.sys.dto.RolePermitDto" >
- <result column="client_id" property="clientId" jdbcType="BIGINT" />
- <result column="role_id" property="roleId" jdbcType="BIGINT" />
- <result column="permit_id" property="permitId" jdbcType="BIGINT" />
- <result column="permit_title" property="permitTitle" jdbcType="VARCHAR"/>
- <result column="permit_code" property="permitCode" jdbcType="VARCHAR"/>
- <result column="permit_entry" property="permitEntry" jdbcType="VARCHAR"/>
- <result column="permit_desc" property="permitDesc" jdbcType="VARCHAR"/>
- <result column="permit_type" property="permitType" jdbcType="BIGINT"/>
- <result column="parent_id" property="parentId" jdbcType="BIGINT" />
- <result column="root_id" property="rootId" jdbcType="BIGINT" />
- <result column="sort_no" property="sortNo" jdbcType="BIGINT" />
- <result column="is_home" property="isHome" jdbcType="BIGINT" />
- </resultMap>
- <sql id="RolePermitDto_Cols">
- A.client_id,
- A.role_id,
- A.permit_id,
- A.permit_title,
- A.permit_code,
- A.permit_entry,
- A.permit_desc,
- A.permit_type,
- A.parent_id,
- A.root_id,
- A.sort_no,
- A.is_home
- </sql>
- <!--列表查询-->
- <select id="getByList" resultMap="RolePermitDtoResultMap" >
- SELECT
- <include refid="RolePermitDto_Cols"/>
- FROM s_role_permit AS A
- WHERE 1 = 1
- <if test="clientId != null">
- AND A.client_id = #{clientId,jdbcType=BIGINT}
- </if>
- <if test="roleId != null">
- AND A.role_id = #{roleId,jdbcType=BIGINT}
- </if>
- <if test="permitId != null">
- AND A.permit_id = #{permitId ,jdbcType=BIGINT}
- </if>
- ORDER BY A.parent_id ASC ,A.sort_no ASC
- </select>
- <!--基于ID查询-->
- <select id="getById" resultMap="RolePermitDtoResultMap" >
- SELECT
- <include refid="RolePermitDto_Cols"/>
- FROM s_role_permit AS A
- WHERE 1 = 1
- <if test="clientId != null">
- AND A.client_id = #{clientId,jdbcType=BIGINT}
- </if>
- <if test="roleId != null">
- AND A.role_id = #{roleId,jdbcType=BIGINT}
- </if>
- <if test="permitId != null">
- AND A.permit_id = #{permitId ,jdbcType=BIGINT}
- </if>
- ORDER BY A.parent_id ASC ,A.sort_no ASC
- </select>
- <!--新增-->
- <insert id="create" parameterType="com.zhyc.xps.sys.entity.RolePermit">
- INSERT INTO s_role_permit
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="clientId != null">
- client_id,
- </if>
- <if test="roleId != null">
- role_id,
- </if>
- <if test="permitId != null">
- permit_id,
- </if>
- <if test="permitTitle != null and permitTitle != ''">
- permit_title,
- </if>
- <if test="permitCode != null and permitCode != ''">
- permit_code,
- </if>
- <if test="permitEntry != null and permitEntry != ''">
- permit_entry,
- </if>
- <if test="permitDesc != null and permitDesc != ''">
- permit_desc,
- </if>
- <if test="permitType != null">
- permit_type,
- </if>
- <if test="parentId != null">
- parent_id,
- </if>
- <if test="rootId != null">
- root_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="clientId != null">
- #{clientId ,jdbcType=BIGINT},
- </if>
- <if test="roleId != null">
- #{roleId ,jdbcType=BIGINT},
- </if>
- <if test="permitId != null">
- #{permitId ,jdbcType=BIGINT},
- </if>
- <if test="permitTitle != null and permitTitle != ''">
- #{permitTitle ,jdbcType=VARCHAR},
- </if>
- <if test="permitCode != null and permitCode != ''">
- #{permitCode ,jdbcType=VARCHAR},
- </if>
- <if test="permitEntry != null and permitEntry != ''">
- #{permitEntry ,jdbcType=VARCHAR},
- </if>
- <if test="permitDesc != null and permitDesc != ''">
- #{permitDesc ,jdbcType=VARCHAR},
- </if>
- <if test="permitType != null">
- #{permitType ,jdbcType=BIGINT},
- </if>
- <if test="parentId != null">
- #{parentId ,jdbcType=BIGINT},
- </if>
- <if test="rootId != null">
- #{rootId ,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=TIMESTAMP},
- </if>
- </trim>
- </insert>
- <!--更新-->
- <update id="update" parameterType="com.zhyc.xps.sys.entity.RolePermit">
- update s_role_permit
- <set>
- <if test="permitTitle != null and permitTitle != ''">
- permit_title = #{permitTitle, jdbcType=VARCHAR},
- </if>
- <if test="permitCode != null and permitCode != ''">
- permit_code = #{permitCode, jdbcType=VARCHAR},
- </if>
- <if test="permitEntry != null and permitEntry != ''">
- permit_entry = #{permitEntry ,jdbcType=VARCHAR},
- </if>
- <if test="permitDesc != null and permitDesc != ''">
- permit_desc = #{permitDesc, jdbcType=VARCHAR},
- </if>
- <if test="permitType != null">
- permit_type = #{permitType ,jdbcType=BIGINT},
- </if>
- <if test="parentId != null">
- parent_id = #{parentId ,jdbcType=BIGINT},
- </if>
- <if test="rootId != null">
- root_id = #{rootId ,jdbcType=BIGINT},
- </if>
- <if test="sortNo != null">
- sort_no = #{sortNo ,jdbcType=BIGINT},
- </if>
- <if test="updatedBy != null">
- updated_by = #{updatedBy ,jdbcType=BIGINT},
- </if>
- <if test="updatedAt != null">
- updated_at = #{updatedAt ,jdbcType=TIMESTAMP},
- </if>
- </set>
- WHERE 1 = 1
- <if test="clientId != null">
- AND client_id = #{clientId , jdbcType=BIGINT}
- </if>
- <if test="roleId != null">
- AND role_id = #{roleId , jdbcType=BIGINT}
- </if>
- <if test="permitId != null">
- AND permit_id = #{permitId , jdbcType=BIGINT}
- </if>
- </update>
- <!--删除-->
- <delete id="delete" parameterType="java.util.Map">
- DELETE
- FROM s_role_permit
- WHERE 1 = 1
- <if test="clientId != null">
- AND client_id = #{clientId , jdbcType=BIGINT}
- </if>
- <if test="roleId != null">
- AND role_id = #{roleId , jdbcType=BIGINT}
- </if>
- <if test="permitId != null">
- AND permit_id = #{permitId , jdbcType=BIGINT}
- </if>
- </delete>
- </mapper>
|