Commit d03e1796c24cd304c3def07aeaccd2600ef5bf2f

Authored by fangcheng
1 parent 8a11e77464
Exists in master

机构组管理

Showing 10 changed files with 289 additions and 49 deletions

parent/base.common/src/main/java/com/lyms/base/common/entity/organ/OrganGroup.java View file @ d03e179
... ... @@ -44,6 +44,9 @@
44 44 */
45 45 @TableField(value = "CLIENTADDRESS")
46 46 private String clientaddress;
  47 +
  48 + @TableField(exist=false)
  49 + private String orgIds;
47 50  
48 51 /**
49 52 * 0:可用 1:不可用
... ... @@ -98,6 +101,15 @@
98 101 public void setIfdel(Integer ifdel) {
99 102 this.ifdel = ifdel;
100 103 }
  104 +
  105 + public String getOrgIds() {
  106 + return orgIds;
  107 + }
  108 +
  109 + public void setOrgIds(String orgIds) {
  110 + this.orgIds = orgIds;
  111 + }
  112 +
101 113  
102 114 }
parent/base.common/src/main/java/com/lyms/base/common/service/organ/OrganGroupService.java View file @ d03e179
... ... @@ -58,6 +58,6 @@
58 58 * <li>修改时间:
59 59 */
60 60 public boolean updateGroup(OrganGroup organGrooup) throws SystemException;
61   -
  61 +
62 62 }
parent/base.common/src/main/java/com/lyms/base/common/service/organ/impl/OrganGroupServiceImpl.java View file @ d03e179
1 1 package com.lyms.base.common.service.organ.impl;
2 2  
3 3 import java.io.Serializable;
  4 +import java.util.List;
4 5  
5 6 import org.apache.commons.lang3.StringUtils;
  7 +import org.springframework.beans.factory.annotation.Autowired;
6 8 import org.springframework.stereotype.Service;
7 9 import org.springframework.transaction.annotation.Transactional;
8 10  
  11 +import com.baomidou.mybatisplus.mapper.EntityWrapper;
9 12 import com.baomidou.mybatisplus.service.impl.ServiceImpl;
10 13 import com.lyms.base.common.dao.organ.OrganGroupMapper;
  14 +import com.lyms.base.common.dao.organ.OrganGroupMapsMapper;
11 15 import com.lyms.base.common.entity.organ.OrganGroup;
  16 +import com.lyms.base.common.entity.organ.OrganGroupMaps;
  17 +import com.lyms.base.common.service.organ.OrganGroupMapsService;
12 18 import com.lyms.base.common.service.organ.OrganGroupService;
13 19 import com.lyms.exception.SystemException;
  20 +import com.lyms.util.InstanceUtils;
  21 +import com.lyms.util.StrUtils;
