From 782e84d68779471c0640584678d4c4df3afa80a2 Mon Sep 17 00:00:00 2001
From: 于紫祥_1901 <email@yuzixiang_1910>
Date: Mon, 14 Dec 2020 17:29:08 +0800
Subject: [PATCH] 电子屏

---
 src/main/resources/mapper/RoleMapper.xml |  143 +++++++++++++++--------------------------------
 1 files changed, 46 insertions(+), 97 deletions(-)

diff --git a/src/main/resources/mapper/RoleMapper.xml b/src/main/resources/mapper/RoleMapper.xml
index a45d1c3..041054a 100644
--- a/src/main/resources/mapper/RoleMapper.xml
+++ b/src/main/resources/mapper/RoleMapper.xml
@@ -3,112 +3,61 @@
 <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
         <include refid="Base_Column_List"/>
         from role
-        where is_delete=0
-        <if test="roleName != 'null'">
-            and role_name like concat('%',#{roleName},'%')
+        <if test="_parameter != null" >
+            <include refid="Example_Where_Clause" />
+        </if>
+        <if test="orderByClause != null" >
+            order by ${orderByClause}
         </if>
     </select>
 

--
Gitblit v1.8.0