xiangpei
2025-02-27 66b258f3e333b2413e3c7c28a8a6794545fc6eb8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?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="com.ycl.mapper.ProjectProcessMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ycl.domain.vo.ProjectProcessVO">
        <id column="id" property="id"/>
        <result column="project_name" property="projectName" />
        <result column="project_code" property="projectCode" />
        <result column="content" property="content" />
        <result column="project_type" property="projectType" />
        <result column="investmentAmount" property="investmentAmount" />
        <result column="project_status" property="projectStatus" />
        <result column="fund_type" property="fundType" />
        <result column="invest_type" property="investType" />
        <result column="project_phase" property="projectPhase" />
        <result column="tag" property="tag" />
        <result column="project_approval_type" property="projectApprovalType" />
        <result column="importance_type" property="importanceType" />
        <result column="create_project_time" property="createProjectTime" />
        <result column="plan_start_time" property="planStartTime" />
        <result column="plan_complete_time" property="planCompleteTime" />
        <result column="project_address" property="projectAddress" />
        <result column="longitude" property="longitude" />
        <result column="latitude" property="latitude" />
        <result column="project_owner_unit" property="projectOwnerUnit" />
        <result column="project_owner_unit_name" property="projectOwnerUnitName" />
        <result column="project_contact_person" property="projectContactPerson" />
        <result column="contact" property="contact" />
        <result column="update_by" property="updateBy" />
        <result column="create_by" property="createBy" />
        <result column="process_def_id" property="processDefId" />
        <result column="process_ins_id" property="processInsId" />
    </resultMap>
 
    <resultMap id="PageResultMap" type="com.ycl.domain.vo.ProjectProcessVO">
        <id column="id" property="id"/>
        <result column="project_name" property="projectName" />
        <result column="project_code" property="projectCode" />
        <result column="content" property="content" />
        <result column="project_type" property="projectType" />
        <result column="investmentAmount" property="investmentAmount" />
        <result column="project_status" property="projectStatus" />
        <result column="fund_type" property="fundType" />
        <result column="invest_type" property="investType" />
        <result column="project_phase" property="projectPhase" />
        <result column="tag" property="tag" />
        <result column="project_approval_type" property="projectApprovalType" />
        <result column="importance_type" property="importanceType" />
        <result column="create_project_time" property="createProjectTime" />
        <result column="plan_start_time" property="planStartTime" />
        <result column="plan_complete_time" property="planCompleteTime" />
        <result column="project_address" property="projectAddress" />
        <result column="longitude" property="longitude" />
        <result column="latitude" property="latitude" />
        <result column="project_owner_unit" property="projectOwnerUnit" />
        <result column="project_owner_unit_name" property="projectOwnerUnitName" />
        <result column="project_contact_person" property="projectContactPerson" />
        <result column="contact" property="contact" />
        <result column="update_by" property="updateBy" />
        <result column="create_by" property="createBy" />
        <result column="process_def_id" property="processDefId" />
        <result column="process_ins_id" property="processInsId" />
        <collection property="children" ofType="com.ycl.domain.vo.ProjectEngineeringVO" select="getProjectEngineering" column="id"></collection>
    </resultMap>
 
    <select id="getProjectEngineering" parameterType="long" resultMap="com.ycl.mapper.ProjectEngineeringMapper.BaseResultMap">
        SELECT * FROM t_project_engineering WHERE project_info_id = #{id} and deleted = 0 ORDER BY gmt_create
    </select>
 
 
    <select id="getById" resultMap="BaseResultMap">
        SELECT
            TPP.project_id,
            TPP.process_def_id,
            TPP.id
        FROM
            t_project_process TPP
        WHERE
            TPP.id = #{id} AND TPP.deleted = 0
    </select>
 
 
    <select id="getPage" resultMap="PageResultMap">
        SELECT
            PI.*,
            TPP.process_def_id,
            TPP.process_ins_id,
            TPIF.total_investment as investmentAmount,
            d.dept_name as project_owner_unit_name
        FROM
            t_project_info PI
                LEFT JOIN t_project_investment_funding TPIF ON TPIF.project_id = PI.id AND TPIF.deleted = 0
                LEFT JOIN t_project_process TPP ON TPP.project_id = PI.id AND TPP.deleted = 0
                LEFT JOIN sys_dept d ON d.dept_id = PI.project_owner_unit
        <where>
            AND PI.used_status = 2 AND PI.deleted = 0
            <if test="query.projectName != null and query.projectName != ''">
                AND PI.project_name like concat('%', #{query.projectName}, '%')
            </if>
            <if test="query.projectCode != null and query.projectCode != ''">
                AND PI.project_code like concat('%', #{query.projectCode}, '%')
            </if>
            ${query.params.dataScope}
        </where>
 
    </select>
 
 
    <select id="getProjectInfo" parameterType="string" resultType="com.ycl.domain.entity.ProjectInfo">
        SELECT
               PI.id, PI.project_name
        FROM
             t_project_process PP
                 INNER JOIN t_project_info PI ON PP.project_id = PI.id AND PI.deleted = 0 AND PP.process_ins_id = #{processInsId}
    </select>
 
 
    <select id="getNormalInsIds" resultType="string">
        SELECT TPP.process_ins_id FROM t_project_info TPI INNER JOIN t_project_process TPP ON TPI.id = TPP.project_id AND TPI.deleted = 0
    </select>
 
</mapper>