郑永安
2023-06-19 7a6abd05683528032687c75e80e0bd2030a3e46c
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
<?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.gkhy.safePlatform.riskCtrl.repository.SpiReportDetailRepository" >
 
    <resultMap id="BaseMapper" type="com.gkhy.safePlatform.riskCtrl.entity.SpiReportDetail">
        <id property="id" column="id" jdbcType="BIGINT"/>
        <result column="eid" property="eid" jdbcType="BIGINT"/>
        <result column="dep_id" property="depId" jdbcType="BIGINT"/>
        <result column="year" property="year" jdbcType="INTEGER"/>
        <result column="month" property="month" jdbcType="INTEGER"/>
        <result column="count_begin_date" property="countBeginDate" jdbcType="DATE"/>
        <result column="count_end_date" property="countEndDate" jdbcType="DATE"/>
        <result column="risk_l1" property="riskL1" jdbcType="INTEGER"/>
        <result column="risk_l1_deal" property="riskL1Deal" jdbcType="INTEGER"/>
        <result column="risk_l1_dmg1" property="riskL1Dmg1" jdbcType="INTEGER"/>
        <result column="risk_l1_dmg2" property="riskL1Dmg2" jdbcType="INTEGER"/>
        <result column="risk_l1_dmg3" property="riskL1Dmg3" jdbcType="INTEGER"/>
        <result column="risk_l2" property="riskL2" jdbcType="INTEGER"/>
        <result column="risk_l2_deal" property="riskL2Deal" jdbcType="INTEGER"/>
        <result column="risk_l2_dmg1" property="riskL2Dmg1" jdbcType="INTEGER"/>
        <result column="risk_l2_dmg2" property="riskL2Dmg2" jdbcType="INTEGER"/>
        <result column="risk_l2_dmg3" property="riskL2Dmg3" jdbcType="INTEGER"/>
        <result column="emgc_practice_count" property="emgcPracticeCount" jdbcType="INTEGER"/>
        <result column="last_practice_time" property="lastPracticeTime" jdbcType="TIMESTAMP"/>
        <result column="accident_l1" property="accidentL1" jdbcType="INTEGER"/>
        <result column="accident_l1_dmg1" property="accidentL1Dmg1" jdbcType="INTEGER"/>
        <result column="accident_l1_dmg2" property="accidentL1Dmg2" jdbcType="INTEGER"/>
        <result column="accident_l1_dmg3" property="accidentL1Dmg3" jdbcType="INTEGER"/>
        <result column="accident_l1_loss" property="accidentL1DmgLoss" jdbcType="DECIMAL"/>
        <result column="accident_l2" property="accidentL2" jdbcType="INTEGER"/>
        <result column="accident_l2_dmg1" property="accidentL2Dmg1" jdbcType="INTEGER"/>
        <result column="accident_l2_dmg2" property="accidentL2Dmg2" jdbcType="INTEGER"/>
        <result column="accident_l2_dmg3" property="accidentL2Dmg3" jdbcType="INTEGER"/>
        <result column="accident_l2_loss" property="accidentL2DmgLoss" jdbcType="DECIMAL"/>
        <result column="accident_l3" property="accidentL3" jdbcType="INTEGER"/>
        <result column="accident_l3_dmg1" property="accidentL3Dmg1" jdbcType="INTEGER"/>
        <result column="accident_l3_dmg2" property="accidentL3Dmg2" jdbcType="INTEGER"/>
        <result column="accident_l3_dmg3" property="accidentL3Dmg3" jdbcType="INTEGER"/>
        <result column="accident_l3_loss" property="accidentL3DmgLoss" jdbcType="DECIMAL"/>
        <result column="accident_l4" property="accidentL4" jdbcType="INTEGER"/>
        <result column="accident_l4_dmg1" property="accidentL4Dmg1" jdbcType="INTEGER"/>
        <result column="accident_l4_dmg2" property="accidentL4Dmg2" jdbcType="INTEGER"/>
        <result column="accident_l4_dmg3" property="accidentL4Dmg3" jdbcType="INTEGER"/>
        <result column="accident_l4_loss" property="accidentL4DmgLoss" jdbcType="DECIMAL"/>
        <result column="accident_l5" property="accidentL5" jdbcType="INTEGER"/>
        <result column="accident_l5_dmg1" property="accidentL5Dmg1" jdbcType="INTEGER"/>
        <result column="accident_l5_dmg2" property="accidentL5Dmg2" jdbcType="INTEGER"/>
        <result column="accident_l5_dmg3" property="accidentL5Dmg3" jdbcType="INTEGER"/>
        <result column="accident_l5_loss" property="accidentL5DmgLoss" jdbcType="DECIMAL"/>
        <result column="gmt_create" property="gmtCreate" jdbcType="TIMESTAMP"/>
    </resultMap>
 
    <sql id="base_columns">
        id,eid,dep_id,year,month,risk_l1,risk_l1_deal,risk_l1_dmg1,risk_l1_dmg2,risk_l1_dmg3,risk_l2,risk_l2_deal,risk_l2_dmg1,risk_l2_dmg2,risk_l2_dmg3,
        emgc_practice_count,last_practice_time,accident_l1,accident_l1_dmg1,accident_l1_dmg2,accident_l1_dmg3,accident_l1_loss,
        accident_l2,accident_l2_dmg1,accident_l2_dmg2,accident_l2_dmg3,accident_l2_loss,
        accident_l3,accident_l3_dmg1,accident_l3_dmg2,accident_l3_dmg3,accident_l3_loss,
        accident_l4,accident_l4_dmg1,accident_l4_dmg2,accident_l4_dmg3,accident_l4_loss,
        accident_l5,accident_l5_dmg1,accident_l5_dmg2,accident_l5_dmg3,accident_l5_loss,gmt_create
    </sql>
    <sql id="base_table_name">spi_report_detail</sql>
 
    <select id="findOneByMonth" resultMap="BaseMapper">
        select (<include refid="base_columns"></include>) from <include refid="base_table_name"></include>
        <where>
            <if test="eid != null">
                and eid = #{eid}
            </if>
            <if test="depId != null">
                and dep_id = #{dep_id}
            </if>
            <if test="year != null">
                and year = #{year}
            </if>
            <if test="month != null">
                and month = #{month}
            </if>
        </where>
    </select>
 
    <select id="listByConditions" resultMap="BaseMapper">
        select (<include refid="base_columns"></include>) from <include refid="base_table_name"></include>
        <where>
            <if test="eid != null">
                and eid = #{eid}
            </if>
            <if test="depId != null">
                and dep_id = #{dep_id}
            </if>
            <if test="countBeginDate != null">
                and count_begin_date >= #{countBeginDate}
            </if>
            <if test="countEndDate != null">
                and count_end_date &lt;= #{countEndDate}
            </if>
        </where>
    </select>
 
</mapper>