whyclxw
2025-05-12 ff4cd28ee0535021dcc86d49bfe37545ea2fc1fd
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
<?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.BaojigroupPowerMapper">
 
    <delete id="deleteStationAndLockList">
        <foreach collection="list" item="item" separator=";">
            delete from db_user.tb_baojigroup_power where baoji_id = #{item.baojiId} and
            station_id = #{item.stationId} and power_id=#{item.powerId}
        </foreach>
    </delete>
    <select id="getALlLockByBjId" resultType="com.whyc.pojo.db_user.BaojigroupPower">
        select tb_baojigroup_power.*,tb_power_inf.power_name,tb_station_inf.station_name
               from db_user.tb_baojigroup_power,db_station.tb_station_inf,db_station.tb_power_inf
        where
              tb_baojigroup_power.station_id=tb_station_inf.station_id
              and tb_baojigroup_power.power_id=tb_power_inf.power_id
              and baoji_id=#{id}
        order by tb_baojigroup_power.baoji_id asc ,tb_baojigroup_power.station_id asc,tb_baojigroup_power.power_id asc
    </select>
    <select id="getHomeStationAndLock" resultType="com.whyc.pojo.db_user.BaojigroupPower">
        select distinct tb_baojigroup_power.station_id,tb_baojigroup_power.power_id
        from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr
       <where>
           tb_baojigroup_power.baoji_id=tb_baojigroup_usr.baoji_id
           <if test="uid>100">
               and tb_baojigroup_usr.uid=#{uid}
           </if>
       </where>
    </select>
    <select id="getLockIdByUid" resultType="java.lang.Integer">
        select distinct tb_baojigroup_power.power_id
        from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr
        <where>
            tb_baojigroup_power.baoji_id=tb_baojigroup_usr.baoji_id
        <if test="uid>100">
            and tb_baojigroup_usr.uid=#{uid}
        </if>
        </where>
    </select>
    <select id="getLocIdByStationidAndBjId" resultType="java.lang.Integer">
        select distinct tb_baojigroup_power.power_id
        from db_user.tb_baojigroup_power
        <where>
            tb_baojigroup_power.baoji_id=#{baojiId}
          and tb_baojigroup_power.station_id=#{stationId}
        </where>
    </select>
    <select id="getLockList" resultType="com.whyc.pojo.db_station.PowerInf">
        select distinct l.power_id,l.power_name,l.station_id,s.station_name
        from db_user.tb_baojigroup_power bl ,db_station.tb_power_inf l,db_station.tb_station_inf s
        where bl.power_id = l.power_id and bl.station_id = s.station_id
        and l.del_flag=0
        and bl.baoji_id = #{id}
        order by s.station_name
    </select>
</mapper>