whyclxw
5 天以前 8c635598000e40edfb3edf5934124ad48d60f62d
src/main/resources/mapper/BattInfMapper.xml
@@ -426,6 +426,20 @@
            and bu.uid = #{userId}
        )
    </select>
    <select id="getListByCondition" resultType="com.whyc.pojo.db_station.BattInf">
        select * from db_station.tb_batt_inf where
        <if test="product!=null">
            and product=#{product}
        </if>
        <if test="inuseTime!=null">
            and inuse_time >= #{inuseTime}
        </if>
        and battgroup_id in(
        select distinct battgroup_id from db_user.tb_baojigroup_usr bu,db_user.tb_baojigroup_power bp,db_station.tb_batt_inf bi
        where bu.baoji_group_id = bp.baoji_group_id
        and bp.station_id = bi.station_id
        and bu.uid = #{userId}
    </select>
    <select id="getBattByUid" resultType="com.whyc.pojo.db_station.BattInf">
        select distinct * from db_station.tb_batt_inf,db_station.tb_station_inf
@@ -452,32 +466,30 @@
            </if>
        </where>
    </select>
    <select id="getBattgroupIdList" resultType="java.lang.Integer">
        select distinct battgroup_id from db_station.tb_batt_inf,db_station.tb_station_inf
    <select id="getBattgroupIdInf" resultType="com.whyc.pojo.db_station.BattInf">
        select distinct tb_batt_inf.*
        ,tb_station_inf.station_type,tb_station_inf.station_name,tb_station_inf.provice,tb_station_inf.city,tb_station_inf.country,tb_station_inf.full_name
        from db_station.tb_batt_inf,db_station.tb_station_inf
        <where>
            tb_batt_inf.station_id=tb_station_inf.station_id
            <if test="dto.provice!=null">
                and tb_station_inf.provice=#{dto.provice}
            </if>
            <if test="dto.city!=null">
                and tb_station_inf.city=#{dto.city}
            </if>
            <if test="dto.country!=null">
                and tb_station_inf.country=#{dto.country}
            </if>
            <if test="dto.stationId!=null">
                and tb_station_inf.station_id=#{dto.stationId}
            </if>
            <if test="dto.battgroupId!=null">
                and battgroup_id.battgroup_id=#{dto.battgroupId}
            </if>
            <if test="dto.uid>100">
                and tb_station_inf.station_id in(
                select distinct station_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=#{dto.uid}
                )
            </if>
            and tb_batt_inf.battgroup_id=#{battgroupId}
        </where>
        limit 1
    </select>
    <select id="getBattgroupIdListByPowerId" resultType="com.whyc.pojo.db_station.BattInf">
        select distinct tb_batt_inf.*
        from db_station.tb_batt_inf
        <where>
             tb_batt_inf.power_id=#{powerId}
        </where>
        order by battgroup_num asc
    </select>
    <select id="getBattgroupIdListByDevId" resultType="com.whyc.pojo.db_station.BattInf">
        select distinct tb_batt_inf.*
        from db_station.tb_batt_inf
        <where>
            tb_batt_inf.dev_id=#{devId}
        </where>
        order by battgroup_num asc
    </select>
</mapper>