From 851d1d14c646f69d40751f75caeff55d41c85b14 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期五, 15 九月 2023 15:26:16 +0800 Subject: [PATCH] 1 --- src/main/resources/application-dev.yml | 4 ++-- src/main/java/com/yssh/controller/LocationController.java | 2 +- src/main/resources/mapper/LocationMapper.xml | 15 ++++++++------- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/yssh/controller/LocationController.java b/src/main/java/com/yssh/controller/LocationController.java index 9997c8e..833ff01 100644 --- a/src/main/java/com/yssh/controller/LocationController.java +++ b/src/main/java/com/yssh/controller/LocationController.java @@ -39,7 +39,7 @@ @GetMapping("/query") public Result query( @RequestParam(value = "name", required = false) String name, - @RequestParam(value = "type", required = true) String type) { + @RequestParam(value = "type", required = false) String type) { List<Location> data = locationService.query(name, type); return Result.OK(data); } diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 8f521c2..fc4b4f7 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -3,8 +3,8 @@ datasource: type: com.alibaba.druid.pool.DruidDataSource driverClassName: com.mysql.cj.jdbc.Driver - #url: jdbc:mysql://192.168.20.228:3306/yssh?useUnicode=true&rewriteBatchedStatements=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8 - url: jdbc:mysql://192.168.22.31:3306/yssh?useUnicode=true&rewriteBatchedStatements=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8 + url: jdbc:mysql://192.168.20.228:3306/yssh?useUnicode=true&rewriteBatchedStatements=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8 + #url: jdbc:mysql://192.168.22.31:3306/yssh?useUnicode=true&rewriteBatchedStatements=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8 username: root password: 123456 # 鍒濆杩炴帴鏁� diff --git a/src/main/resources/mapper/LocationMapper.xml b/src/main/resources/mapper/LocationMapper.xml index d826e52..8e04b51 100644 --- a/src/main/resources/mapper/LocationMapper.xml +++ b/src/main/resources/mapper/LocationMapper.xml @@ -13,8 +13,8 @@ SELECT id, name, type, format(lon, 6) lon, format(lat, 6) lat FROM location </sql> - <select id="selectByXY" resultMap="locationResult"> - <include refid="locationSql"></include> + <select id="selectByXY" resultType="com.yssh.entity.Location"> + select id, name, type, lon, lat from location <where> lon between (#{x} - 0.0009) and (#{x} + 0.0009) and @@ -22,13 +22,13 @@ </where> </select> - <select id="selectVocAddrs" resultMap="locationResult"> + <select id="selectVocAddrs" resultType="com.yssh.entity.Location"> select id, x "lon", y "lat", addr "name" from voc_addr where length(addr) > 0; </select> - <select id="query" resultMap="locationResult"> + <select id="query" resultType="com.yssh.entity.Location"> <include refid="locationSql"></include> <where> <if test="name != null and name != ''"> @@ -39,9 +39,10 @@ </if> </where> </select> - - <select id="getAll" resultMap="locationResult"> - <include refid="locationSql"></include> + + <!--include refid="locationSql"></include--> + <select id="getAll" resultType="com.yssh.entity.Location"> + select id, name, type, lon, lat from location; </select> <insert id="insertLocation" parameterType="com.yssh.entity.Location"> -- Gitblit v1.9.3