123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- <?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.aidex.system.mapper.SysTableConfigMapper">
- <sql id="sysTableConfigColumns">
- table_key as "tableKey",
- user_id as "userId",
- space as "space",
- columns as "columns",
- remark as "remark",
- status as "status",
- id as "id",
- create_by as "createBy",
- create_dept as "createDept",
- create_time as "createTime",
- update_by as "updateBy",
- update_time as "updateTime",
- update_ip as "updateIp",
- version as "version",
- del_flag as "delFlag"
- </sql>
- <sql id="sysTableConfigJoins">
- </sql>
- <select id="get" resultType="SysTableConfig">
- SELECT
- <include refid="sysTableConfigColumns"/>
- FROM sys_table_config a
- <include refid="sysTableConfigJoins"/>
- WHERE a.id = #{id}
- </select>
- <select id="findList" resultType="SysTableConfig">
- SELECT
- <include refid="sysTableConfigColumns"/>
- FROM sys_table_config a
- <include refid="sysTableConfigJoins"/>
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL}
- <if test="tableKey != null and tableKey != ''">
- and table_key = #{tableKey}
- </if>
- <if test="userId != null and userId != ''">
- and user_id = #{userId}
- </if>
- <if test="space != null and space != ''">
- and space like concat('%', #{space}, '%')
- </if>
- <if test="columns != null and columns != ''">
- and columns like concat('%', #{columns}, '%')
- </if>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- ORDER BY a.create_time
- </otherwise>
- </choose>
- </select>
- <select id="findListWithUnique" resultType="SysTableConfig">
- SELECT
- a.id
- FROM sys_table_config a
- <include refid="sysTableConfigJoins"/>
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL}
- <if test="notEqualId != null and notEqualId != ''">
- AND id != #{notEqualId}
- </if>
- </where>
- </select>
- <insert id="insert">
- INSERT INTO sys_table_config(
- table_key,
- user_id,
- space,
- columns,
- remark,
- status,
- id,
- create_by,
- create_dept,
- create_time,
- update_by,
- update_time,
- update_ip,
- version,
- del_flag
- ) VALUES (
- #{tableKey},
- #{userId},
- #{space},
- #{columns},
- #{remark},
- #{status},
- #{id},
- #{createBy},
- #{createDept},
- #{createTime},
- #{updateBy},
- #{updateTime},
- #{updateIp},
- #{version},
- #{delFlag}
- )
- </insert>
- <update id="update">
- UPDATE sys_table_config SET
- table_key = #{tableKey},
- user_id = #{userId},
- <if test="space != null and space != ''">space = #{space}, </if>
- columns = #{columns},
- <if test="remark != null and remark != ''">remark = #{remark}, </if>
- status = #{status},
- update_by = #{updateBy},
- update_time = #{updateTime},
- update_ip = #{updateIp},
- version = version + 1
- WHERE id = #{id} and version = #{version}
- </update>
- <update id="delete">
- UPDATE sys_table_config SET
- del_flag = #{DEL_FLAG_DELETE}
- WHERE id = #{id}
- </update>
- <delete id="deleteSysTableConfigByIds">
- UPDATE sys_table_config SET
- del_flag = #{DEL_FLAG_DELETE}
- WHERE id in
- <foreach item="tableKey" collection="array" open="(" separator="," close=")">
- #{tableKey}
- </foreach>
- </delete>
- <select id="getInfoByTableKey" resultType="SysTableConfig">
- SELECT
- <include refid="sysTableConfigColumns"/>,
- 'U' as configType
- FROM sys_table_config a
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL}
- <if test="tableKey != null and tableKey != ''">
- and table_key = #{tableKey}
- </if>
- <if test="userId != null and userId != ''">
- and user_id = #{userId}
- </if>
- </where>
- <!--查询个人列配置时union all系统管理对应的配置,如果个人没有则使用管理员对应配置,用户管理员初始化全局配置-->
- union all
- SELECT
- <include refid="sysTableConfigColumns"/>,
- 'S' as configType
- FROM sys_table_config a
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL}
- <if test="tableKey != null and tableKey != ''">
- and table_key = #{tableKey}
- </if>
- and user_id = '1'
- </where>
- </select>
- </mapper>
|