|
@@ -0,0 +1,99 @@
|
|
|
+<?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.ruoyi.system.mapper.TableSqlMapper">
|
|
|
+
|
|
|
+ <resultMap type="com.ruoyi.system.entity.TableSql" id="TableSqlResult">
|
|
|
+ <result property="tId" column="t_id" />
|
|
|
+ <result property="tableSql" column="table_sql" />
|
|
|
+ <result property="tableCondition" column="table_condition" />
|
|
|
+ <result property="tableAlias" column="table_alias" />
|
|
|
+ <result property="sqlKey" column="sql_key" />
|
|
|
+ <result property="createBy" column="create_by" />
|
|
|
+ <result property="createTime" column="create_time" />
|
|
|
+ <result property="updateBy" column="update_by" />
|
|
|
+ <result property="updateTime" column="update_time" />
|
|
|
+ <result property="delFlag" column="del_flag" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectTableSqlVo">
|
|
|
+ select t_id, table_sql, table_condition, table_alias, sql_key, create_by, create_time, update_by, update_time, del_flag from table_sql
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectTableSqlList" parameterType="com.ruoyi.system.entity.TableSql" resultMap="TableSqlResult">
|
|
|
+ <include refid="selectTableSqlVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="tableSql != null and tableSql != ''"> and table_sql = #{tableSql}</if>
|
|
|
+ <if test="tableCondition != null and tableCondition != ''"> and table_condition = #{tableCondition}</if>
|
|
|
+ <if test="tableAlias != null and tableAlias != ''"> and table_alias = #{tableAlias}</if>
|
|
|
+ <if test="sqlKey != null and sqlKey != ''"> and sql_key = #{sqlKey}</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectTableSqlByTId" parameterType="Long" resultMap="TableSqlResult">
|
|
|
+ <include refid="selectTableSqlVo"/>
|
|
|
+ where t_id = #{tId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectTableSqlByTSqlKey" parameterType="String" resultMap="TableSqlResult">
|
|
|
+ <include refid="selectTableSqlVo"/>
|
|
|
+ where sql_key = #{SQLKEY}
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <insert id="insertTableSql" parameterType="com.ruoyi.system.entity.TableSql" useGeneratedKeys="true" keyProperty="tId">
|
|
|
+ insert into table_sql
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="tableSql != null">table_sql,</if>
|
|
|
+ <if test="tableCondition != null">table_condition,</if>
|
|
|
+ <if test="tableAlias != null">table_alias,</if>
|
|
|
+ <if test="sqlKey != null">sql_key,</if>
|
|
|
+ <if test="createBy != null">create_by,</if>
|
|
|
+ <if test="createTime != null">create_time,</if>
|
|
|
+ <if test="updateBy != null">update_by,</if>
|
|
|
+ <if test="updateTime != null">update_time,</if>
|
|
|
+ <if test="delFlag != null">del_flag,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="tableSql != null">#{tableSql},</if>
|
|
|
+ <if test="tableCondition != null">#{tableCondition},</if>
|
|
|
+ <if test="tableAlias != null">#{tableAlias},</if>
|
|
|
+ <if test="sqlKey != null">#{sqlKey},</if>
|
|
|
+ <if test="createBy != null">#{createBy},</if>
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
+ <if test="updateBy != null">#{updateBy},</if>
|
|
|
+ <if test="updateTime != null">#{updateTime},</if>
|
|
|
+ <if test="delFlag != null">#{delFlag},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateTableSql" parameterType="com.ruoyi.system.entity.TableSql">
|
|
|
+ update table_sql
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="tableSql != null">table_sql = #{tableSql},</if>
|
|
|
+ <if test="tableCondition != null">table_condition = #{tableCondition},</if>
|
|
|
+ <if test="tableAlias != null">table_alias = #{tableAlias},</if>
|
|
|
+ <if test="sqlKey != null">sql_key = #{sqlKey},</if>
|
|
|
+ <if test="createBy != null">create_by = #{createBy},</if>
|
|
|
+ <if test="createTime != null">create_time = #{createTime},</if>
|
|
|
+ <if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
+ <if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
+ <if test="delFlag != null">del_flag = #{delFlag},</if>
|
|
|
+ </trim>
|
|
|
+ where t_id = #{tId}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteTableSqlByTId" parameterType="Long">
|
|
|
+ delete from table_sql where t_id = #{tId}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteTableSqlByTIds" parameterType="String">
|
|
|
+ delete from table_sql where t_id in
|
|
|
+ <foreach item="tId" collection="array" open="(" separator="," close=")">
|
|
|
+ #{tId}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+</mapper>
|