123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220 |
- <?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="org.springblade.manager.mapper.ExcelTabMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="excelTabResultMap" type="org.springblade.manager.entity.ExcelTab">
- <result column="id" property="id"/>
- <result column="create_user" property="createUser"/>
- <result column="create_dept" property="createDept"/>
- <result column="create_time" property="createTime"/>
- <result column="update_user" property="updateUser"/>
- <result column="update_time" property="updateTime"/>
- <result column="status" property="status"/>
- <result column="is_deleted" property="isDeleted"/>
- <result column="parent_id" property="parentId"/>
- <result column="file_type" property="fileType"/>
- <result column="name" property="name"/>
- <result column="alias" property="alias"/>
- <result column="file_url" property="fileUrl"/>
- <result column="tab_cout" property="tabCout"/>
- <result column="extension" property="extension"/>
- <result column="attach_size" property="attachSize"/>
- <result column="tab_type" property="tabType"/>
- <result column="sort" property="sort"/>
- <result column="tab_id" property="tabId"/>
- </resultMap>
- <resultMap id="treeNodeResultMap" type="org.springblade.manager.vo.ExceTabTreVO">
- <id column="id" property="id"/>
- <result column="parent_id" property="parentId"/>
- <result column="name" property="name"/>
- <result column="has_children" property="hasChildren"/>
- </resultMap>
- <resultMap id="wbsResultMap" type="org.springblade.manager.vo.ExcelTabWbsTypeVO">
- <id column="id" property="id"/>
- <id column="wbsName" property="wbsName"/>
- <result column="wbsType" property="wbsType"/>
- </resultMap>
- <resultMap id="treeNodeResultMap2" type="org.springblade.manager.vo.WbsTreeVO">
- <id column="id" property="id"/>
- <result column="parent_id" property="parentId"/>
- <result column="nodeName" property="nodeName"/>
- <result column="has_children" property="hasChildren"/>
- <result column="type" property="type"/>
- </resultMap>
- <select id="tabLazyTree" resultMap="treeNodeResultMap">
- SELECT
- dept.id,
- dept.parent_id,
- dept.name,
- dept.file_type,
- dept.tab_type AS "tabType",
- (
- SELECT
- CASE WHEN count(1) > 0 THEN 1 ELSE 0 END
- FROM
- m_excel_tab
- WHERE
- parent_id = dept.id and is_deleted = 0
- ) AS "has_children"
- FROM
- m_excel_tab dept
- WHERE
- dept.is_deleted = 0
- <if test="param3!=null and param3!=''">
- AND dept.parent_id = #{param3}
- </if>
- <if test="param2!=null and param2!=''">
- and dept.alias like concat(concat('%', #{param2}),'%')
- </if>
- <if test="param1!=null and param1!=''">
- and dept.tenant_id = #{param1}
- </if>
- ORDER BY dept.sort,dept.create_time
- </select>
- <select id="getWbsTypeList" resultMap="wbsResultMap">
- select * from (
- SELECT a.project_id as id,
- CONCAT_WS("_", b.project_name, a.full_name) as wbsName,
- 2 as wbsType
- from m_wbs_tree_private a,
- m_project_info b
- where a.is_deleted = 0
- and a.parent_id = 0
- and a.project_id = b.id
- and b.is_deleted = 0
- union
- SELECT id, c.wbs_name, 1 as wbsType FROM m_wbs_info c where c.is_deleted = 0
- )d where 1=1
- <if test="wbstype!=null and wbstype!=''">
- and d.wbsType = #{wbstype}
- </if>
- </select>
- <select id="lazyTree" resultMap="treeNodeResultMap2">
- SELECT
- dept.type,
- dept.table_type,
- dept.id,
- dept.is_link_table,
- dept.parent_id,
- dept.node_name as nodeName,
- (
- SELECT
- CASE WHEN count(1) > 0 THEN 1 ELSE 0 END
- FROM
- m_wbs_tree
- WHERE
- parent_id = dept.id and is_deleted = 0 AND type = 1
- ) AS "has_children"
- FROM
- m_wbs_tree dept
- WHERE
- dept.parent_id = #{parentId} AND dept.is_deleted = 0
- <if test="tenantId!=null and tenantId!=''">
- and dept.tenant_id = #{tenantId}
- </if>
- AND dept.project_id = #{wbsId}
- /* AND dept.type = 1
- AND status = 1*/
- ORDER BY dept.sort
- </select>
- <select id="lazyTreeByPri" resultMap="treeNodeResultMap2">
- SELECT
- dept.type,
- dept.table_type,
- dept.id,
- dept.is_link_table,
- dept.parent_id,
- dept.node_name as nodeName,
- (
- SELECT
- CASE WHEN count(1) > 0 THEN 1 ELSE 0 END
- FROM
- m_wbs_tree_private
- WHERE
- parent_id = dept.id and is_deleted = 0 AND type = 1
- ) AS "has_children"
- FROM
- m_wbs_tree_private dept
- WHERE
- dept.parent_id = #{parentId} AND dept.is_deleted = 0
- <if test="tenantId!=null and tenantId!=''">
- and dept.tenant_id = #{tenantId}
- </if>
- AND dept.project_id = #{wbsId}
- /* AND dept.type = 1
- AND status = 1*/
- GROUP BY dept.id
- ORDER BY dept.sort
- </select>
- <select id="tabLazyTreeAll" resultMap="treeNodeResultMap">
- SELECT
- dept.id,
- dept.parent_id,
- dept.name,
- dept.file_type,
- (
- SELECT
- CASE WHEN count(1) > 0 THEN 1 ELSE 0 END
- FROM
- m_excel_tab
- WHERE
- parent_id = dept.id and is_deleted = 0
- ) AS "has_children"
- FROM
- m_excel_tab dept
- WHERE
- dept.is_deleted = 0
- <if test="param1!=null and param1!=''">
- and dept.tenant_id = #{param1}
- </if>
- <if test="param2!=null and param2!=''">
- and dept.alias like concat(concat('%', #{param2}),'%')
- </if>
- <if test="param3!=null and param3!=''">
- and dept.name like concat(concat('%', #{param3}),'%')
- </if>
- ORDER BY dept.create_time
- </select>
- <select id="selectExcelTabPage" resultType="org.springblade.manager.vo.ExcelTabVO">
- select x.id,x.create_time,x.name,x.table_template_type,
- (SELECT bdb.dict_value from blade_dict_biz bdb WHERE code = 'table_template_type' AND dict_key = x.table_template_type) as tableTemplateTypeName,
- (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
- tab_cout
- from m_excel_tab x where is_deleted = 0 and parent_id =#{param2.parentId}
- <if test="excelTab.name!=null and excelTab.name!=''">
- AND x.name like concat(concat('%', #{excelTab.name}),'%')
- </if>
- </select>
- <select id="getWaterByTableId" resultType="org.springblade.manager.entity.ExcelTab">
- select * from m_excel_tab met WHERE met.parent_id = 0 AND met.table_template_type = 2 AND met.is_deleted = 0
- AND met.id =
- (SELECT SUBSTRING_INDEX(alias,',',1) from m_excel_tab WHERE id = #{id})
- </select>
- <select id="getUnMatchField" resultType="org.springblade.manager.entity.WbsFormElement">
- select * from m_wbs_form_element
- WHERE f_id = #{tabId} and is_deleted = 0 and e_name not in
- <foreach collection="set" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </select>
- <delete id="removeBussTabInfoById">
- delete from m_wbs_tree_contract where p_key_id = #{pkeyid}
- </delete>
- </mapper>
|