郑永安
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
<?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.RiskMonthReportRepository">
    <resultMap id="BaseMapper" type="com.gkhy.safePlatform.riskCtrl.entity.RiskMonthReport">
        <id property="id" column="id" jdbcType="BIGINT"/>
        <result column="biz" property="biz" jdbcType="TINYINT"/>
        <result column="eid" property="eid" jdbcType="BIGINT"/>
        <result column="dep_id" property="depId" jdbcType="BIGINT"/>
        <result column="dep_level" property="depLevel" jdbcType="INTEGER"/>
        <result column="year" property="year" jdbcType="INTEGER"/>
        <result column="month" property="month" jdbcType="INTEGER"/>
        <result column="begin_date" property="beginDate" jdbcType="DATE"/>
        <result column="end_date" property="endDate" jdbcType="DATE"/>
        <result column="gmt_create" property="gmtCreate" jdbcType="TIMESTAMP"/>
    </resultMap>
 
    <sql id="base_table_name">risk_month_report</sql>
 
    <sql id="all_columns">
        id,biz,eid,dep_id,dep_level,year,month,begin_date,end_date,gmt_create
    </sql>
 
    <select id="findByMonth" resultMap="BaseMapper">
        select <include refid="all_columns"></include> from <include refid="base_table_name"></include>
        where biz = #{biz}
        and dep_id = #{depId}
        and year = #{year}
        and month = #{month}
    </select>
 
    <select id="listByConditions" resultMap="BaseMapper">
        select <include refid="all_columns"></include> from <include refid="base_table_name"></include>
        <where>
            <if test="params.biz != null">
                biz = #{params.biz}
            </if>
            <if test="params.eid != null">
                and eid = #{params.eid}
            </if>
            <if test="params.depId != null">
                and dep_id = #{params.depId}
            </if>
            <if test="params.depLevel != null">
                and dep_level = #{params.depLevel}
            </if>
            <if test="params.year != null">
                and year = #{params.year}
            </if>
            <if test="params.month != null">
                and month = #{params.month}
            </if>
            <if test="params.startDate != null">
                and start_date >= #{params.startDate}
            </if>
            <if test="params.endDate != null">
                and end_date &lt;= #{params.endDate}
            </if>
        </where>
    </select>
</mapper>