Commit 196bcda59e984230af77f3996252489369584845

Authored by 李强
1 parent c1ee5c21

Signed-off-by: bsthlq <2519941818@qq.com>

src/main/java/com/bsth/controller/LineController.java
... ... @@ -9,15 +9,15 @@ import com.bsth.entity.Line;
9 9 *
10 10 * @ClassName: LineController(线路控制器)
11 11 *
12   - * @extends : BaseController
  12 + * @Extends : BaseController
13 13 *
14 14 * @Description: TODO(线路控制层)
15 15 *
16   - * @author bsth@lq
  16 + * @Author bsth@lq
17 17 *
18   - * @date 2016年4月28日 上午9:21:17
  18 + * @Date 2016年4月28日 上午9:21:17
19 19 *
20   - * @version 公交调度系统BS版 0.1
  20 + * @Version 公交调度系统BS版 0.1
21 21 *
22 22 */
23 23 @RestController
... ...
src/main/java/com/bsth/controller/StationController.java 0 → 100644
  1 +package com.bsth.controller;
  2 +
  3 +import org.springframework.web.bind.annotation.RequestMapping;
  4 +import org.springframework.web.bind.annotation.RestController;
  5 +
  6 +import com.bsth.entity.Line;
  7 +import com.bsth.entity.Station;
  8 +
  9 +/**
  10 + *
  11 + * @ClassName: StationController(站点控制器)
  12 + *
  13 + * @Extends : BaseController
  14 + *
  15 + * @Description: TODO(站点控制层)
  16 + *
  17 + * @Author bsth@lq
  18 + *
  19 + * @Date 2016年05月03日 上午9:21:17
  20 + *
  21 + * @Version 公交调度系统BS版 0.1
  22 + *
  23 + */
  24 +
  25 +@RestController
  26 +@RequestMapping("station")
  27 +public class StationController extends BaseController<Station, Integer> {
  28 +
  29 +}
... ...
src/main/java/com/bsth/controller/StationRouteController.java 0 → 100644
  1 +package com.bsth.controller;
  2 +
  3 +import org.springframework.web.bind.annotation.RequestMapping;
  4 +import org.springframework.web.bind.annotation.RestController;
  5 +
  6 +import com.bsth.entity.Line;
  7 +import com.bsth.entity.StationRoute;
  8 +
  9 +/**
  10 + *
  11 + * @ClassName: StationRouteController(站点路由控制器)
  12 + *
  13 + * @Extends : BaseController
  14 + *
  15 + * @Description: TODO(站点路由控制层)
  16 + *
  17 + * @Author bsth@lq
  18 + *
  19 + * @Date 2016年5月03日 上午9:21:17
  20 + *
  21 + * @Dersion 公交调度系统BS版 0.1
  22 + *
  23 + */
  24 +@RestController
  25 +@RequestMapping("stationroute")
  26 +public class StationRouteController extends BaseController<StationRoute, Integer> {
  27 +
  28 +}
... ...
src/main/java/com/bsth/entity/Line.java
... ... @@ -17,13 +17,14 @@ import javax.persistence.Table;
17 17 *
18 18 * @Description: TODO(线路)
19 19 *
20   - * @author bsth@lq
  20 + * @Author bsth@lq
21 21 *
22   - * @date 2016年4月11日 下午4:06:17
  22 + * @Date 2016年4月11日 下午4:06:17
23 23 *
24   - * @version 公交调度系统BS版 0.1
  24 + * @Version 公交调度系统BS版 0.1
25 25 *
26 26 */
  27 +
