123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- <?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="tableExportField" column="table_export_field"/>
- <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"/>
- <result property="orderByColumn" column="order_by_column"/>
- <result property="sortOrder" column="is_asc"/>
- </resultMap>
- <sql id="selectTableSqlVo">
- select t_id,
- table_sql,
- table_condition,
- table_alias,
- sql_key,
- table_export_field,
- create_by,
- create_time,
- update_by,
- update_time,
- del_flag,
- order_by_column,
- is_asc
- 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="tableExportField != null">table_export_field,</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>
- <if test="orderByColumn != null">order_by_column,</if>
- <if test="sortOrder != null">is_asc,</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="tableExportField != null">#{tableExportField},</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>
- <if test="orderByColumn != null">#{orderByColumn},</if>
- <if test="sortOrder != null">#{sortOrder},</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="tableExportField != null">table_export_field = #{tableExportField},</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>
- <if test="orderByColumn != null">order_by_column = #{orderByColumn},</if>
- <if test="sortOrder != null">is_asc = #{sortOrder},</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>
- <update id="updateTableSqlBySqlKey">
- 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="tableExportField != null">table_export_field = #{tableExportField},</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>
- <if test="orderByColumn != null">order_by_column = #{orderByColumn},</if>
- <if test="sortOrder != null">is_asc = #{sortOrder},</if>
- </trim>
- where sql_key = #{sqlKey}
- </update>
- <delete id="deleteTableSqlBySqlKeys" parameterType="String">
- delete from table_sql where sql_key in
- <foreach item="sqlKey" collection="list" open="(" separator="," close=")">
- #{sqlKey}
- </foreach>
- </delete>
- </mapper>
|