ExcelTabMapper.xml 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="org.springblade.manager.mapper.ExcelTabMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="excelTabResultMap" type="org.springblade.manager.entity.ExcelTab">
  6. <result column="id" property="id"/>
  7. <result column="create_user" property="createUser"/>
  8. <result column="create_dept" property="createDept"/>
  9. <result column="create_time" property="createTime"/>
  10. <result column="update_user" property="updateUser"/>
  11. <result column="update_time" property="updateTime"/>
  12. <result column="status" property="status"/>
  13. <result column="is_deleted" property="isDeleted"/>
  14. <result column="parent_id" property="parentId"/>
  15. <result column="file_type" property="fileType"/>
  16. <result column="name" property="name"/>
  17. <result column="alias" property="alias"/>
  18. <result column="file_url" property="fileUrl"/>
  19. <result column="tab_cout" property="tabCout"/>
  20. <result column="extension" property="extension"/>
  21. <result column="attach_size" property="attachSize"/>
  22. <result column="tab_type" property="tabType"/>
  23. <result column="sort" property="sort"/>
  24. <result column="tab_id" property="tabId"/>
  25. </resultMap>
  26. <resultMap id="treeNodeResultMap" type="org.springblade.manager.vo.ExceTabTreVO">
  27. <id column="id" property="id"/>
  28. <result column="parent_id" property="parentId"/>
  29. <result column="name" property="name"/>
  30. <result column="has_children" property="hasChildren"/>
  31. </resultMap>
  32. <resultMap id="wbsResultMap" type="org.springblade.manager.vo.ExcelTabWbsTypeVO">
  33. <id column="id" property="id"/>
  34. <id column="wbsName" property="wbsName"/>
  35. <result column="wbsType" property="wbsType"/>
  36. </resultMap>
  37. <resultMap id="treeNodeResultMap2" type="org.springblade.manager.vo.WbsTreeVO">
  38. <id column="id" property="id"/>
  39. <result column="parent_id" property="parentId"/>
  40. <result column="nodeName" property="nodeName"/>
  41. <result column="has_children" property="hasChildren"/>
  42. <result column="type" property="type"/>
  43. </resultMap>
  44. <select id="tabLazyTree" resultMap="treeNodeResultMap">
  45. SELECT
  46. dept.id,
  47. dept.parent_id,
  48. dept.name,
  49. dept.file_type,
  50. dept.tab_type AS "tabType",
  51. (
  52. SELECT
  53. CASE WHEN count(1) > 0 THEN 1 ELSE 0 END
  54. FROM
  55. m_excel_tab
  56. WHERE
  57. parent_id = dept.id and is_deleted = 0
  58. ) AS "has_children"
  59. FROM
  60. m_excel_tab dept
  61. WHERE
  62. dept.is_deleted = 0
  63. <if test="param3!=null and param3!=''">
  64. AND dept.parent_id = #{param3}
  65. </if>
  66. <if test="param2!=null and param2!=''">
  67. and dept.alias like concat(concat('%', #{param2}),'%')
  68. </if>
  69. <if test="param1!=null and param1!=''">
  70. and dept.tenant_id = #{param1}
  71. </if>
  72. ORDER BY dept.sort,dept.create_time
  73. </select>
  74. <select id="getWbsTypeList" resultMap="wbsResultMap">
  75. select * from (
  76. SELECT a.project_id as id,
  77. CONCAT_WS("_", b.project_name, a.full_name) as wbsName,
  78. 2 as wbsType
  79. from m_wbs_tree_private a,
  80. m_project_info b
  81. where a.is_deleted = 0
  82. and a.parent_id = 0
  83. and a.project_id = b.id
  84. and b.is_deleted = 0
  85. union
  86. SELECT id, c.wbs_name, 1 as wbsType FROM m_wbs_info c where c.is_deleted = 0
  87. )d where 1=1
  88. <if test="wbstype!=null and wbstype!=''">
  89. and d.wbsType = #{wbstype}
  90. </if>
  91. </select>
  92. <select id="lazyTree" resultMap="treeNodeResultMap2">
  93. SELECT
  94. dept.type,
  95. dept.table_type,
  96. dept.id,
  97. dept.is_link_table,
  98. dept.parent_id,
  99. dept.node_name as nodeName,
  100. (
  101. SELECT
  102. CASE WHEN count(1) > 0 THEN 1 ELSE 0 END
  103. FROM
  104. m_wbs_tree
  105. WHERE
  106. parent_id = dept.id and is_deleted = 0 AND type = 1
  107. ) AS "has_children"
  108. FROM
  109. m_wbs_tree dept
  110. WHERE
  111. dept.parent_id = #{parentId} AND dept.is_deleted = 0
  112. <if test="tenantId!=null and tenantId!=''">
  113. and dept.tenant_id = #{tenantId}
  114. </if>
  115. AND dept.project_id = #{wbsId}
  116. /* AND dept.type = 1
  117. AND status = 1*/
  118. ORDER BY dept.sort
  119. </select>
  120. <select id="lazyTreeByPri" resultMap="treeNodeResultMap2">
  121. SELECT
  122. dept.type,
  123. dept.table_type,
  124. dept.id,
  125. dept.is_link_table,
  126. dept.parent_id,
  127. dept.node_name as nodeName,
  128. (
  129. SELECT
  130. CASE WHEN count(1) > 0 THEN 1 ELSE 0 END
  131. FROM
  132. m_wbs_tree_private
  133. WHERE
  134. parent_id = dept.id and is_deleted = 0 AND type = 1
  135. ) AS "has_children"
  136. FROM
  137. m_wbs_tree_private dept
  138. WHERE
  139. dept.parent_id = #{parentId} AND dept.is_deleted = 0
  140. <if test="tenantId!=null and tenantId!=''">
  141. and dept.tenant_id = #{tenantId}
  142. </if>
  143. AND dept.project_id = #{wbsId}
  144. /* AND dept.type = 1
  145. AND status = 1*/
  146. GROUP BY dept.id
  147. ORDER BY dept.sort
  148. </select>
  149. <select id="tabLazyTreeAll" resultMap="treeNodeResultMap">
  150. SELECT
  151. dept.id,
  152. dept.parent_id,
  153. dept.name,
  154. dept.file_type,
  155. (
  156. SELECT
  157. CASE WHEN count(1) > 0 THEN 1 ELSE 0 END
  158. FROM
  159. m_excel_tab
  160. WHERE
  161. parent_id = dept.id and is_deleted = 0
  162. ) AS "has_children"
  163. FROM
  164. m_excel_tab dept
  165. WHERE
  166. dept.is_deleted = 0
  167. <if test="param1!=null and param1!=''">
  168. and dept.tenant_id = #{param1}
  169. </if>
  170. <if test="param2!=null and param2!=''">
  171. and dept.alias like concat(concat('%', #{param2}),'%')
  172. </if>
  173. <if test="param3!=null and param3!=''">
  174. and dept.name like concat(concat('%', #{param3}),'%')
  175. </if>
  176. ORDER BY dept.create_time
  177. </select>
  178. <select id="selectExcelTabPage" resultType="org.springblade.manager.vo.ExcelTabVO">
  179. select x.id,x.create_time,x.name,x.table_template_type,
  180. (SELECT bdb.dict_value from blade_dict_biz bdb WHERE code = 'table_template_type' AND dict_key = x.table_template_type) as tableTemplateTypeName,
  181. (SELECT count(1) from m_excel_tab a where FIND_IN_SET(x.id,a.alias) and a.is_deleted = 0 and a.file_type=3) as
  182. tab_cout
  183. from m_excel_tab x where is_deleted = 0 and parent_id =#{param2.parentId}
  184. <if test="excelTab.name!=null and excelTab.name!=''">
  185. AND x.name like concat(concat('%', #{excelTab.name}),'%')
  186. </if>
  187. </select>
  188. <select id="getWaterByTableId" resultType="org.springblade.manager.entity.ExcelTab">
  189. select * from m_excel_tab met WHERE met.parent_id = 0 AND met.table_template_type = 2 AND met.is_deleted = 0
  190. AND met.id =
  191. (SELECT SUBSTRING_INDEX(alias,',',1) from m_excel_tab WHERE id = #{id})
  192. </select>
  193. <select id="getUnMatchField" resultType="org.springblade.manager.entity.WbsFormElement">
  194. select * from m_wbs_form_element
  195. WHERE f_id = #{tabId} and is_deleted = 0 and e_name not in
  196. <foreach collection="set" item="item" open="(" separator="," close=")">
  197. #{item}
  198. </foreach>
  199. </select>
  200. <delete id="removeBussTabInfoById">
  201. delete from m_wbs_tree_contract where p_key_id = #{pkeyid}
  202. </delete>
  203. </mapper>