增加接口完善区域用户功能
This commit is contained in:
parent
6995037bc3
commit
c637b2a344
@ -2,15 +2,19 @@ package ink.wgink.module.dictionary.controller.api;
|
|||||||
|
|
||||||
import ink.wgink.annotation.CheckRequestBodyAnnotation;
|
import ink.wgink.annotation.CheckRequestBodyAnnotation;
|
||||||
import ink.wgink.common.base.DefaultBaseController;
|
import ink.wgink.common.base.DefaultBaseController;
|
||||||
|
import ink.wgink.exceptions.ParamsException;
|
||||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||||
import ink.wgink.module.dictionary.pojo.dtos.AreaDTO;
|
import ink.wgink.module.dictionary.pojo.dtos.AreaDTO;
|
||||||
|
import ink.wgink.module.dictionary.pojo.dtos.AreaZTreeDTO;
|
||||||
import ink.wgink.module.dictionary.pojo.vos.AreaVO;
|
import ink.wgink.module.dictionary.pojo.vos.AreaVO;
|
||||||
import ink.wgink.module.dictionary.service.IAreaService;
|
import ink.wgink.module.dictionary.service.IAreaService;
|
||||||
import ink.wgink.pojo.ListPage;
|
import ink.wgink.pojo.ListPage;
|
||||||
import ink.wgink.pojo.dtos.ZTreeDTO;
|
import ink.wgink.pojo.dtos.ZTreeDTO;
|
||||||
|
import ink.wgink.pojo.dtos.department.DepartmentDTO;
|
||||||
import ink.wgink.pojo.result.ErrorResult;
|
import ink.wgink.pojo.result.ErrorResult;
|
||||||
import ink.wgink.pojo.result.SuccessResult;
|
import ink.wgink.pojo.result.SuccessResult;
|
||||||
import ink.wgink.pojo.result.SuccessResultList;
|
import ink.wgink.pojo.result.SuccessResultList;
|
||||||
|
import ink.wgink.pojo.vos.IdsVO;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -138,6 +142,22 @@ public class AreaController extends DefaultBaseController {
|
|||||||
return areaService.listZTree(params);
|
return areaService.listZTree(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "地区字典zTree列表", notes = "地区字典zTree列表接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "id", value = "父ID", paramType = "query", dataType = "String")
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("list-area-ztree")
|
||||||
|
public List<AreaZTreeDTO> listAreaZTree() {
|
||||||
|
Map<String, Object> params = requestParams();
|
||||||
|
String parentId = "0";
|
||||||
|
if (!StringUtils.isBlank(params.get(ISystemConstant.PARAMS_ID) == null ? null : params.get(ISystemConstant.PARAMS_ID).toString())) {
|
||||||
|
parentId = params.get(ISystemConstant.PARAMS_ID).toString();
|
||||||
|
}
|
||||||
|
params.put("areaParentId", parentId);
|
||||||
|
return areaService.listAreaZTree(params);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "地区字典列表(通过地区字典编码)", notes = "地区字典列表(通过地区字典编码)接口")
|
@ApiOperation(value = "地区字典列表(通过地区字典编码)", notes = "地区字典列表(通过地区字典编码)接口")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "areaCode", value = "地区字典编码", paramType = "path")
|
@ApiImplicitParam(name = "areaCode", value = "地区字典编码", paramType = "path")
|
||||||
@ -156,4 +176,24 @@ public class AreaController extends DefaultBaseController {
|
|||||||
return new SuccessResult();
|
return new SuccessResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "区域列表", notes = "区域列表接口")
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@PostMapping("list/ids")
|
||||||
|
public List<AreaDTO> list(@RequestBody IdsVO idsVO) {
|
||||||
|
if (idsVO.getIds().isEmpty()) {
|
||||||
|
throw new ParamsException("id列表不能为空");
|
||||||
|
}
|
||||||
|
return areaService.list(idsVO.getIds());
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "区域列表", notes = "区域列表接口")
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@PostMapping("list/codes")
|
||||||
|
public List<AreaDTO> listByCodes(@RequestBody IdsVO idsVO) {
|
||||||
|
if (idsVO.getIds().isEmpty()) {
|
||||||
|
throw new ParamsException("id列表不能为空");
|
||||||
|
}
|
||||||
|
return areaService.listByCodes(idsVO.getIds());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import ink.wgink.exceptions.SearchException;
|
|||||||
import ink.wgink.exceptions.UpdateException;
|
import ink.wgink.exceptions.UpdateException;
|
||||||
import ink.wgink.interfaces.init.IInitBaseTable;
|
import ink.wgink.interfaces.init.IInitBaseTable;
|
||||||
import ink.wgink.module.dictionary.pojo.dtos.AreaDTO;
|
import ink.wgink.module.dictionary.pojo.dtos.AreaDTO;
|
||||||
|
import ink.wgink.module.dictionary.pojo.dtos.AreaZTreeDTO;
|
||||||
import ink.wgink.pojo.dtos.ZTreeDTO;
|
import ink.wgink.pojo.dtos.ZTreeDTO;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
@ -108,6 +109,9 @@ public interface IAreaDao extends IInitBaseTable {
|
|||||||
*/
|
*/
|
||||||
List<ZTreeDTO> listZTree(Map<String, Object> params) throws SearchException;
|
List<ZTreeDTO> listZTree(Map<String, Object> params) throws SearchException;
|
||||||
|
|
||||||
|
List<AreaZTreeDTO> listAreaZTree(Map<String, Object> params);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 子列表个数
|
* 子列表个数
|
||||||
*
|
*
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
package ink.wgink.module.dictionary.pojo.dtos;
|
||||||
|
|
||||||
|
import ink.wgink.pojo.dtos.ZTreeDTO;
|
||||||
|
|
||||||
|
public class AreaZTreeDTO extends ZTreeDTO {
|
||||||
|
|
||||||
|
private String areaCode;
|
||||||
|
|
||||||
|
public String getAreaCode() {
|
||||||
|
return areaCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAreaCode(String areaCode) {
|
||||||
|
this.areaCode = areaCode;
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package ink.wgink.module.dictionary.service;
|
package ink.wgink.module.dictionary.service;
|
||||||
|
|
||||||
import ink.wgink.module.dictionary.pojo.dtos.AreaDTO;
|
import ink.wgink.module.dictionary.pojo.dtos.AreaDTO;
|
||||||
|
import ink.wgink.module.dictionary.pojo.dtos.AreaZTreeDTO;
|
||||||
import ink.wgink.module.dictionary.pojo.vos.AreaVO;
|
import ink.wgink.module.dictionary.pojo.vos.AreaVO;
|
||||||
import ink.wgink.pojo.ListPage;
|
import ink.wgink.pojo.ListPage;
|
||||||
import ink.wgink.pojo.dtos.ZTreeDTO;
|
import ink.wgink.pojo.dtos.ZTreeDTO;
|
||||||
@ -87,6 +88,8 @@ public interface IAreaService {
|
|||||||
*/
|
*/
|
||||||
List<AreaDTO> list();
|
List<AreaDTO> list();
|
||||||
|
|
||||||
|
List<AreaDTO> list(List<String> areaIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过上级ID获取地区字典列表
|
* 通过上级ID获取地区字典列表
|
||||||
*
|
*
|
||||||
@ -119,6 +122,13 @@ public interface IAreaService {
|
|||||||
*/
|
*/
|
||||||
List<ZTreeDTO> listZTree(Map<String, Object> params);
|
List<ZTreeDTO> listZTree(Map<String, Object> params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<AreaZTreeDTO> listAreaZTree(Map<String, Object> params);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 地区字典列表(通过地区字典编码)
|
* 地区字典列表(通过地区字典编码)
|
||||||
*
|
*
|
||||||
@ -148,4 +158,15 @@ public interface IAreaService {
|
|||||||
*/
|
*/
|
||||||
void updateShortAndMergerName();
|
void updateShortAndMergerName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路径区域列表
|
||||||
|
*
|
||||||
|
* @param areaCode
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<AreaDTO> listPathAreaByCode(String areaCode);
|
||||||
|
|
||||||
|
List<AreaDTO> listPathArea(String areaId);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import ink.wgink.common.base.DefaultBaseService;
|
|||||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||||
import ink.wgink.module.dictionary.dao.IAreaDao;
|
import ink.wgink.module.dictionary.dao.IAreaDao;
|
||||||
import ink.wgink.module.dictionary.pojo.dtos.AreaDTO;
|
import ink.wgink.module.dictionary.pojo.dtos.AreaDTO;
|
||||||
|
import ink.wgink.module.dictionary.pojo.dtos.AreaZTreeDTO;
|
||||||
import ink.wgink.module.dictionary.pojo.vos.AreaVO;
|
import ink.wgink.module.dictionary.pojo.vos.AreaVO;
|
||||||
import ink.wgink.module.dictionary.service.IAreaService;
|
import ink.wgink.module.dictionary.service.IAreaService;
|
||||||
import ink.wgink.pojo.ListPage;
|
import ink.wgink.pojo.ListPage;
|
||||||
@ -102,6 +103,13 @@ public class AreaServiceImpl extends DefaultBaseService implements IAreaService
|
|||||||
return areaDao.list(params);
|
return areaDao.list(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AreaDTO> list(List<String> areaIds) {
|
||||||
|
Map<String, Object> params = getHashMap(0);
|
||||||
|
params.put("areaIds", areaIds);
|
||||||
|
return areaDao.list(params);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AreaDTO> listByParentId(String areaParentId) {
|
public List<AreaDTO> listByParentId(String areaParentId) {
|
||||||
Map<String, Object> params = getHashMap(1);
|
Map<String, Object> params = getHashMap(1);
|
||||||
@ -136,6 +144,25 @@ public class AreaServiceImpl extends DefaultBaseService implements IAreaService
|
|||||||
return zTreeDTOs;
|
return zTreeDTOs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AreaZTreeDTO> listAreaZTree(Map<String, Object> params) {
|
||||||
|
List<AreaZTreeDTO> areaZTreeDTOS = areaDao.listAreaZTree(params);
|
||||||
|
for (AreaZTreeDTO areaZTreeDTO : areaZTreeDTOS) {
|
||||||
|
Integer subCount = areaDao.countByParentId(areaZTreeDTO.getId());
|
||||||
|
setAreaZTreeInfo(areaZTreeDTO, subCount);
|
||||||
|
}
|
||||||
|
return areaZTreeDTOS;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setAreaZTreeInfo(AreaZTreeDTO areaZTreeDTO, Integer subCount) {
|
||||||
|
areaZTreeDTO.setUrl("javascript:void(0);");
|
||||||
|
if (null != subCount && 0 < subCount) {
|
||||||
|
areaZTreeDTO.setIsParent(true);
|
||||||
|
} else {
|
||||||
|
areaZTreeDTO.setIsParent(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AreaDTO> listByCode(String areaCode) {
|
public List<AreaDTO> listByCode(String areaCode) {
|
||||||
Map<String, Object> params = getHashMap(1);
|
Map<String, Object> params = getHashMap(1);
|
||||||
@ -176,6 +203,43 @@ public class AreaServiceImpl extends DefaultBaseService implements IAreaService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AreaDTO> listPathAreaByCode(String areaCode) {
|
||||||
|
AreaDTO areaDTO = getByCode(areaCode);
|
||||||
|
return listPathArea(areaDTO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AreaDTO> listPathArea(String areaId) {
|
||||||
|
AreaDTO areaDTO = get(areaId);
|
||||||
|
return listPathArea(areaDTO);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<AreaDTO> listPathArea(AreaDTO areaDTO) {
|
||||||
|
if (areaDTO == null) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
List<AreaDTO> areaDTOS = new ArrayList<>();
|
||||||
|
areaDTOS.add(0, areaDTO);
|
||||||
|
setPathArea(areaDTOS, areaDTO.getAreaParentId());
|
||||||
|
return areaDTOS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置路径区域
|
||||||
|
*
|
||||||
|
* @param areaDTOS
|
||||||
|
* @param areaId
|
||||||
|
*/
|
||||||
|
private void setPathArea(List<AreaDTO> areaDTOS, String areaId) {
|
||||||
|
AreaDTO areaDTO = get(areaId);
|
||||||
|
if (areaDTO == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
areaDTOS.add(0, areaDTO);
|
||||||
|
setPathArea(areaDTOS, areaDTO.getAreaParentId());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否正在更新
|
* 是否正在更新
|
||||||
*
|
*
|
||||||
|
@ -20,13 +20,17 @@
|
|||||||
<result property="areaFirst" column="area_first"/>
|
<result property="areaFirst" column="area_first"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap id="areaZTreeDTO" type="ink.wgink.pojo.dtos.ZTreeDTO">
|
<resultMap id="zTreeDTO" type="ink.wgink.pojo.dtos.ZTreeDTO">
|
||||||
<id property="id" column="area_id"/>
|
<id property="id" column="area_id"/>
|
||||||
<result property="pId" column="area_parent_id"/>
|
<result property="pId" column="area_parent_id"/>
|
||||||
<result property="name" column="area_name"/>
|
<result property="name" column="area_name"/>
|
||||||
<result property="title" column="area_merger_name"/>
|
<result property="title" column="area_merger_name"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap id="areaZTreeDTO" type="ink.wgink.module.dictionary.pojo.dtos.AreaZTreeDTO" extends="zTreeDTO">
|
||||||
|
<result property="areaCode" column="area_code"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
<!-- 建表 -->
|
<!-- 建表 -->
|
||||||
<update id="createTable">
|
<update id="createTable">
|
||||||
CREATE TABLE IF NOT EXISTS `data_area` (
|
CREATE TABLE IF NOT EXISTS `data_area` (
|
||||||
@ -166,7 +170,21 @@
|
|||||||
</update>
|
</update>
|
||||||
|
|
||||||
<!-- ztree列表 -->
|
<!-- ztree列表 -->
|
||||||
<select id="listZTree" parameterType="map" resultMap="areaZTreeDTO">
|
<select id="listZTree" parameterType="map" resultMap="zTreeDTO">
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
data_area
|
||||||
|
WHERE
|
||||||
|
is_delete = 0
|
||||||
|
<if test="areaParentId != null and areaParentId != ''">
|
||||||
|
AND
|
||||||
|
area_parent_id = #{areaParentId}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- ztree列表 -->
|
||||||
|
<select id="listAreaZTree" parameterType="map" resultMap="areaZTreeDTO">
|
||||||
SELECT
|
SELECT
|
||||||
*
|
*
|
||||||
FROM
|
FROM
|
||||||
|
@ -62,6 +62,11 @@ public class GridRouteController {
|
|||||||
return new ModelAndView("grid/grid/default/list-select");
|
return new ModelAndView("grid/grid/default/list-select");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("list-selected")
|
||||||
|
public ModelAndView listSelected() {
|
||||||
|
return new ModelAndView("grid/grid/default/list-selected");
|
||||||
|
}
|
||||||
|
|
||||||
private void setConfig(ModelAndView modelAndView) {
|
private void setConfig(ModelAndView modelAndView) {
|
||||||
EnvManager envManager = EnvManager.getInstance();
|
EnvManager envManager = EnvManager.getInstance();
|
||||||
Map<String, Object> baiduMapProperties = new HashMap<>(5);
|
Map<String, Object> baiduMapProperties = new HashMap<>(5);
|
||||||
|
@ -31,6 +31,9 @@ public interface IGridRelationService {
|
|||||||
*/
|
*/
|
||||||
void save(String token, String gridId, List<String> relationIdArray);
|
void save(String token, String gridId, List<String> relationIdArray);
|
||||||
|
|
||||||
|
void save(List<String> gridIds, String relationId);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除网格关联
|
* 删除网格关联
|
||||||
*
|
*
|
||||||
@ -148,4 +151,5 @@ public interface IGridRelationService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
GridRelationDTO getByGridIdAndRelationId(String gridId, String relationId);
|
GridRelationDTO getByGridIdAndRelationId(String gridId, String relationId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,21 @@ public class GridRelationServiceImpl extends DefaultBaseService implements IGrid
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void save(List<String> gridIds, String relationId) {
|
||||||
|
deleteByRelationId(relationId);
|
||||||
|
gridIds.forEach(gridId -> {
|
||||||
|
Map<String, Object> params = getHashMap(4);
|
||||||
|
params.put("gridId", gridId);
|
||||||
|
params.put("relationId", relationId);
|
||||||
|
setSaveInfo(params);
|
||||||
|
gridRelationDao.save(params);
|
||||||
|
});
|
||||||
|
if (gridRelationSaveAfterHandler != null) {
|
||||||
|
gridRelationSaveAfterHandler.handle(Arrays.asList(relationId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void delete(String gridId) {
|
public void delete(String gridId) {
|
||||||
List<String> relationIds = listRelationId(gridId);
|
List<String> relationIds = listRelationId(gridId);
|
||||||
|
@ -247,6 +247,10 @@
|
|||||||
map_grid t1
|
map_grid t1
|
||||||
WHERE
|
WHERE
|
||||||
t1.is_delete = 0
|
t1.is_delete = 0
|
||||||
|
<if test="keywords != null and keywords != ''">
|
||||||
|
AND
|
||||||
|
t1.grid_name LIKE CONCAT('%', #{keywords}, '%')
|
||||||
|
</if>
|
||||||
<if test="gridIds != null and gridIds.size > 0">
|
<if test="gridIds != null and gridIds.size > 0">
|
||||||
AND
|
AND
|
||||||
t1.grid_id IN
|
t1.grid_id IN
|
||||||
|
@ -9,6 +9,11 @@
|
|||||||
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||||
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||||
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||||
|
<style>
|
||||||
|
.table-select-area {position: relative; width: 200px;}
|
||||||
|
.table-select-area #areaName {width: 64%}
|
||||||
|
.table-select-area .select-btn {position: absolute; top: 0px; right: 0px; width: 36%; border-color: #e6e6e6;}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="layui-anim layui-anim-fadein">
|
<div class="layui-anim layui-anim-fadein">
|
||||||
@ -20,8 +25,21 @@
|
|||||||
<div class="layui-inline">
|
<div class="layui-inline">
|
||||||
<input type="text" id="keywords" class="layui-input search-item search-item-width-100" placeholder="输入关键字">
|
<input type="text" id="keywords" class="layui-input search-item search-item-width-100" placeholder="输入关键字">
|
||||||
</div>
|
</div>
|
||||||
|
<div id="selectArea" class="layui-inline table-select-area" style="display: none;">
|
||||||
|
<input type="hidden" id="areaCode">
|
||||||
|
<input type="text" id="areaName" class="layui-input search-item search-item-width-300" placeholder="选择地区" readonly>
|
||||||
|
<div class="layui-btn-group select-btn">
|
||||||
|
<button type="button" id="areaSelectBtn" class="layui-btn layui-btn-sm layui-btn-primary" title="选择区域">
|
||||||
|
<i class="fa fa-circle-thin"></i>
|
||||||
|
</button>
|
||||||
|
<button type="button" id="areaCleanBtn" class="layui-btn layui-btn-sm layui-btn-primary" title="删除区域">
|
||||||
|
<i class="fa fa-times-circle"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<button type="button" id="search" class="layui-btn layui-btn-sm">
|
<button type="button" id="search" class="layui-btn layui-btn-sm">
|
||||||
<i class="fa fa-lg fa-search"></i> 搜索
|
<i class="fa fa-lg fa-search"></i> 搜索
|
||||||
|
<button type="button" id="showGrid" class="layui-btn layui-btn-sm">查看网格</button>
|
||||||
</button>
|
</button>
|
||||||
<button type="button" id="confirm" class="layui-btn layui-btn-normal layui-btn-sm" style="float: right;">确定</button>
|
<button type="button" id="confirm" class="layui-btn layui-btn-normal layui-btn-sm" style="float: right;">确定</button>
|
||||||
</div>
|
</div>
|
||||||
@ -58,7 +76,14 @@
|
|||||||
var newSelectedGridList = [];
|
var newSelectedGridList = [];
|
||||||
var tableData = [];
|
var tableData = [];
|
||||||
|
|
||||||
var tableUrl = 'api/grid/listpage/area-code/{areaCode}';
|
var tableUrl = null;
|
||||||
|
if(areaCode) {
|
||||||
|
tableUrl = 'api/grid/listpage/area-code/{areaCode}';
|
||||||
|
$('#selectArea').hide();
|
||||||
|
} else {
|
||||||
|
tableUrl = 'api/grid/listpage';
|
||||||
|
$('#selectArea').show();
|
||||||
|
}
|
||||||
|
|
||||||
// 初始化选择列表
|
// 初始化选择列表
|
||||||
function initNewSelectedGridList() {
|
function initNewSelectedGridList() {
|
||||||
@ -76,10 +101,10 @@
|
|||||||
id: 'dataTable',
|
id: 'dataTable',
|
||||||
url: top.restAjax.path(tableUrl, [areaCode]),
|
url: top.restAjax.path(tableUrl, [areaCode]),
|
||||||
width: admin.screen() > 1 ? '100%' : '',
|
width: admin.screen() > 1 ? '100%' : '',
|
||||||
height: $win.height() - 90,
|
height: $win.height() - 60,
|
||||||
limit: 20,
|
limit: 20,
|
||||||
limits: [20, 40, 60, 80, 100, 200],
|
limits: [20, 40, 60, 80, 100, 200],
|
||||||
toolbar: '#headerToolBar',
|
toolbar: false,
|
||||||
request: {
|
request: {
|
||||||
pageName: 'page',
|
pageName: 'page',
|
||||||
limitName: 'rows'
|
limitName: 'rows'
|
||||||
@ -180,6 +205,7 @@
|
|||||||
],
|
],
|
||||||
page: true,
|
page: true,
|
||||||
parseData: function(data) {
|
parseData: function(data) {
|
||||||
|
console.log(newSelectedGridList);
|
||||||
for(var i = 0, item; item = data.rows[i++];) {
|
for(var i = 0, item; item = data.rows[i++];) {
|
||||||
if(!newSelectedGridList) {
|
if(!newSelectedGridList) {
|
||||||
item.checked = false;
|
item.checked = false;
|
||||||
@ -215,13 +241,13 @@
|
|||||||
url: top.restAjax.path(tableUrl, [areaCode]),
|
url: top.restAjax.path(tableUrl, [areaCode]),
|
||||||
where: {
|
where: {
|
||||||
keywords: $('#keywords').val(),
|
keywords: $('#keywords').val(),
|
||||||
|
areaCodeLike: $('#areaCode').val() ? $('#areaCode').val() : '',
|
||||||
startTime: $('#startTime').val(),
|
startTime: $('#startTime').val(),
|
||||||
endTime: $('#endTime').val()
|
endTime: $('#endTime').val()
|
||||||
},
|
},
|
||||||
page: {
|
page: {
|
||||||
curr: currentPage
|
curr: currentPage
|
||||||
},
|
},
|
||||||
height: $win.height() - 90,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
initTable();
|
initTable();
|
||||||
@ -289,6 +315,46 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(document).on('click', '#showGrid', function() {
|
||||||
|
top.dialog.open({
|
||||||
|
url: top.restAjax.path('route/grid/show-grid?areaCode={areaCode}', [areaCode ? areaCode : $('#areaCode').val()]),
|
||||||
|
title: '查看网格',
|
||||||
|
width: '80%',
|
||||||
|
height: '80%',
|
||||||
|
onClose: function() {}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// 地区选择事件
|
||||||
|
$(document).on('click', '#areaSelectBtn', function() {
|
||||||
|
top.dialog.open({
|
||||||
|
title: '选择地区',
|
||||||
|
url: top.restAjax.path('route/area/get-select', []),
|
||||||
|
width: '600px',
|
||||||
|
height: '225px',
|
||||||
|
onClose: function() {
|
||||||
|
var selectedAreaArray = top.dialog.dialogData.selectedAreaArray;
|
||||||
|
var areaCode = '';
|
||||||
|
var areaName = '';
|
||||||
|
if(selectedAreaArray.length > 0) {
|
||||||
|
areaCode = selectedAreaArray[selectedAreaArray.length - 1].areaCode;
|
||||||
|
for(var i = 0, item; item = selectedAreaArray[i++];) {
|
||||||
|
if(areaName) {
|
||||||
|
areaName += ' / ';
|
||||||
|
}
|
||||||
|
areaName += item.areaName;
|
||||||
|
}
|
||||||
|
$('#areaCode').val(areaCode);
|
||||||
|
$('#areaName').val(areaName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
$(document).on('click', '#areaCleanBtn', function () {
|
||||||
|
$('#areaCode').val('');
|
||||||
|
$('#areaName').val('');
|
||||||
|
})
|
||||||
|
|
||||||
table.on('radio(dataTable)', function(obj) {
|
table.on('radio(dataTable)', function(obj) {
|
||||||
newSelectedGridList.splice(0, newSelectedGridList.length);
|
newSelectedGridList.splice(0, newSelectedGridList.length);
|
||||||
addGridSelected(obj.data);
|
addGridSelected(obj.data);
|
||||||
|
@ -2,6 +2,7 @@ package ink.wgink.service.core.controller.api.manage;
|
|||||||
|
|
||||||
import ink.wgink.annotation.CheckRequestBodyAnnotation;
|
import ink.wgink.annotation.CheckRequestBodyAnnotation;
|
||||||
import ink.wgink.common.base.DefaultBaseController;
|
import ink.wgink.common.base.DefaultBaseController;
|
||||||
|
import ink.wgink.exceptions.ParamsException;
|
||||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||||
import ink.wgink.pojo.ListPage;
|
import ink.wgink.pojo.ListPage;
|
||||||
import ink.wgink.pojo.dtos.department.DepartmentDTO;
|
import ink.wgink.pojo.dtos.department.DepartmentDTO;
|
||||||
@ -40,6 +41,7 @@ public class CoreManageController extends DefaultBaseController {
|
|||||||
@PostMapping("save-user")
|
@PostMapping("save-user")
|
||||||
@CheckRequestBodyAnnotation
|
@CheckRequestBodyAnnotation
|
||||||
public SuccessResult saveUser(@RequestBody CoreManageUserVO coreManageUserVO) {
|
public SuccessResult saveUser(@RequestBody CoreManageUserVO coreManageUserVO) {
|
||||||
|
checkParams(coreManageUserVO);
|
||||||
UserUtil.checkParams(coreManageUserVO);
|
UserUtil.checkParams(coreManageUserVO);
|
||||||
coreManageService.saveUser(coreManageUserVO);
|
coreManageService.saveUser(coreManageUserVO);
|
||||||
return new SuccessResult();
|
return new SuccessResult();
|
||||||
@ -61,11 +63,18 @@ public class CoreManageController extends DefaultBaseController {
|
|||||||
@PutMapping("update-user/{userId}")
|
@PutMapping("update-user/{userId}")
|
||||||
@CheckRequestBodyAnnotation
|
@CheckRequestBodyAnnotation
|
||||||
public SuccessResult updateUser(@PathVariable("userId") String userId, @RequestBody CoreManageUserVO coreManageUserVO) {
|
public SuccessResult updateUser(@PathVariable("userId") String userId, @RequestBody CoreManageUserVO coreManageUserVO) {
|
||||||
|
checkParams(coreManageUserVO);
|
||||||
UserUtil.checkParams(coreManageUserVO);
|
UserUtil.checkParams(coreManageUserVO);
|
||||||
coreManageService.updateUser(userId, coreManageUserVO);
|
coreManageService.updateUser(userId, coreManageUserVO);
|
||||||
return new SuccessResult();
|
return new SuccessResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkParams(CoreManageUserVO coreManageUserVO) {
|
||||||
|
if (coreManageUserVO.getDepartmentIds() == null || coreManageUserVO.getDepartmentIds().isEmpty()) {
|
||||||
|
throw new ParamsException("组织部门不能为空");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "用户详情", notes = "用户详情接口")
|
@ApiOperation(value = "用户详情", notes = "用户详情接口")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "userId", value = "用户ID", paramType = "path")
|
@ApiImplicitParam(name = "userId", value = "用户ID", paramType = "path")
|
||||||
|
@ -19,7 +19,6 @@ import java.util.List;
|
|||||||
public class CoreManageUserVO extends UserVO {
|
public class CoreManageUserVO extends UserVO {
|
||||||
|
|
||||||
@ApiModelProperty(name = "departmentIds", value = "部门ID列表")
|
@ApiModelProperty(name = "departmentIds", value = "部门ID列表")
|
||||||
@CheckListAnnotation(name = "部门ID列表")
|
|
||||||
private List<String> departmentIds;
|
private List<String> departmentIds;
|
||||||
@ApiModelProperty(name = "roleIds", value = "角色ID列表")
|
@ApiModelProperty(name = "roleIds", value = "角色ID列表")
|
||||||
private List<String> roleIds;
|
private List<String> roleIds;
|
||||||
|
@ -636,7 +636,6 @@
|
|||||||
|
|
||||||
form.on('checkbox(noDepartmentFilter)', function(data) {
|
form.on('checkbox(noDepartmentFilter)', function(data) {
|
||||||
noDepartment = data.elem.checked;
|
noDepartment = data.elem.checked;
|
||||||
console.log(1)
|
|
||||||
});
|
});
|
||||||
|
|
||||||
form.on('checkbox(noRoleFilter)', function(data) {
|
form.on('checkbox(noRoleFilter)', function(data) {
|
||||||
|
Loading…
Reference in New Issue
Block a user