DragTreeMapper.xml 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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.zkqy.business.mapper.DragTreeMapper">
  6. <resultMap type="com.zkqy.business.entity.DragTree" id="DragTreeResult">
  7. <result property="id" column="id" />
  8. <result property="menuId" column="menu_id" />
  9. <result property="menuName" column="menu_name" />
  10. <result property="treeDesc" column="tree_desc" />
  11. <result property="treeTableName" column="tree_table_name" />
  12. <result property="treeTablePrimaryKey" column="tree_table_primary_key" />
  13. <result property="treeTableDgl" column="tree_table_dgl" />
  14. <result property="treeTableCondition" column="tree_table_condition" />
  15. <result property="treeTableJoinTable" column="tree_table_join_table" />
  16. <result property="allJson" column="all_json" />
  17. <result property="delFlag" column="del_flag" />
  18. <result property="createBy" column="create_by" />
  19. <result property="createById" column="create_by_id" />
  20. <result property="createTime" column="create_time" />
  21. <result property="updateBy" column="update_by" />
  22. <result property="updateById" column="update_by_id" />
  23. <result property="updateTime" column="update_time" />
  24. <result property="tableId" column="table_id"/>
  25. <result property="tableNameDes" column="table_name_des"/>
  26. <result property="treeTableKey" column="tree_table_key"/>
  27. <result property="treeShowLabel" column="tree_show_label"/>
  28. <result property="treeTableJoinTableCondition" column="tree_table_join_table_condition"/>
  29. </resultMap>
  30. <sql id="selectDragTreeVo">
  31. select id, menu_id, menu_name, tree_desc, tree_table_name, tree_table_primary_key, tree_table_dgl, tree_table_condition, tree_table_join_table, table_name_des, del_flag, create_by, create_by_id, create_time, update_by, update_by_id, update_time,table_id,tree_table_key,tree_show_label,tree_table_join_table_condition from {DBNAME}.drag_tree
  32. </sql>
  33. <select id="selectDragTreeList" parameterType="com.zkqy.business.entity.DragTree" resultMap="DragTreeResult">
  34. <include refid="selectDragTreeVo"/>
  35. <where>
  36. <if test="menuId != null "> and menu_id = #{menuId}</if>
  37. <if test="menuName != null and menuName != ''"> and menu_name like concat('%', #{menuName}, '%')</if>
  38. <if test="treeDesc != null and treeDesc != ''"> and tree_desc = #{treeDesc}</if>
  39. <if test="treeTableName != null and treeTableName != ''"> and tree_table_name like concat('%', #{treeTableName}, '%')</if>
  40. <if test="treeTablePrimaryKey != null and treeTablePrimaryKey != ''"> and tree_table_primary_key = #{treeTablePrimaryKey}</if>
  41. <if test="treeTableDgl != null and treeTableDgl != ''"> and tree_table_dgl = #{treeTableDgl}</if>
  42. <if test="treeTableCondition != null and treeTableCondition != ''"> and tree_table_condition = #{treeTableCondition}</if>
  43. <if test="treeTableJoinTable != null and treeTableJoinTable != ''"> and tree_table_join_table = #{treeTableJoinTable}</if>
  44. <if test="tableNameDes != null and tableNameDes != ''"> and table_name_des = #{tableNameDes}</if>
  45. <if test="createById != null "> and create_by_id = #{createById}</if>
  46. <if test="updateById != null "> and update_by_id = #{updateById}</if>
  47. <if test="tableId != null">and table_id=#{tableId},</if>
  48. <if test="treeTableKey!=null">and tree_table_key=#{treeTableKey}</if>
  49. </where>
  50. </select>
  51. <select id="selectDragTreeById" parameterType="Long" resultMap="DragTreeResult">
  52. <include refid="selectDragTreeVo"/>
  53. where id = #{id}
  54. </select>
  55. <select id="selectDragTreeByTreeTableKey" resultType="com.zkqy.business.entity.DragTree">
  56. <include refid="selectDragTreeVo"/>
  57. where tree_table_key = #{id}
  58. </select>
  59. <select id="selectList" resultType="java.util.HashMap">
  60. ${executeSql}
  61. </select>
  62. <select id="allTabColumns" resultType="java.lang.String">
  63. SELECT COLUMN_NAME
  64. FROM INFORMATION_SCHEMA.COLUMNS
  65. WHERE TABLE_SCHEMA = #{dbname}
  66. AND TABLE_NAME = #{tableName}
  67. </select>
  68. <insert id="insertDragTree" parameterType="com.zkqy.business.entity.DragTree" useGeneratedKeys="true" keyProperty="id">
  69. insert into {DBNAME}.drag_tree
  70. <trim prefix="(" suffix=")" suffixOverrides=",">
  71. <if test="menuId != null">menu_id,</if>
  72. <if test="menuName != null and menuName != ''">menu_name,</if>
  73. <if test="treeDesc != null and treeDesc != ''">tree_desc,</if>
  74. <if test="treeTableName != null and treeTableName != ''">tree_table_name,</if>
  75. <if test="treeTablePrimaryKey != null">tree_table_primary_key,</if>
  76. <if test="treeTableDgl != null">tree_table_dgl,</if>
  77. <if test="treeTableCondition != null">tree_table_condition,</if>
  78. <if test="treeTableJoinTable != null">tree_table_join_table,</if>
  79. <if test="tableNameDes != null">`table_name_des`,</if>
  80. <if test="delFlag != null">del_flag,</if>
  81. <if test="createBy != null">create_by,</if>
  82. <if test="createById != null">create_by_id,</if>
  83. <if test="createTime != null">create_time,</if>
  84. <if test="updateBy != null">update_by,</if>
  85. <if test="updateById != null">update_by_id,</if>
  86. <if test="updateTime != null">update_time,</if>
  87. <if test="tableId != null">table_id,</if>
  88. <if test="treeTableKey!=null">tree_table_key,</if>
  89. </trim>
  90. <trim prefix="values (" suffix=")" suffixOverrides=",">
  91. <if test="menuId != null">#{menuId},</if>
  92. <if test="menuName != null and menuName != ''">#{menuName},</if>
  93. <if test="treeDesc != null and treeDesc != ''">#{treeDesc},</if>
  94. <if test="treeTableName != null and treeTableName != ''">#{treeTableName},</if>
  95. <if test="treeTablePrimaryKey != null">#{treeTablePrimaryKey},</if>
  96. <if test="treeTableDgl != null">#{treeTableDgl},</if>
  97. <if test="treeTableCondition != null">#{treeTableCondition},</if>
  98. <if test="treeTableJoinTable != null">#{treeTableJoinTable},</if>
  99. <if test="tableNameDes != null">#{tableNameDes},</if>
  100. <if test="delFlag != null">#{delFlag},</if>
  101. <if test="createBy != null">#{createBy},</if>
  102. <if test="createById != null">#{createById},</if>
  103. <if test="createTime != null">#{createTime},</if>
  104. <if test="updateBy != null">#{updateBy},</if>
  105. <if test="updateById != null">#{updateById},</if>
  106. <if test="updateTime != null">#{updateTime},</if>
  107. <if test="tableId != null">#{tableId},</if>
  108. <if test="treeTableKey!=null">#{treeTableKey}</if>
  109. </trim>
  110. </insert>
  111. <update id="updateDragTree" parameterType="com.zkqy.business.entity.DragTree">
  112. update {DBNAME}.drag_tree
  113. <trim prefix="SET" suffixOverrides=",">
  114. <if test="menuId != null">menu_id = #{menuId},</if>
  115. <if test="menuName != null and menuName != ''">menu_name = #{menuName},</if>
  116. <if test="treeDesc != null and treeDesc != ''">tree_desc = #{treeDesc},</if>
  117. <if test="treeTableName != null and treeTableName != ''">tree_table_name = #{treeTableName},</if>
  118. <if test="treeTablePrimaryKey != null">tree_table_primary_key = #{treeTablePrimaryKey},</if>
  119. <if test="treeTableDgl != null">tree_table_dgl = #{treeTableDgl},</if>
  120. <if test="treeTableCondition != null">tree_table_condition = #{treeTableCondition},</if>
  121. <if test="treeTableJoinTable != null">tree_table_join_table = #{treeTableJoinTable},</if>
  122. <if test="tableNameDes != null">`table_name_des`= #{tableNameDes},</if>
  123. <if test="delFlag != null">del_flag = #{delFlag},</if>
  124. <if test="createBy != null">create_by = #{createBy},</if>
  125. <if test="createById != null">create_by_id = #{createById},</if>
  126. <if test="createTime != null">create_time = #{createTime},</if>
  127. <if test="updateBy != null">update_by = #{updateBy},</if>
  128. <if test="updateById != null">update_by_id = #{updateById},</if>
  129. <if test="updateTime != null">update_time = #{updateTime},</if>
  130. <if test="tableId != null">table_id=#{tableId},</if>
  131. <if test="treeTableKey!=null">tree_table_key=#{treeTableKey}</if>
  132. </trim>
  133. where id = #{id}
  134. </update>
  135. <delete id="deleteDragTreeById" parameterType="Long">
  136. delete from {DBNAME}.drag_tree where id = #{id}
  137. </delete>
  138. <delete id="deleteDragTreeByIds" parameterType="String">
  139. delete from {DBNAME}.drag_tree where id in
  140. <foreach item="id" collection="array" open="(" separator="," close=")">
  141. #{id}
  142. </foreach>
  143. </delete>
  144. </mapper>