houzhongjian
2024-07-23 a6de490948278991e47952e90671ddba4555e9a2
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
<?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.iailab.module.data.ind.dao.IndItemDao">
 
 
    <select id="getItemAtom" resultType="com.iailab.module.data.ind.dto.IndItemDTO">
      SELECT
        t1.item_no,
        t1.item_name,
        t1.item_type,
        t1.coefficient,
        t1.precision,
        t1.time_range,
        t1.time_granularity,
        t2.data_source,
        t2.query_sql
        FROM t_ind_item t1
        LEFT JOIN t_ind_item_atom t2 ON t2.item_id = t1.id
        <where>
            t1.item_type =  #{itemType}
            <if test="isEnable != null">
                AND t1.is_enable = #{isEnable}
            </if>
            <if test="timeGranularity != null and timeGranularity != ''">
                AND t1.time_granularity = #{timeGranularity}
            </if>
            <if test="itemNo != null and itemNo != ''">
                AND t1.item_no = #{itemNo}
            </if>
            <if test="itemNos != null">
                AND t1.item_no in
                <foreach collection="itemNos" item="item" index="item" open="(" close=")" separator=",">
                    #{item}
                </foreach>
            </if>
        </where>
    </select>
    <select id="getItemCal" resultType="com.iailab.module.data.ind.dto.IndItemDTO">
        SELECT
        t1.item_no,
        t1.item_name,
        t1.item_type,
        t1.coefficient,
        t1.precision,
        t1.time_range,
        t1.time_granularity,
        t2.expression
        FROM t_ind_item t1
        LEFT JOIN t_ind_item_cal t2 ON t2.item_id = t1.id
        <where>
            t1.item_type =  #{itemType}
            <if test="isEnable != null">
                AND t1.is_enable = #{isEnable}
            </if>
            <if test="timeGranularity != null and timeGranularity != ''">
                AND t1.time_granularity = #{timeGranularity}
            </if>
            <if test="itemNo != null and itemNo != ''">
                AND t1.item_no = #{itemNo}
            </if>
            <if test="itemNos != null">
                AND t1.item_no in
                <foreach collection="itemNos" item="item" index="item" open="(" close=")" separator=",">
                    #{item}
                </foreach>
            </if>
        </where>
 
    </select>
 
 
 
</mapper>