浏览代码

Merge remote-tracking branch 'origin/master'

hym 4 年之前
父节点
当前提交
25e7e25267
共有 1 个文件被更改,包括 211 次插入0 次删除
  1. 211 0
      user_center/src/main/resources/mapper/DictMapper.xml

+ 211 - 0
user_center/src/main/resources/mapper/DictMapper.xml

@@ -0,0 +1,211 @@
+<?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.huaxu.dao.DictMapper">
+    <!-- 结果集 -->
+    <resultMap type="com.huaxu.entity.Dict" id="DictMap">
+        <result property="id" column="ID" jdbcType="INTEGER"/>
+        <result property="dictName" column="DICT_NAME" jdbcType="VARCHAR"/>
+        <result property="dictCode" column="DICT_CODE" jdbcType="VARCHAR"/>
+        <result property="dictValue" column="DICT_VALUE" jdbcType="VARCHAR"/>
+        <result property="parentDictId" column="PARENT_DICT_ID" jdbcType="INTEGER"/>
+        <result property="remark" column="REMARK" jdbcType="VARCHAR"/>
+        <result property="status" column="STATUS" jdbcType="INTEGER"/>
+        <result property="createBy" column="CREATE_BY" jdbcType="VARCHAR"/>
+        <result property="dateCreate" column="DATE_CREATE" jdbcType="TIMESTAMP"/>
+        <result property="updateBy" column="UPDATE_BY" jdbcType="VARCHAR"/>
+        <result property="dateUpdate" column="DATE_UPDATE" jdbcType="TIMESTAMP"/>
+    </resultMap>
+
+    <!-- 基本字段 -->
+    <sql id="Base_Column_List">
+         ID,DICT_NAME,DICT_CODE,DICT_VALUE,	PARENT_DICT_ID,	REMARK,	STATUS,	DATE_CREATE,CREATE_BY,DATE_UPDATE,UPDATE_BY</sql>
+
+    <!-- 查询单个 -->
+    <select id="selectById" resultMap="DictMap">
+        select
+        <include refid="Base_Column_List"/>
+        from uims_dict
+        where ID = #{id}
+    </select>
+
+
+    <!-- 查询全部 -->
+    <select id="selectAll" resultMap="DictMap">
+        select
+        <include refid="Base_Column_List"/>
+        from uims_dict
+    </select>
+
+    <!--通过实体作为筛选条件查询-->
+    <select id="selectList" resultMap="DictMap">
+        select
+        <include refid="Base_Column_List"/>
+        from uims_dict
+        <where>
+            <if test="id != null">
+                and ID = #{id}
+            </if>
+            <if test="dictName != null and dictName != ''">
+                and DICT_NAME = #{dictName}
+            </if>
+            <if test="dictCode != null and dictCode != ''">
+                and (DICT_CODE LIKE CONCAT('%',#{dictCode},'%')
+            </if>
+            <if test="dictValue != null and dictValue != ''">
+                or DICT_VALUE LIKE CONCAT('%',#{dictValue},'%'))
+            </if>
+            <if test="parentDictId != null and parentDictId != ''">
+                and PARENT_DICT_ID = #{parentDictId}
+            </if>
+            <if test="remark != null and remark != ''">
+                and REMARK = #{remark}
+            </if>
+            <if test="status != null">
+                and STATUS = #{status}
+            </if>
+            <if test="createBy != null and createBy != ''">
+                and CREATE_BY = #{createBy}
+            </if>
+            <if test="dateCreate != null">
+                and DATE_CREATE = #{dateCreate}
+            </if>
+            <if test="updateBy != null and updateBy != ''">
+                and UPDATE_BY = #{updateBy}
+            </if>
+            <if test="dateUpdate != null">
+                and DATE_UPDATE = #{dateUpdate}
+            </if>
+            and STATUS =1
+        </where>
+    </select>
+
+    <!-- 新增所有列 -->
+    <insert id="insert" keyProperty="id" useGeneratedKeys="true">
+        insert into uims_dict(ID,DICT_NAME,DICT_CODE,DICT_VALUE,PARENT_DICT_ID,	REMARK,	STATUS,	CREATE_BY,DATE_CREATE,UPDATE_BY,DATE_UPDATE)
+        values ( #{id}, #{dictName}, #{dictCode}, #{dictValue}, #{parentDictId}, #{remark}, 1, #{createBy}, #{dateCreate}, #{updateBy}, #{dateUpdate})
+    </insert>
+
+    <!-- 批量新增 -->
+    <insert id="batchInsert">
+        insert into uims_dict(ID,DICT_NAME,DICT_CODE,DICT_VALUE,PARENT_DICT_ID,	REMARK,	STATUS,	CREATE_BY,DATE_CREATE,UPDATE_BY,DATE_UPDATE)
+        values
+        <foreach collection="dicts" item="item" index="index" separator=",">
+            (
+            #{item.id}, #{item.dictName}, #{item.dictCode}, #{item.dictValue}, #{item.parentDictId}, #{item.remark}, 1,
+            #{item.createBy}, #{item.dateCreate}, #{item.updateBy}, #{item.dateUpdate})
+        </foreach>
+    </insert>
+
+    <!-- 通过主键修改数据 -->
+    <update id="update">
+        update uims.uims_dict
+        <set>
+            <if test="dictName != null and dictName != ''">
+                DICT_NAME = #{dictName},
+            </if>
+            <if test="dictCode != null and dictCode != ''">
+                DICT_CODE = #{dictCode},
+            </if>
+            <if test="dictValue != null and dictValue != ''">
+                DICT_VALUE = #{dictValue},
+            </if>
+            <if test="parentDictId != null and parentDictId != ''">
+                PARENT_DICT_ID = #{parentDictId},
+            </if>
+            <if test="remark != null and remark != ''">
+                REMARK = #{remark},
+            </if>
+            <if test="status != null">
+                STATUS = #{status},
+            </if>
+            <if test="createBy != null and createBy != ''">
+                CREATE_BY = #{createBy},
+            </if>
+            <if test="dateCreate != null">
+                DATE_CREATE = #{dateCreate},
+            </if>
+            <if test="updateBy != null and updateBy != ''">
+                UPDATE_BY = #{updateBy},
+            </if>
+            <if test="dateUpdate != null">
+                DATE_UPDATE = #{dateUpdate},
+            </if>
+        </set>
+        where ID = #{id}
+    </update>
+
+    <!--通过主键删除-物理删除-->
+    <!--<delete id="deleteById" parameterType="java.util.List">
+        delete from uims_dict where ID IN
+        <foreach item="item" index="index" collection="idList" open="("
+                 separator="," close=")">
+            #{item}
+        </foreach>
+         or  PARENT_DICT_ID in
+        <foreach item="item" index="index" collection="idList" open="("
+                 separator="," close=")">
+            #{item}
+        </foreach>
+    </delete>-->
+    <!--通过主键删除-逻辑删除-->
+    <update id="deleteById" parameterType="java.util.List">
+        update uims.uims_dict
+        set STATUS=0
+        where ID in
+        <foreach item="item" index="index" collection="idList" open="("
+                 separator="," close=")">
+            #{item}
+        </foreach>
+            or  PARENT_DICT_ID in
+        <foreach item="item" index="index" collection="idList" open="("
+                 separator="," close=")">
+            #{item}
+        </foreach>
+    </update>
+    <!-- 总数 -->
+    <select id="count" resultType="int">
+        select count(*) from uims_dict
+    </select>
+    <select id="selectPage" resultMap="DictMap">
+        select
+        <include refid="Base_Column_List"/>
+        from uims_dict
+        <where>
+            <if test="dict.id != null">
+                and ID = #{dict.id}
+            </if>
+            <if test="dict.dictName != null and dict.dictName != ''">
+                and (DICT_NAME LIKE CONCAT('%',#{dict.dictName},'%')
+            </if>
+            <if test="dict.dictCode != null and dict.dictCode != ''">
+                or DICT_CODE LIKE CONCAT('%',#{dict.dictCode},'%'))
+            </if>
+            <if test="dict.dictValue != null and dict.dictValue != ''">
+                and DICT_VALUE = #{dict.dictValue}
+            </if>
+            <if test="dict.parentDictId != null and dict.parentDictId != ''">
+                and PARENT_DICT_ID = #{dict.parentDictId}
+            </if>
+            <if test="dict.remark != null and dict.remark != ''">
+                and REMARK = #{dict.remark}
+            </if>
+            <if test="dict.status != null">
+                and STATUS = #{dict.status}
+            </if>
+            <if test="dict.createBy != null and dict.createBy != ''">
+                and CREATE_BY = #{dict.createBy}
+            </if>
+            <if test="dict.dateCreate != null">
+                and DATE_CREATE = #{dict.dateCreate}
+            </if>
+            <if test="dict.updateBy != null and dict.updateBy != ''">
+                and UPDATE_BY = #{dict.updateBy}
+            </if>
+            <if test="dict.dateUpdate != null">
+                and DATE_UPDATE = #{dict.dateUpdate}
+            </if>
+            and PARENT_DICT_ID IS NULL
+            and STATUS =1
+        </where>
+    </select>
+</mapper>