123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949 |
- <?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.WbsTreePrivateMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="wbsTreeResultMap" type="org.springblade.manager.entity.WbsTreePrivate">
- <result column="project_id" property="projectId"/>
- <result column="p_key_id" property="pKeyId"/>
- <result column="id" property="id"/>
- <result column="tree_p_id" property="treePId"/>
- <result column="w_id" property="wbsId"/>
- <result column="is_deleted" property="isDeleted"/>
- <result column="status" property="status"/>
- <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
- <result column="create_user" property="createUser"/>
- <result column="create_dept" property="createDept"/>
- <result column="update_user" property="updateUser"/>
- <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
- <result column="type" property="type"/>
- <result column="table_type" property="tableType"/>
- <result column="tenant_id" property="tenantId"/>
- <result column="parent_id" property="parentId"/>
- <result column="ancestors" property="ancestors"/>
- <result column="node_type" property="nodeType"/>
- <result column="node_name" property="nodeName"/>
- <result column="full_name" property="fullName"/>
- <result column="sort" property="sort"/>
- <result column="remark" property="remark"/>
- <result column="unique_code" property="uniqueCode"/>
- <result column="partition_code" property="partitionCode"/>
- <result column="is_concrete" property="isConcrete"/>
- <result column="is_expernode" property="isExpernode"/>
- <result column="table_owner" property="tableOwner"/>
- <result column="major_data_type" property="majorDataType"/>
- <result column="init_table_name" property="initTableName"/>
- <result column="init_table_id" property="initTableId"/>
- <result column="is_link_table" property="isLinkTable"/>
- <result column="import_matching_info" property="importMatchingInfo"/>
- <result column="tab_file_type" property="tabFileType"/>
- <result column="trial_tab_contract_id" property="trialTabContractId"/>
- <result column="yzer_tree_id" property="yzerTreeId"/>
- <result column="jler_tree_id" property="jlerTreeId"/>
- </resultMap>
- <resultMap id="resultMap2" type="org.springblade.manager.vo.WbsTreePrivateVO2">
- <result column="pKeyId" property="pKeyId"/>
- <result column="wbs_id" property="wbsId"/>
- <result column="wbs_type" property="wbsType"/>
- <result column="project_id" property="projectId"/>
- <result column="project_name" property="projectName"/>
- </resultMap>
- <resultMap id="WbsTreeResultMap2" type="org.springblade.manager.vo.WbsTreeVO2">
- <id column="id" property="id"/>
- <result column="primaryKeyId" property="primaryKeyId"/>
- <result column="parent_id" property="parentId"/>
- <result column="title" property="title"/>
- <result column="value" property="value"/>
- <result column="key" property="key"/>
- <result column="has_children" property="hasChildren"/>
- <result column="major_data_type" property="majorDataType"/>
- <result column="type" property="type"/>
- <result column="nodeType" property="nodeType"/>
- <result column="wbsType" property="wbsType"/>
- <result column="isExistForm" property="isExistForm"/>
- <result column="ancestors" property="ancestors"/>
- <result column="tenantId" property="tenantId"/>
- </resultMap>
- <resultMap id="treeNodeResultMap" type="org.springblade.manager.vo.TreeNodeVO">
- <id column="id" property="id"/>
- <result column="parent_id" property="parentId"/>
- <result column="title" property="title"/>
- <result column="value" property="value"/>
- <result column="key" property="key"/>
- <result column="has_children" property="hasChildren"/>
- <result column="type" property="type"/>
- <result column="wbsType" property="wbsType"/>
- <result column="primaryKeyId" property="primaryKeyId"/>
- <result column="nodeType" property="nodeType"/>
- <result column="isExistForm" property="isExistForm"/>
- <result column="majorDataType" property="majorDataType"/>
- <result column="mixRatioTestIds" property="mixRatioTestIds"/>
- </resultMap>
- <resultMap id="treeNodeResultMap2" type="org.springblade.manager.vo.TreeNodeVO">
- <id column="id" property="id"/>
- <result column="parent_id" property="parentId"/>
- <result column="title" property="title"/>
- <result column="has_children" property="hasChildren"/>
- <result column="primaryKeyId" property="primaryKeyId"/>
- </resultMap>
- <resultMap id="treeNodeResultMapTabType" type="org.springblade.manager.vo.TreeNodeVOByTabType">
- <id column="id" property="id"/>
- <result column="parent_id" property="parentId"/>
- <result column="title" property="title"/>
- <result column="has_children" property="hasChildren"/>
- <result column="primaryKeyId" property="primaryKeyId"/>
- <result column="tabOwner" property="tabOwner"/>
- <result column="tabType" property="tabType"/>
- <result column="elementTotal" property="elementTotal"/>
- <result column="fillRate" property="fillRate"/>
- <result column="initTableId" property="initTableId"/>
- <result column="excelIds" property="excelIds"/>
- </resultMap>
- <insert id="insertCombination1">
- INSERT INTO m_wbs_tree_private(p_key_id, id, wbs_id, wbs_type, project_id, tenant_id, parent_id, ancestors,
- node_type, node_name, full_name, sort, remark, `type`,
- table_type, create_time, create_user, create_dept, update_user, update_time,
- `STATUS`, is_deleted,
- unique_code, partition_code, is_expernode, is_concrete, table_owner,
- major_data_type, init_table_name, is_link_table)
- VALUES (#{snowId}, #{wbsTree.id}, #{wbsTree.wbsId}, #{wbsType}, #{projectId}, #{wbsTree.tenantId},
- #{wbsTree.parentId}, #{wbsTree.ancestors},
- #{wbsTree.nodeType}, #{wbsTree.nodeName}, #{wbsTree.fullName}, #{wbsTree.sort}, #{wbsTree.remark},
- #{wbsTree.type},
- #{wbsTree.tableType}, #{wbsTree.createTime}, #{wbsTree.createUser}, #{wbsTree.createDept},
- #{wbsTree.updateUser}, #{wbsTree.updateTime},
- #{wbsTree.status}, #{wbsTree.isDeleted}, #{wbsTree.uniqueCode}, #{wbsTree.partitionCode},
- #{wbsTree.isExpernode}, #{wbsTree.isConcrete},
- #{wbsTree.tableOwner}, #{wbsTree.majorDataType}, #{wbsTree.initTableName}, #{wbsTree.isLinkTable})
- </insert>
- <insert id="insertCombination2">
- INSERT INTO m_wbs_tree_private(p_key_id, id, wbs_id, wbs_type, project_id, tenant_id, parent_id, ancestors,
- node_type, node_name, full_name, sort, remark, `type`,
- table_type, create_time, create_user, create_dept, update_user, update_time,
- `STATUS`, is_deleted,
- unique_code, partition_code, is_expernode, is_concrete, table_owner,
- major_data_type, init_table_name, is_link_table)
- VALUES (#{snowId}, #{wbsTree.id}, #{wbsTree.wbsId}, #{wbsTree.wbsType}, #{projectId}, #{wbsTree.tenantId},
- #{wbsTree.parentId}, #{wbsTree.ancestors},
- #{wbsTree.nodeType}, #{wbsTree.nodeName}, #{wbsTree.fullName}, #{wbsTree.sort}, #{wbsTree.remark},
- #{wbsTree.type},
- #{wbsTree.tableType}, #{wbsTree.createTime}, #{wbsTree.createUser}, #{wbsTree.createDept},
- #{wbsTree.updateUser}, #{wbsTree.updateTime},
- #{wbsTree.status}, #{wbsTree.isDeleted}, #{wbsTree.uniqueCode}, #{wbsTree.partitionCode},
- #{wbsTree.isExpernode}, #{wbsTree.isConcrete},
- #{wbsTree.tableOwner}, #{wbsTree.majorDataType}, #{wbsTree.initTableName}, #{wbsTree.isLinkTable})
- </insert>
- <update id="deleteByCondition">
- UPDATE m_wbs_tree_private
- SET is_deleted = 1
- WHERE id = #{id}
- AND wbs_id = #{wbsId}
- AND project_id = #{projectId}
- </update>
- <update id="deleteByCondition2">
- UPDATE m_wbs_tree_private
- SET is_deleted = 1
- WHERE parent_id = #{id}
- AND wbs_id = #{wbsId}
- AND project_id = #{projectId}
- </update>
- <update id="updateByCondition">
- UPDATE m_wbs_tree_private
- SET is_deleted = 0
- WHERE id = #{id}
- AND wbs_id = #{wbsId}
- AND project_id = #{projectId}
- </update>
- <update id="updateTableByCondition">
- UPDATE m_wbs_tree_private
- SET is_deleted = 0
- WHERE parent_id = #{id}
- AND project_id = #{projectId}
- AND wbs_id = #{wbsId}
- AND type = 2
- </update>
- <update id="updateDeletedByCondition">
- UPDATE m_wbs_tree_private
- SET is_deleted = 1
- WHERE type = 2
- AND id = #{id}
- AND wbs_id = #{wbsId}
- AND project_id = #{projectId}
- </update>
- <update id="updateByPKeyId">
- update m_wbs_tree_private
- set tenant_id = #{wbsTP.tenantId},
- parent_id = #{wbsTP.parentId},
- node_type = #{wbsTP.nodeType},
- node_name = #{wbsTP.nodeName},
- full_name = #{wbsTP.nodeName},
- ancestors = #{wbsTP.ancestors},
- unique_code = #{wbsTP.uniqueCode},
- partition_code = #{wbsTP.partitionCode},
- major_data_type = #{wbsTP.majorDataType},
- create_user = #{wbsTP.createUser},
- create_dept = #{wbsTP.createDept},
- create_time = #{wbsTP.createTime},
- update_user = #{wbsTP.updateUser},
- update_time = #{wbsTP.updateTime},
- mix_ratio_test_ids = #{wbsTP.mixRatioTestIds},
- is_concrete = #{wbsTP.isConcrete},
- is_expernode = #{wbsTP.isExpernode},
- is_add_conceal = #{wbsTP.isAddConceal},
- status = 1,
- is_deleted = 0
- <if test="wbsTP.className!=null and wbsTP.className!=''">
- ,class_name =#{wbsTP.className},
- unit_name =#{wbsTP.unitName},
- is_classifition =#{wbsTP.isClassifition}
- </if>
- where p_key_id = #{pKeyId}
- </update>
- <update id="updateSortById">
- UPDATE m_wbs_tree_private
- SET sort = #{sort}
- WHERE p_key_id = #{pKeyId}
- AND type = 1
- AND status = 1
- AND is_deleted = 0
- </update>
- <update id="updateSortById2">
- UPDATE m_wbs_tree_private
- SET sort = #{sort}
- WHERE p_key_id = #{pKeyId}
- AND type = 2
- -- AND status = 1
- AND is_deleted = 0
- </update>
- <update id="updateSortById3">
- UPDATE m_wbs_tree_private
- SET sort = #{sort}
- WHERE id = #{id}
- AND status = 1
- AND is_deleted = 0
- </update>
- <update id="updateIsDeletedByPKeyId">
- UPDATE m_wbs_tree_private
- SET is_deleted = 1
- WHERE p_key_id = #{pKeyId}
- AND status = 1
- AND is_deleted = 0
- </update>
- <update id="updateBatchByIds">
- UPDATE m_wbs_tree_private
- SET node_name = #{wbsTree.nodeName},
- full_name =#{wbsTree.nodeName},
- node_type = #{wbsTree.nodeType},
- major_data_type = #{wbsTree.majorDataType},
- unique_code = #{wbsTree.uniqueCode},
- partition_code = #{wbsTree.partitionCode},
- table_type = #{wbsTree.tableType},
- table_owner = #{wbsTree.tableOwner}
- fill_rate = #{wbsTree.fillRate}
- <if test="wbsTree.sort != null and wbsTree.sort != ''">
- , sort = #{wbsTree.sort}
- </if>
- WHERE id = #{wbsTree.id}
- AND project_id = #{projectId}
- AND status = 1
- AND is_deleted = 0
- </update>
- <update id="updateBatchByIds2">
- UPDATE m_wbs_tree_private
- SET node_name = #{wbsTreePrivate.nodeName},
- full_name = #{wbsTreePrivate.fullName},
- node_type = #{wbsTreePrivate.nodeType},
- major_data_type = #{wbsTreePrivate.majorDataType},
- unique_code = #{wbsTreePrivate.uniqueCode},
- partition_code = #{wbsTreePrivate.partitionCode},
- table_type = #{wbsTreePrivate.tableType},
- table_owner = #{wbsTreePrivate.tableOwner},
- fill_rate = #{wbsTreePrivate.fillRate},
- import_matching_info = #{item.importMatchingInfo}
- <if test="wbsTreePrivate.sort != null and wbsTreePrivate.sort != ''">
- , sort = #{wbsTreePrivate.sort}
- </if>
- WHERE id = #{wbsTreePrivate.id}
- AND project_id = #{projectId}
- AND wbs_id = #{wbsId}
- AND status = 1
- AND is_deleted = 0
- </update>
- <update id="updateBatchWbsPrivate" parameterType="java.util.List">
- <foreach collection="listPrivate" item="item" index="index" separator=";">
- UPDATE m_wbs_tree_private
- <set>
- node_name = #{item.nodeName},
- full_name = #{item.fullName},
- node_type = #{item.nodeType},
- major_data_type = #{item.majorDataType},
- table_type = #{item.tableType},
- table_owner = #{item.tableOwner},
- fill_rate = #{item.fillRate},
- import_matching_info = #{item.importMatchingInfo},
- mix_ratio_test_ids = #{item.mixRatioTestIds},
- init_table_name = #{item.initTableName},
- init_table_id = #{item.initTableId},
- html_url = #{item.htmlUrl},
- excel_id = #{item.excelId},
- sort = #{item.sort}
- </set>
- WHERE id = #{item.id}
- AND project_id = #{item.projectId}
- AND wbs_id = #{item.wbsId}
- AND status = 1
- AND is_deleted = 0
- </foreach>
- </update>
- <update id="updateBatchByPKeyId">
- <foreach item="item" collection="list" separator=";">
- UPDATE m_wbs_tree_private
- <set>html_url = #{item.htmlUrl}</set>
- where p_key_id = #{item.pKeyId}
- </foreach>
- </update>
- <update id="syncCurrentFormInProject">
- UPDATE m_wbs_tree_private
- SET html_url = #{wbsTreePrivate.htmlUrl},
- init_table_name = #{wbsTreePrivate.initTableName},
- init_table_id = #{wbsTreePrivate.initTableId},
- node_name = #{wbsTreePrivate.nodeName},
- full_name = #{wbsTreePrivate.fullName}
- WHERE project_id = #{wbsTreePrivate.projectId}
- and excel_id = #{wbsTreePrivate.excelId}
- </update>
- <update id="updateContractByPId">
- <foreach collection="list" item="item" separator=";">
- update
- m_wbs_tree_contract
- set
- is_type_private_pid = #{item.isTypePrivatePid}
- where
- p_key_id = #{item.pKeyId}
- </foreach>
- </update>
- <select id="lazyTree" resultMap="treeNodeResultMap">
- SELECT
- d.p_key_id as "primaryKeyId",
- d.type AS "type",
- d.table_type,
- d.id,
- d.parent_id,
- IFNULL(d.yzer_tree_id,d.jler_tree_id) as erTreeId,
- CASE
- WHEN d.parent_id = 0 THEN
- (SELECT project_alias FROM m_project_info WHERE id = #{projectId})
- ELSE d.node_name
- END AS title,
- d.node_type AS "nodeType",
- d.id AS "value",
- d.id AS "key",
- d.major_data_type AS "majorDataType",
- d.is_exist_form AS "isExistForm",
- d.mix_ratio_test_ids AS "mixRatioTestIds",
- (
- SELECT
- CASE WHEN count(1) > 0 THEN 1 ELSE 0 END
- FROM
- m_wbs_tree_private
- WHERE
- parent_id = d.id and is_deleted = 0 and type != 2
- ) AS "has_children"
- FROM
- m_wbs_tree_private d
- WHERE
- d.is_deleted = 0
- AND d.parent_id = #{parentId}
- AND d.project_id = #{projectId}
- <if test="wbsType != null and wbsType != '' and wbsType != -1">
- AND d.wbs_type = #{wbsType}
- </if>
- <if test="wbsId != null and wbsId != '' and wbsType !=-1">
- AND d.wbs_id = #{wbsId}
- </if>
- AND d.type = 1
- AND status = 1
- ORDER BY d.sort
- </select>
- <select id="selectAll" resultMap="resultMap2">
- SELECT
- wtp.p_key_id AS "pKeyId",
- wtp.wbs_id,
- wtp.wbs_type,
- wtp.project_id,
- ( SELECT project_name FROM m_project_info pi WHERE wtp.project_id = pi.id ) AS project_name
- FROM
- m_wbs_tree_private AS wtp
- WHERE
- is_deleted = 0
- AND STATUS = 1
- AND parent_id = 0
- <if test="wbsType != null and wbsType != ''">
- AND wbs_type = #{wbsType}
- </if>
- GROUP BY
- project_id
- ORDER BY
- ( SELECT create_time FROM m_project_info pi WHERE wtp.project_id = pi.id )
- </select>
- <select id="tree" resultMap="treeNodeResultMap">
- select p_key_id as "primaryKeyId",
- id, parent_id, node_name as title,type as "type", id as "value", id as "key" ,
- node_type AS "nodeType", is_exist_form AS "isExistForm",
- wbs_type as "wbsType"
- from m_wbs_tree_private
- where
- is_deleted = 0
- and status = 1
- and `type` = 1
- and project_id = #{projectId}
- and wbs_id = #{wbsId}
- <if test="wbsType != null and wbsType != ''">
- and wbs_type = #{wbsType}
- </if>
- <if test="parentId != null and parentId != ''">
- and parent_id = 0
- </if>
- ORDER BY sort
- </select>
- <select id="tree2" resultMap="WbsTreeResultMap2">
- select p_key_id as "primaryKeyId",
- id, parent_id , node_name as title,type as "type", id as "value", id as "key" ,
- node_type AS "nodeType", is_exist_form AS "isExistForm",major_data_type,
- wbs_type as "wbsType"
- from m_wbs_tree_private
- where
- is_deleted = 0
- and status = 1
- and `type` = 1
- and project_id = #{projectId}
- and wbs_id = #{wbsId}
- and parent_id is not null
- <if test="wbsType != null and wbsType != ''">
- and wbs_type = #{wbsType}
- </if>
- ORDER BY sort
- </select>
- <select id="selectByCondition" resultType="org.springblade.manager.entity.WbsTreePrivate">
- SELECT *
- FROM m_wbs_tree_private
- WHERE (id = #{id}
- AND type = 1
- AND project_id = #{projectId}
- AND wbs_id = #{wbsId}
- AND STATUS = 1
- AND is_deleted = 0)
- OR (parent_id = #{id}
- AND type = 2
- AND project_id = #{projectId}
- AND wbs_id = #{wbsId}
- AND STATUS = 1
- AND is_deleted = 0)
- </select>
- <select id="selectByCondition2" resultType="org.springblade.manager.entity.WbsTreePrivate">
- SELECT p_key_id
- FROM m_wbs_tree_private
- WHERE id = #{id}
- AND project_id = #{projectId}
- AND wbs_id = #{wbsId}
- AND STATUS = 1
- AND is_deleted = 1
- </select>
- <select id="selectIsTable" resultType="org.springblade.manager.entity.WbsTree">
- SELECT *
- FROM m_wbs_tree_private
- WHERE type = 2
- AND is_deleted = 0
- AND `status` = 1
- AND parent_id = #{tableId}
- AND project_id = #{projectId}
- </select>
- <select id="selectByNodeTable" resultType="org.springblade.manager.vo.WbsNodeTableVO">
- SELECT wt.p_key_id AS "pKeyId",
- wt.id AS id,
- wt.wbs_type AS wbsType,
- wt.node_name AS tableName,
- IFNULL(if(length(trim(wt.full_name)) > 0, wt.full_name, wt.node_name), wt.node_name) AS fullName,
- case
- when wt.table_type in (1, 9) then 1
- when wt.table_type in (2, 10) then 2
- else wt.table_type
- end as tableType,
- wt.`status` AS isCreateTable,
- wt.table_owner AS tableOwner,
- wt.is_link_table,
- wt.init_table_name,
- wt.init_table_id as initTableId,
- wt.excel_id AS excelId,
- wt.sort,
- wt.status,
- wt.node_type AS nodeType,
- wt.fill_rate AS "fillRate",
- wt.html_url AS htmlUrl,
- (SELECT count(1)
- FROM m_wbs_form_element
- WHERE f_id = wt.init_table_id
- and is_deleted = 0) AS "elementTotal"
- FROM m_wbs_tree_private AS wt
- WHERE wt.type = 2
- AND wt.is_deleted = 0
- AND wt.parent_id = #{id}
- AND wt.wbs_id = #{wbsId}
- AND wt.project_id = #{projectId}
- AND wt.trial_tab_contract_id is null
- -- AND (wt.wbs_type != 2 OR wt.table_type IN (1,2,9,10))
- ORDER BY wt.sort, fullName
- </select>
- <select id="getByCondition" resultType="org.springblade.manager.entity.WbsTreePrivate">
- SELECT *
- FROM m_wbs_tree_private
- WHERE project_id = #{projectId}
- AND id = #{parentId}
- AND wbs_id = #{wbsId}
- AND is_deleted = 0
- AND status = 1
- AND type = 1
- </select>
- <select id="getByPKeyId" resultType="org.springblade.manager.entity.WbsTreePrivate">
- SELECT *
- FROM m_wbs_tree_private
- WHERE p_key_id = #{pKeyId}
- </select>
- <select id="selectByCondition3" resultType="org.springblade.manager.entity.WbsTreePrivate">
- SELECT p_key_id
- FROM m_wbs_tree_private
- WHERE id = #{id}
- AND project_id = #{referencePrivateWbsProjectId}
- AND wbs_id = #{wbsId}
- AND STATUS = 1
- AND is_deleted = 0
- AND type = 1
- AND parent_id = 0
- </select>
- <select id="selectByPKeyId" resultType="org.springblade.manager.entity.WbsTreePrivate">
- SELECT *
- FROM m_wbs_tree_private
- WHERE p_key_id = #{referenceWbsTemplateId}
- </select>
- <select id="selectNodeListByCondition" resultType="org.springblade.manager.dto.WbsTreePrivateDTO2">
- SELECT p_key_id as "pKeyId", node_name AS "tableName", sort
- FROM m_wbs_tree_private
- WHERE project_id = #{projectId}
- AND parent_id = #{parentId}
- AND wbs_id = #{wbsId}
- AND status = 1
- AND is_deleted = 0
- AND type = 1
- ORDER BY sort
- </select>
- <select id="selectNodeAndTable" resultType="org.springblade.manager.entity.WbsTreePrivate">
- SELECT * FROM m_wbs_tree_private
- WHERE
- (
- type = 1
- <if test="id != null and id != ''">
- AND id = #{id}
- </if>
- AND project_id = #{referencePrivateWbsProjectId}
- AND wbs_id = #{wbsId}
- AND STATUS = 1
- AND is_deleted = 0
- )
- OR
- (
- type = 2
- <if test="id != null and id != ''">
- parent_id = #{id}
- </if>
- AND project_id = #{referencePrivateWbsProjectId}
- AND wbs_id = #{wbsId}
- AND STATUS = 1
- AND is_deleted = 0
- )
- OR
- (
- type = 10
- AND project_id = #{referencePrivateWbsProjectId}
- AND wbs_id is null
- AND parent_id = -10
- AND STATUS = 1
- AND is_deleted = 0
- )
- </select>
- <select id="selectNodeAndTable2" resultType="org.springblade.manager.entity.WbsTreePrivate">
- SELECT *
- FROM m_wbs_tree_private
- WHERE project_id = #{referencePrivateWbsProjectId}
- AND wbs_id = #{wbsId}
- AND STATUS = 1
- AND is_deleted = 0
- </select>
- <select id="selectByIds" resultType="org.springblade.manager.entity.WbsTreePrivate">
- SELECT * FROM m_wbs_tree_private
- WHERE id in
- <foreach item="ids" collection="ids" open="(" close=")" separator=",">
- #{ids}
- </foreach>
- AND project_id = #{projectId}
- </select>
- <select id="selectNodeTabAndParamList" resultType="org.springblade.manager.vo.WbsNodeTableVO">
- SELECT wt.p_key_id AS "pKeyId",
- wt.id AS id,
- wt.node_name AS tableName,
- wt.table_type AS tableType,
- wt.`status` AS isCreateTable,
- wt.table_owner as tableOwner,
- wt.is_link_table,
- wt.init_table_name,
- wt.init_table_id initTableId,
- wt.excel_id as excelId,
- wt.sort,
- wt.status,
- wt.parent_id AS parentId,
- (SELECT count(1) FROM m_wbs_form_element WHERE f_id = wt.id) AS "elementTotal"
- FROM m_wbs_tree_private AS wt
- WHERE wt.type = 2
- AND wt.is_deleted = 0
- AND wt.parent_id = #{id}
- AND wt.wbs_id = #{wbsId}
- AND wt.project_id = #{projectId}
- ORDER BY wt.sort, wt.node_name, wt.create_time
- </select>
- <!-- 项目级 表单类型分类 wbs树 -->
- <select id="tabTypeLazyTree" resultMap="treeNodeResultMapTabType">
- SELECT a.exceIds AS excelIds,
- p_key_id as id,p_key_id as primaryKeyId,title,parent_id,fill_rate as fillRate,initTableId,
- (SELECT dict_value from blade_dict where code='table_type' and dict_key not in(-1,0) and dict_key=table_type )
- as tabType,
- (SELECT count(1) FROM m_wbs_form_element WHERE f_id = initTableId and is_deleted=0) AS "elementTotal",
- (SELECT dict_value from blade_dict where code='owner_type' and dict_key not in(-1,0) and dict_key=table_owner )
- as tabOwner,
- /*排序*/
- -- (SELECT sort FROM m_wbs_node_sort c WHERE a.p_key_id = c.p_key_id) AS sort,
- (
- SELECT
- CASE WHEN count(1) > 0 THEN 1 ELSE 0 END
- FROM
- (
- SELECT '12345678910' as p_key_id , '表单类型' as node_name, 0 as parent_id
- union all
- SELECT dict_key as p_key_id ,dict_value as node_name,'12345678910' as parent_id from blade_dict where
- code='table_type' and dict_key not in(-1,0)
- union all
- SELECT p_key_id,node_name,table_type as parent_id from m_wbs_tree_private WHERE project_id=#{projectId} and
- is_deleted=0 and type=10 and table_type is not NULL GROUP BY node_name
- ) b
- WHERE
- b.parent_id = a.p_key_id
- ) AS "has_children"
- from (
- SELECT '12345678910' as p_key_id , '表单类型' as title, 0 as parent_id,0 as table_type,0 as fill_rate,0 as
- table_owner,0 as initTableId,0 as exceIds
- union all
- SELECT dict_key as p_key_id ,dict_value as title,'12345678910' as parent_id,0 as table_type,0 as fill_rate,0 as
- table_owner,0 as initTableId,0 as exceIds from blade_dict where code='table_type' and dict_key not in(-1,0)
- union all
- SELECT p_key_id,node_name as title,table_type as parent_id,table_type,fill_rate,table_owner,init_table_id as
- initTableId,
- IFNULL(GROUP_CONCAT( excel_id ),-1) AS excelIds
- from m_wbs_tree_private WHERE project_id=#{projectId} and
- is_deleted=0 and type=10 and table_type is not NULL GROUP BY node_name
- ) a where 1=1
- <if test="parentId != null and parentId != ''">
- and a.parent_id = #{parentId}
- </if>
- <if test="titleName != null and titleName != ''">
- and a.title like concat('%',#{titleName},'%') and LENGTH(a.p_key_id)>11
- </if>
- /*排序*/
- -- order by sort,title
- </select>
- <!-- 项目级 表单类型分类 wbs树 -->
- <select id="tabTypeLazyTreeAll" resultMap="treeNodeResultMapTabType">
- SELECT p_key_id as id,p_key_id as primaryKeyId,title,parent_id,fill_rate as fillRate,0 as
- excelIds,initTableId,initTableName,
- (SELECT dict_value from blade_dict where code='table_type' and dict_key not in(-1,0) and dict_key=table_type )
- as tabType,
- (SELECT count(1) FROM m_wbs_form_element WHERE f_id = initTableId and is_deleted=0) AS "elementTotal",
- (SELECT dict_value from blade_dict where code='owner_type' and dict_key not in(-1,0) and dict_key=table_owner )
- as tabOwner,
- (
- SELECT
- CASE WHEN count(1) > 0 THEN 1 ELSE 0 END
- FROM
- (
- SELECT '12345678910' as p_key_id , '表单类型' as node_name, 0 as parent_id
- union all
- SELECT dict_key as p_key_id ,dict_value as node_name,'12345678910' as parent_id from blade_dict where
- code='table_type' and dict_key not in(-1,0)
- union all
- SELECT id as p_key_id,tab_ch_name as node_name,tab_type as parent_id from m_table_info WHERE is_deleted=0
- ) b
- WHERE
- b.parent_id = a.p_key_id
- ) AS "has_children"
- from (
- SELECT '12345678910' as p_key_id , '表单类型' as title, 0 as parent_id,0 as table_type,0 as fill_rate,0 as
- table_owner,0 as initTableId,0 as initTableName
- union all
- SELECT dict_key as p_key_id ,dict_value as title,'12345678910' as parent_id,0 as table_type,0 as fill_rate,0 as
- table_owner,0 as initTableId,0 as initTableName from blade_dict where code='table_type' and dict_key not
- in(-1,0)
- union all
- SELECT id as p_key_id,tab_ch_name as title,tab_type as parent_id,tab_type as table_type,fill_rate,table_owner,id
- as initTableId,tab_en_name as initTableName from m_table_info WHERE is_deleted=0
- ) a where 1=1
- <if test="parentId != null and parentId != ''">
- and a.parent_id = #{parentId}
- </if>
- <if test="titleName != null and titleName != ''">
- and a.title like concat('%',#{titleName},'%') and LENGTH(a.p_key_id)>11
- </if>
- </select>
- <select id="selectWbsTreeTrialTabList" resultType="org.springblade.manager.vo.WbsTreePrivateVO4">
- SELECT
- p_key_id,
- node_name,
- full_name,
- node_type,
- case when table_type in(1,9) then 1
- when table_type in(2,10) then 2
- else table_type
- end as tableType,
- table_owner,
- is_link_table,
- is_tab_pdf,
- is_buss_show,
- tab_file_type,
- wbs_id,
- wbs_type,
- html_url,
- excel_id,
- project_id,
- parent_id,
- type,
- init_table_name,
- init_table_id,
- fill_rate,
- pdf_url,
- sort,
- create_time,
- ancestors,
- (CASE WHEN locate('__',node_name) > 0 THEN 1 ELSE 0 END) AS isCopyTab
- FROM
- m_wbs_tree_private
- WHERE project_id = #{projectId}
- AND wbs_id = #{wbsId}
- AND parent_id = #{parentId}
- AND table_type in (${tableType})
- AND type = 2
- AND status = 1
- AND is_deleted = 0
- /*试验所属方=7*/
- AND table_owner = 7
- /*解决不同合同段中复制表问题*/
- <if test="contractId == null">
- -- 后管加载原始表
- AND trial_tab_contract_id is null
- </if>
- <if test="contractId != null and contractId != ''">
- -- 客户端加载当前合同段表+原始表
- AND (trial_tab_contract_id is null OR (trial_tab_contract_id = #{contractId}))
- </if>
- ORDER BY sort,node_name,create_time
- </select>
- <select id="selectTabInfoAll" resultType="org.springblade.manager.entity.TableInfo">
- select *
- from m_table_info
- </select>
- <select id="treeRecordTrial" resultType="org.springblade.manager.vo.WbsTreePrivateVO5">
- select id, parent_id,
- node_name as title,
- node_type AS "nodeType",
- wbs_type as "wbsType"
- from m_wbs_tree_private
- where
- is_deleted = 0
- and status = 1
- and `type` = 1
- and project_id = #{projectId}
- and wbs_id = #{wbsId}
- <if test="wbsType != null and wbsType != ''">
- and wbs_type = #{wbsType}
- </if>
- ORDER BY sort
- </select>
- <select id="getAllPrivateTableByIds" resultType="java.lang.Long">
- select p_key_id from m_wbs_tree_private
- where is_deleted = 0 and project_id = #{projectId} and id in
- <foreach collection="ids" item="id" open="(" close=")" separator=",">
- #{id}
- </foreach>
- </select>
- <select id="getALLTableConfig" resultType="org.springblade.manager.entity.TextdictInfo">
- select * from m_textdict_info where is_deleted = 0 and tab_id in
- <foreach collection="ids" item="id" open="(" close=")" separator=",">
- #{id}
- </foreach>
- </select>
- <select id="getSelectNodes" resultType="org.springblade.manager.vo.WbsTreePrivateVO6">
- select *,ifnull((select count(1) from m_wbs_tree_private wtp2 where wtp2.parent_id = wtp.id and wtp2.is_deleted = 0 and project_id = #{projectId}),0) as formCount,
- (select GROUP_CONCAT(id)
- from m_wbs_tree_private wtp3 WHERE wtp3.parent_id = wtp.id and wtp3.is_deleted = 0 and project_id = #{projectId}) as formIds
- from m_wbs_tree_private wtp where p_key_id in
- <foreach collection="ids" item="id" open="(" close=")" separator=",">
- #{id}
- </foreach>
- </select>
- <select id="getSelectContractNodes" resultType="org.springblade.manager.vo.WbsTreeContractVO7">
- select *,
- ifnull((select count(1) from m_wbs_tree_contract wtc2 where wtc2.project_id = #{projectId}
- and wtc2.contract_id = wtc.contract_id and wtc2.parent_id = wtc.id ),0) as formCount,
- (select GROUP_CONCAT(id)
- from m_wbs_tree_contract wtc3 WHERE wtc3.parent_id = wtc.id and wtc3.project_id = #{projectId}
- and wtc3.contract_id = wtc.contract_id and wtc3.parent_id = wtc.id) as formIds
- from m_wbs_tree_contract wtc where is_type_private_pid in
- <foreach collection="ids" item="id" open="(" close=")" separator=",">
- #{id}
- </foreach>
- </select>
- <select id="getContractNode" resultType="org.springblade.manager.entity.WbsTreeContract">
- select p_key_id,id,wbs_id,contract_id,old_id,is_type_private_pid
- from m_wbs_tree_contract where project_id = #{projectId} and `type` = 1 and is_deleted = 0 and (is_type_private_pid = -1 or is_type_private_pid is null)
- </select>
- <select id="getPrivateNode" resultType="org.springblade.manager.entity.WbsTreePrivate">
- select p_key_id,id,wbs_id
- from m_wbs_tree_private where project_id = #{projectId} and `type` = 1 and is_deleted = 0
- </select>
- <select id="getThisForm" resultType="org.springblade.manager.entity.WbsTreePrivate">
- select * from m_wbs_tree_private where project_id = #{projectId} and parent_id = #{parentId} and id = #{id} and is_deleted = 0
- </select>
- <select id="getcontractAllNode" resultType="org.springblade.manager.entity.WbsTreeContract">
- select p_key_id,project_id,contract_id,id,wbs_id,old_id
- from m_wbs_tree_contract where project_id = #{projectId} and `type` = 1 and is_deleted = 0
- </select>
- <select id="getAllNodeByProjectId" resultType="org.springblade.manager.entity.WbsTreePrivate">
- select p_key_id,id,wbs_id,project_id from m_wbs_tree_private where project_id = #{projectId} and type = 1 and is_deleted = 0
- </select>
- <select id="getProjectOpinionNode" resultType="org.springblade.manager.entity.WbsTreePrivate">
- select * from m_wbs_tree_private where type = 2 and project_id = #{projectId} and parent_id = #{id} limit 1;
- </select>
- <delete id="delTabProjectById">
- delete
- from m_wbs_tree_private
- WHERE p_key_id = #{pKeyId}
- and project_id = #{projectId}AND type = 10
- </delete>
- <delete id="delTableById">
- delete
- from m_table_info
- WHERE id = #{pKeyId}
- </delete>
- <update id="cancelLinkNodeTreeInfoByJL">
- UPDATE m_wbs_tree_private
- SET jler_tree_id = NULL
- WHERE jler_tree_id = #{pkeyId}
- AND is_deleted = 0
- AND `type` = 1;
- </update>
- <update id="cancelLinkNodeTreeInfoByYZ">
- UPDATE m_wbs_tree_private
- SET yzer_tree_id = NULL
- WHERE yzer_tree_id = #{pkeyId}
- AND is_deleted = 0
- AND `type` = 1;
- </update>
- <update id="linkNodeTreeInfoByYZ" >
- <foreach collection="list" item="item" separator=";" >
- update m_wbs_tree_private set yzer_tree_id = #{pkeyid} where p_key_id = #{item} and is_deleted=0 and `type` = 1
- </foreach>
- </update>
- <update id="linkNodeTreeInfoByJL" >
- <foreach collection="list" item="item" separator=";" >
- update m_wbs_tree_private set jler_tree_id = #{pkeyid} where p_key_id = #{item} and is_deleted=0 and `type` = 1
- </foreach>
- </update>
- <update id="batchUpdateIsAddConceal">
- update m_wbs_tree_private
- set is_add_conceal = #{private.isAddConceal}
- where project_id = #{private.projectId}
- and FIND_IN_SET(#{pId},ancestors) > 0
- </update>
- <update id="updatePrivatePid">
- UPDATE m_wbs_tree_private a
- LEFT JOIN ( SELECT tree_p_id, p_key_id FROM m_wbs_tree_private WHERE project_id = #{projectId} ) b ON a.parent_id = b.tree_p_id
- SET a.p_id =IFNULL(b.p_key_id, 0)
- WHERE
- a.project_id = #{projectId}
- </update>
- <update id="updateBatchAncestorsByPKeyId">
- <foreach collection="allNodes" item="item" separator=";">
- UPDATE m_wbs_tree_private
- <set>`ancestors_p_id` = #{item.ancestorsPId}</set>
- where p_key_id = #{item.pKeyId}
- </foreach>
- </update>
- <select id="linkNodeTreeBynodeId" resultType="java.lang.Long" >
- select p_key_id from m_wbs_tree_private where `type` = 1 and is_deleted = 0
- <if test="nodeType != null and nodeType != '' and nodeType==1">
- and yzer_tree_id = #{pkeyid}
- </if>
- <if test="nodeType != null and nodeType != '' and nodeType==2">
- and jler_tree_id = #{pkeyid}
- </if>
- </select>
- <select id="getContractAllLog" resultType="org.springblade.manager.vo.ArchiveSyncLogVO">
- select id,create_user_name,record_time,file_name,pdf_url,e_visa_pdf_url,create_user,create_time,
- (select node_type from m_wbs_tree_private where p_key_id = ucl.wbs_node_id) as logType,
- (select node_name from m_wbs_tree_private where p_key_id = ucl.wbs_node_id) as logName
- from u_contract_log ucl
- where contract_id = #{contractId} and is_deleted = 0
- </select>
- </mapper>
|