zhanghl
2025-05-23 c8abec662e3c634365a9aeeda5c57e0f0e51cb41
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<?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.aps.core.mapper.ApsGasPipelineCapacityPlanMapper">
    
    <resultMap type="com.aps.core.domain.ApsGasPipelineCapacityPlan" id="ApsGasPipelineCapacityPlanResult">
        <result property="id"    column="id"    />
        <result property="processName"    column="process_name"    />
        <result property="year"    column="year"    />
        <result property="month"    column="month"    />
        <result property="major"    column="major"    />
        <result property="workshop"    column="workshop"    />
        <result property="dayProduceType"    column="day_produce_type"    />
        <result property="dayProduceNum"    column="day_produce_num"    />
        <result property="dayProduceUnit"    column="day_produce_unit"    />
        <result property="personnelNumber"    column="personnel_number"    />
        <result property="dayProduceAllNum"    column="day_produce_all_num"    />
        <result property="days"    column="days"    />
        <result property="monthProduceAllNum"    column="month_produce_all_num"    />
        <result property="remark"    column="remark"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="orgCode"    column="org_code"    />
    </resultMap>
 
    <sql id="selectApsGasPipelineCapacityPlanVo">
        select id, process_name, year, month, major, workshop, day_produce_type, day_produce_num, day_produce_unit, personnel_number, day_produce_all_num, days, month_produce_all_num, remark, create_by, create_time, update_by, update_time, org_code from aps_gas_pipeline_capacity_plan
    </sql>
 
    <select id="selectApsGasPipelineCapacityPlanList" parameterType="com.aps.core.domain.ApsGasPipelineCapacityPlan" resultMap="ApsGasPipelineCapacityPlanResult">
        <include refid="selectApsGasPipelineCapacityPlanVo"/>
        <where>  
            <if test="processName != null  and processName != ''"> and process_name like concat('%', #{processName}, '%')</if>
            <if test="year != null  and year != ''"> and year = #{year}</if>
            <if test="month != null  and month != ''"> and month = #{month}</if>
            <if test="major != null  and major != ''"> and major = #{major}</if>
            <if test="workshop != null  and workshop != ''"> and workshop = #{workshop}</if>
            <if test="dayProduceType != null  and dayProduceType != ''"> and day_produce_type = #{dayProduceType}</if>
            <if test="dayProduceNum != null "> and day_produce_num = #{dayProduceNum}</if>
            <if test="dayProduceUnit != null  and dayProduceUnit != ''"> and day_produce_unit = #{dayProduceUnit}</if>
            <if test="personnelNumber != null "> and personnel_number = #{personnelNumber}</if>
            <if test="dayProduceAllNum != null "> and day_produce_all_num = #{dayProduceAllNum}</if>
            <if test="days != null "> and days = #{days}</if>
            <if test="monthProduceAllNum != null "> and month_produce_all_num = #{monthProduceAllNum}</if>
            <if test="orgCode != null "> and org_code = #{orgCode}</if>
<!--            <if test="major != null and major != ''">-->
<!--                and process_name in (select process_name from aps_standard_process where major=#{major})-->
<!--            </if>-->
        </where>
    </select>
    
    <select id="selectApsGasPipelineCapacityPlanById" parameterType="Long" resultMap="ApsGasPipelineCapacityPlanResult">
        <include refid="selectApsGasPipelineCapacityPlanVo"/>
        where id = #{id}
    </select>
 
    <insert id="insertApsGasPipelineCapacityPlan" parameterType="com.aps.core.domain.ApsGasPipelineCapacityPlan">
        insert into aps_gas_pipeline_capacity_plan
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="processName != null">process_name,</if>
            <if test="year != null">year,</if>
            <if test="month != null">month,</if>
            <if test="major != null">major,</if>
            <if test="workshop != null">workshop,</if>
            <if test="dayProduceType != null">day_produce_type,</if>
            <if test="dayProduceNum != null">day_produce_num,</if>
            <if test="dayProduceUnit != null">day_produce_unit,</if>
            <if test="personnelNumber != null">personnel_number,</if>
            <if test="dayProduceAllNum != null">day_produce_all_num,</if>
            <if test="days != null">days,</if>
            <if test="monthProduceAllNum != null">month_produce_all_num,</if>
            <if test="remark != null">remark,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="orgCode != null">org_code,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="processName != null">#{processName},</if>
            <if test="year != null">#{year},</if>
            <if test="month != null">#{month},</if>
            <if test="major != null">#{major},</if>
            <if test="workshop != null">workshop,</if>
            <if test="dayProduceType != null">#{dayProduceType},</if>
            <if test="dayProduceNum != null">#{dayProduceNum},</if>
            <if test="dayProduceUnit != null">#{dayProduceUnit},</if>
            <if test="personnelNumber != null">#{personnelNumber},</if>
            <if test="dayProduceAllNum != null">#{dayProduceAllNum},</if>
            <if test="days != null">#{days},</if>
            <if test="monthProduceAllNum != null">#{monthProduceAllNum},</if>
            <if test="remark != null">#{remark},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="orgCode != null">#{orgCode},</if>
         </trim>
    </insert>
 
    <update id="updateApsGasPipelineCapacityPlan" parameterType="com.aps.core.domain.ApsGasPipelineCapacityPlan">
        update aps_gas_pipeline_capacity_plan
        <trim prefix="SET" suffixOverrides=",">
            <if test="processName != null">process_name = #{processName},</if>
            <if test="year != null">year = #{year},</if>
            <if test="month != null">month = #{month},</if>
            <if test="major != null">major = #{major},</if>
            <if test="workshop != null">workshop,</if>
            <if test="dayProduceType != null">day_produce_type = #{dayProduceType},</if>
            <if test="dayProduceNum != null">day_produce_num = #{dayProduceNum},</if>
            <if test="dayProduceUnit != null">day_produce_unit = #{dayProduceUnit},</if>
            <if test="personnelNumber != null">personnel_number = #{personnelNumber},</if>
            <if test="dayProduceAllNum != null">day_produce_all_num = #{dayProduceAllNum},</if>
            <if test="days != null">days = #{days},</if>
            <if test="monthProduceAllNum != null">month_produce_all_num = #{monthProduceAllNum},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="orgCode != null">org_code = #{orgCode},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteApsGasPipelineCapacityPlanById" parameterType="Long">
        delete from aps_gas_pipeline_capacity_plan where id = #{id}
    </delete>
 
    <delete id="deleteApsGasPipelineCapacityPlanByIds" parameterType="String">
        delete from aps_gas_pipeline_capacity_plan where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
    <delete id="deleteByDateAndFactory" >
        delete from aps_gas_pipeline_capacity_plan
               where year = #{year}
                   and month = #{month}
                   and org_code = #{factory}
                   and major = #{major}
    </delete>
    
    <!-- 查询设计产能数据 - 专用于接口二功能 -->
    <select id="selectDesignCapacityForInterface2" resultMap="ApsGasPipelineCapacityPlanResult">
        <include refid="selectApsGasPipelineCapacityPlanVo"/>
        <where>
            <if test="processName != null and processName != ''">
                and process_name = #{processName}
            </if>
            <if test="year != null and year != ''">
                and year = #{year}
            </if>
            <if test="month != null and month != ''">
                and CAST(month AS INTEGER) = CAST(#{month} AS INTEGER)
            </if>
            <if test="major != null and major != ''">
                and major = #{major}
            </if>
            <if test="orgCode != null and orgCode != ''">
                and org_code = #{orgCode}
            </if>
        </where>
    </select>
</mapper>