Newer
Older
huludao / src / main / resources / mapper / StationBaseMapper.xml
<?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.newfiber.api.pc.dao.newmonitoring.StationBaseMapper" >
  <resultMap id="BaseResultMap" type="com.newfiber.api.pc.model.monitor.StationBase" >

    <id column="id" property="id" jdbcType="BIGINT" />
    <result column="st_name" property="stName" jdbcType="VARCHAR" />
    <result column="st_code" property="stCode" jdbcType="VARCHAR" />
    <result column="ut" property="ut" jdbcType="TIMESTAMP" />
    <result column="tt" property="tt" jdbcType="VARCHAR" />
    <result column="area" property="area" jdbcType="VARCHAR" />
    <result column="construction_status" property="constructionStatus" jdbcType="TINYINT" />
    <result column="fault_status" property="faultStatus" jdbcType="TINYINT" />
    <result column="task_status" property="taskStatus" jdbcType="TINYINT" />
    <result column="platform_code" property="platformCode" jdbcType="VARCHAR" />
    <result column="lat" property="lat" jdbcType="VARCHAR" />
    <result column="lon" property="lon" jdbcType="VARCHAR" />
    <result column="is_push" property="isPush" jdbcType="TINYINT" />
    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
    <result column="coordinate_system" property="coordinateSystem" jdbcType="VARCHAR" />
    <result column="status" property="status" jdbcType="TINYINT" />
    <result column="offline_time" property="offlineTime" jdbcType="TINYINT" />
  </resultMap>

  <resultMap id="riverInfoData" type="com.newfiber.api.pc.model.entity.RiverInfoData">
    <result column="black_id" property="blackId"/>
    <result column="black_river_name" property="blackRiverName"/>
    <result column="water_site_no" property="waterSiteNo"/>
    <result column="water_quality_site_no" property="waterQualitySiteNo"/>
    <result column="water_warn_level" property="waterLevel"/>
    <result column="duty_user" property="dutyUserName"/>
    <result column="duty_user_phone" property="dutyUserPhone"/>
  </resultMap>

  <select id="selectSitesByPlatformCode" resultMap="BaseResultMap" parameterType="java.lang.String" >
    select sb.st_code,sb.st_name,sb.status,
    date_format(sb.tt,'%Y-%m-%d %H:%i:%s') ttTime,
    date_format(sb.ut,'%Y-%m-%d %H:%i:%s') utTime,
    sb.lon,sb.lat,sb.st_name
    from nf_monitor.station_base sb
    where sb.platform_code = #{platformCode,jdbcType=VARCHAR}
    <if test="siteName != null and siteName != '' ">
      AND (sb.st_name like concat('%',#{siteName},'%') or sb.st_code like concat('%',#{siteName},'%'))
    </if>
  </select>

  <select id="selectFaultCodeByCodes"  parameterType="java.lang.String" resultType="java.lang.String">
    SELECT st_code as stCode
    FROM nf_monitor.fault_temp where st_code in
    <foreach collection="stCodes" item="item" open="(" close=")" separator=",">
      #{item}
    </foreach>
  </select>

  <select id="selectLowPowerByCodes" resultType="com.newfiber.api.pc.model.monitor.StationBase" parameterType="java.lang.String" >
    select sb.id, st_name, sb.st_code as stCode,sb.ut,sb.tt, sb.area, sb.construction_status, sb.fault_status,  sb.task_status,
    sb.platform_code, sb.lat, sb.lon, sb.is_push, sb.create_time, sb.coordinate_system, sb.status, sb.offline_time
    from nf_monitor.station_base sb left join nf_monitor.station_config sc on sb.st_code = sc.st_code
    where sc.`key` = "vt" and `value` &lt; 10.5
    and sb.st_code in
    <foreach collection="stCodes" item="item" open="(" close=")" separator=",">
      #{item}
    </foreach>
  </select>


  <select id="selectSiteSiteManByStCode" resultType="com.newfiber.api.pc.model.monitor.StationBase" parameterType="java.lang.String" >
    select sb.st_code as stCode,sb.st_name as stName,
    date_format(sb.tt,'%Y-%m-%d %H:%i:%s') ttTime,
    date_format(sb.update_time,'%Y-%m-%d %H:%i:%s') sttTime,
    video_path videoPath,sb.site_type
    from nf_monitor.station_base sb
    where 1=1
    <if test="stCode != null and stCode != ''">
      and sb.st_code = #{stCode,jdbcType=VARCHAR}
    </if>
    Order by sb.tt DESC
  </select>


  <select id="selectSiteStatus" resultMap="BaseResultMap">
    select st_code,status from nf_monitor.station_base where st_code in
    <foreach collection="stCodes" item="item" open="(" close=")" separator=",">
      #{item}
    </foreach>
  </select>

  <select id="selectListData" resultMap="riverInfoData">
    select
      br.black_id,
      br.black_river_name,
      brs.water_site_no,
      brs.water_warn_level,
      brs.water_quality_site_no,
      brs.duty_user,
      brs.duty_user_phone
    from
      xinyang_river.black_river br left join xinyang_river.black_river_site brs on br.black_id = brs.black_id where br.black_id = brs.black_id
  </select>

</mapper>