From baa11d154e41d24a790596899b329faaa19b24be Mon Sep 17 00:00:00 2001
From: ZhuDongming <773644075@qq.com>
Date: Wed, 13 Nov 2019 09:31:40 +0800
Subject: [PATCH] update污染溯源
---
src/main/resources/mapper/RoleMapper.xml | 183 ++++++++++++++++++++++-----------------------
1 files changed, 88 insertions(+), 95 deletions(-)
diff --git a/src/main/resources/mapper/RoleMapper.xml b/src/main/resources/mapper/RoleMapper.xml
index a45d1c3..965ff3e 100644
--- a/src/main/resources/mapper/RoleMapper.xml
+++ b/src/main/resources/mapper/RoleMapper.xml
@@ -3,106 +3,53 @@
<mapper namespace="com.moral.mapper.RoleMapper">
<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="is_delete" property="isDelete" jdbcType="CHAR"/>
- <result column="role_remark" property="roleRemark" jdbcType="VARCHAR"/>
- <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
- <result column="create_user" property="createUser" jdbcType="VARCHAR"/>
- <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
- <result column="update_user" property="updateUser" jdbcType="VARCHAR"/>
+ <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="is_delete" property="isDelete" jdbcType="CHAR" />
+ <result column="role_remark" property="roleRemark" jdbcType="VARCHAR" />
+ <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
+ <result column="create_user" property="createUser" jdbcType="VARCHAR" />
+ <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
+ <result column="update_user" property="updateUser" jdbcType="VARCHAR" />
</resultMap>
- <sql id="Base_Column_List">
- id, role_code, role_name, is_delete, role_remark, create_time, create_user, update_time,
- update_user
+ <sql id="Base_Column_List" >
+ id, role_code, role_name, is_delete, role_remark, create_time, create_user,
+ update_time, update_user
</sql>
- <insert id="insertSelective" parameterType="com.moral.entity.Role">
- insert into role
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">
- id,
- </if>
- <if test="roleCode != null">
- role_code,
- </if>
- <if test="roleName != null">
- role_name,
- </if>
- <if test="isDelete != null">
- is_delete,
- </if>
- <if test="roleRemark != null">
- role_remark,
- </if>
- <if test="createTime != null">
- create_time,
- </if>
- <if test="createUser != null">
- create_user,
- </if>
- <if test="updateTime != null">
- update_time,
- </if>
- <if test="updateUser != null">
- update_user,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null">
- #{id,jdbcType=INTEGER},
- </if>
- <if test="roleCode != null">
- #{roleCode,jdbcType=VARCHAR},
- </if>
- <if test="roleName != null">
- #{roleName,jdbcType=VARCHAR},
- </if>
- <if test="isDelete != null">
- #{isDelete,jdbcType=CHAR},
- </if>
- <if test="roleRemark != null">
- #{roleRemark,jdbcType=VARCHAR},
- </if>
- <if test="createTime != null">
- #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="createUser != null">
- #{createUser,jdbcType=VARCHAR},
- </if>
- <if test="updateTime != null">
- #{updateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="updateUser != null">
- #{updateUser,jdbcType=VARCHAR},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.moral.entity.Role">
- update role
- <set>
- <if test="roleName != null">
- role_name=#{roleName,jdbcType=VARCHAR},
- </if>
- <if test="roleCode != null">
- role_code=#{roleCode,jdbcType=VARCHAR},
- </if>
- <if test="roleRemark != null">
- role_remark=#{roleRemark,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>
+ <sql id="Example_Where_Clause" >
+ <where >
+ <foreach collection="oredCriteria" item="criteria" separator="or" >
+ <if test="criteria.valid" >
+ <trim prefix="(" suffix=")" prefixOverrides="and" >
+ <foreach collection="criteria.criteria" item="criterion" >
+ <choose >
+ <when test="criterion.noValue" >
+ and ${criterion.condition}
+ </when>
+ <when test="criterion.singleValue" >
+ and ${criterion.condition} #{criterion.value}
+ </when>
+ <when test="criterion.betweenValue" >
+ and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+ </when>
+ <when test="criterion.listValue" >
+ and ${criterion.condition}
+ <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
+ #{listItem}
+ </foreach>
+ </when>
+ </choose>
+ </foreach>
+ </trim>
+ </if>
+ </foreach>
+ </where>
+ </sql>
- <select id="getRoleList" resultMap="BaseResultMap">
+ <select id="getRoleListByName" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from role
@@ -112,4 +59,50 @@
</if>
</select>
+ <select id="getRoleList" resultMap="BaseResultMap">
+ select
+ <include refid="Base_Column_List"/>
+ from role
+ <if test="_parameter != null" >
+ <include refid="Example_Where_Clause" />
+ </if>
+ <if test="orderByClause != null" >
+ 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>
\ No newline at end of file
--
Gitblit v1.8.0