27 28 @Entity
28 29 @Table(name = "bsth_c_line")
29 30 public class Line {
... ... @@ -34,7 +35,7 @@ public class Line {
34 35 private Integer id;
35 36  
36 37 // 线路代码
37   - private String code;
  38 + private String lineCode;
38 39  
39 40 // 线路名称
40 41 private String name;
... ... @@ -149,12 +150,12 @@ public class Line {
149 150 this.id = id;
150 151 }
151 152  
152   - public String getCode() {
153   - return code;
  153 + public String getLineCode() {
  154 + return lineCode;
154 155 }
155 156  
156   - public void setCode(String code) {
157   - this.code = code;
  157 + public void setLineCode(String lineCode) {
  158 + this.lineCode = lineCode;
158 159 }
159 160  
160 161 public String getName() {
... ...
src/main/java/com/bsth/repository/LineRepository.java
... ... @@ -6,17 +6,17 @@ import com.bsth.entity.Line;
6 6  
7 7 /**
8 8 *
9   - * @Interface: LineService(线路Repository数据持久层接口)
  9 + * @Interface: LineRepository(线路Repository数据持久层接口)
10 10 *
11   - * @extends : BaseRepository
  11 + * @Extends : BaseRepository
12 12 *
13 13 * @Description: TODO(线路Repository数据持久层接口)
14 14 *
15   - * @author bsth@lq
  15 + * @Author bsth@lq
16 16 *
17   - * @date 2016年4月28日 上午9:21:17
  17 + * @Date 2016年4月28日 上午9:21:17
18 18 *
19   - * @version 公交调度系统BS版 0.1
  19 + * @Version 公交调度系统BS版 0.1
20 20 *
21 21 */
22 22 @Repository
... ...
src/main/java/com/bsth/repository/StationRepository.java 0 → 100644
  1 +package com.bsth.repository;
  2 +
  3 +import org.springframework.stereotype.Repository;
  4 +
  5 +import com.bsth.entity.Station;
  6 +
  7 +/**
  8 + *
  9 + * @Interface: StationRepository(站点Repository数据持久层接口)
  10 + *
  11 + * @Extends : BaseRepository
  12 + *
  13 + * @Description: TODO(站点Repository数据持久层接口)
  14 + *
  15 + * @Author bsth@lq
  16 + *
  17 + * @Date 2016年05月03日 上午9:21:17
  18 + *
  19 + * @Version 公交调度系统BS版 0.1
  20 + *
  21 + */
  22 +
  23 +@Repository
  24 +public interface StationRepository extends BaseRepository<Station, Integer> {
  25 +
  26 +}
... ...
src/main/java/com/bsth/repository/StationRouteRepository.java 0 → 100644
  1 +package com.bsth.repository;
  2 +
  3 +import org.springframework.stereotype.Repository;
  4 +
  5 +import com.bsth.entity.StationRoute;
  6 +
  7 +/**
  8 + *
  9 + * @Interface: StationRouteRepository(站点路由Repository数据持久层接口)
  10 + *
  11 + * @Extends : BaseRepository
  12 + *
  13 + * @Description: TODO(站点路由Repository数据持久层接口)
  14 + *
  15 + * @Author bsth@lq
  16 + *
  17 + * @Date 2016年5月03日 上午9:21:17
  18 + *
  19 + * @Version 公交调度系统BS版 0.1
  20 + *
  21 + */
  22 +
  23 +@Repository
  24 +public interface StationRouteRepository extends BaseRepository<StationRoute, Integer> {
  25 +
  26 +}
... ...
src/main/java/com/bsth/service/LineService.java
... ... @@ -10,11 +10,11 @@ import com.bsth.entity.Line;
10 10 *
11 11 * @Description: TODO(线路service业务层实现接口)
12 12 *
13   - * @author bsth@lq
  13 + * @Author bsth@lq
14 14 *
15   - * @date 2016年4月28日 上午9:21:17
  15 + * @Date 2016年4月28日 上午9:21:17
16 16 *
17   - * @version 公交调度系统BS版 0.1
  17 + * @Version 公交调度系统BS版 0.1
18 18 *
19 19 */
20 20 public interface LineService extends BaseService<Line, Integer> {
... ...
src/main/java/com/bsth/service/StationRouteService.java 0 → 100644
  1 +package com.bsth.service;
  2 +
  3 +import com.bsth.entity.StationRoute;
  4 +
  5 +/**
  6 + *
  7 + * @Interface: StationRouteService(站点路由service业务层实现接口)
  8 + *
  9 + * @Extends : BaseService
  10 + *
  11 + * @Description: TODO(站点路由service业务层实现接口)
  12 + *
  13 + * @Author bsth@lq
  14 + *
  15 + * @Date 2016年5月03日 上午9:21:17
  16 + *
  17 + * @Version 公交调度系统BS版 0.1
  18 + *
  19 + */
  20 +public interface StationRouteService extends BaseService<StationRoute, Integer> {
  21 +
  22 +}
... ...
src/main/java/com/bsth/service/StationService.java 0 → 100644
  1 +package com.bsth.service;
  2 +
  3 +import com.bsth.entity.Station;
  4 +
  5 +/**
  6 + *
  7 + * @Interface: StationService(站点service业务层实现接口)
  8 + *
  9 + * @extends : BaseService
  10 + *
  11 + * @Description: TODO(站点service业务层实现接口)
  12 + *
  13 + * @Author bsth@lq
  14 + *
  15 + * @Date 2016年05月03日 上午9:21:17
  16 + *
  17 + * @Version 公交调度系统BS版 0.1
  18 + *
  19 + */
  20 +public interface StationService extends BaseService<Station, Integer> {
  21 +
  22 +}
... ...
src/main/java/com/bsth/service/impl/LineServiceImpl.java
... ... @@ -3,24 +3,25 @@ package com.bsth.service.impl;
3 3 import org.springframework.stereotype.Service;
4 4  
5 5 import com.bsth.entity.Line;
  6 +import com.bsth.service.LineService;
6 7  
7 8 /**
8 9 *
9 10 * @ClassName: LineServiceImpl(线路service业务层实现类)
10 11 *
11   - * @extends : BaseService
  12 + * @Extends : BaseService
12 13 *
13 14 * @Description: TODO(线路service业务层)
14 15 *
15   - * @author bsth@lq
  16 + * @Author bsth@lq
16 17 *
17   - * @date 2016年4月28日 上午9:21:17
  18 + * @Date 2016年4月28日 上午9:21:17
18 19 *
19   - * @version 公交调度系统BS版 0.1
  20 + * @Version 公交调度系统BS版 0.1
20 21 *
21 22 */
22 23  
23 24 @Service
24   -public class LineServiceImpl extends BaseServiceImpl<Line, Integer> {
  25 +public class LineServiceImpl extends BaseServiceImpl<Line, Integer> implements LineService{
25 26  
26 27 }
... ...
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java 0 → 100644
  1 +package com.bsth.service.impl;
  2 +
  3 +import org.springframework.stereotype.Service;
  4 +
  5 +import com.bsth.entity.StationRoute;
  6 +import com.bsth.service.StationRouteService;
  7 +
  8 +/**
  9 + *
  10 + * @ClassName: StationRouteServiceImpl(站点路由service业务层实现类)
  11 + *
  12 + * @Extends : BaseService
  13 + *
  14 + * @Description: TODO(站点路由service业务层)
  15 + *
  16 + * @Author bsth@lq
  17 + *
  18 + * @Date 2016年5月03日 上午9:21:17
  19 + *
  20 + * @Version 公交调度系统BS版 0.1
  21 + *
  22 + */
  23 +
  24 +@Service
  25 +public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integer> implements StationRouteService{
  26 +
  27 +}
... ...
src/main/java/com/bsth/service/impl/StationServiceImpl.java 0 → 100644
  1 +package com.bsth.service.impl;
  2 +
  3 +import org.springframework.stereotype.Service;
  4 +
  5 +import com.bsth.entity.Station;
  6 +import com.bsth.service.StationService;
  7 +
  8 +/**
  9 + *
  10 + * @ClassName: StationServiceImpl(站点service业务层实现类)
  11 + *
  12 + * @Extends : BaseService
  13 + *
  14 + * @Description: TODO(站点service业务层)
  15 + *
  16 + * @Author bsth@lq
  17 + *
  18 + * @Date 2016年05月03日 上午9:21:17
  19 + *
  20 + * @Version 公交调度系统BS版 0.1
  21 + *
  22 + */
  23 +
  24 +@Service
  25 +public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implements StationService{
  26 +
  27 +}
... ...
src/main/resources/static/pages/base/line/js/list.js
... ... @@ -39,7 +39,36 @@
39 39 // 清空搜索框值
40 40 $('tr.filter input,select').val('').change();
41 41 // 重新加载表格数据
42   - loadTableData(null,true);
  42 + loadTableDate(null,true);
  43 + });
  44 +
  45 + /**
  46 + * 搜索按钮事件
  47 + *
  48 + */
  49 + $('tr.filter .filter-submit').on('click',function(){
  50 + // cells 集合返回表格中所有(列)单元格的一个数组
  51 + var cells = $('tr.filter')[0].cells;
  52 + // 搜索参数集合
  53 + var params = {};
  54 + // 搜索字段名称
  55 + var name;
  56 + // 遍历cells数组
  57 + $.each(cells, function(i, cell){
  58 + // 获取第i列的input或者select集合
  59 + var items = $('input,select', cell);
  60 + // 遍历items集合
  61 + for(var j = 0, item; item = items[j++];){
  62 + // 获取字段名称
  63 + name = $(item).attr('name');
  64 + if(name){
  65 + // 赋取相对应的值
  66 + params[name] = $(item).val();
  67 + }
  68 + }
  69 + });
  70 + page = 0;
  71 + loadTableDate(params,true);
43 72 });
44 73  
45 74 /**
... ... @@ -51,6 +80,7 @@
51 80 *
52 81 */
53 82 function loadTableDate(param,isPon){
  83 + // 搜索参数
54 84 var params = {};
55 85 if(param)
56 86 params = param;
... ... @@ -58,9 +88,73 @@
58 88 params['order'] = 'id';
59 89 // 记录当前页数
60 90 params['page'] = page;
  91 + // 弹出正在加载层
61 92 var i = layer.load(2);
  93 + // 异步请求获取表格数据
62 94 $.get('/line',params,function(result){
63   - console.log(result);
  95 + // 把数据填充到模版中
  96 + var tbodyHtml = template('line_list_temp',{list:result.content});
  97 + // 把渲染好的模版html文本追加到表格中
  98 + $('#datatable_line tbody').html(tbodyHtml);
  99 + // 制定复选框
  100 + $('#datatable_line tbody').find('.icheck').iCheck(icheckOptions);
  101 + // 复选框改变事件
  102 + $('#datatable_line tbody').find('.icheck').on('ifChanged', iCheckChange);
  103 + // 是重新分页且返回数据长度大于0
  104 + if(isPon && result.content.length > 0){
  105 + // 重新分页
  106 + initPag = true;
  107 + // 分页栏
  108 + showPagination(result);
  109 + }
  110 + // 关闭弹出加载层
  111 + layer.close(i);
  112 + });
  113 + }
  114 +
  115 + /**
  116 + * 复选框组件
  117 + *
  118 + */
  119 + function iCheckChange(){
  120 + // 获取当前的父节点tr
  121 + var tr = $(this).parents('tr');
  122 +
  123 + // 判断当前是否选中
  124 + if(this.checked)
  125 + // 选中,则增添父节点tr的样式
  126 + tr.addClass('row-active');
  127 + else
  128 + // 未选中,则删除父节点tr的样式
  129 + tr.removeClass('row-active');
  130 + }
  131 +
  132 + /**
  133 + * 分页栏组件
  134 + *
  135 + */
  136 + function showPagination(data){
  137 + // 分页组件
  138 + $('#pagination').jqPaginator({
  139 + // 总页数
  140 + totalPages: data.totalPages,
  141 + // 中间显示页数
  142 + visiblePages: 6,
  143 + // 当前页
  144 + currentPage: page + 1,
  145 + first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>',
  146 + prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>',
  147 + next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>',
  148 + last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>',
  149 + page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>',
  150 + onPageChange: function (num, type) {
  151 + if(initPag){
  152 + initPag = false;
  153 + return;
  154 + }
  155 + page = num - 1;
  156 + loadTableDate(null, false);
  157 + }
64 158 });
65 159 }
66 160 })();
67 161 \ No newline at end of file
... ...
src/main/resources/static/pages/base/line/list.html
... ... @@ -30,33 +30,49 @@
30 30 <thead>
31 31 <tr role="row" class="heading">
32 32 <th width="3%">#</th>
33   - <th width="15%">线路编码</th>
34   - <th width="13%">线路名称</th>
35   - <th width="100">配车总数</th>
36   - <th width="11%">停车场编码</th>
37   - <th width="18%">起始站名称</th>
38   - <th width="10%">终点站名称</th>
39   - <th width="18%">操作</th>
  33 + <th width="8%">线路编码</th>
  34 + <th width="8%">线路名称</th>
  35 + <th width="8%">配车总数</th>
  36 + <th width="8%">停车场编码</th>
  37 + <th width="8%">起始站名称</th>
  38 + <th width="8%">终点站名称</th>
  39 + <th width="8%">所属分公司</th>
  40 + <th width="8%">所属公司</th>
  41 + <th width="8%">运营状态</th>
  42 + <th width="15%">操作</th>
40 43 </tr>
41 44 <tr role="row" class="filter">
42 45 <td></td>
43 46 <td>
44   - <input type="text" class="form-control form-filter input-sm" name="name_like">
  47 + <input type="text" class="form-control form-filter input-sm" name="lineCode">
45 48 </td>
46 49 <td>
47   - <input type="text" class="form-control form-filter input-sm" name="name_like">
  50 + <input type="text" class="form-control form-filter input-sm" name="name">
48 51 </td>
49 52 <td>
50   - <input type="text" class="form-control form-filter input-sm" name="url_like">
  53 + <input type="text" class="form-control form-filter input-sm" name="carSumNumber">
51 54 </td>
52 55 <td>
53   - <input type="text" class="form-control form-filter input-sm" name="url_like">
  56 + <input type="text" class="form-control form-filter input-sm" name="carParkCode">
54 57 </td>
55 58 <td>
56   - <input type="text" class="form-control form-filter input-sm" name="url_like">
  59 + <input type="text" class="form-control form-filter input-sm" name="startStationName">
57 60 </td>
58 61 <td>
59   - <input type="text" class="form-control form-filter input-sm" name="url_like">
  62 + <input type="text" class="form-control form-filter input-sm" name="endStationName">
  63 + </td>
  64 + <td>
  65 + <input type="text" class="form-control form-filter input-sm" name="brancheCompany">
  66 + </td>
  67 + <td>
  68 + <input type="text" class="form-control form-filter input-sm" name="company">
  69 + </td>
  70 + <td>
  71 + <select class="form-control form-filter " name="destroy">
  72 + <option value="">请选择...</option>
  73 + <option value="1">运营</option>
  74 + <option value="0">撤销</option>
  75 + </select>
60 76 </td>
61 77 <td>
62 78 <button class="btn btn-sm green btn-outline filter-submit margin-bottom" >
... ... @@ -79,4 +95,48 @@
79 95 </div>
80 96 </div>
81 97 </div>
  98 +<script type="text/html" id="line_list_temp">
  99 + {{each list as obj i }}
  100 + <tr>
  101 + <td style="vertical-align: middle;">
  102 + <input type="checkbox" class="group-checkable icheck" data-id="{{obj.id}}">
  103 + </td>
  104 + <td>
  105 + {{obj.lineCode}}
  106 + </td>
  107 + <td>
  108 + {{obj.name}}
  109 + </td>
  110 + <td>
  111 + {{obj.carSumNumber}}
  112 + </td>
  113 + <td>
  114 + {{obj.carParkCode}}
  115 + </td>
  116 + <td>
  117 + {{obj.startStationName}}
  118 + </td>
  119 + <td>
  120 + {{obj.endStationName}}
  121 + </td>
  122 + <td>
  123 + {{obj.company}}
  124 + </td>
  125 + <td>
  126 + {{obj.brancheCompany}}
  127 + </td>
  128 + <td>
  129 + {{obj.destroy}}
  130 + </td>
  131 + <td>
  132 + <a href="edit.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 详细 </a>
  133 + </td>
  134 + </tr>
  135 + {{/each}}
  136 + {{if list.length == 0}}
  137 + <tr>
  138 + <td colspan=8><h6 class="muted">没有找到相关数据</h6></td>
  139 + </tr>
  140 + {{/if}}
  141 +</script>
82 142 <script src="/pages/base/line/js/list.js"></script>
83 143 \ No newline at end of file
... ...