<?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.RiverManage.StationBaseDao"> <!-- 可根据自己的需求,是否要使用 --> <resultMap type="com.newfiber.api.pc.model.River.StationBase" id="stationBaseMap"> <result property="id" column="id"/> <result property="stName" column="st_name"/> <result property="ut" column="ut"/> <result property="tt" column="tt"/> <result property="area" column="area"/> <result property="constructionStatus" column="construction_status"/> <result property="faultStatus" column="fault_status"/> <result property="taskStatus" column="task_status"/> <result property="platformCode" column="platform_code"/> <result property="lat" column="lat"/> <result property="lon" column="lon"/> <result property="isPush" column="is_push"/> <result property="createTime" column="create_time"/> <result property="coordinateSystem" column="coordinate_system"/> <result property="status" column="status"/> <result property="offlineTime" column="offline_time"/> <result property="address" column="address"/> <result property="person" column="person"/> </resultMap> <select id="selectByStCode" resultMap="stationBaseMap"> select id, st_name, st_code, lat, lon from river_info where 1=1 <if test="stCode != null and stCode != ''"> and st_code = #{stCode} </if> </select> <select id="selectDataByStCode" resultMap="stationBaseMap"> select sb.id, sb.st_name, sb.st_code, sb.lat, sb.lon,sbe.address from nf_monitor.station_base sb left join nf_monitor.station_base_extend sbe on sb.id = sbe.station_base_id where 1=1 and sbe.address is not null <if test="stCode != null and stCode != ''"> and st_code = #{stCode} </if> </select> </mapper>