123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211 |
- <?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.macro.mall.tiny.modules.business.mapper.KrBLineMapper">
- <select id="findById" resultMap="BaseResultMap">
- SELECT l.id,
- l.province_id,
- p.name province,
- l.city_id,
- c.name city,
- l.line_name,
- l.voltage,
- l.line_status,
- l.service_begintime,
- l.begin_tower,
- l.end_tower,
- l.creator_id,
- l.create_time,
- t.id t_id,
- t.line_id t_line_id,
- t.tower_index t_tower_index,
- t.tower_name t_tower_name,
- t.tower_number t_tower_number,
- t.hardware_type t_hardware_type,
- t.longitude t_longitude,
- t.latitude t_latitude,
- t.type t_type,
- t.is_station t_is_station,
- t.is_weather t_is_weather,
- t.circuit t_circuit,
- t.height t_height,
- t.practical_height t_practical_height,
- t.corner_direction t_corner_direction,
- t.corner_number t_corner_number,
- t.span t_span,
- t.service_begintime t_service_begintime,
- t.remark t_remark,
- t.has_file t_has_file,
- t.create_time t_create_time
- FROM kr_b_line l
- LEFT JOIN kr_b_region_province p ON l.province_id = p.province_id
- LEFT JOIN kr_b_region_city c ON l.city_id = c.city_id
- LEFT JOIN kr_b_tower t ON l.id = t.line_id
- WHERE l.id = #{id}
- ORDER BY tower_index;
- </select>
- <select id="findListMulti" resultMap="BaseResultMap">
- SELECT l.id,
- l.province_id,
- p.name province,
- l.city_id,
- c.name city,
- l.line_name,
- l.voltage,
- l.line_status,
- l.service_begintime,
- l.begin_tower,
- l.end_tower,
- l.creator_id,
- l.create_time,
- t.id t_id,
- t.line_id t_line_id,
- t.tower_index t_tower_index,
- t.tower_name t_tower_name,
- t.tower_number t_tower_number,
- t.hardware_type t_hardware_type,
- t.longitude t_longitude,
- t.latitude t_latitude,
- t.type t_type,
- t.is_station t_is_station,
- t.is_weather t_is_weather,
- t.circuit t_circuit,
- t.height t_height,
- t.practical_height t_practical_height,
- t.corner_direction t_corner_direction,
- t.corner_number t_corner_number,
- t.span t_span,
- t.service_begintime t_service_begintime,
- t.remark t_remark,
- t.has_file t_has_file,
- t.create_time t_create_time
- FROM kr_b_line l
- LEFT JOIN kr_b_region_province p ON l.province_id = p.province_id
- LEFT JOIN kr_b_region_city c ON l.city_id = c.city_id
- LEFT JOIN kr_b_tower t ON l.id = t.line_id
- ORDER BY tower_index;
- </select>
- <select id="findListByKey" resultMap="BaseResultMap">
- SELECT l.id,
- l.province_id,
- p.name province,
- l.city_id,
- c.name city,
- l.line_name,
- l.voltage,
- l.line_status,
- l.service_begintime,
- l.begin_tower,
- l.end_tower,
- l.creator_id,
- l.create_time,
- t.id t_id,
- t.line_id t_line_id,
- t.tower_index t_tower_index,
- t.tower_name t_tower_name,
- t.tower_number t_tower_number,
- t.hardware_type t_hardware_type,
- t.longitude t_longitude,
- t.latitude t_latitude,
- t.type t_type,
- t.is_station t_is_station,
- t.is_weather t_is_weather,
- t.circuit t_circuit,
- t.height t_height,
- t.practical_height t_practical_height,
- t.corner_direction t_corner_direction,
- t.corner_number t_corner_number,
- t.span t_span,
- t.service_begintime t_service_begintime,
- t.remark t_remark,
- t.has_file t_has_file,
- t.create_time t_create_time
- FROM kr_b_line l
- LEFT JOIN kr_b_region_province p ON l.province_id = p.province_id
- LEFT JOIN kr_b_region_city c ON l.city_id = c.city_id
- LEFT JOIN kr_b_tower t ON l.id = t.line_id
- WHERE l.line_name LIKE concat('%', #{key}, '%')
- OR p.name like concat('%', #{key}, '%')
- OR t.tower_number like concat('%', #{key}, '%')
- <if test="provinceId != null and provinceId != ''">
- AND l.province_id = #{provinceId}
- </if>
- <if test="cityId != null and cityId != ''">
- AND l.city_id = #{cityId}
- </if>
- ORDER BY tower_index;
- </select>
- <select id="findByKeySimple" resultMap="BaseResultMap">
- SELECT l.id,
- l.province_id,
- p.name province,
- l.city_id,
- c.name city,
- l.line_name,
- l.voltage,
- l.line_status,
- l.service_begintime,
- l.begin_tower,
- l.end_tower,
- l.creator_id,
- l.create_time
- FROM kr_b_line l
- LEFT JOIN kr_b_region_province p ON l.province_id = p.province_id
- LEFT JOIN kr_b_region_city c ON l.city_id = c.city_id
- WHERE l.line_name LIKE concat('%', #{key}, '%')
- OR p.name like concat('%', #{key}, '%')
- <if test="provinceId != null and provinceId != ''">
- AND l.province_id = #{provinceId}
- </if>
- <if test="cityId != null and cityId != ''">
- AND l.city_id = #{cityId}
- </if>
- </select>
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.macro.mall.tiny.modules.business.model.KrBLine">
- <id column="id" property="id"/>
- <result column="province_id" property="provinceId"/>
- <result column="province" property="province"/>
- <result column="city_id" property="cityId"/>
- <result column="city" property="city"/>
- <result column="line_name" property="lineName"/>
- <result column="voltage" property="voltage"/>
- <result column="line_status" property="lineStatus"/>
- <result column="service_begintime" property="serviceBegintime"/>
- <result column="begin_tower" property="beginTower"/>
- <result column="end_tower" property="endTower"/>
- <result column="creator_id" property="creatorId"/>
- <result column="create_time" property="createTime"/>
- <collection property="towerList" ofType="com.macro.mall.tiny.modules.business.model.KrBTower" column="id">
- <id column="t_id" property="id"/>
- <result column="t_line_id" property="lineId"/>
- <result column="t_tower_index" property="towerIndex"/>
- <result column="t_tower_name" property="towerName"/>
- <result column="t_tower_number" property="towerNumber"/>
- <result column="t_hardware_type" property="hardwareType"/>
- <result column="t_line_id" property="lineId"/>
- <result column="t_longitude" property="longitude"/>
- <result column="t_latitude" property="latitude"/>
- <result column="t_type" property="type"/>
- <result column="t_is_station" property="isStation"/>
- <result column="t_is_weather" property="isWeather"/>
- <result column="t_circuit" property="circuit"/>
- <result column="t_height" property="height"/>
- <result column="t_practical_height" property="practicalHeight"/>
- <result column="t_corner_direction" property="cornerDirection"/>
- <result column="t_corner_number" property="cornerNumber"/>
- <result column="t_span" property="span"/>
- <result column="t_service_begintime" property="serviceBegintime"/>
- <result column="t_remark" property="remark"/>
- <result column="t_has_file" property="hasFile"/>
- <result column="t_create_time" property="createTime"/>
- </collection>
- </resultMap>
- </mapper>
|