DragTableStatisticMapper.xml 5.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.business.mapper.DragTableStatisticMapper">
  6. <resultMap type="com.ruoyi.business.entity.DragTableStatistic" id="DragTableStatisticResult">
  7. <result property="id" column="id" />
  8. <result property="statisticTitle" column="statistic_title" />
  9. <result property="tableKey" column="table_key" />
  10. <result property="statisticDescription" column="statistic_description" />
  11. <result property="statisticType" column="statistic_type" />
  12. <result property="statisticField" column="statistic_field" />
  13. <result property="statisticObject" column="statistic_object" />
  14. <result property="sqlKey" column="sql_key" />
  15. <result property="delFlag" column="del_flag" />
  16. <result property="createBy" column="create_by" />
  17. <result property="createTime" column="create_time" />
  18. <result property="updateBy" column="update_by" />
  19. <result property="updateTime" column="update_time" />
  20. </resultMap>
  21. <sql id="selectDragTableStatisticVo">
  22. select id, statistic_title, table_key, statistic_description, statistic_type, statistic_field, statistic_object, sql_key, del_flag, create_by, create_time, update_by, update_time from {DBNAME}.drag_table_statistic
  23. </sql>
  24. <select id="selectDragTableStatisticList" parameterType="com.ruoyi.business.entity.DragTableStatistic" resultMap="DragTableStatisticResult">
  25. <include refid="selectDragTableStatisticVo"/>
  26. where del_flag = '0'
  27. <if test="statisticTitle != null and statisticTitle != ''"> and statistic_title = #{statisticTitle}</if>
  28. <if test="tableKey != null and tableKey != ''"> and table_key = #{tableKey}</if>
  29. <if test="statisticDescription != null and statisticDescription != ''"> and statistic_description = #{statisticDescription}</if>
  30. <if test="statisticType != null "> and statistic_type = #{statisticType}</if>
  31. <if test="statisticField != null and statisticField != ''"> and statistic_field = #{statisticField}</if>
  32. <if test="statisticObject != null and statisticObject != ''"> and statistic_object = #{statisticObject}</if>
  33. </select>
  34. <select id="selectDragTableStatisticById" parameterType="Long" resultMap="DragTableStatisticResult">
  35. <include refid="selectDragTableStatisticVo"/>
  36. where id = #{id}
  37. </select>
  38. <insert id="batchInsertDragTableStatistic" useGeneratedKeys="true" keyProperty="id">
  39. insert into drag_table_statistic
  40. (statistic_title,table_key,statistic_description,statistic_type,statistic_field,statistic_object,sql_key,create_by_id,create_by,create_time,del_flag)
  41. values
  42. <foreach collection="list" item="item" index="index" separator=",">
  43. (#{item.statisticTitle},#{item.tableKey},#{item.statisticDescription},#{item.statisticType},#{item.statisticField},#{item.statisticObject},
  44. #{item.sqlKey},#{item.createById},#{item.createBy},#{item.createTime},'0')
  45. </foreach>
  46. </insert>
  47. <update id="updateDragTableStatistic">
  48. update drag_table_statistic
  49. <trim prefix="SET" suffixOverrides=",">
  50. <if test="statisticTitle != null">statistic_title = #{statisticTitle},</if>
  51. <if test="tableKey != null">table_key = #{tableKey},</if>
  52. <if test="statisticDescription != null">statistic_description = #{statisticDescription},</if>
  53. <if test="statisticType != null">statistic_type = #{statisticType},</if>
  54. <if test="statisticField != null">statistic_field = #{statisticField},</if>
  55. <if test="statisticObject != null">statistic_object = #{statisticObject},</if>
  56. <if test="sqlKey != null">sql_key = #{sqlKey},</if>
  57. <if test="updateBy != null">update_by = #{updateBy},</if>
  58. <if test="updateTime != null">update_time = #{updateTime},</if>
  59. </trim>
  60. where id = #{id}
  61. </update>
  62. <update id="deleteDragTableStatisticByTableKey" parameterType="String">
  63. update drag_table_statistic set del_flag = '2' where table_key = #{tableKey}
  64. </update>
  65. <update id="deleteDragTableStatisticByTableKeys" parameterType="String">
  66. update drag_table_statistic set del_flag = '2' where table_key in
  67. <foreach collection="list" item="tableKey" open="(" close=")" separator=",">
  68. #{tableKey}
  69. </foreach>
  70. </update>
  71. <delete id="deleteDragTableStatisticByIds">
  72. update drag_table_statistic set del_flag = '2' where id in
  73. <foreach item="id" collection="list" open="(" separator="," close=")">
  74. #{id}
  75. </foreach>
  76. </delete>
  77. <select id="selectIdsByTableKey" parameterType="String" resultType="Long">
  78. select id from drag_table_statistic where del_flag = '0' and table_key = #{tableKey}
  79. </select>
  80. <select id="selectSqlKeyByTableKey" parameterType="String" resultType="String">
  81. select sql_key from drag_table_statistic where del_flag = '0' and table_key = #{tableKey}
  82. </select>
  83. </mapper>