Commit c5e7606ad44602c4a2ede38899f5b25bd85d5cfd

Authored by 李强
2 parents 72e5c26f ecf87ecb

Merge branch 'master' of git@192.168.168.201:panzhaov5/bsth_control.git

src/main/java/com/bsth/Application.java
1 1 package com.bsth;
2 2  
  3 +import com.fasterxml.jackson.databind.ObjectMapper;
  4 +import com.fasterxml.jackson.databind.SerializationFeature;
3 5 import org.springframework.boot.SpringApplication;
4 6 import org.springframework.boot.autoconfigure.*;
  7 +import org.springframework.context.annotation.Bean;
  8 +import org.springframework.context.annotation.Primary;
5 9  
6 10 @SpringBootApplication
7 11 public class Application{
  12 +
  13 + @Bean
  14 + @Primary
  15 + public ObjectMapper objectMapper() {
  16 + ObjectMapper objectMapper = new ObjectMapper();
  17 + objectMapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
  18 +
  19 + return objectMapper;
  20 + }
8 21  
9 22 public static void main(String[] args) throws Exception {
10 23 SpringApplication.run(Application.class, args);
... ...
src/main/java/com/bsth/entity/Cars.java
... ... @@ -3,6 +3,7 @@ package com.bsth.entity;
3 3 import com.bsth.entity.sys.SysUser;
4 4  
5 5 import javax.persistence.*;
  6 +import java.io.Serializable;
6 7 import java.util.Date;
7 8  
8 9 /**
... ... @@ -21,7 +22,7 @@ import java.util.Date;
21 22  
22 23 @Entity
23 24 @Table(name = "bsth_c_cars")
24   -public class Cars {
  25 +public class Cars implements Serializable {
25 26  
26 27 /** 主键Id */
27 28 @Id
... ...
src/main/java/com/bsth/entity/Line.java
1 1 package com.bsth.entity;
2 2  
3   -import java.util.Date;
4   -
5   -import javax.persistence.Column;
6   -import javax.persistence.Entity;
7   -import javax.persistence.GeneratedValue;
8   -import javax.persistence.GenerationType;
9   -import javax.persistence.Id;
10   -import javax.persistence.OneToMany;
11   -import javax.persistence.OneToOne;
12   -import javax.persistence.Table;
13   -
14 3 import org.springframework.format.annotation.DateTimeFormat;
15 4  
  5 +import javax.persistence.*;
  6 +import java.io.Serializable;
  7 +import java.util.Date;
  8 +
16 9  
17 10 /**
18 11 *
... ... @@ -30,7 +23,7 @@ import org.springframework.format.annotation.DateTimeFormat;
30 23  
31 24 @Entity
32 25 @Table(name = "bsth_c_line")
33   -public class Line {
  26 +public class Line implements Serializable {
34 27  
35 28 // 线路ID
36 29 @Id
... ...
src/main/java/com/bsth/entity/schedule/CarConfigInfo.java
... ... @@ -5,6 +5,7 @@ import com.bsth.entity.Line;
5 5 import com.bsth.entity.sys.SysUser;
6 6  
7 7 import javax.persistence.*;
  8 +import java.io.Serializable;
8 9 import java.util.Date;
9 10  
10 11 /**
... ... @@ -12,7 +13,13 @@ import java.util.Date;
12 13 */
13 14 @Entity
14 15 @Table(name = "bsth_c_s_ccinfo")
15   -public class CarConfigInfo {
  16 +@NamedEntityGraphs({
  17 + @NamedEntityGraph(name = "carConfigInfo_xl_cl", attributeNodes = {
  18 + @NamedAttributeNode("xl"),
  19 + @NamedAttributeNode("cl")
  20 + })
  21 +})
  22 +public class CarConfigInfo implements Serializable {
16 23  
17 24 /** 主健Id */
18 25 @Id
... ...
src/main/java/com/bsth/repository/schedule/CarConfigInfoRepository.java
... ... @@ -2,6 +2,9 @@ package com.bsth.repository.schedule;
2 2  
3 3 import com.bsth.entity.schedule.CarConfigInfo;
4 4 import com.bsth.repository.BaseRepository;
  5 +import org.springframework.data.domain.Page;
  6 +import org.springframework.data.domain.Pageable;
  7 +import org.springframework.data.jpa.repository.EntityGraph;
5 8 import org.springframework.stereotype.Repository;
6 9  
7 10 /**
... ... @@ -9,4 +12,8 @@ import org.springframework.stereotype.Repository;
9 12 */
10 13 @Repository
11 14 public interface CarConfigInfoRepository extends BaseRepository<CarConfigInfo, Long> {
  15 +
  16 + @EntityGraph(value = "carConfigInfo_xl_cl", type = EntityGraph.EntityGraphType.FETCH)
  17 + @Override
  18 + Page<CarConfigInfo> findAll(Pageable pageable);
12 19 }
... ...
src/main/resources/static/pages/scheduleApp/module/core/busConfig/busConfig.js
1 1 // 车辆配置管理 service controller 等写在一起
2   -angular.module('ScheduleApp').factory('BusConfigService', ['$resource', function($resource) {
3   - // TODO:测试
4   - return $resource(
5   - '/cci',
6   - {},
7   - {
8   - list: {
9   - method: 'GET'
  2 +angular.module('ScheduleApp').factory('BusConfigService', ['BusConfigService_g', function(service) {
  3 + /** 当前的查询条件信息 */
  4 + var currentSearchCondition = {};
  5 +
  6 + /** 当前第几页 */
  7 + var currentPageNo = 1;
  8 +
  9 + return {
  10 + /**
  11 + * 获取查询条件信息,
  12 + * 用于给controller用来和页面数据绑定。
  13 + */
  14 + getSearchCondition: function() {
  15 + return currentSearchCondition;
  16 + },
  17 + /**
  18 + * 重置查询条件信息。
  19 + */
  20 + resetSearchCondition: function() {
  21 + var key;
  22 + for (key in currentSearchCondition) {
  23 + currentSearchCondition[key] = "";
10 24 }
  25 + },
  26 + /**
  27 + * 设置当前页码。
  28 + * @param cpn 从1开始,后台是从0开始的
  29 + */
  30 + setCurrentPageNo: function(cpn) {
  31 + currentPageNo = cpn;
  32 + },
  33 + /**
  34 + * 组装查询参数,返回一个promise查询结果。
  35 + * @param params 查询参数
  36 + * @return 返回一个 promise
  37 + */
  38 + getPage: function() {
  39 + var params = currentSearchCondition; // 查询条件
  40 + params.page = currentPageNo - 1; // 服务端页码从0开始
  41 + return service.list(params).$promise;
  42 + },
  43 + /**
  44 + * 获取明细信息。
  45 + * @param id 车辆id
  46 + * @return 返回一个 promise
  47 + */
  48 + getDetail: function(id) {
  49 + var params = {id: id};
  50 + return service.get(params).$promise;
  51 + },
  52 + /**
  53 + * 保存信息。
  54 + * @param obj 车辆详细信息
  55 + * @return 返回一个 promise
  56 + */
  57 + saveDetail: function(obj) {
  58 + return service.save(obj).$promise;
11 59 }
12   - );
  60 + };
  61 +
13 62 }]);
14 63  
15   -angular.module('ScheduleApp').controller('BusConfigCtrl', ['BusConfigService', function(busConfigService) {
  64 +angular.module('ScheduleApp').controller('BusConfigCtrl', ['BusConfigService', '$state', function(busConfigService, $state) {
  65 + var self = this;
16 66  
  67 + // 切换到form状态
  68 + self.goForm = function() {
  69 + //alert("切换");
  70 + $state.go("busConfig_form");
  71 + }
17 72 }]);
18 73  
19 74 angular.module('ScheduleApp').controller('BusConfigListCtrl', ['BusConfigService', function(busConfigService) {
20   - // TODO:模拟数据
21 75 var self = this;
22   - self.totalItems = 64;
23   - self.currentPage = 4;
24   - self.infos = {};
25   - self.pageChanaged = function() {
26   - console.log("页面跳转到:" + currentPage.currentPage);
27   - }
28   -}]);
  76 + self.pageInfo = {
  77 + totalItems : 0,
  78 + currentPage : 1,
  79 + infos: []
  80 + };
  81 +
  82 + // 初始创建的时候,获取一次列表数据
  83 + busConfigService.getPage().then(
  84 + function(result) {
  85 + self.pageInfo.totalItems = result.totalElements;
  86 + self.pageInfo.currentPage = result.number + 1;
  87 + self.pageInfo.infos = result.content;
  88 + busConfigService.setCurrentPageNo(result.number + 1);
  89 + },
  90 + function(result) {
  91 + alert("出错啦!");
  92 + }
  93 + );
29 94  
30   -angular.module('ScheduleApp').controller('BusConfigFormCtrl', ['BusConfigService', function(busConfigService) {
  95 + //$scope.$watch("ctrl.pageInfo.currentPage", function() {
  96 + // alert("dfdfdf");
  97 + //});
  98 +
  99 + // 翻页的时候调用
  100 + self.pageChanaged = function() {
  101 + busConfigService.setCurrentPageNo(self.pageInfo.currentPage);
  102 + busConfigService.getPage().then(
  103 + function(result) {
  104 + self.pageInfo.totalItems = result.totalElements;
  105 + self.pageInfo.currentPage = result.number + 1;
  106 + self.pageInfo.infos = result.content;
  107 + busConfigService.setCurrentPageNo(result.number + 1);
  108 + },
  109 + function(result) {
  110 + alert("出错啦!");
  111 + }
  112 + );
  113 + };
  114 + // 获取查询条件数据
  115 + self.searchCondition = function() {
  116 + return busConfigService.getSearchCondition();
  117 + };
  118 + // 重置查询条件
  119 + self.resetSearchCondition = function() {
  120 + return busConfigService.resetSearchCondition();
  121 + };
31 122  
32 123 }]);
33 124  
34   -angular.module('ScheduleApp').controller('BusConfigDetailCtrl', ['BusConfigService', function(busConfigService) {
  125 +angular.module('ScheduleApp').controller('BusConfigFormCtrl', ['BusConfigService', '$stateParams', '$state', function(busConfigService, $stateParams, $state) {
  126 + // TODO:
  127 +}]);
35 128  
  129 +angular.module('ScheduleApp').controller('BusConfigDetailCtrl', ['BusConfigService', '$stateParams', function(busConfigService, $stateParams) {
  130 + // TODO:
36 131 }]);
37 132  
38 133  
... ...
src/main/resources/static/pages/scheduleApp/module/core/busConfig/edit.html 0 → 100644
src/main/resources/static/pages/scheduleApp/module/core/busConfig/index.html
1 1 <div class="page-head">
2 2 <div class="page-title">
3   - <h1>车辆配置</h1>
  3 + <h1>车辆配置管理</h1>
4 4 </div>
5 5 </div>
6 6  
... ... @@ -14,7 +14,7 @@
14 14 <i class="fa fa-circle"></i>
15 15 </li>
16 16 <li>
17   - <span class="active">车俩配置</span>
  17 + <span class="active">车俩配置管理</span>
18 18 </li>
19 19 </ul>
20 20  
... ... @@ -27,7 +27,7 @@
27 27 <span class="caption-subject bold uppercase">配置表</span>
28 28 </div>
29 29 <div class="actions">
30   - <a href="javascirpt:" class="btn btn-circle blue">
  30 + <a href="javascirpt:" class="btn btn-circle blue" ng-click="ctrl.goForm()">
31 31 <i class="fa fa-plus"></i>
32 32 添加配置
33 33 </a>
... ... @@ -58,7 +58,7 @@
58 58 </div>
59 59  
60 60 <div class="portlet-body">
61   - <div ui-view="list"></div>
  61 + <div ui-view="busConfig_list"></div>
62 62 </div>
63 63 </div>
64 64 </div>
... ...
src/main/resources/static/pages/scheduleApp/module/core/busConfig/list.html
... ... @@ -2,7 +2,7 @@
2 2 <div ng-controller="BusConfigListCtrl as ctrl">
3 3 <table class="table table-striped table-bordered table-hover table-checkable order-column">
4 4 <thead>
5   - <tr>
  5 + <tr role="row" class="heading">
6 6 <th>
7 7 <input type="checkbox" class="group-checkable"/>
8 8 </th>
... ... @@ -16,28 +16,49 @@
16 16 <th>是否切换</th>
17 17 <th>操作</th>
18 18 </tr>
  19 + <tr role="row" class="filter">
  20 + <td></td>
  21 + <td></td>
  22 + <td></td>
  23 + <td></td>
  24 + <td></td>
  25 + <td></td>
  26 + <td></td>
  27 + <td>
  28 + <input type="text" class="form-control form-filter input-sm" ng-model="ctrl.searchCondition().tcd_like"/>
  29 + </td>
  30 + <td></td>
  31 + <td>
  32 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom"
  33 + ng-click="ctrl.pageChanaged()">
  34 + <i class="fa fa-search"></i> 搜索</button>
  35 +
  36 + <button class="btn btn-sm red btn-outline filter-cancel"
  37 + ng-click="ctrl.resetSearchCondition()">
  38 + <i class="fa fa-times"></i> 重置</button>
  39 + </td>
  40 +
  41 + </tr>
  42 +
19 43 </thead>
20 44 <tbody>
21   - <tr ng-repeat="info in ctrl.infos" class="odd gradeX">
  45 + <tr ng-repeat="info in ctrl.pageInfo.infos" class="odd gradeX">
22 46 <td>
23 47 <input type="checkbox"/>
24 48 </td>
25 49 <td>
26   - <span>TODO</span>
  50 + <span ng-bind="$index + 1"></span>
27 51 </td>
28 52 <td>
29 53 <span ng-bind="info.xl.name"></span>
30 54 </td>
31 55 <td>
32   - <span ng-bind="info.cl.carCode"></span>
  56 + <span ng-bind="info.cl.insideCode"></span>
33 57 </td>
34 58 <td>
35 59 <span ng-bind="info.cl.equipmentCode"></span>
36 60 </td>
37 61 <td>
38   - <span ng-bind="info.personnelType"></span>
39   - </td>
40   - <td>
41 62 <span ng-bind="info.qyrq | date: 'yyyy-MM-dd HH:mm:ss'"></span>
42 63 </td>
43 64 <td>
... ... @@ -50,18 +71,26 @@
50 71 <span ng-bind="info.isSwitch"></span>
51 72 </td>
52 73 <td>
53   - <span>TODO</span>
  74 + <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>-->
  75 + <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>-->
  76 + <a ui-sref="busConfig_detail({id: info.id})" class="btn default blue-stripe btn-sm"> 详细 </a>
  77 + <a ui-sref="busConfig_edit({id: info.id})" class="btn default blue-stripe btn-sm"> 修改 </a>
54 78 </td>
55 79 </tr>
56 80 </tbody>
57 81 </table>
58 82  
59 83 <div style="text-align: right;">
60   - <uib-pagination total-items="ctrl.totalItems"
61   - ng-model="ctrl.currentPage"
62   - ng-change="ctrl.pageChanged()"
  84 + <uib-pagination total-items="ctrl.pageInfo.totalItems"
  85 + ng-model="ctrl.pageInfo.currentPage"
  86 + ng-change="ctrl.pageChanaged()"
  87 + rotate="false"
  88 + max-size="10"
  89 + boundary-links="true"
  90 + first-text="首页"
63 91 previous-text="上一页"
64   - next-text="下一页">
  92 + next-text="下一页"
  93 + last-text="尾页">
65 94 </uib-pagination>
66 95 </div>
67 96 </div>
68 97 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/main.js
... ... @@ -114,7 +114,7 @@ ScheduleApp.config([&#39;$stateProvider&#39;, &#39;$urlRouterProvider&#39;, function($stateProvi
114 114 resolve: {
115 115 deps: ['$ocLazyLoad', function($ocLazyLoad) {
116 116 return $ocLazyLoad.load({
117   - name: 'busInfoManage_module',
  117 + name: 'busInfoManage_detail_module',
118 118 insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
119 119 files: [
120 120 "pages/scheduleApp/module/basicInfo/busInfoManage/busInfoManage.js"
... ... @@ -194,7 +194,7 @@ ScheduleApp.config([&#39;$stateProvider&#39;, &#39;$urlRouterProvider&#39;, function($stateProvi
194 194 resolve: {
195 195 deps: ['$ocLazyLoad', function($ocLazyLoad) {
196 196 return $ocLazyLoad.load({
197   - name: 'employeeInfoManage_module',
  197 + name: 'employeeInfoManage_detail_module',
198 198 insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
199 199 files: [
200 200 "pages/scheduleApp/module/basicInfo/employeeInfoManage/employeeInfoManage.js"
... ... @@ -274,7 +274,7 @@ ScheduleApp.config([&#39;$stateProvider&#39;, &#39;$urlRouterProvider&#39;, function($stateProvi
274 274 resolve: {
275 275 deps: ['$ocLazyLoad', function($ocLazyLoad) {
276 276 return $ocLazyLoad.load({
277   - name: 'deviceInfoManage_module',
  277 + name: 'deviceInfoManage_detail_module',
278 278 insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
279 279 files: [
280 280 "pages/scheduleApp/module/basicInfo/deviceInfoManage/deviceInfoManage.js"
... ... @@ -284,13 +284,6 @@ ScheduleApp.config([&#39;$stateProvider&#39;, &#39;$urlRouterProvider&#39;, function($stateProvi
284 284 }
285 285 })
286 286  
287   -
288   -
289   -
290   -
291   -
292   -
293   -
294 287 // 车辆配置模块
295 288 .state("busConfig", {
296 289 url: '/busConfig',
... ... @@ -298,7 +291,7 @@ ScheduleApp.config([&#39;$stateProvider&#39;, &#39;$urlRouterProvider&#39;, function($stateProvi
298 291 "": {
299 292 templateUrl: 'pages/scheduleApp/module/core/busConfig/index.html'
300 293 },
301   - "list@busConfig": {
  294 + "busConfig_list@busConfig": {
302 295 templateUrl: 'pages/scheduleApp/module/core/busConfig/list.html'
303 296 }
304 297 },
... ... @@ -315,6 +308,76 @@ ScheduleApp.config([&#39;$stateProvider&#39;, &#39;$urlRouterProvider&#39;, function($stateProvi
315 308 }]
316 309 }
317 310 })
  311 + .state("busConfig_form", {
  312 + url: '/busConfig_form',
  313 + views: {
  314 + "": {templateUrl: 'pages/scheduleApp/module/core/busConfig/form.html'}
  315 + },
  316 + resolve: {
  317 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  318 + return $ocLazyLoad.load({
  319 + name: 'busConfig_form_module',
  320 + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
  321 + files: [
  322 + "assets/bower_components/angular-ui-select/dist/select.min.css",
  323 + "assets/bower_components/angular-ui-select/dist/select.min.js",
  324 + "pages/scheduleApp/module/core/busConfig/busConfig.js"
  325 + ]
  326 + });
  327 + }]
  328 + }
  329 + })
  330 + .state("busConfig_edit", {
  331 + url: '/busConfig_edit/:id',
  332 + views: {
  333 + "": {templateUrl: 'pages/scheduleApp/module/core/busConfig/edit.html'}
  334 + },
  335 + resolve: {
  336 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  337 + return $ocLazyLoad.load({
  338 + name: 'busConfig_edit_module',
  339 + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
  340 + files: [
  341 + "assets/bower_components/angular-ui-select/dist/select.min.css",
  342 + "assets/bower_components/angular-ui-select/dist/select.min.js",
  343 + "pages/scheduleApp/module/core/busConfig/busConfig.js"
  344 + ]
  345 + });
  346 + }]
  347 + }
  348 + })
  349 + .state("busConfig_detail", {
  350 + url: '/busConfig_detail/:id',
  351 + views: {
  352 + "": {templateUrl: 'pages/scheduleApp/module/core/busConfig/detail.html'}
  353 + },
  354 + resolve: {
  355 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  356 + return $ocLazyLoad.load({
  357 + name: 'busConfig_detail_module',
  358 + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
  359 + files: [
  360 + "pages/scheduleApp/module/core/busConfig/busConfig.js"
  361 + ]
  362 + });
  363 + }]
  364 + }
  365 + })
  366 +
  367 +
  368 +
  369 +
  370 +
  371 +
  372 +
  373 +
  374 +
  375 +
  376 +
  377 +
  378 +
  379 +
  380 +
318 381  
319 382 // 人员配置模块
320 383 .state("employeeConfig", {
... ... @@ -433,6 +496,28 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;DeviceInfoManageService_g&#39;, [&#39;$resource&#39;,
433 496 );
434 497 }]);
435 498  
  499 +// 车辆配置service
  500 +angular.module('ScheduleApp').factory('BusConfigService_g', ['$resource', function($resource) {
  501 + return $resource(
  502 + '/cci/:id',
  503 + {order: 'createDate', direction: 'DESC', id: '@id_route'}, // TODO:以后需要根据属性对象的属性查询
  504 + {
  505 + list: {
  506 + method: 'GET',
  507 + params: {
  508 + page: 0
  509 + }
  510 + },
  511 + get: {
  512 + method: 'GET'
  513 + },
  514 + save: {
  515 + method: 'POST'
  516 + }
  517 + }
  518 + );
  519 +}]);
  520 +
436 521  
437 522  
438 523  
... ...