package org.gyk.modules.jlgl.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.gyk.modules.jlgl.entity.CxcJlQjglJlqjtz;

import java.util.List;

/**
 * @Description: cxc_jl_qjgl_jlqjtz
 * 从局计量点数据库查询出所需数据
 * @Author: jiang
 * @Date:   2023-09-25
 * @Version: V1.0
 */
@Mapper
@DS("jlglDb")
public interface CxcJlQjglJlqjtzMapper extends BaseMapper<CxcJlQjglJlqjtz> {

//    //主库
//    @Select("select * from Jl_Qjgl_Jlqjtz ")
//    List<CxcJlQjglJlqjtz> queryMaster();

    //从库
    //把产销厂的数据查询出来
    @Select("select  distinct * from Jl_Qjgl_Jlqjtz t where t.f_gldwbh like 'S010107%' ")
    List<CxcJlQjglJlqjtz> queryJldData();

    //查询局数据库中的数据
    @Select("select  distinct * from Jl_Qjgl_Jlqjtz t where t.F_GLDWBH like 'S010107%' AND F_DWQC = #{dwqc} AND ")
    List<CxcJlQjglJlqjtz> queryJuDate();
    /**
     * 功能描述: <br>
     * 〈〉获取单位
     * @Param: []
     * @Return: java.util.List<java.lang.String>
     * @Author: 闵年泽
     * @Date: 2023/10/9 8:21
     */
    @Select("select  distinct f_dwqc from Jl_Qjgl_Jlqjtz t where t.f_gldwbh like 'S010107%' ")
    List<String> getDw();

    /**
     * 功能描述: <br>
     * 〈〉获取战场
     * @Param: [dw]
     * @Return: java.util.List<java.lang.String>
     * @Author: 闵年泽
     * @Date: 2023/10/9 8:47
     */
    @Select("select distinct F_SCZZMC from Jl_Qjgl_Jlqjtz where F_DWQC like '%'||#{dw}||'%' ")
    List<String> getZc(String dw);

    /**
     * 功能描述: <br>
     * 〈〉获取设备名称
     * @Param: [zc]
     * @Return: java.util.List<java.lang.String>
     * @Author: 闵年泽
     * @Date: 2023/10/9 8:47
     */
    @Select("select distinct f_qjlbmc from Jl_Qjgl_Jlqjtz t where t.f_gldwbh like 'S010107%' and f_sczzmc=#{zc}")
    List<String> getSbmc(String zc);



}
