cjl
2023-09-26 3154d80303294d32672ca2402159bf0b1cccafb0
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
<?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.moral.api.mapper.AllocationExtensionMapper">
 
    <!-- 通用查询映射结果 deyt template generate -->
    <resultMap id="BaseResultMap" type="com.moral.api.entity.AllocationExtension">
        <id column="id" property="id" />
        <result column="allocation_id" property="allocationId" />
        <result column="extension_num" property="extensionNum" />
        <result column="remake" property="remake" />
        <result column="state" property="state" />
        <result column="invalid_reason" property="invalidReason" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, allocation_id, extension_num, remake, state, is_del, is_invalid, invalid_reason, create_id, create_name, create_time, update_id, update_name, update_time
    </sql>
 
    <!-- 通用查询结果列 -->
    <sql id="AllocationExtension_Column_List">
        allocationextension.id, allocationextension.allocation_id, allocationextension.extension_num, allocationextension.remake, allocationextension.state, allocationextension.is_del, allocationextension.is_invalid, allocationextension.invalid_reason, allocationextension.create_id, allocationextension.create_name, allocationextension.create_time, allocationextension.update_id, allocationextension.update_name, allocationextension.update_time
    </sql>
 
 
    <select id="extOne" resultType="com.moral.api.pojo.ext.allocationextension.AllocationExtensionExt">
        SELECT
        <include refid="AllocationExtension_Column_List"/>
        FROM allocation_extension allocationextension
        where allocationextension.id = #{id} and allocationextension.is_del = 0
    </select>
 
 
    <select id="extPage" resultType="com.moral.api.pojo.ext.allocationextension.AllocationExtensionPageExt">
        SELECT
        <include refid="AllocationExtension_Column_List"/>,
        t1.allocation_num,t1.escalation_time,t1.unit_id,t1.pollute_type,t1.change_type,t1.change_day,t1.escalation_unit_id,t1.escalation_name
        FROM allocation_extension allocationextension
        left join allocation t1 on allocationextension.allocation_id = t1.allocation_id
        <where>
            1 = 1 and allocationextension.is_del = 0
 
            <if test="allocation.unitId != null and allocation.unitId != 0">
                and t1.unit_id = #{allocation.unitId}
            </if>
            <if test="allocation.polluteType != null and allocation.polluteType != 0">
                and t1.pollute_type = #{allocation.polluteType}
            </if>
            <if test="allocation.state != null and allocation.state != 0">
                and t1.state = #{allocation.state}
            </if>
            <if test="allocation.investigationType != null and allocation.investigationType != 0">
                and t1.investigation_type = #{allocation.investigationType}
            </if>
            <if test="allocation.changeType != null and allocation.changeType != 0">
                and t1.change_type = #{allocation.changeType}
            </if>
 
            <if test="allocation.startTime != null and allocation.startTime != '' ">
                and date(t1.escalation_time) <![CDATA[>=]]> #{allocation.startTime}
            </if>
            <if test="allocation.endTime != null and allocation.endTime !='' ">
                and date(t1.escalation_time) <![CDATA[<=]]>  #{allocation.endTime}
            </if>
 
        </where>
        order by t1.escalation_time desc,t1.allocation_id desc
    </select>
</mapper>