| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585 |
- <?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.ContractInfoMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="contractInfoResultMap" type="org.springblade.manager.vo.ContractInfoVO">
- <result column="id" property="id"/>
- <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="status" property="status"/>
- <result column="is_deleted" property="isDeleted"/>
- <result column="contract_name" property="contractName"/>
- <result column="contract_type" property="contractType"/>
- <result column="p_id" property="pId"/>
- <result column="project_name" property="projectName"/>
- <result column="contract_number" property="contractNumber"/>
- <result column="contractor_unit_name" property="contractorUnitName"/>
- <result column="construction_unit_name" property="constructionUnitName"/>
- <result column="supervision_unit_name" property="supervisionUnitName"/>
- <result column="laboratory_name" property="laboratoryName"/>
- <result column="contractor_join_time" property="contractorJoinTime"/>
- <result column="plan_start_time" property="planStartTime"/>
- <result column="plan_end_time" property="planEndTime"/>
- <result column="actual_start_time" property="actualStartTime"/>
- <result column="actual_end_time" property="actualEndTime"/>
- <result column="start_file_url" property="startFileUrl"/>
- <result column="contract_amount" property="contractAmount"/>
- <result column="contract_amount" property="contractAmount"/>
- <result column="project_place" property="projectPlace"/>
- <result column="start_station" property="startStation"/>
- <result column="end_station" property="endStation"/>
- <result column="filer" property="filer"/>
- <result column="reviewer" property="reviewer"/>
- <result column="prefix" property="prefix"/>
- <result column="security_level" property="securityLevel"/>
- <result column="storage_period" property="storagePeriod"/>
- <result column="is_electronic_signature" property="isElectronicSignature"/>
- <result column="is_test_module" property="isTestModule"/>
- <result column="is_reference_number" property="isReferenceNumber"/>
- <result column="isTestRecord" property="is_test_record"/>
- </resultMap>
- <resultMap id="contractInfoResultMap1" type="org.springblade.manager.vo.ContractlnfoCountVO">
- <result column="contract_name" property="contractName"/>
- <result column="contract_counts" property="contractCounts"/>
- </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="primaryKeyId" property="primaryKeyId"/>
- <result column="wbsType" property="wbsType"/>
- <result column="partition_code" property="partitionCode"/>
- <result column="old_id" property="oldId"/>
- <result column="contractIdRelation" property="contractIdRelation"/>
- <result column="major_data_type" property="majorDataType"/>
- </resultMap>
- <resultMap id="treeNodeResultMap6" type="org.springblade.manager.vo.WbsTreeContractVO6">
- <id column="id" property="id"/>
- <result column="parentId" property="parentId"/>
- <result column="primaryKeyId" property="pKeyId"/>
- <result column="title" property="title"/>
- <result column="value" property="value"/>
- <result column="key" property="key"/>
- <result column="has_children" property="hasChildren"/>
- <result column="node_type" property="nodeType"/>
- <result column="major_data_type" property="majorDataType"/>
- <result column="old_id" property="oldId"/>
- <result column="sort" property="sort"/>
- </resultMap>
- <resultMap id="treeNodeResultMap2" type="org.springblade.manager.vo.WbsTreeContractVO">
- <id column="id" property="id"/>
- <result column="parentId" 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="primaryKeyId" property="primaryKeyId"/>
- <result column="wbsType" property="wbsType"/>
- <result column="partition_code" property="partitionCode"/>
- <result column="old_id" property="oldId"/>
- <result column="nodeName" property="nodeName"/>
- <result column="fullName" property="fullName"/>
- <result column="contractId" property="contractId"/>
- <result column="isTestRecord" property="is_test_record"/>
- </resultMap>
- <resultMap id="resultMap2" type="org.springblade.manager.vo.ContractInfoVO">
- <id column="id" property="id"/>
- <collection property="idList" ofType="org.springblade.manager.vo.WbsTreeContractVO3">
- <id column="id" property="id"/>
- <result property="pkeyId" column="pkeyId"/>
- <result property="contractId" column="contractId"/>
- <result property="contractIdRelation" column="contractIdRelation"/>
- </collection>
- </resultMap>
- <insert id="insertContractRelationJLYZ">
- insert into m_contract_relation_jlyz (id, contract_id_jlyz, contract_id_sg)
- values (#{id}, #{contractId}, #{contractIdSG})
- </insert>
- <delete id="deleteContractRelationJLYZ">
- delete
- from m_contract_relation_jlyz
- where contract_id_jlyz = #{id}
- </delete>
- <select id="selectContractByProjectIds" resultMap="contractInfoResultMap">
- select id, p_id, contract_name, contract_number, contract_type from m_contract_info where is_deleted = 0 and
- p_id in
- <foreach collection="ids" item="pId" open="(" separator="," close=")">
- #{pId}
- </foreach>
- </select>
- <update id="updatePasswordByUserId">
- update blade_user
- set password = #{password}
- where id = #{userId}
- </update>
- <update id="deleteFile">
- update blade_attach
- set is_deleted = 1
- where link = #{url}
- and `status` = 1
- </update>
- <select id="selectContractInfoPage" resultMap="contractInfoResultMap">
- select c.*, p.project_name as project_name
- from m_contract_info c
- INNER JOIN m_project_info p on c.p_id = p.id
- where c.is_deleted = 0
- </select>
- <select id="selectContractInfoCount" resultMap="contractInfoResultMap1">
- select c.contract_name, count(*) as contract_counts
- from m_contract_info c
- where c.is_deleted = 0
- GROUP BY c.p_id
- </select>
- <select id="selectContractInfoPageByPid" resultMap="contractInfoResultMap">
- select c.*, p.project_name as project_name
- from m_contract_info c
- INNER JOIN m_project_info p on c.p_id = p.id
- where p.id = #{pid}
- and c.is_deleted = 0
- </select>
- <select id="findJobByRoleId" resultType="org.springblade.manager.vo.CRolePostVO">
- select p.id, p.post_name
- from blade_post p
- INNER JOIN m_role_post m ON p.id = m.p_id
- INNER JOIN blade_role r ON r.id = m.r_id
- WHERE p.is_deleted = 0
- and p.`status` = 1
- and r.id = #{id}
- </select>
- <select id="findAllUserByCondition" resultType="org.springblade.system.user.vo.UserVO2">
- SELECT
- u.id as uId,mpau.id,pi.project_name,ci.contract_name,u.id as uid,u.`name`,u.account,u.plaintext_password as
- "password",u.`phone`
- FROM
- blade_user u
- INNER JOIN m_project_assignment_user mpau ON u.id = mpau.user_id
- INNER JOIN m_contract_info ci ON ci.id = mpau.contract_id
- INNER JOIN m_project_info pi ON pi.id = mpau.project_id
- INNER JOIN blade_role r ON r.id = mpau.role_id
- WHERE mpau.is_deleted = 0 AND mpau.`status` = 1
- AND pi.id = #{Values.pId}
- <if test="Values.cId != null and Values.cId != '' ">
- AND ci.id = #{Values.cId}
- </if>
- <if test="Values.rId !=null and Values.rId !='' ">
- AND r.id = #{Values.rId}
- </if>
- </select>
- <select id="findUserListByCondition" resultType="org.springblade.system.user.vo.UserVO3">
- SELECT
- mpau.id,
- u.`name`,
- u.account,
- (select dict_value from blade_dict_biz where id = mpau.post_id) as postName,
- (select contract_name from m_contract_info where id = mpau.contract_id) as contractName,
- u.`password`,
- u.`phone`
- FROM
- blade_user u
- INNER JOIN m_project_assignment_user mpau ON u.id = mpau.user_id
- INNER JOIN m_project_info pi ON pi.id = mpau.project_id
- WHERE
- mpau.is_deleted = 0
- AND mpau.`status` = 1
- AND mpau.project_id = #{Values.pId}
- AND mpau.post_id = #{Values.rId}
- <if test="Values.cId != null and Values.cId != '' ">
- AND mpau.contract_id = #{Values.cId}
- </if>
- </select>
- <select id="findUserInfoByCondition" resultType="org.springblade.system.user.entity.User">
- SELECT `name`,`account`,`password` FROM blade_user
- WHERE is_deleted = 0 AND `status` = 1
- AND role_id = #{rId}
- AND post_id = #{pId}
- <if test=" userName != null and userName != '' ">
- AND `name` = #{userName}
- </if>
- </select>
- <select id="findUserList" resultType="org.springblade.system.user.entity.User">
- select `id`, `name`, account, `password`
- from blade_user
- WHERE is_deleted = 0
- and `status` = 1
- order by create_time
- </select>
- <select id="tree" resultMap="treeNodeResultMap">
- SELECT
- p_key_id AS primaryKeyId,
- wbs_type AS wbsType,
- id,
- parent_id,
- IFNULL(if(length(trim(full_name)) > 0, full_name, node_name),node_name) AS title,
- type AS "type",
- node_type AS nodeType,
- id AS "value",
- id AS "key",
- partition_code,
- old_id,
- major_data_type,
- sort
- FROM
- m_wbs_tree_contract
- WHERE
- is_deleted = 0
- AND STATUS = 1
- /* major_data_type = 5是日志类型,日志类型不需要直接在划分树上体现 */
- AND (major_data_type != 5 or major_data_type is null)
- AND type = 1
- <if test="wbsId!=null and wbsId!=''">
- and wbs_id = #{wbsId}
- </if>
- <if test="projectId !=null and projectId!=''">
- and project_id = #{projectId}
- </if>
- <if test="contractId!=null and contractId!=''">
- and contract_id = #{contractId}
- </if>
- <if test="wbsType != null and wbsType != ''">
- and wbs_type = #{wbsType}
- </if>
- <if test="parentId != null and parentId != ''">
- and parent_id = #{parentId}
- </if>
- ORDER BY sort
- </select>
- <select id="tree2" resultMap="treeNodeResultMap2">
- SELECT
- d.p_key_id AS "primaryKeyId",
- d.wbs_type AS "wbsType",
- d.id,
- d.parent_id AS "parentId",
- d.node_name AS title,
- d.node_name AS "nodeName",
- d.full_name AS "fullName",
- d.import_matching_info AS "importMatchingInfo",
- d.type AS "type",
- d.node_type AS "nodeType",
- d.id AS "value",
- d.id AS "key",
- partition_code,
- old_id,
- sort
- FROM m_wbs_tree_contract d
- WHERE
- d.is_deleted = 0
- AND d.status = 1
- AND d.type = 1
- <if test="wbsId!=null and wbsId!=''">
- and wbs_id = #{wbsId}
- </if>
- <if test="projectId !=null and projectId!=''">
- and project_id = #{projectId}
- </if>
- <if test="contractId!=null and contractId!=''">
- and contract_id = #{contractId}
- </if>
- /*不查询客户端新增或者复制的节点 old_id = null*/
- AND old_id is null
- ORDER BY d.sort
- </select>
- <select id="tree3" resultType="org.springblade.manager.vo.WbsTreeContractVO">
- SELECT
- d.p_key_id AS "primaryKeyId",
- d.wbs_type AS "wbsType",
- d.id,
- d.parent_id AS "parentId",
- IFNULL(if(length(trim(full_name)) > 0, full_name, node_name),node_name) AS title,
- d.node_name AS "nodeName",
- d.full_name AS "fullName",
- d.import_matching_info AS "importMatchingInfo",
- d.type AS "type",
- d.node_type AS "nodeType",
- d.id AS "value",
- d.id AS "key",
- partition_code,
- old_id,
- sort
- FROM m_wbs_tree_contract d
- WHERE
- d.is_deleted = 0
- AND d.status = 1
- AND d.type = 1
- <if test="wbsId!=null and wbsId!=''">
- and wbs_id = #{wbsId}
- </if>
- <if test="projectId !=null and projectId!=''">
- and project_id = #{projectId}
- </if>
- <if test="contractId!=null and contractId!=''">
- and contract_id = #{contractId}
- </if>
- <if test="wbsType != null and wbsType != ''">
- and wbs_type = #{wbsType}
- </if>
- <if test="parentId != null and parentId != ''">
- and parent_id = #{parentId}
- </if>
- /*改变划分节点,暂时未说明是否新增到新增、复制节点下,默认可以修改 old_id != null*/
- /*AND old_id is null*/
- ORDER BY d.sort
- </select>
- <select id="selectByCondition" resultMap="resultMap2">
- SELECT t.p_key_id AS "pKeyId",
- t.contract_id AS "contractId",
- t.contract_id_relation AS "contractIdRelation",
- c.*
- FROM m_contract_info c
- INNER JOIN m_wbs_tree_contract t ON c.id = t.contract_id
- WHERE c.id = #{contractInfo.id}
- AND t.parent_id = 0
- </select>
- <select id="selectLists" resultType="org.springblade.manager.vo.WbsTreeContractVO3">
- SELECT full_name AS "fullName",
- id AS "id",
- p_key_id AS "pKeyId",
- contract_id AS "contractId",
- contract_id_relation AS "contractIdRelation"
- FROM m_wbs_tree_contract
- WHERE contract_id = #{contractInfo.id}
- AND contract_type = #{contractType}
- AND parent_id = 0
- AND status = 1
- AND is_deleted = 0
- </select>
- <select id="selectByContractRelationJlyz" resultType="org.springblade.manager.entity.ContractRelationJlyz">
- SELECT contract_id_sg AS "id", contract_id_jlyz
- FROM m_contract_relation_jlyz
- WHERE contract_id_jlyz = #{id}
- </select>
- <select id="selectContractIdByProjectId" resultType="org.springblade.manager.entity.ContractInfo">
- SELECT id
- FROM m_contract_info
- WHERE p_id = #{project_id}
- AND contract_type = 1
- AND is_deleted = 0
- AND status =
- 1
- </select>
- <select id="getContractListByProjectId" resultType="org.springblade.manager.entity.ContractInfo">
- SELECT *
- FROM m_contract_info
- WHERE p_id = #{projectId}
- AND is_deleted = 0
- AND status = 1
- </select>
- <select id="tree4" resultType="org.springblade.manager.vo.WbsTreeContractVO">
- SELECT
- d.*
- /*,(select CASE WHEN count(1) > 0 THEN 1 ELSE 0 END from m_wbs_tree_contract c where c.parent_id = d.id and
- c.contract_id = d.contract_id and c.is_deleted = 0 ) AS "has_children"*/
- FROM m_wbs_tree_contract d
- WHERE
- d.is_deleted = 0
- AND d.status = 1
- AND d.type = 1
- <if test="contractId!=null and contractId!=''">
- AND contract_id = #{contractId}
- </if>
- <if test="parentId != null and parentId != ''">
- AND (FIND_IN_SET(#{parentId},ancestors) OR p_key_id = #{parentId})
- </if>
- ORDER BY d.create_time,d.sort
- </select>
- <select id="selectContractUserInfo" resultType="org.springblade.manager.entity.SaveUserInfoByProject">
- select *
- from m_project_assignment_user
- where contract_id = #{contractId}
- and is_deleted = 0
- and status = 1
- </select>
- <select id="userListByIds" resultType="org.springblade.system.user.vo.UserContractInfoVO">
- select id as userId,`name` as userName from blade_user where id in
- <foreach collection="ids" item="ids" index="ids" open="(" separator="," close=")">
- #{ids}
- </foreach>
- </select>
- <select id="tree5" resultType="org.springblade.manager.vo.WbsTreeContractTreeAllVO">
- SELECT d.p_key_id AS "primaryKeyId",
- d.id,
- d.parent_id AS "parentId",
- IFNULL(if(length(trim(full_name)) > 0, full_name, node_name), node_name) AS title,
- partition_code,
- node_type,
- sort,
- d.contract_id AS contractIdRelation,
- d.type,
- d.major_data_type AS majorDataType,
- d.create_time
- FROM m_wbs_tree_contract d
- WHERE contract_id = #{contractId}
- AND d.type = 1
- AND d.status = 1
- AND d.is_deleted = 0
- ORDER BY d.sort, title, d.create_time
- </select>
- <select id="tree6" resultMap="treeNodeResultMap6">
- SELECT
- d.p_key_id AS "primaryKeyId",
- d.id,
- d.parent_id AS "parentId",
- IFNULL(if(length(trim(full_name)) > 0, full_name, node_name),node_name) AS title,
- d.node_name AS "nodeName",
- d.full_name AS "fullName",
- d.node_type ,
- d.id AS "value",
- d.id AS "key",
- old_id,
- major_data_type,
- sort
- FROM m_wbs_tree_contract d
- WHERE
- d.is_deleted = 0
- AND d.status = 1
- AND d.type = 1
- <if test="wbsId!=null and wbsId!=''">
- and wbs_id = #{wbsId}
- </if>
- <if test="projectId !=null and projectId!=''">
- and project_id = #{projectId}
- </if>
- <if test="contractId!=null and contractId!=''">
- and contract_id = #{contractId}
- </if>
- ORDER BY d.sort, title, d.create_time
- </select>
- <select id="trialRelationTree" resultType="org.springblade.manager.vo.TrialRecordZJTreeVO">
- SELECT d.p_key_id AS "primaryKeyId",
- d.id AS id,
- IFNULL(if(length(trim(d.full_name)) > 0, d.full_name, d.node_name), d.node_name) AS fullName,
- d.parent_id AS "parentId"
- FROM m_wbs_tree_contract d
- WHERE d.is_deleted = 0
- AND d.status = 1
- AND d.type = 1
- AND wbs_type = 1
- AND project_id = #{projectId}
- AND contract_id = #{contractId}
- AND wbs_id = #{wbsId}
- ORDER BY d.sort, d.create_time
- </select>
- <select id="trialRelationTreeLazy" resultType="org.springblade.manager.vo.TrialRecordZJTreeLazyVO">
- SELECT d.p_key_id AS "primaryKeyId",
- d.node_type AS "nodeType",
- d.type AS "type",
- d.major_data_type AS "majorDataType",
- d.id AS id,
- IFNULL(if(length(trim(d.full_name)) > 0, d.full_name, d.node_name), d.node_name) AS fullName,
- d.parent_id AS "parentId",
- (select case when count(1) > 0 then 1 else 0 end
- from m_wbs_tree_contract
- where parent_id = d.id
- and is_deleted = 0
- and project_id = #{projectId}
- and contract_id = #{contractId}
- and wbs_id = #{wbsId}
- and type = 1
- ) AS "status"
- FROM m_wbs_tree_contract d
- WHERE d.is_deleted = 0
- AND d.status = 1
- AND d.type = 1
- AND wbs_type = 1
- AND project_id = #{projectId}
- AND contract_id = #{contractId}
- AND wbs_id = #{wbsId}
- AND parent_id = #{id}
- AND node_type in (1, 2, 3, 4, 5, 6)
- ORDER BY d.sort, d.create_time
- </select>
- <select id="getAllContractByType" resultType="org.springblade.manager.vo.WbsTreeContractVO2">
- select id as contractId,contract_name as contractName
- from m_contract_info where is_deleted = 0 and p_id = #{projectId}
- and contract_type = 1
- <if test="contractType == 3">
- union all
- select id as contractId,contract_name as contractName
- from m_contract_info where is_deleted = 0 and p_id = #{projectId}
- and contract_type = 2
- </if>
- </select>
- <select id="getContractInfoByContractId" resultType="org.springblade.manager.entity.ContractInfo">
- SELECT distinct * from m_contract_info where id in(SELECT contract_id_sg from m_contract_relation_jlyz where contract_id_jlyz=#{contractId}) or id=#{contractId}
- </select>
- <select id="findAllUserAndRoleList1" resultType="org.springblade.manager.vo.RoleSignPfxUserVO1">
- SELECT
- r.id as roleId,r.role_name as roleName FROM
- blade_role r
- INNER JOIN m_project_assignment_user mpau ON r.id = mpau.role_id
- INNER JOIN m_contract_info ci ON ci.id = mpau.contract_id
- WHERE mpau.is_deleted = 0 AND mpau.`status` = 1
- AND ci.id=#{contractId}
- <if test="roleId == null">
- And r.parent_id!=0
- </if>
- <if test="roleId!=null">
- And r.parent_id=#{roleId}
- </if>
- </select>
- <select id="findAllUserAndRoleList2" resultType="org.springblade.manager.vo.RoleSignPfxUserVO2">
- SELECT
- u.id as certificateUserId, u.`name` as certificateUserName
- FROM
- blade_user u
- INNER JOIN m_project_assignment_user mpau ON u.id = mpau.user_id
- INNER JOIN m_contract_info ci ON ci.id = mpau.contract_id
- INNER JOIN blade_role r ON r.id = mpau.role_id
- WHERE mpau.is_deleted = 0 AND mpau.`status` = 1
- AND ci.id=#{contractId}
- <if test="roleId != null">
- And r.id=#{roleId}
- </if>
- </select>
- </mapper>
|