|
@@ -47,6 +47,24 @@
|
|
|
<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="deptCategory" property="deptCategory"/>
|
|
|
+ <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>
|
|
|
+
|
|
|
+
|
|
|
<insert id="insertWbsTreeContract1">
|
|
|
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,dept_category,dept_name,full_name,sort,remark,`type`,
|
|
@@ -259,4 +277,36 @@
|
|
|
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.dept_category AS "deptCategory",
|
|
|
+ dept.id AS "primaryKeyId",
|
|
|
+ dept.id AS "value",
|
|
|
+ dept.id AS "key" ,
|
|
|
+ dept.parent_id,
|
|
|
+ dept.full_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>
|
|
|
+ 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>
|
|
|
+
|
|
|
</mapper>
|