Commit f26deb0e71fc80f30de66751f65fdff914e3d439
1 parent
23b305af
版本页面
Showing
5 changed files
with
7 additions
and
4 deletions
src/main/java/com/bsth/controller/SectionController.java
| ... | ... | @@ -142,7 +142,7 @@ public class SectionController extends BaseController<Section, Integer> { |
| 142 | 142 | * |
| 143 | 143 | * @return int <sectionCode路段编码> |
| 144 | 144 | */ |
| 145 | - @RequestMapping(value="doubleName" , method = RequestMethod.GET) | |
| 145 | + @RequestMapping(value="doubleName" , method = RequestMethod.POST) | |
| 146 | 146 | public Map<String, Object> doubleName(@RequestParam Map<String, Object> map) { |
| 147 | 147 | return service.doubleName(map); |
| 148 | 148 | } | ... | ... |
src/main/java/com/bsth/repository/LineVersionsRepository.java
| ... | ... | @@ -70,7 +70,7 @@ public interface LineVersionsRepository extends BaseRepository<LineVersions, Int |
| 70 | 70 | /** |
| 71 | 71 | * 获取线路版本的上一个版本 |
| 72 | 72 | */ |
| 73 | - @Query(value = " SELECT lv FROM LineVersions lv where lv.line.id = ?1 and lv.versions = (?2 - "+1+")") | |
| 73 | + @Query(value = " SELECT lv FROM LineVersions lv where lv.line.id = ?1 and lv.versions = (SELECT MAX(v.versions) FROM LineVersions v where v.line.id = ?1 and v.versions < ?2)") | |
| 74 | 74 | public LineVersions findBylineIdAndVersions(Integer id, Integer versions); |
| 75 | 75 | |
| 76 | 76 | ... | ... |
src/main/java/com/bsth/service/impl/LineVersionsServiceImpl.java
| ... | ... | @@ -96,6 +96,9 @@ public class LineVersionsServiceImpl extends BaseServiceImpl<LineVersions, Integ |
| 96 | 96 | |
| 97 | 97 | int statu = repository.update(id,line,lineCode,new java.sql.Date(startDate.getTime()), |
| 98 | 98 | new java.sql.Date(endDate.getTime()),versions,status,remark); |
| 99 | + LineVersions upLineVersions = repository.findBylineIdAndVersions(line.getId(),versions); | |
| 100 | + upLineVersions.setEndDate(new java.sql.Date(startDate.getTime())); | |
| 101 | + repository.save(upLineVersions); | |
| 99 | 102 | if (statu==1) { |
| 100 | 103 | resultMap.put("status", ResponseCode.SUCCESS); |
| 101 | 104 | } else { | ... | ... |
src/main/resources/application-dev.properties
| ... | ... | @@ -10,7 +10,7 @@ spring.jpa.show-sql= true |
| 10 | 10 | spring.datasource.driver-class-name= com.mysql.jdbc.Driver |
| 11 | 11 | spring.datasource.url= jdbc:mysql://127.0.0.1/pd_control?useUnicode=true&characterEncoding=utf-8&useSSL=false |
| 12 | 12 | spring.datasource.username= root |
| 13 | -spring.datasource.password= panzhao | |
| 13 | +spring.datasource.password= | |
| 14 | 14 | #spring.datasource.url= jdbc:mysql://192.168.168.117/pd_control?useUnicode=true&characterEncoding=utf-8&useSSL=false |
| 15 | 15 | #spring.datasource.username= root |
| 16 | 16 | #spring.datasource.password= root | ... | ... |
src/main/resources/static/pages/base/stationroute/doublename_road.html
| ... | ... | @@ -127,7 +127,7 @@ |
| 127 | 127 | $.get("/lineVersions/findCurrentVersion", {"lineId" : lineId}, function (versions) { |
| 128 | 128 | params.versions = versions; |
| 129 | 129 | // 生成路段 |
| 130 | - $.get('/section/doubleName',params,function (resuntDate) { | |
| 130 | + $.post('/section/doubleName',params,function (resuntDate) { | |
| 131 | 131 | if(resuntDate.status=='SUCCESS') { |
| 132 | 132 | // 弹出添加成功提示消息 |
| 133 | 133 | layer.msg('生成成功...'); | ... | ... |