14 22  
15 23 /**
16 24 * <p>
17 25  
18 26  
19 27  
20 28  
21 29  
... ... @@ -22,18 +30,37 @@
22 30 */
23 31 @Service
24 32 public class OrganGroupServiceImpl extends ServiceImpl<OrganGroupMapper, OrganGroup> implements OrganGroupService {
  33 +
  34 + @Autowired
  35 + private OrganGroupMapsMapper organGroupMapsMapper;
25 36  
  37 + @Transactional
26 38 public Integer deleteLogicById(Serializable id) {
  39 + organGroupMapsMapper.delete(new EntityWrapper<OrganGroupMaps>().where("GROUP_ID={0}", id));
27 40 return baseMapper.deleteLogicById(id);
28 41 }
29 42  
30 43 @Override
31 44 @Transactional
32 45 public boolean create(OrganGroup organGroup) throws SystemException {
33   -
34 46 if (organGroup == null)
35 47 return false;
  48 + organGroup.setId(StrUtils.uuid());
  49 + if(StrUtils.isNotEmpty(organGroup.getOrgIds())){
  50 + String[] ids = organGroup.getOrgIds().split(",");
  51 + List<OrganGroupMaps> mapsList = InstanceUtils.newArrayList();
  52 + for(String id : ids){
  53 + OrganGroupMaps maps = new OrganGroupMaps();
  54 + maps.setId(StrUtils.uuid());
  55 + maps.setGroupId(organGroup.getId());
  56 + maps.setOrganId(id);
  57 + mapsList.add(maps);
  58 + organGroupMapsMapper.insert(maps);
  59 + }
  60 + organGroup.setOrgnumber(mapsList.size());
  61 + }
36 62 Integer tag = baseMapper.insert(organGroup);
  63 +
37 64 return tag != null && tag > 0;
38 65  
39 66 }
... ... @@ -52,11 +79,25 @@
52 79 @Override
53 80 @Transactional
54 81 public boolean updateGroup(OrganGroup organGroup) throws SystemException {
55   -
56   - if (organGroup == null)
57   - return false;
58   - Integer tag = baseMapper.updateById(organGroup);
59   - return tag != null && tag > 0;
  82 + if (organGroup == null)
  83 + return false;
  84 + organGroupMapsMapper.delete(new EntityWrapper<OrganGroupMaps>().where("GROUP_ID={0}", organGroup.getId()));
  85 + if(StrUtils.isNotEmpty(organGroup.getOrgIds())){
  86 + String[] ids = organGroup.getOrgIds().split(",");
  87 + List<OrganGroupMaps> mapsList = InstanceUtils.newArrayList();
  88 + for(String id : ids){
  89 + OrganGroupMaps maps = new OrganGroupMaps();
  90 + maps.setId(StrUtils.uuid());
  91 + maps.setGroupId(organGroup.getId());
  92 + maps.setOrganId(id);
  93 + mapsList.add(maps);
  94 + organGroupMapsMapper.insert(maps);
  95 + }
  96 + organGroup.setOrgnumber(mapsList.size());
  97 + }
  98 + Integer tag = baseMapper.updateById(organGroup);
  99 +
  100 + return tag != null && tag > 0;
60 101  
61 102 }
62 103 }
parent/center.manager/src/main/java/com/lyms/cm/controller/sys/SysOrganGroupController.java View file @ d03e179
... ... @@ -15,7 +15,11 @@
15 15 import com.baomidou.mybatisplus.plugins.Page;
16 16 import com.lyms.base.common.entity.organ.OrganGroup;
17 17 import com.lyms.base.common.enums.ValidityEnum;
  18 +import com.lyms.base.common.service.organ.OrganGroupMapsService;
18 19 import com.lyms.base.common.service.organ.OrganGroupService;
  20 +import com.lyms.constants.OperationName;
  21 +import com.lyms.util.StrUtils;
  22 +import com.lyms.web.bean.AjaxResult;
