whyclxw
6 天以前 8c635598000e40edfb3edf5934124ad48d60f62d
src/main/resources/mapper/PwrdevAlarmMapper.xml
@@ -50,4 +50,51 @@
        and pi.station_id=si.station_id
        and pa.num>#{id}
    </select>
    <select id="getListByUserId" resultType="com.whyc.dto.AlarmDto">
        select pa.*,pa.num as alm_num,pi.power_name,pi.power_id,si.station_id,si.station_name from db_pwrdev_alarm.tb_pwrdev_alarm pa,db_station.tb_power_inf pi,db_station.tb_station_inf si
        where pa.power_id=pi.power_id
        and pi.station_id=si.station_id
        <if test="alarmLevel !=null">
            and pa.alm_level=#{alarmLevel}
        </if>
        and pa.power_id in (
            select distinct power_id from db_user.tb_baojigroup_usr bu,db_user.tb_baojigroup_power bp
            where bu.baoji_group_id = bp.baoji_group_id
            and bu.uid = #{userId}
        )
    </select>
    <select id="getPwrtAlmAnalyse" resultType="com.whyc.pojo.db_pwrdev_alarm.PwrdevAlarm">
        select tb_pwrdev_alarm.*,tb_power_inf.power_name,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_station_inf.full_name
        from db_pwrdev_alarm.tb_pwrdev_alarm,db_station.tb_power_inf,db_station.tb_station_inf
        <where>
            tb_pwrdev_alarm.power_id=tb_power_inf.power_id
            and tb_power_inf.station_id=tb_station_inf.station_id
            <if test="provice!=null">
                and tb_station_inf.provice=#{provice}
            </if>
            <if test="city!=null">
                and tb_station_inf.city=#{city}
            </if>
            <if test="country!=null">
                and tb_station_inf.country=#{country}
            </if>
            <if test="stationId!=null">
                and tb_station_inf.station_id=#{stationId}
            </if>
            <if test="powerId!=null">
                and tb_pwrdev_alarm.power_id=#{powerId}
            </if>
            <if test="almLevel!=null">
                and tb_pwrdev_alarm.alm_level=#{almLevel}
            </if>
            <if test="uid>100">
                and tb_pwrdev_alarm.power_id in(
                select distinct power_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr
                where   tb_baojigroup_power.baoji_group_id=tb_baojigroup_usr.baoji_group_id
                and tb_baojigroup_usr.uid=#{uid}
                )
            </if>
        </where>
        order by alm_start_time desc
    </select>
</mapper>