whyclxw
2024-06-27 2eff7304df15f463dcd4563c0c62f4531bbef138
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
<?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.whyc.mapper.SinfBinfMapper">
    <resultMap id="sinfList1" type="stationInf">
        <id property="sinfId" column="sinf_id"></id>
        <result property="sinfName" column="sinf_name"></result>
        <result property="sinfIp" column="sinf_ip"></result>
        <collection property="binfList" javaType="java.util.ArrayList" ofType="com.whyc.pojo.BattInf" column="{sinfId=sinf_id}" select="selectBinfList">
        </collection>
    </resultMap>
    <select id="getAllSinfBinf1" resultMap="sinfList1">
         select * from db_batt.station_inf where stype=1 or stype=0 order by sinf_id asc
    </select>
 
    <select id="selectBinfList" resultType="battInf">
        select batt_inf.* from db_batt.batt_inf,db_batt.sinf_binf
        <where>
            batt_inf.binf_id=sinf_binf.binf_id
            and sinf_binf.sinf_id=#{sinfId}
        </where>
    </select>
 
    <resultMap id="sinfList2" type="stationInf">
        <id property="sinfId" column="sinf_id"></id>
        <result property="sinfName" column="sinf_name"></result>
        <result property="sinfIp" column="sinf_ip"></result>
        <collection property="pinfList" javaType="java.util.ArrayList" ofType="com.whyc.pojo.PowerInf" column="{sinfId=sinf_id}" select="selectPinfList">
        </collection>
    </resultMap>
    <select id="getAllSinfBinf2" resultMap="sinfList2">
        select * from db_batt.station_inf where stype=2 or stype=0 order by sinf_id asc
    </select>
 
    <select id="selectPinfList" resultType="powerInf">
        select power_inf.* from db_batt.power_inf,db_batt.sinf_pinf
        <where>
            power_inf.power_id=sinf_pinf.pinf_id
            and sinf_pinf.sinf_id=#{sinfId}
        </where>
    </select>
 
</mapper>