19 23 import com.lyms.web.controller.BaseController;
20 24  
21 25 /**
... ... @@ -32,6 +36,9 @@
32 36  
33 37 @Autowired
34 38 private OrganGroupService groupService;
  39 +
  40 + @Autowired
  41 + private OrganGroupMapsService organGroupMapsService;
35 42  
36 43 /**
37 44 * <li>@Description:跳转到租列表
38 45  
... ... @@ -76,10 +83,41 @@
76 83 if (!StringUtils.isBlank(id)) {
77 84 OrganGroup group = groupService.selectById(id);
78 85 model.addAttribute("group", group);
79   -
  86 +
80 87 }
81 88 return "/group/group_edit";
82 89 }
  90 + @ResponseBody
  91 + @RequestMapping(value = "/create", method = { RequestMethod.POST })
  92 + public AjaxResult create(OrganGroup organGroup, AjaxResult ajaxResult) {
  93 + boolean tag = groupService.create(organGroup);
  94 + return handleAjaxResult(ajaxResult, tag, OperationName.CREATE);
  95 + }
  96 +
  97 + @ResponseBody
  98 + @RequestMapping(value = "/update", method = { RequestMethod.POST })
  99 + public AjaxResult update(OrganGroup organGroup, AjaxResult ajaxResult) {
  100 + boolean tag = groupService.updateGroup(organGroup);
  101 + return handleAjaxResult(ajaxResult, tag, OperationName.UPDATE);
  102 + }
  103 +
  104 + @RequestMapping(value = "/{id}/delete", method = { RequestMethod.GET, RequestMethod.POST })
  105 + @ResponseBody
  106 + public AjaxResult delete(@PathVariable String id, AjaxResult ajaxResult) {
  107 + int tag = groupService.deleteLogicById(id);
  108 + return handleAjaxResult(ajaxResult, tag, OperationName.DELETE);
  109 + }
  110 +
  111 +
  112 + @ResponseBody
  113 + @RequestMapping(value = "/listGroupOrg/{groupId}", method = { RequestMethod.GET, RequestMethod.POST })
  114 + public Map<String, Object> listGroupOrg(@PathVariable String groupId) {
  115 + Page<OrganGroup> page = getPage();
  116 + if(StrUtils.isNotEmpty(groupId)){
  117 + page = organGroupMapsService.getOrgList(page,groupId);
  118 + }
  119 + return toGridData(page);
  120 + }
83 121  
84 122 }
parent/center.manager/src/main/java/com/lyms/cm/controller/sys/SysOrganizationsController.java View file @ d03e179
... ... @@ -65,6 +65,9 @@
65 65 String provinceId = organizations.getProvinceId();
66 66 String cityId = organizations.getCityId();
67 67 String areaId = organizations.getAreaId();
  68 + if(StringUtils.isNotBlank(organizations.getName())){
  69 + ew.where("NAME like {0}", "%"+organizations.getName()+"%");
  70 + }
68 71 if (StringUtils.isNotBlank(provinceId)) {
69 72 ew.where("PROVINCE_ID={0}", provinceId);
70 73 }
parent/center.manager/src/main/webapp/WEB-INF/views/group/group_edit.html View file @ d03e179
... ... @@ -28,7 +28,14 @@
28 28 <input type="text" value="$!group.clientaddress" placeholder="连接地址" aria-required="true" required="true" minlength="3" name="clientaddress" class="form-control" id="shortCode">
29 29 </div>
30 30 </div>
31   -
  31 + <div class="form-group">
  32 + <label class="col-sm-3 control-label">机构列表:</label>
  33 + <button class="btn btn-info " type="button" onclick="del();"><i class="fa fa-trash"></i> 移除</button>
  34 + </div>
  35 + <div class="form-group">
  36 + <input type="hidden" id="orgIds" name="orgIds"/>
  37 + <table id="orgList"></table>
  38 + </div>
32 39 <div class="hr-line-dashed"></div>
33 40 <div class="form-group">
34 41 <div class="col-sm-4 col-sm-offset-3 pull-right">
35 42  
... ... @@ -40,11 +47,60 @@
40 47 </div>
41 48 <!-- 机构组拥有机构 -->
42 49 <div class="col-sm-8">
43   - <table id="dataTable"></table>
44   - </div>
  50 + <div style="padding-top:30px;">
  51 + <form class="form-inline">
  52 + <div class="form-group">
  53 + <input type="text" placeholder="请输入机构名过滤" id="groupName" name="groupName" class="form-control">
  54 + </div>
  55 + <div class="form-group" onclick="search();">
  56 + <a class="btn btn-primary"><i class="fa fa-search"></i> 查询</a>
  57 + </div>
  58 + <div class="form-group" onclick="add();">
  59 + <a class="btn btn-primary"><i class="fa fa-plus"></i> 添加</a>
  60 + </div>
  61 + </form>
  62 + </div>
  63 + <table id="dataTable"></table>
45 64 </div>
46 65 </div>
47 66 <script type="text/javascript">
  67 +function search(){
  68 + var queryParams = {
  69 + query:{
  70 + name: $("#groupName").val()
  71 + }
  72 + }
  73 + $('#dataTable').bootstrapTable('refresh', queryParams );
  74 +}
  75 +function add(){
  76 + var list = $('#dataTable').bootstrapTable('getSelections');
  77 + for(var i = 0 ; i< list.length ; i++){
  78 + if(! $('#orgList').bootstrapTable('getRowByUniqueId', list[i]['id'])){
  79 + var row = [];
  80 + row.push({
  81 + id: list[i]['id'],
  82 + name: list[i]['name']
  83 + });
  84 + $('#orgList').bootstrapTable('append', row);
  85 + }
  86 + }
  87 + $('#orgIds').val(getOrgIds());
  88 +}
  89 +function del(){
  90 + var list = $('#orgList').bootstrapTable('getSelections');
  91 + for(var i = 0 ; i< list.length ; i++){
  92 + $('#orgList').bootstrapTable('remove', {field: 'id', values: list[i]['id']});
  93 + }
  94 + $('#orgIds').val(getOrgIds());
  95 +}
  96 +function getOrgIds(){
  97 + var list = $('#orgList').bootstrapTable('getData');
  98 + var ids = [];
  99 + for(var i = 0 ;i < list.length ;i++){
  100 + ids.push(list[i]['id']);
  101 + }
  102 + return ids.join(',');
  103 +}
48 104 function save(){
49 105 if($('#validForm').valid()){
50 106 var data = $('#validForm').serialize();
... ... @@ -137,4 +193,80 @@
137 193 </script>
138 194 #end
139 195 #extends("/common/base_list.html")
  196 +
  197 +<script type="text/javascript">
  198 +//拥有机构列表
  199 +$(function () {
  200 + var orgListTable = new orgLostTableInit();
  201 + orgListTable.Init();
  202 +})
  203 +
  204 +
  205 +
  206 +var orgLostTableInit = function () {
  207 + var orgListTableInit = new Object();
  208 + //初始化Table
  209 + orgListTableInit.Init = function () {
  210 + $('#orgList').bootstrapTable({
  211 + url: '${ctx}/sysOrganGroup/listGroupOrg/$!group.id', //请求后台的URL(*)
  212 + method: 'get', //请求方式(*)
  213 + striped: true, //是否显示行间隔色
  214 + cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  215 + sortable: false, //是否启用排序
  216 + queryParams: orgListTableInit.queryParams,//传递参数(*)
  217 + sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  218 + pageNumber:1, //初始化加载第一页,默认第一页
  219 + pageSize: 999, //每页的记录行数(*)
  220 + pageList: [999], //可供选择的每页的行数(*)
  221 + strictSearch: true,
  222 + clickToSelect: true, //是否启用点击选中行
  223 + //height: 600, //行高,如果没有设置height属性,表格自动根据记录条数觉得表格高度
  224 + uniqueId: "id", //每一行的唯一标识,一般为主键列
  225 + cardView: false, //是否显示详细视图
  226 + detailView: false, //是否显示父子表
  227 + columns: [{
  228 + field: 'check_state',
  229 + title: '',
  230 + checkbox: true
  231 + },{
  232 + field: 'id',
  233 + title: '序号',
  234 + visible: false
  235 + }, {
  236 + field: 'name',
  237 + title: '机构名称'
  238 + }],
  239 + onLoadSuccess: function(){ //加载成功时执行
  240 + var list = $('#orgList').bootstrapTable('getData');
  241 + var ids = [];
  242 + for(var i = 0 ;i< list.length ; i++ ){
  243 + ids.push(list[i]['id']);
  244 + }
  245 + $('#orgIds').val(ids.join(','));
  246 + }
  247 + });
  248 + };
  249 +
  250 + //得到查询的参数
  251 + orgListTableInit.queryParams = function (params) {
  252 + var temp = { //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
  253 + _size: 999, //每页记录数
  254 + _offset: 1 , //偏移量
  255 + /*sdate: $("#stratTime").val(),
  256 + edate: $("#endTime").val(),
  257 + sellerid: $("#sellerid").val(),
  258 + orderid: $("#orderid").val(),
  259 + CardNumber: $("#CardNumber").val(),
  260 + maxrows: params.limit,
  261 + pageindex: params.pageNumber,
  262 + portid: $("#portid").val(),
  263 + CardNumber: $("#CardNumber").val(),
  264 + tradetype: $('input:radio[name="tradetype"]:checked').val(),
  265 + success: $('input:radio[name="success"]:checked').val(),*/
  266 + };
  267 + return temp;
  268 + };
  269 + return orgListTableInit;
  270 +};
  271 +</script>
