From 1ff17fd97a85cd191467b4a2ffe0e4b7b1959af5 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期日, 12 十一月 2023 17:00:25 +0800 Subject: [PATCH] 查询用户同时得到其对应的多个角色,采用积极关联查询方式 --- pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaDistrictMapper.xml | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 51 insertions(+), 8 deletions(-) diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaDistrictMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaDistrictMapper.xml index e434616..f8679a0 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaDistrictMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaDistrictMapper.xml @@ -5,13 +5,14 @@ <!--@mbg.generated--> <!--@Table ba_district--> <id column="id" jdbcType="BIGINT" property="id" /> + <id column="supperId" jdbcType="BIGINT" property="supperId" /> <result column="name" jdbcType="VARCHAR" property="name" /> <result property="level" column="level" typeHandler="com.dy.common.mybatis.envm.EnumCodeTypeHandler" javaType="com.dy.pipIrrGlobal.util.DistrictLevel"/> - + <result property="deleted" column="deleted" typeHandler="com.dy.common.mybatis.envm.EnumCodeTypeHandler" javaType="com.dy.common.mybatis.envm.Deleted"/> </resultMap> <sql id="Base_Column_List"> <!--@mbg.generated--> - id, `name`, `level` + id, supperId, `name`, `level`, deleted </sql> <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> <!--@mbg.generated--> @@ -20,17 +21,39 @@ from ba_district where id = #{id,jdbcType=BIGINT} </select> + <select id="selectByLevel" parameterType="java.lang.Byte" resultMap="BaseResultMap"> + <!--@mbg.generated--> + select + <include refid="Base_Column_List" /> + from ba_district + where level = #{level,jdbcType=TINYINT} + </select> + <select id="selectBySupperId" parameterType="java.lang.Long" resultMap="BaseResultMap"> + <!--@mbg.generated--> + select + <include refid="Base_Column_List" /> + from ba_district + where supperId = #{supperId,jdbcType=BIGINT} + </select> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> <!--@mbg.generated--> delete from ba_district where id = #{id,jdbcType=BIGINT} </delete> + <delete id="deleteLogicById" parameterType="java.lang.Long"> + <!--@mbg.generated--> + update ba_district set deleted = 1 + where id = #{id,jdbcType=BIGINT} + </delete> <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoBa.BaDistrict"> <!--@mbg.generated--> - insert into ba_district (id, `name`, `level` - ) - values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{level,jdbcType=TINYINT} - ) + insert into ba_district (id, supperId, `name`, `level`, deleted) + values (#{id,jdbcType=BIGINT}, + #{supperId,jdbcType=BIGINT}, + #{name,jdbcType=VARCHAR}, + #{level,jdbcType=TINYINT}, + #{deleted,jdbcType=TINYINT} + ) </insert> <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaDistrict"> <!--@mbg.generated--> @@ -39,22 +62,34 @@ <if test="id != null"> id, </if> + <if test="supperId != null"> + supperId, + </if> <if test="name != null"> `name`, </if> <if test="level != null"> `level`, </if> + <if test="deleted != null"> + deleted, + </if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="id != null"> #{id,jdbcType=BIGINT}, + </if> + <if test="supperId != null"> + #{supperId,jdbcType=BIGINT}, </if> <if test="name != null"> #{name,jdbcType=VARCHAR}, </if> <if test="level != null"> #{level,jdbcType=TINYINT}, + </if> + <if test="deleted != null"> + #{deleted,jdbcType=TINYINT}, </if> </trim> </insert> @@ -65,8 +100,14 @@ <if test="name != null"> `name` = #{name,jdbcType=VARCHAR}, </if> + <if test="supperId != null"> + supperId = #{supperId,jdbcType=BIGINT}, + </if> <if test="level != null"> `level` = #{level,jdbcType=TINYINT}, + </if> + <if test="deleted != null"> + deleted = #{deleted,jdbcType=TINYINT}, </if> </set> where id = #{id,jdbcType=BIGINT} @@ -74,8 +115,10 @@ <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoBa.BaDistrict"> <!--@mbg.generated--> update ba_district - set `name` = #{name,jdbcType=VARCHAR}, - `level` = #{level,jdbcType=TINYINT} + set supperId = #{supperId,jdbcType=BIGINT}, + `name` = #{name,jdbcType=VARCHAR}, + `level` = #{level,jdbcType=TINYINT}, + deleted = #{deleted,jdbcType=TINYINT} where id = #{id,jdbcType=BIGINT} </update> </mapper> \ No newline at end of file -- Gitblit v1.8.0