123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912 |
- <?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.WbsTreeContractMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="ResultMap" type="org.springblade.manager.entity.WbsTreeContract">
- <result column="id" property="id"/>
- <result column="p_key_id" property="pKeyId"/>
- <result column="wbs_id" property="wbsId"/>
- <result column="project_id" property="projectId"/>
- <result column="contract_id" property="contractId"/>
- <result column="contract_type" property="contractType"/>
- <result column="contract_id_relation" property="contractIdRelation"/>
- <result column="is_deleted" property="isDeleted"/>
- <result column="status" property="status"/>
- <result column="create_time" property="createTime"/>
- <result column="create_user" property="createUser"/>
- <result column="create_dept" property="createDept"/>
- <result column="update_user" property="updateUser"/>
- <result column="update_time" property="updateTime"/>
- <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="is_link_table" property="isLinkTable"/>
- <result column="wbs_type" property="wbsType"/>
- <result column="excel_id" property="excelId"/>
- <result column="old_id" property="oldId"/>
- <result column="html_url" property="htmlUrl"/>
- <result column="pdf_url" property="pdfUrl"/>
- <result column="is_buss_show" property="isBussShow"/>
- <result column="tab_file_type" property="tabFileType"/>
- <result column="is_cope_tab" property="isCopeTab"/>
- <result column="is_tab_pdf" property="isTabPdf"/>
- <result column="is_type_private_pid" property="isTypePrivatePid"/>
- <result column="is_import_identification_node" property="isImportIdentificationNode"/>
- <result column="import_matching_info" property="importMatchingInfo"/>
- <result column="is_concealed_works_node" property="isConcealedWorksNode"/>
- <result column="is_ele" property="isEle"/>
- <result column="tab_group_id" property="tabGroupId"/>
- <result column="tree_code" property="treeCode"/>
- </resultMap>
- <!-- 通用查询映射结果 -->
- <resultMap id="appResultMap" type="org.springblade.manager.vo.AppWbsTreeContractVO">
- <result column="id" property="id"/>
- <result column="p_key_id" property="pKeyId"/>
- <result column="wbs_id" property="wbsId"/>
- <result column="project_id" property="projectId"/>
- <result column="contract_id" property="contractId"/>
- <result column="contract_type" property="contractType"/>
- <result column="contract_id_relation" property="contractIdRelation"/>
- <result column="is_deleted" property="isDeleted"/>
- <result column="status" property="status"/>
- <result column="create_time" property="createTime"/>
- <result column="create_user" property="createUser"/>
- <result column="create_dept" property="createDept"/>
- <result column="update_user" property="updateUser"/>
- <result column="update_time" property="updateTime"/>
- <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="is_link_table" property="isLinkTable"/>
- <result column="wbs_type" property="wbsType"/>
- <result column="excel_id" property="excelId"/>
- <result column="old_id" property="oldId"/>
- <result column="html_url" property="htmlUrl"/>
- <result column="pdf_url" property="pdfUrl"/>
- <result column="is_buss_show" property="isBussShow"/>
- <result column="tab_file_type" property="tabFileType"/>
- <result column="is_cope_tab" property="isCopeTab"/>
- <result column="is_tab_pdf" property="isTabPdf"/>
- <result column="is_type_private_pid" property="isTypePrivatePid"/>
- <result column="is_import_identification_node" property="isImportIdentificationNode"/>
- <result column="import_matching_info" property="importMatchingInfo"/>
- <result column="is_concealed_works_node" property="isConcealedWorksNode"/>
- <result column="is_ele" property="isEle"/>
- <collection property="appUserList" javaType="java.util.List" ofType="org.springblade.manager.entity.AppUser"
- select="getuserInfoByaccount"
- column="{sonId=p_key_id}">
- </collection>
- </resultMap>
- <resultMap id="resultMap2" type="org.springblade.manager.vo.WbsTreeContractVO">
- <result column="id" property="id"/>
- <result column="wbs_id" property="wbsId"/>
- <result column="project_id" property="projectId"/>
- <result column="project_name" property="projectName"/>
- <result column="contract_id" property="contractId"/>
- </resultMap>
- <resultMap id="treeNodeResultMap" type="org.springblade.manager.vo.TreeNodeVO">
- <id column="id" property="id"/>
- <result column="parent_id" property="parentId"/>
- <result column="fullName" property="title"/>
- <result column="has_children" property="hasChildren"/>
- <result column="type" property="type"/>
- <result column="nodeType" property="nodeType"/>
- <result column="wbsType" property="wbsType"/>
- <result column="contractType" property="contractType"/>
- <result column="contractId" property="contractId"/>
- <result column="primaryKeyId" property="primaryKeyId"/>
- <result column="tenantId" property="tenantId"/>
- <result column="key" property="key"/>
- <result column="value" property="value"/>
- <result column="contractIdRelation" property="contractIdRelation"/>
- </resultMap>
- <resultMap id="apiTreeNodeResultMap" type="org.springblade.manager.vo.APIWbsContractNodeVo">
- <id column="id" property="id"/>
- <result column="p_key_id" property="pkeyId"/>
- <result column="parent_id" property="parentId"/>
- <result column="node_name" property="nodeName"/>
- <result column="type" property="type"/>
- <result column="has_children" property="hasChildren"/>
- </resultMap>
- <resultMap id="apiTreeNodeHzrcResultMap" type="org.springblade.manager.vo.APIWbsContractNodeHzrcVo">
- <id column="id" property="id"/>
- <result column="p_key_id" property="pkeyId"/>
- <result column="parent_id" property="parentId"/>
- <result column="node_name" property="nodeName"/>
- <result column="isMea" property="isMea"/>
- <result column="fileUrl" property="fileUrl"/>
- <result column="has_children" property="hasChildren"/>
- <result column="taskStatus" property="taskStatus"/>
- <result column="partitionCode" property="partitionCode"/>
- </resultMap>
- <insert id="insertByCondition">
- INSERT INTO m_wbs_tree_contract(p_key_id, id, wbs_id, wbs_type, project_id, contract_id, contract_type,
- 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, excel_id, html_url,
- is_type_private_pid, is_ele)
- VALUES (#{pKeyId}, #{wbsTree.id}, #{wbsTree.wbsId}, #{wbsType}, #{wbsTree.projectId}, #{contractId}, 1,
- #{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},
- #{wbsTree.excelId}, #{wbsTree.htmlUrl}, #{wbsTree.pKeyId}, 1)
- </insert>
- <update id="deleteBatch">
- DELETE FROM m_wbs_tree_contract
- WHERE (id IN
- <foreach item="ids" collection="ids" open="(" close=")" separator=",">
- #{ids}
- </foreach>
- OR parent_id IN
- <foreach item="ids" collection="ids" open="(" close=")" separator=",">
- #{ids}
- </foreach>)
- AND wbs_id = #{wbsId}
- AND project_id = #{projectId}
- AND contract_id = #{contractId}
- </update>
- <update id="updateByCondition">
- UPDATE m_wbs_tree_contract
- SET is_deleted = 0
- WHERE id = #{id}
- AND wbs_id = #{wbsId}
- AND project_id = #{projectId}
- AND contract_id = #{contractId}
- </update>
- <!-- <update id="updateByCondition1">-->
- <!-- UPDATE m_wbs_tree_contract-->
- <!-- SET node_type = #{wbsTP.nodeType},-->
- <!-- node_name = #{wbsTP.nodeName},-->
- <!-- unique_code = #{wbsTP.uniqueCode},-->
- <!-- partition_code = #{wbsTP.partitionCode},-->
- <!-- major_data_type = #{wbsTP.majorDataType}-->
- <!-- WHERE project_id = #{wbsTP.projectId}-->
- <!-- AND id = #{wbsTP.id}-->
- <!-- AND wbs_id = #{wbsTP.wbsId}-->
- <!-- </update>-->
- <update id="updateByCondition1">
- UPDATE m_wbs_tree_contract
- SET node_type = #{wbsTP.nodeType}
- <if test="wbsTP.isClassifition!=null and wbsTP.isClassifition!='' and wbsTP.isClassifition=1">
- ,is_classifition=#{wbsTP.isClassifition},class_name=#{wbsTP.className},unit_name=#{wbsTP.unitName}
- </if>
- WHERE project_id = #{wbsTP.projectId}
- AND is_type_private_pid = #{wbsTP.pKeyId}
- </update>
- <update id="updateByCondition2">
- UPDATE m_wbs_tree_contract
- SET is_deleted = 0
- WHERE contract_id = #{contractId}
- AND contract_id_relation = #{contractIdRelation}
- AND status = 1
- </update>
- <delete id="deleteByIds">
- DELETE FROM m_wbs_tree_contract WHERE p_key_id IN
- <foreach item="ids" collection="ids" open="(" close=")" separator=",">
- #{ids}
- </foreach>
- </delete>
- <delete id="deleteLogicByIds">
- UPDATE m_wbs_tree_contract SET is_deleted=1 WHERE p_key_id IN
- <foreach item="ids" collection="ids" open="(" close=")" separator=",">
- #{ids}
- </foreach>
- </delete>
- <select id="selectAll" resultMap="resultMap2">
- SELECT wtc.id,
- wtc.wbs_id,
- wtc.project_id,
- (SELECT project_name FROM m_project_info pi WHERE wtc.project_id = pi.id) AS project_name,
- contract_id
- FROM m_wbs_tree_contract wtc
- WHERE is_deleted = 0
- AND STATUS = 1
- GROUP BY project_id
- </select>
- <select id="selectByCondition" resultType="org.springblade.manager.entity.WbsTreeContract">
- SELECT *
- FROM m_wbs_tree_contract
- WHERE id = #{id}
- AND project_id = #{projectId}
- AND contract_id = #{contractId}
- AND wbs_id = #{wbsId}
- AND STATUS = 1
- AND is_deleted = 0
- </select>
- <select id="selectByCondition2" resultType="org.springblade.manager.entity.WbsTreeContract">
- SELECT *
- FROM m_wbs_tree_contract
- WHERE id = #{id}
- AND project_id = #{projectId}
- AND contract_id = #{contractId}
- AND wbs_id = #{wbsId}
- AND STATUS = 1
- </select>
- <select id="selectParent" resultType="org.springblade.manager.entity.WbsTreePrivate">
- SELECT p_key_id, node_name, full_name
- FROM m_wbs_tree_private
- WHERE project_id = #{projectId}
- AND wbs_id = #{wbsId}
- AND id = #{parentId}
- </select>
- <select id="queryCurrentContractLogList" resultMap="ResultMap">
- select p_key_id,
- node_name,
- full_name,
- node_type,
- excel_id,
- is_link_table
- from m_wbs_tree_private
- where is_deleted = 0
- and major_data_type = 5
- and wbs_type = 4
- and project_id = #{projectId}
- </select>
- <select id="selectListByCondition" resultType="org.springblade.manager.vo.WbsTreeContractVO2">
- SELECT p_key_id AS "pKeyId",
- id AS "id",
- node_name AS "nodeName",
- full_name AS "fullName",
- wbs_type AS "wbsType",
- wbs_id AS "wbsId",
- project_id AS "projectId",
- contract_id AS "contractId",
- contract_type AS "contractType",
- (select project_name from m_project_info where id = #{projectId}) AS "projectName",
- (select contract_name from m_contract_info ci where ci.id = t.contract_id) AS "contractName"
- FROM m_wbs_tree_contract t
- WHERE project_id = #{projectId}
- /*AND contract_type = 1*/
- AND status = 1
- AND parent_id = 0
- AND is_deleted = 0
- </select>
- <select id="selectCondition" resultType="org.springblade.manager.entity.WbsTreeContract">
- SELECT *
- FROM m_wbs_tree_contract
- WHERE is_deleted = 1
- AND parent_id = 0
- AND contract_id = #{getContractId}
- AND id = #{id}
- AND contract_id_relation = #{getContractIdRelation}
- AND contract_type = #{contractType}
- </select>
- <select id="lazyTreeTwo" resultMap="treeNodeResultMap">
- SELECT
- dept.type AS "type",
- dept.wbs_type AS "wbsType",
- dept.contract_type AS "contractType",
- dept.contract_id AS "contractId",
- dept.p_key_id AS "id",
- dept.node_type AS "nodeType",
- dept.id AS "primaryKeyId",
- dept.id AS "value",
- dept.id AS "key" ,
- dept.parent_id,
- IFNULL(dept.full_name,dept.node_name) AS "fullName",
- dept.tenant_id AS "tenantId",
- dept.contract_id_relation AS "contractIdRelation",
- (SELECT CASE WHEN count(1) > 0 THEN 1 ELSE 0 END FROM m_wbs_tree_contract WHERE parent_id = dept.id and
- is_deleted = 0 ) AS "has_children"
- FROM
- m_wbs_tree_contract dept
- WHERE
- dept.is_deleted = 0
- <if test="contractIdRelation != null and contractIdRelation != ''">
- AND contract_id_relation = #{contractIdRelation}
- </if>
- /* major_data_type = 5是日志类型,日志类型不需要直接在划分树上体现 */
- AND (major_data_type != 5 or major_data_type is null)
- AND dept.contract_id = #{contractId}
- AND dept.contract_type = #{contractType}
- AND parent_id = #{parentId}
- AND dept.type = 1
- AND status = 1
- ORDER BY dept.sort
- </select>
- <select id="lazyTreeThree" resultType="org.springblade.manager.vo.WbsTreeContractTreeVO3">
- SELECT
- c.id AS "primaryKeyId",
- c.p_key_id AS "id",
- c.type AS "type",
- c.wbs_type AS "wbsType",
- c.contract_type AS "contractType",
- c.contract_id AS "contractId",
- c.node_type AS "nodeType",
- c.parent_id,
- c.tenant_id AS "tenantId",
- c.id AS "originallyId",
- c.p_key_id AS "originallyPkeyId",
- case
- when c.full_name is null then c.node_name
- when c.full_name = '' then c.node_name
- else c.full_name end AS "title",
- c.contract_id AS "contractIdRelation",
- (SELECT CASE WHEN count(1) > 0 THEN 1 ELSE 0 END
- FROM m_wbs_tree_contract
- WHERE parent_id = c.id
- AND is_deleted = 0) AS "has_children"
- FROM m_wbs_tree_contract c
- WHERE (major_data_type != 5 or major_data_type is null)
- AND c.contract_id in
- <foreach item="contractIdRelation" collection="contractIdRelation" open="(" close=")" separator=",">
- #{contractIdRelation}
- </foreach>
- AND parent_id = #{parentId}
- AND c.contract_type = 1
- AND c.type = 1
- AND c.status = 1
- AND c.is_deleted = 0
- ORDER BY c.sort
- </select>
- <select id="appSearchConcealedNodes" resultType="org.springblade.manager.vo.WbsContractNodeVo">
- SELECT t.*,
- (SELECT CASE WHEN count(1) > 0 THEN 1 ELSE 0 END
- FROM m_wbs_tree_contract
- WHERE parent_id = t.id
- and is_deleted = 0) AS "has_children"
- FROM m_wbs_tree_contract t,
- (SELECT getParentList(#{contractId}) AS keyxs) b
- WHERE FIND_IN_SET(t.id, b.keyxs)
- and contract_id = #{contractId}
- and is_deleted = 0
- </select>
- <select id="searchParentAllNode" resultType="org.springblade.manager.entity.WbsTreeContract">
- SELECT DISTINCT T2.id,
- if(length(trim(T2.full_name)) > 0, T2.full_name, T2.node_name) as node_name,
- T2.parent_id,
- T2.p_key_id
- FROM (
- SELECT @r AS _id,(SELECT @r := parent_id FROM m_wbs_tree_contract WHERE id = _id and contract_id = h.contract_id
- ) AS pid, @l := @l + 1 AS lvl
- FROM (SELECT @r := #{primaryKeyId}, @l := 0) vars, m_wbs_tree_contract h
- WHERE @r != 0 and contract_id=#{contractId}
- union ALL
- (
- SELECT id, parent_id, 0
- FROM m_wbs_tree_contract
- where parent_id=#{primaryKeyId}
- and contract_id=#{contractId} LIMIT 1)
- ) T1
- JOIN m_wbs_tree_contract T2 ON T1._id = T2.id
- where T2.contract_id=#{contractId} and T2.type<>2
- </select>
- <select id="updateAllNodeTabById" resultType="org.springblade.manager.entity.WbsTreeContract">
- update m_wbs_tree_contract
- set excel_id= #{aPrivate.excelId},
- node_name = #{aPrivate.nodeName},
- full_name = #{aPrivate.fullName},
- init_table_name = #{aPrivate.initTableName},
- is_link_table = 2,
- html_url = #{aPrivate.htmlUrl}
- where type = 2
- and project_id = #{aPrivate.projectId}
- and id = #{aPrivate.id};
- </select>
- <select id="selectWbsTableOwnerRoleList" resultType="org.springblade.manager.entity.WbsTableOwnerRole">
- select id, role_id as "roleId", table_owner_number as "tableOwnerNumber"
- from m_wbs_table_owner_role
- where role_id = #{roleId}
- </select>
- <!--APP返回appResultMap(内部嵌套子查询(不清楚为什么要这样嵌套查询,导致一直递归))-->
- <select id="selectWbsTreeContractList" resultMap="appResultMap">
- SELECT * FROM
- m_wbs_tree_contract
- WHERE project_id = #{projectId}
- AND wbs_id = #{wbsId}
- AND contract_id = #{contractId}
- AND parent_id = #{parentId}
- AND type = 2
- AND status = 1
- AND is_deleted = 0
- <if test="contractIdRelation != null and contractIdRelation!= ''">
- AND contract_id = #{contractIdRelation}
- </if>
- <if test="roleTableOwnerSets != null and roleTableOwnerSets!= ''">
- AND table_owner in
- <foreach item="roleTableOwnerSets" collection="roleTableOwnerSets" open="(" close=")" separator=",">
- #{roleTableOwnerSets}
- </foreach>
- </if>
- ORDER BY sort,full_name,create_time
- </select>
- <!--客户端返回WbsTreeContract-->
- <select id="selectWbsTreeContractListClient" resultType="org.springblade.manager.vo.AppWbsTreeContractVO">
- SELECT * FROM
- m_wbs_tree_contract
- WHERE project_id = #{projectId}
- AND wbs_id = #{wbsId}
- AND contract_id = #{contractId}
- AND parent_id = #{parentId}
- AND type = 2
- AND status = 1
- AND is_deleted = 0
- <if test="contractIdRelation != null and contractIdRelation!= ''">
- AND contract_id = #{contractIdRelation}
- </if>
- <if test="roleTableOwnerSets != null and roleTableOwnerSets!= ''">
- AND table_owner in
- <foreach item="roleTableOwnerSets" collection="roleTableOwnerSets" open="(" close=")" separator=",">
- #{roleTableOwnerSets}
- </foreach>
- </if>
- ORDER BY sort,full_name,create_time
- </select>
- <select id="selectRoleInfo" resultType="org.springblade.manager.entity.SaveUserInfoByProject">
- SELECT role_id
- FROM m_project_assignment_user
- WHERE user_id = #{userId}
- AND contract_id = #{contractId}
- AND project_id = #{projectId}
- AND status = 1
- AND is_deleted = 0
- AND role_id is not null
- </select>
- <select id="selectContractRelationInfo" resultType="org.springblade.manager.entity.ContractRelationJlyz">
- SELECT *
- FROM m_contract_relation_jlyz
- WHERE contract_id_jlyz = #{id}
- </select>
- <select id="selectContractInfo" resultType="org.springblade.manager.entity.ContractInfo">
- SELECT contract_name
- FROM m_contract_info
- WHERE id = #{contractId}
- </select>
- <select id="selectContractRelationInfoByidSG" resultType="org.springblade.manager.entity.ContractRelationJlyz">
- SELECT *
- FROM m_contract_relation_jlyz
- WHERE contract_id_sg = #{contractId}
- </select>
- <select id="selectContractRelationInfoByidSG2" resultType="org.springblade.manager.entity.ContractRelationJlyz">
- SELECT *
- FROM m_contract_relation_jlyz
- WHERE contract_id_sg = #{contractId}
- </select>
- <select id="queryContractSubmitWbsTreeByContractId" resultMap="ResultMap">
- select p_key_id, contract_id, major_data_type
- from m_wbs_tree_contract
- where is_deleted = 0
- and major_data_type in (1, 2, 3, 4)
- and contract_id = #{contractId}
- </select>
- <select id="selectInformationQueryInfo" resultType="org.springblade.business.entity.InformationQuery">
- SELECT wbs_id FROM u_information_query
- WHERE wbs_id IN
- <foreach item="ids" collection="ids" open="(" close=")" separator=",">
- #{ids}
- </foreach>
- AND is_deleted = 0
- </select>
- <select id="selectTableListInfo" resultType="org.springblade.manager.entity.WbsTreeContract">
- SELECT p_key_id AS "pKeyId"
- ,id,node_name AS "nodeName"
- ,type,parent_id AS "parentId"
- ,is_tab_pdf AS "isTabPdf"
- FROM m_wbs_tree_contract
- WHERE ( id IN
- <foreach item="ids" collection="ids" open="(" close=")" separator=",">
- #{ids}
- </foreach>
- OR (parent_id IN
- <foreach item="ids" collection="ids" open="(" close=")" separator=",">
- #{ids}
- </foreach>
- ) )
- AND wbs_id = #{wbsId}
- AND project_id = #{projectId}
- AND contract_id = #{contractId}
- /*AND contract_type = 1*/
- </select>
- <update id="regainRemoveTreeByPrimaryKeyIds">
- update m_wbs_tree_contract set is_deleted = 0
- <where>
- p_key_id in
- <foreach collection="primaryKeyIds" item="primaryKeyId" open="(" separator="," close=")">
- #{primaryKeyId}
- </foreach>
- </where>
- </update>
- <update id="updateBatchByIds">
- UPDATE m_wbs_tree_contract
- 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}
- <if test="wbsTree.sort != null and wbsTree.sort != ''">
- , sort = #{wbsTree.sort}
- </if>
- WHERE id = #{wbsTree.id}
- AND contract_id = #{id}
- AND status = 1
- AND is_deleted = 0
- </update>
- <update id="updateBatchByIds2">
- UPDATE m_wbs_tree_contract
- SET node_name = #{wbsTreePrivate.nodeName},
- full_name = #{wbsTreePrivate.nodeName},
- 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}
- <if test="wbsTreePrivate.sort != null and wbsTreePrivate.sort != ''">
- , sort = #{wbsTreePrivate.sort}
- </if>
- WHERE id = #{wbsTreePrivate.id}
- AND contract_id = #{id}
- AND status = 1
- AND is_deleted = 0
- </update>
- <update id="updateContractTablesInfo">
- UPDATE m_wbs_tree_contract
- SET
- node_name =
- CASE
- WHEN node_name LIKE '%_PL_%' THEN CONCAT(#{wbsTreePrivate.nodeName}, SUBSTRING(node_name FROM INSTR(node_name,
- '_PL_')))
- WHEN node_name LIKE '%__%' THEN CONCAT(#{wbsTreePrivate.nodeName}, SUBSTRING(node_name FROM INSTR(node_name,
- '__')))
- ELSE #{wbsTreePrivate.nodeName}
- END,
- full_name =
- CASE
- WHEN full_name LIKE '%_PL_%' THEN CONCAT(#{wbsTreePrivate.nodeName}, SUBSTRING(full_name FROM INSTR(full_name,
- '_PL_')))
- WHEN full_name LIKE '%__%' THEN CONCAT(#{wbsTreePrivate.nodeName}, SUBSTRING(full_name FROM INSTR(full_name,
- '__')))
- ELSE #{wbsTreePrivate.nodeName}
- END,
- table_type = #{wbsTreePrivate.tableType},
- table_owner = #{wbsTreePrivate.tableOwner}
- <if test="wbsTreePrivate.sort != null and wbsTreePrivate.sort != ''">
- ,sort = #{wbsTreePrivate.sort}
- </if>
- WHERE
- p_key_id in
- <foreach collection="pKeyIdsContracts" item="pKeyIds" open="(" close=")" separator=",">
- #{pKeyIds}
- </foreach>
- </update>
- <update id="updateBatchWbsContract" parameterType="java.util.List">
- <foreach collection="listContract" item="item" index="index" separator=";">
- UPDATE m_wbs_tree_contract
- <set>
- node_name =
- CASE
- WHEN node_name LIKE '%_PL_%'
- THEN CONCAT(
- <if test="item.nodeName != null and item.nodeName != ''">
- #{item.nodeName}
- </if>,
- SUBSTRING(node_name FROM INSTR(node_name, '_PL_'))
- )
- WHEN node_name LIKE '%__%'
- THEN CONCAT(
- <if test="item.nodeName != null and item.nodeName != ''">
- #{item.nodeName}
- </if>,
- SUBSTRING(node_name FROM INSTR(node_name, '__'))
- )
- ELSE
- <if test="item.nodeName != null and item.nodeName != ''">
- #{item.nodeName}
- </if>
- END,
- full_name =
- CASE
- WHEN full_name LIKE '%_PL_%'
- THEN CONCAT(
- <if test="item.nodeName != null and item.nodeName != ''">
- #{item.nodeName}
- </if>,
- SUBSTRING(full_name FROM INSTR(full_name, '_PL_'))
- )
- WHEN full_name LIKE '%__%'
- THEN CONCAT(
- <if test="item.nodeName != null and item.nodeName != ''">
- #{item.nodeName}
- </if>,
- SUBSTRING(full_name FROM INSTR(full_name, '__'))
- )
- ELSE
- <if test="item.nodeName != null and item.nodeName != ''">
- #{item.nodeName}
- </if>
- END,
- <if test="item.nodeType != null and item.nodeType != ''">
- node_type = #{item.nodeType},
- </if>
- <if test="item.majorDataType != null and item.majorDataType != ''">
- major_data_type = #{item.majorDataType},
- </if>
- <if test="item.tableType != null and item.tableType != ''">
- table_type = #{item.tableType},
- </if>
- <if test="item.tableOwner != null and item.tableOwner != ''">
- table_owner = #{item.tableOwner},
- </if>
- <if test="item.htmlUrl != null and item.htmlUrl != ''">
- html_url = #{item.htmlUrl},
- </if>
- <if test="item.excelId != null and item.excelId != ''">
- excel_id = #{item.excelId},
- </if>
- <if test="item.sort != null and item.sort != ''">
- sort = #{item.sort}
- </if>
- </set>
- WHERE id = #{item.id}
- AND project_id = #{item.projectId}
- AND contract_id = #{item.contractId}
- AND status = 1
- AND is_deleted = 0
- </foreach>
- </update>
- <update id="updateDeletedByIds">
- UPDATE m_wbs_tree_contract
- SET is_deleted = 1
- WHERE type = 2
- AND p_key_id in
- <foreach item="ids" collection="ids" open="(" close=")" separator=",">
- #{ids}
- </foreach>
- </update>
- <update id="syncCurrentFormToAllContract">
- UPDATE m_wbs_tree_contract
- SET html_url = #{wbsTreePrivate.htmlUrl},
- init_table_name = #{wbsTreePrivate.initTableName},
- node_name = #{wbsTreePrivate.nodeName},
- full_name = #{wbsTreePrivate.fullName}
- WHERE project_id = #{wbsTreePrivate.projectId}
- and excel_id = #{wbsTreePrivate.excelId}
- </update>
- <update id="updateIsPId">
- <foreach item="value" collection="map" index="key" separator=";">
- UPDATE m_wbs_tree_contract
- <set>
- is_type_private_pid = #{value}
- </set>
- where p_key_id = #{key}
- </foreach>
- </update>
- <update id="tableSort">
- <foreach item="value" collection="map" index="key" separator=";">
- UPDATE m_wbs_tree_contract
- <set>
- sort = #{value}
- </set>
- where p_key_id = #{key}
- </foreach>
- </update>
- <update id="batchUpdateTable">
- <foreach item="item" collection="list" separator=";">
- ${item}
- </foreach>
- </update>
- <update id="updateContractPid">
- UPDATE m_wbs_tree_contract a
- LEFT JOIN (
- SELECT
- tree_p_id,
- p_key_id
- FROM
- m_wbs_tree_contract
- WHERE
- project_id = #{projectId} and contract_id = #{contractId} ) b ON a.parent_id = b.tree_p_id
- SET a.p_id = IFNULL( b.p_key_id, 0 )
- WHERE
- a.project_id = #{projectId} and contract_id = #{contractId}
- </update>
- <update id="updateBatchAncestorsByPKeyId">
- <foreach collection="allNodes" item="item" separator=";">
- UPDATE m_wbs_tree_contract
- <set>`ancestors_p_id` = #{item.ancestorsPId}</set>
- where p_key_id = #{item.pKeyId}
- </foreach>
- </update>
- <select id="selectQueryValueLikeNodeName" resultMap="ResultMap">
- select *
- from m_wbs_tree_contract
- where is_deleted = 0
- and contract_id = #{contractId}
- and (node_name like concat('%', #{queryValue}, '%') or full_name like concat('%', #{queryValue}, '%'))
- and `type` = '1'
- </select>
- <select id="selectQueryCurrentNodeByAncestors" resultMap="ResultMap">
- select * from m_wbs_tree_contract where is_deleted = 0 and contract_id = #{contractId} and `type` = '1' and (
- parent_id = '0' or parent_id = (select id from m_wbs_tree_contract where parent_id = '0' and contract_id =
- #{contractId}) or (
- <foreach collection="ids" item="id" index="index" separator="or">
- ancestors like concat('%',#{id},'%')
- </foreach>
- )
- ) group by id order by parent_id,`sort`
- </select>
- <select id="selectContractList" resultType="org.springblade.manager.entity.WbsTreeContract">
- SELECT contract_id FROM m_wbs_tree_contract WHERE id in
- <foreach item="ids" collection="ids" open="(" close=")" separator=",">
- #{ids}
- </foreach>
- AND project_id = #{projectId}
- AND wbs_id = #{wbsId}
- AND is_deleted = 0
- </select>
- <select id="getuserInfoByaccount" resultType="org.springblade.manager.entity.AppUser">
- SELECT b.*
- from u_operation_log a,
- blade_user b
- where b.tenant_id = '000000' /*只查询后管系统的用户*/
- and a.contract_id = 1
- and a.operation_account = b.account
- and a.operation_type = 1
- and a.business_id like concat('%', #{sonId}, '%')
- group by b.id
- </select>
- <select id="getAllTableFileSize" resultType="java.lang.Long">
- select sum(DATA_LENGTH)
- from information_schema.tables
- where table_schema = 'bladex'
- AND table_name in (SELECT mwtc.init_table_name
- FROM m_wbs_tree_contract mwtc
- WHERE mwtc.project_id = #{projectId}
- and mwtc.init_table_name is NOT NULL
- and mwtc.init_table_name
- != ''
- GROUP by mwtc.init_table_name );
- </select>
- <select id="getProjectAllFillNode" resultType="java.lang.Integer">
- select COUNT(1) from m_wbs_tree_contract
- WHERE project_id = #{projectId} and node_type = 6 and is_deleted = 0
- </select>
- <select id="getAllAppTotal" resultType="java.lang.Integer">
- select COUNT(1) from u_information_query
- WHERE project_id = #{projectId} and status = 2 and classify = 1 and is_deleted = 0
- </select>
- <select id="getAllAppTotal2" resultType="java.lang.Integer">
- select COUNT(1) from u_construction_ledger
- WHERE project_id = #{projectId} and is_deleted = 0 and site_end_time < NOW()
- </select>
- <select id="getAllNodeByProjectId" resultType="org.springblade.manager.entity.WbsTreeContract">
- select p_key_id,id,wbs_id,project_id from m_wbs_tree_contract
- WHERE project_id = #{projectId} and type = 1 and is_deleted = 0 and is_type_private_pid is null
- </select>
- <select id="apiTreeNode" resultMap="apiTreeNodeResultMap">
- select distinct p_key_id ,type, id , parent_id , node_name
- from m_wbs_tree_contract
- where
- is_deleted = 0
- and status = 1
- and wbs_type = 1
- and type=1
- and contract_id = #{contractId}
- <if test="nodeName != null and nodeName != ''">
- AND node_name like CONCAT(CONCAT('%', #{nodeName}), '%')
- </if>
- ORDER BY type,sort
- </select>
- <select id="apiTreeNodeHzrc" resultMap="apiTreeNodeHzrcResultMap">
- select distinct a.p_key_id , a.id , a.parent_id , a.node_name , b.e_visa_pdf_url as fileUrl,
- (SELECT count(1) from u_task e ,u_task_parallel f,m_project_assignment_user g where e.process_instance_id = f.process_instance_id and f.task_user = g.user_id and g.role_id in(
- SELECT id from blade_role where role_name like '监理员%' and is_deleted=0) and g.contract_id=1792792387901288450 and e.form_data_id=b.id )
- AS isMea,
- a.partition_Code as partitionCode,
- b.taskStatus
- from m_wbs_tree_contract a LEFT JOIN (SELECT c.e_visa_pdf_url ,d.`status` as taskStatus,c.wbs_id ,,d.id from u_information_query c,u_task d where d.form_data_id=c.id and c.contract_id = #{contractId} and c.classify = #{classType}) b on a.p_key_id = b.wbs_id
- where
- a.is_deleted = 0
- and a.status = 1
- and a.wbs_type = 1
- and a.type=1
- and a.contract_id = #{contractId}
- ORDER BY a.type,a.sort
- </select>
- <select id="getContractAllNode" resultType="org.springblade.manager.vo.ArchiveSyncWbsVO">
- select p_key_id,id,parent_id,node_name,full_name,sort
- from m_wbs_tree_contract where contract_id = #{contractId} and type = 1 and is_deleted = 0
- ORDER BY sort,create_time
- </select>
- <select id="projectAllTable" resultType="org.springblade.manager.entity.WbsTreeContract">
- select p_key_id,init_table_name
- from m_wbs_tree_contract where project_id = #{projectId} and type = 2 and is_deleted = 0
- </select>
- <select id="selectContractJLForm" resultType="org.springblade.manager.vo.WbsTreeContractTreeVOS">
- select id from m_wbs_tree_contract where p_key_id in (
- <foreach collection="list" item="pkeyId" separator=",">
- #{pkeyId}
- </foreach>
- ) and pdf_url is not null and pdf_url != '' and (table_owner = 4 or table_owner = 5 or table_owner = 6) and is_deleted = 0
- </select>
- </mapper>
|