潘志宝
2024-08-21 4d3533b6e75e6afa5af325288b03915715add4b6
提交 | 用户 | 时间
a6de49 1 <?xml version="1.0" encoding="UTF-8"?>
H 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
4 <mapper namespace="com.iailab.module.data.ind.dao.IndItemDao">
5
6
7     <select id="getItemAtom" resultType="com.iailab.module.data.ind.dto.IndItemDTO">
8       SELECT
9         t1.item_no,
10         t1.item_name,
11         t1.item_type,
12         t1.coefficient,
13         t1.precision,
14         t1.time_range,
15         t1.time_granularity,
16         t2.data_source,
17         t2.query_sql
18         FROM t_ind_item t1
19         LEFT JOIN t_ind_item_atom t2 ON t2.item_id = t1.id
20         <where>
21             t1.item_type =  #{itemType}
22             <if test="isEnable != null">
23                 AND t1.is_enable = #{isEnable}
24             </if>
25             <if test="timeGranularity != null and timeGranularity != ''">
26                 AND t1.time_granularity = #{timeGranularity}
27             </if>
28             <if test="itemNo != null and itemNo != ''">
29                 AND t1.item_no = #{itemNo}
30             </if>
31             <if test="itemNos != null">
32                 AND t1.item_no in
33                 <foreach collection="itemNos" item="item" index="item" open="(" close=")" separator=",">
34                     #{item}
35                 </foreach>
36             </if>
37         </where>
38     </select>
39     <select id="getItemCal" resultType="com.iailab.module.data.ind.dto.IndItemDTO">
40         SELECT
41         t1.item_no,
42         t1.item_name,
43         t1.item_type,
44         t1.coefficient,
45         t1.precision,
46         t1.time_range,
47         t1.time_granularity,
48         t2.expression
49         FROM t_ind_item t1
50         LEFT JOIN t_ind_item_cal t2 ON t2.item_id = t1.id
51         <where>
52             t1.item_type =  #{itemType}
53             <if test="isEnable != null">
54                 AND t1.is_enable = #{isEnable}
55             </if>
56             <if test="timeGranularity != null and timeGranularity != ''">
57                 AND t1.time_granularity = #{timeGranularity}
58             </if>
59             <if test="itemNo != null and itemNo != ''">
60                 AND t1.item_no = #{itemNo}
61             </if>
62             <if test="itemNos != null">
63                 AND t1.item_no in
64                 <foreach collection="itemNos" item="item" index="item" open="(" close=")" separator=",">
65                     #{item}
66                 </foreach>
67             </if>
68         </where>
69
70     </select>
71
72
73
74 </mapper>