|
@@ -2,11 +2,10 @@
|
|
|
<!DOCTYPE mapper
|
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
-<mapper namespace="com.miaxis.app.school.mapper.SchoolRegionMapper">
|
|
|
+<mapper namespace="com.miaxis.school.mapper.SchoolRegionMapper">
|
|
|
|
|
|
<resultMap type="SchoolRegion" id="SchoolRegionResult">
|
|
|
<result property="id" column="id" />
|
|
|
- <result property="schoolId" column="school_id" />
|
|
|
<result property="inscode" column="inscode" />
|
|
|
<result property="seq" column="seq" />
|
|
|
<result property="name" column="name" />
|
|
@@ -18,21 +17,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<result property="totalvehnum" column="totalvehnum" />
|
|
|
<result property="curvehnum" column="curvehnum" />
|
|
|
<result property="status" column="status" />
|
|
|
- <result property="crdate" column="crdate" />
|
|
|
<result property="flag" column="flag" />
|
|
|
<result property="areaCode" column="area_code" />
|
|
|
+ <result property="poiLon" column="poi_lon" />
|
|
|
+ <result property="poiLat" column="poi_lat" />
|
|
|
<result property="createTime" column="create_time" />
|
|
|
<result property="updateTime" column="update_time" />
|
|
|
</resultMap>
|
|
|
|
|
|
+ <select id="selectSchoolRegionUrlList" parameterType="SchoolRegionDTO" resultType="SchoolRegionVO">
|
|
|
+ SELECT sr.id,sr.NAME region_name,s.NAME school_name,sr.address,
|
|
|
+ sr.area,sr.type,sr.vehicletype,sr.totalvehnum,sr.curvehnum,sr.poi_lon,sr.poi_lat,sri.url,
|
|
|
+ (2 * 6378.137 * ASIN(SQRT(POW( SIN( PI( ) * ( 120.211162- s.poi_lon ) / 360 ), 2 ) + COS( PI( ) * 30.186584 / 180 ) * COS( sr.poi_lat * PI( ) / 180 ) * POW( SIN( PI( ) * ( 30.186584- s.poi_lat ) / 360 ), 2 )) ) ) AS distance
|
|
|
+ FROM school_region sr
|
|
|
+ left JOIN school_info s ON sr.inscode = s.inscode
|
|
|
+ left join school_region_images sri on sr.id = sri. region_id
|
|
|
+ <where>
|
|
|
+ <if test="areaCode != null and areaCode != ''"> and area_code = #{areaCode}</if>
|
|
|
+ </where>
|
|
|
+ order by distance desc
|
|
|
+ </select>
|
|
|
+
|
|
|
<sql id="selectSchoolRegionVo">
|
|
|
- select id, school_id, inscode, seq, name, address, area, type, vehicletype, polygon, totalvehnum, curvehnum, status, crdate, flag, area_code, create_time, update_time from school_region
|
|
|
+ select id, inscode, seq, name, address, area, type, vehicletype, polygon, totalvehnum, curvehnum, status, flag, area_code, poi_lon, poi_lat, create_time, update_time from school_region
|
|
|
</sql>
|
|
|
|
|
|
<select id="selectSchoolRegionList" parameterType="SchoolRegion" resultMap="SchoolRegionResult">
|
|
|
<include refid="selectSchoolRegionVo"/>
|
|
|
<where>
|
|
|
- <if test="schoolId != null and schoolId != ''"> and school_id = #{schoolId}</if>
|
|
|
<if test="inscode != null and inscode != ''"> and inscode = #{inscode}</if>
|
|
|
<if test="seq != null and seq != ''"> and seq = #{seq}</if>
|
|
|
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
|
@@ -44,9 +56,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="totalvehnum != null "> and totalvehnum = #{totalvehnum}</if>
|
|
|
<if test="curvehnum != null "> and curvehnum = #{curvehnum}</if>
|
|
|
<if test="status != null "> and status = #{status}</if>
|
|
|
- <if test="crdate != null "> and crdate = #{crdate}</if>
|
|
|
<if test="flag != null "> and flag = #{flag}</if>
|
|
|
<if test="areaCode != null and areaCode != ''"> and area_code = #{areaCode}</if>
|
|
|
+ <if test="poiLon != null "> and poi_lon = #{poiLon}</if>
|
|
|
+ <if test="poiLat != null "> and poi_lat = #{poiLat}</if>
|
|
|
</where>
|
|
|
</select>
|
|
|
|
|
@@ -59,7 +72,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
insert into school_region
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
<if test="id != null">id,</if>
|
|
|
- <if test="schoolId != null">school_id,</if>
|
|
|
<if test="inscode != null">inscode,</if>
|
|
|
<if test="seq != null">seq,</if>
|
|
|
<if test="name != null">name,</if>
|
|
@@ -71,15 +83,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="totalvehnum != null">totalvehnum,</if>
|
|
|
<if test="curvehnum != null">curvehnum,</if>
|
|
|
<if test="status != null">status,</if>
|
|
|
- <if test="crdate != null">crdate,</if>
|
|
|
<if test="flag != null">flag,</if>
|
|
|
<if test="areaCode != null">area_code,</if>
|
|
|
+ <if test="poiLon != null">poi_lon,</if>
|
|
|
+ <if test="poiLat != null">poi_lat,</if>
|
|
|
<if test="createTime != null">create_time,</if>
|
|
|
<if test="updateTime != null">update_time,</if>
|
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
<if test="id != null">#{id},</if>
|
|
|
- <if test="schoolId != null">#{schoolId},</if>
|
|
|
<if test="inscode != null">#{inscode},</if>
|
|
|
<if test="seq != null">#{seq},</if>
|
|
|
<if test="name != null">#{name},</if>
|
|
@@ -91,9 +103,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="totalvehnum != null">#{totalvehnum},</if>
|
|
|
<if test="curvehnum != null">#{curvehnum},</if>
|
|
|
<if test="status != null">#{status},</if>
|
|
|
- <if test="crdate != null">#{crdate},</if>
|
|
|
<if test="flag != null">#{flag},</if>
|
|
|
<if test="areaCode != null">#{areaCode},</if>
|
|
|
+ <if test="poiLon != null">#{poiLon},</if>
|
|
|
+ <if test="poiLat != null">#{poiLat},</if>
|
|
|
<if test="createTime != null">#{createTime},</if>
|
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
|
</trim>
|
|
@@ -102,7 +115,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<update id="updateSchoolRegion" parameterType="SchoolRegion">
|
|
|
update school_region
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
- <if test="schoolId != null">school_id = #{schoolId},</if>
|
|
|
<if test="inscode != null">inscode = #{inscode},</if>
|
|
|
<if test="seq != null">seq = #{seq},</if>
|
|
|
<if test="name != null">name = #{name},</if>
|
|
@@ -114,9 +126,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="totalvehnum != null">totalvehnum = #{totalvehnum},</if>
|
|
|
<if test="curvehnum != null">curvehnum = #{curvehnum},</if>
|
|
|
<if test="status != null">status = #{status},</if>
|
|
|
- <if test="crdate != null">crdate = #{crdate},</if>
|
|
|
<if test="flag != null">flag = #{flag},</if>
|
|
|
<if test="areaCode != null">area_code = #{areaCode},</if>
|
|
|
+ <if test="poiLon != null">poi_lon = #{poiLon},</if>
|
|
|
+ <if test="poiLat != null">poi_lat = #{poiLat},</if>
|
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
</trim>
|