parent/center.manager/src/main/webapp/WEB-INF/views/group/group_list.html View file @ d03e179
1 1 #override("body")
2 2  
3   -<div class="ibox float-e-margins">
4   - <div class="rows" style="width: 100%">
5   - <div class="col-sm-10">
6   - <div class="row wrapper border-bottom white-bg page-heading">
7   - <div class="col-sm-4">
8   - <div style="padding-top:30px;">
9   - <form role="form" class="form-inline">
10   - <div class="form-group">
11   - <span class="form-control"> 机构组</span>
12   - <input type="text" placeholder="请输入机构组名称" id="usernameSearch" class="form-control">
13   - </div>
14   - </form>
15   - </div>
16   - </div>
17   -
18   - <div class="col-sm-2">
19   - <div class="title-action">
20   - <a class="btn btn-primary"><i class="fa fa-search"></i> 查询</a>
21   - </div>
22   - </div>
23   - </div>
24   - <div class="wrapper wrapper-content">
25   - <div class="row">
26   - <div class="col-sm-12">
27   - <div id="toolbar">
28   - <button class="btn btn-info " type="button" onclick="add();"><i class="fa fa-plus"></i> 新增</button>
29   - <button class="btn btn-info " type="button" onclick="edit();"><i class="fa fa-paste"></i> 编辑</button>
30   - <button class="btn btn-info " type="button" onclick="del();"><i class="fa fa-trash"></i> 删除</button>
31   - </div>
32   - <table id="dataTable"></table>
33   - </div>
34   - </div>
35   - </div>
36   - </div>
  3 +<div class="ibox float-e-margins"><div class="row wrapper border-bottom white-bg page-heading">
  4 + <div class="col-sm-10">
  5 + <div style="padding-top:30px;">
  6 + <form role="form" class="form-inline">
  7 + <div class="form-group">
  8 + <input type="text" placeholder="角色名" id="searchName" class="form-control">
  9 + </div>
  10 + <div class="form-group">
  11 + <select class="form-control m-b" name="type" id="searchType" style="margin-bottom: 0;">
  12 + <option value="">所有</option>
  13 + <option value="1">用户角色</option>
  14 + <option value="0">管理员角色</option>
  15 + </select>
  16 + </div>
  17 + <div class="form-group">
  18 + <input type="text" placeholder="角色id编号" id="searchId" class="form-control">
  19 + </div>
  20 + </form>
  21 + </div>
  22 + </div>
  23 + <div class="col-sm-2">
  24 + <div class="title-action" onclick="search();">
  25 + <a class="btn btn-primary"><i class="fa fa-search"></i> 查询</a>
  26 + </div>
  27 + </div>
  28 +</div>
  29 +<div class="wrapper wrapper-content">
  30 + <div class="row">
  31 + <div class="col-sm-12">
  32 + <div id="toolbar">
  33 + <button class="btn btn-info " type="button" onclick="add();"><i class="fa fa-plus"></i> 新增</button>
  34 + <button class="btn btn-info " type="button" onclick="edit();"><i class="fa fa-paste"></i> 编辑</button>
  35 + <button class="btn btn-info " type="button" onclick="del();"><i class="fa fa-trash"></i> 删除</button>
  36 + </div>
  37 + <table id="dataTable"></table>
  38 + </div>
