Commit 82ae531afcafa043ce135b841e537c986a8dac45

Authored by yiming
1 parent afdd1ef3

新增接口

src/main/java/com/example/demo/control/Ticket.java 0 → 100644
  1 +package com.example.demo.control;
  2 +
  3 +import com.example.demo.mapper.db1.SiteMapper1;
  4 +import com.example.demo.model.TJRLDB;
  5 +import org.slf4j.Logger;
  6 +import org.slf4j.LoggerFactory;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.web.bind.annotation.RequestMapping;
  9 +import org.springframework.web.bind.annotation.RequestParam;
  10 +import org.springframework.web.bind.annotation.RestController;
  11 +import java.util.ArrayList;
  12 +import java.util.HashMap;
  13 +import java.util.List;
  14 +import java.util.Map;
  15 +
  16 +
  17 +@RestController
  18 +@RequestMapping("ticket")
  19 +public class Ticket {
  20 +
  21 + @Autowired
  22 + private SiteMapper1 siteMapper1;
  23 +
  24 + Logger logger = LoggerFactory.getLogger(this.getClass());
  25 +
  26 + @RequestMapping("getList")
  27 + public List<TJRLDB> getSchedules(@RequestParam String date,@RequestParam String nbbm){
  28 + List<TJRLDB> tjrldbList = new ArrayList<>();
  29 + try {
  30 + Map<String, String> map = new HashMap<>();
  31 + map.put("date",date);
  32 + map.put("nbbm",nbbm);
  33 + tjrldbList=siteMapper1.getT_jc_result(map);
  34 + } catch (Exception e) {
  35 + e.printStackTrace();
  36 + }
  37 + logger.info(">>>>>>>>>>>>>>>>路单信息返回:"+tjrldbList.size());
  38 + return tjrldbList;
  39 + }
  40 +
  41 +
  42 +}
0 \ No newline at end of file 43 \ No newline at end of file
src/main/java/com/example/demo/mapper/db1/SiteMapper1.java
@@ -29,4 +29,8 @@ public interface SiteMapper1 { @@ -29,4 +29,8 @@ public interface SiteMapper1 {
29 29
30 @DS("db1") 30 @DS("db1")
31 List<TJRLDB> getRecords(Map<String, Object> map); 31 List<TJRLDB> getRecords(Map<String, Object> map);
  32 +
  33 + @DS("db1")
  34 + List<TJRLDB> getT_jc_result(Map<String, String> map);
  35 +
32 } 36 }
33 \ No newline at end of file 37 \ No newline at end of file
src/main/resources/mapping/db1/Site-mapper1.xml
@@ -70,5 +70,8 @@ @@ -70,5 +70,8 @@
70 from ${table} where TJRLRDATE >= '${start}' and TJRLRDATE &lt; '${end}' 70 from ${table} where TJRLRDATE >= '${start}' and TJRLRDATE &lt; '${end}'
71 </select> 71 </select>
72 72
  73 + <select id="getT_jc_result" resultType="com.example.demo.model.TJRLDB">
  74 + SELECT * from passenger_flow.t_jc_result where TJRLRDATE = '${date}' and BUS_CODE = '${nbbm}'
  75 + </select>
73 76
74 </mapper> 77 </mapper>
75 \ No newline at end of file 78 \ No newline at end of file