郑永安
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
<?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.RiskSpiReportRepository" >
 
    <resultMap id="BaseMapper" type="com.gkhy.safePlatform.riskCtrl.entity.RiskSpiReport">
        <result 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="val" property="val" jdbcType="DECIMAL"/>
        <result column="gmt_create" property="gmtCreate" jdbcType="TIMESTAMP"/>
    </resultMap>
 
    <select id="listByConditions" resultMap="BaseMapper">
        select * from risk_spi_report
        <where>
            <if test="eid != null and eid > 0">
                and eid = #{searchDTO.eid}
            </if>
            <if test="depId != null and depId > 0">
                and dep_id = #{searchDTO.depId}
            </if>
            <if test="year != null and year > 2000 and year &lt; 2999">
                and year = #{year}
            </if>
            <if test="beginMonth != null and beginMonth > 0 and beginMonth &lt;= 12">
                and month >= beginMonth
            </if>
            <if test="endMonth != null and endMonth > 0 and endMonth &lt;= 12">
                and month >= endMonth
            </if>
        </where>
    </select>
 
    <select id="getMonthlySpiReport" resultMap="BaseMapper">
        select * from risk_spi_report
        <where>
            <if test="depId != null">
                and dep_id = #{depId}
            </if>
            <if test="year != null">
                and year = #{year}
            </if>
            <if test="month != null">
                and month = #{month}
            </if>
        </where>
    </select>
 
</mapper>