37 39 </div>
38 40 </div>
39 41 #end
parent/center.manager/src/main/webapp/WEB-INF/views/organ/org_list.html View file @ d03e179
... ... @@ -42,13 +42,13 @@
42 42 var controllerRequestMappint = "/sysOrganizations/";
43 43  
44 44 function add() {
45   - popWindow("添加结构", APP.PATH + controllerRequestMappint + "/toEdit?orgId=",700,550);
  45 + fullWindow("添加机构", APP.PATH + controllerRequestMappint + "/toEdit?orgId=");
46 46 }
47 47  
48 48 function edit(){
49 49 var id = getSingleSelectedValue("dataTable","id");
50 50 if(id){
51   - popWindow("修改机构", APP.PATH + controllerRequestMappint + "toEdit?orgId="+id,700,550);
  51 + fullWindow("修改机构", APP.PATH + controllerRequestMappint + "toEdit?orgId="+id);
52 52 }
53 53 }
54 54  
parent/center.manager/src/main/webapp/WEB-INF/views/user/user_list.html View file @ d03e179
... ... @@ -12,6 +12,10 @@
12 12 <div class="form-group">
13 13 <input type="text" placeholder="手机号" id="searchPhone" class="form-control">
14 14 </div>
  15 + <div class="form-group" id="leve">
  16 + <span class="form-control">所属区域</span>
  17 + #extends("/organ/org.html")
  18 + </div>
15 19 </form>
16 20 </div>
17 21 </div>
... ... @@ -105,4 +109,12 @@
105 109 </script>
106 110 #end
107 111 #extends("/common/base_list.html")
  112 +<script src="${ctx}/static/js/area.js"></script>
  113 +<script type="text/javascript">
  114 +//初始信息
  115 +get("",function(data){
  116 + handler(data,"leve0");
  117 + //填充选择信息
  118 +});
  119 +</script>
parent/pom.xml View file @ d03e179
... ... @@ -11,7 +11,7 @@
11 11 <mysql.jdbc.version>5.1.34</mysql.jdbc.version>
12 12 <spring.version>4.2.5.RELEASE</spring.version>
13 13 <aspectjweaver.version>1.8.9</aspectjweaver.version>
14   - <mybatis-plus.version>2.0.1</mybatis-plus.version>
  14 + <mybatis-plus.version>2.0.5</mybatis-plus.version>
15 15 <fastjson.version>1.2.8</fastjson.version>
16 16 <slf4j.version>1.7.21</slf4j.version>
17 17 <logback.version>1.0.13</logback.version>