ZzglController.java 18.3 KB
Newer Older
yuquan.zhu committed
1 2 3 4 5 6 7 8
package cn.timer.api.controller.zzgl;

import java.util.ArrayList;
import java.util.List;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
9
import org.springframework.validation.annotation.Validated;
yuquan.zhu committed
10 11 12 13
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
14
import org.springframework.web.bind.annotation.PutMapping;
yuquan.zhu committed
15 16 17 18 19 20 21 22
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
23
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
yuquan.zhu committed
24
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
25
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
26

27 28 29 30
import cn.hutool.core.convert.Convert;
import cn.hutool.core.lang.tree.Tree;
import cn.hutool.core.lang.tree.TreeNodeConfig;
import cn.hutool.core.lang.tree.TreeUtil;
31
import cn.hutool.core.util.StrUtil;
32 33
import cn.timer.api.aspect.lang.annotation.Log;
import cn.timer.api.aspect.lang.enums.BusinessType;
yuquan.zhu committed
34 35 36
import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.bean.zzgl.ZzglAuth;
import cn.timer.api.bean.zzgl.ZzglBmgwM;
37 38
import cn.timer.api.bean.zzgl.ZzglMenu;
import cn.timer.api.bean.zzgl.ZzglPostMenu;
yuquan.zhu committed
39 40
import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean;
41
import cn.timer.api.config.enuminterface.YgEnumInterface;
42
import cn.timer.api.controller.zzgl.service.ZzglBmgwMService;
43
import cn.timer.api.dao.yggl.YgglMainEmpMapper;
yuquan.zhu committed
44 45
import cn.timer.api.dao.zzgl.ZzglBmgwMMapper;
import cn.timer.api.dao.zzgl.ZzglLogDgjlMapper;
46 47
import cn.timer.api.dao.zzgl.ZzglMenuMapper;
import cn.timer.api.dao.zzgl.ZzglPostMenuMapper;
yuquan.zhu committed
48 49 50
import cn.timer.api.dto.zzgl.LogDgjlsDto;
import cn.timer.api.dto.zzgl.LogDgjlsQueryDto;
import cn.timer.api.dto.zzgl.UpEmpDeptDto;
51
import cn.timer.api.dto.zzgl.ZzglPostMenuDto;
yuquan.zhu committed
52 53 54 55 56 57 58 59 60 61 62 63
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@Api(tags = "2.组织管理")
@RestController
@Transactional
@RequestMapping(value = "/zzgl", produces = { "application/json" })
public class ZzglController {

	@Autowired
64 65 66
	ZzglBmgwMService zzglBmgwMService;
	
	@Autowired
yuquan.zhu committed
67
	ZzglBmgwMMapper zzglBmgwMMapper;
68 69 70
	
	@Autowired
	ZzglPostMenuMapper zzglPostMenuMapper;
yuquan.zhu committed
71 72

	@Autowired
73
	ZzglLogDgjlMapper zzglLogDgjlMapper;
74 75 76
	
	@Autowired
	YgglMainEmpMapper ygglMainEmpMapper;
yuquan.zhu committed
77 78 79 80 81 82 83 84 85 86 87 88 89

	/**
	 * 架构树/架构图/导出
	 * 
	 * @param
	 * @return
	 */
	@GetMapping(value = "/deptlist")
	@ApiOperation(value = "获取部门岗位", httpMethod = "GET", notes = "接口发布说明")
	public Result<List<ZzglBmgwM>> selectlistdept(@CurrentUser UserBean userBean) {
		Integer orgCode = userBean.getOrgCode();
		List<ZzglBmgwM> zzglBmgwMs = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper)
				.eq(ZzglBmgwM::getOrgCode, orgCode).list();
90 91
		return ResultUtil.data(zzglBmgwMs);
	}
92
	
93 94 95 96 97 98
	/**
	 * 架构树/架构图/导出
	 * 
	 * @param
	 * @return
	 */
99
	@GetMapping(value = "/deptlist_plus")
100 101 102 103 104 105 106 107
	@ApiOperation(value = "1.获取部门岗位-升级版", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 1)
	public Result<List<Tree<String>>> selectlistdept2(@CurrentUser UserBean userBean) {
		Integer orgCode = userBean.getOrgCode();
		List<ZzglBmgwM> zzglBmgwMs = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper)
				.eq(ZzglBmgwM::getOrgCode, orgCode).list();
		
		// 构建node列表
108 109 110 111
//		List<TreeNode<String>> nodeList = CollUtil.newArrayList();
//		zzglBmgwMs.forEach(z -> {
//			nodeList.add(new TreeNode<>(Convert.toStr(z.getId()), Convert.toStr(z.getUpId()), z.getName(), 0));
//		});
112 113 114 115 116 117 118 119 120 121
		
		//配置
		TreeNodeConfig treeNodeConfig = new TreeNodeConfig();
		// 自定义属性名 都要默认值的
		treeNodeConfig.setIdKey("id");
		treeNodeConfig.setParentIdKey("upId");
		// 最大递归深度
//		treeNodeConfig.setDeep(10);

		//转换器
122
		List<Tree<String>> treeNodes = TreeUtil.build(zzglBmgwMs, "0", treeNodeConfig,
123
		        (treeNode, tree) -> {
124 125 126
		            tree.setId(Convert.toStr(treeNode.getId()));
		            tree.setParentId(Convert.toStr(treeNode.getUpId()));
//		            tree.setWeight(treeNode.getWeight());
127 128
		            tree.setName(treeNode.getName());
		            // 扩展属性 ...
129
		            tree.putExtra("leader", treeNode.getLeader());
130 131 132 133 134 135 136
//		            tree.putExtra("other", new Object());
		        });
		
		
		return ResultUtil.data(treeNodes);
	}
	
137
	@GetMapping(value = "/depts")
138 139
	@ApiOperation(value = "2.获取部门", httpMethod = "GET", notes = "接口发布说明")
	@ApiOperationSupport(order = 2)
140 141 142
	public Result<List<ZzglBmgwM>> selectdepts(@CurrentUser UserBean userBean) {
		Integer orgCode = userBean.getOrgCode();
		List<ZzglBmgwM> zzglBmgwMs = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper)
143 144 145
				.eq(ZzglBmgwM::getOrgCode, orgCode)
				.eq(ZzglBmgwM::getType, YgEnumInterface.OrgType.DEPARTMENT)
				.list();
146 147
		return ResultUtil.data(zzglBmgwMs);
	}
yuquan.zhu committed
148 149 150 151 152 153 154 155 156

	/**
	 * 岗位成员
	 * 
	 * @param 部门岗位id
	 * @return
	 */
	@GetMapping(value = "/otherlistent/{id}")
	@ApiOperation(value = "获取岗位成员列表", httpMethod = "GET", notes = "接口发布说明")
157
	public Result<List<YgglMainEmp>> selectOtherlistent(@CurrentUser UserBean userBean, @PathVariable Integer id) {
yuquan.zhu committed
158 159 160 161 162 163 164
		Integer orgCode = userBean.getOrgCode();
		ArrayList<Integer> list = new ArrayList<Integer>();
		List<ZzglBmgwM> zzglBmgwMs = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper)
				.eq(ZzglBmgwM::getOrgCode, orgCode).list();
		list.add(id);
		ZzglBmgwM.getDepts(list, id, zzglBmgwMs);

165 166 167
		ZzglBmgwM messsage = ZzglBmgwM.builder().build().selectOne(new QueryWrapper<ZzglBmgwM>().eq("id", id));
		Integer lead = messsage.getLeader(); // 获取部门或岗位领导id

yuquan.zhu committed
168 169 170 171 172 173 174
		if (list == null || list.size() == 0) {
			return ResultUtil.error("部门信息不存在,请先添加部门!");
		} else {
			LambdaQueryWrapper<YgglMainEmp> ygglMainEmpsLambdaQueryWrapper = new LambdaQueryWrapper<>();
			ygglMainEmpsLambdaQueryWrapper
					.select(YgglMainEmp::getId, YgglMainEmp::getEmpNum, YgglMainEmp::getName, YgglMainEmp::getPhone,
							YgglMainEmp::getBmgwId)
175 176
					.eq(YgglMainEmp::getOrgCode, orgCode).and(i -> i.in(YgglMainEmp::getBmgwId, list.toArray()))
					.last(lead != null, "order by if (emp_num='" + lead + "',0,1)");
yuquan.zhu committed
177 178 179 180 181 182 183 184 185 186 187 188 189
			List<YgglMainEmp> ygglMainEmps = YgglMainEmp.builder().build().selectList(ygglMainEmpsLambdaQueryWrapper);
			return ResultUtil.data(ygglMainEmps);
		}
	}

	/**
	 * 获取调岗记录(weng)
	 * 
	 * @param 部门岗位id
	 * @return
	 */
	@PostMapping(value = "/listdgjl")
	@ApiOperation(value = "获取调岗记录(weng)", httpMethod = "POST", notes = "接口发布说明")
190 191
	public Result<Object> selectlistdgjl(@CurrentUser UserBean userBean,
			@RequestBody LogDgjlsQueryDto logDgjlsQueryDto) {
yuquan.zhu committed
192 193 194 195 196 197 198 199 200 201
		Integer orgCode = userBean.getOrgCode();
		ArrayList<Integer> list = new ArrayList<Integer>();
		List<ZzglBmgwM> zzglBmgwMs = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper)
				.eq(ZzglBmgwM::getOrgCode, orgCode).list();
		list.add(logDgjlsQueryDto.getDeptId());
		ZzglBmgwM.getDepts(list, logDgjlsQueryDto.getDeptId(), zzglBmgwMs);

		if (list == null || list.size() == 0) {
			return ResultUtil.error("部门信息不存在,请先添加部门!");
		} else {
202

yuquan.zhu committed
203 204
			logDgjlsQueryDto.setDeptIdList(list);
			logDgjlsQueryDto.setOrgCode(orgCode);
205

yuquan.zhu committed
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244
			IPage<LogDgjlsDto> page = new Page<LogDgjlsDto>(
					logDgjlsQueryDto.getCurrentPage() == null ? 1 : logDgjlsQueryDto.getCurrentPage(),
					logDgjlsQueryDto.getTotalPage() == null ? 10 : logDgjlsQueryDto.getTotalPage());
			List<LogDgjlsDto> logDgjlDtos = zzglLogDgjlMapper.selectListdgjls(page, logDgjlsQueryDto);
			return ResultUtil.data(page, logDgjlDtos, "查询成功");
		}
	}

	/**
	 * 未设置岗位的成员
	 * 
	 * @return
	 */
	@GetMapping(value = "/listent")
	@ApiOperation(value = "未设置岗位的成员", httpMethod = "GET", notes = "接口发布说明")
	public Result<List<YgglMainEmp>> selectlistent(@CurrentUser UserBean userBean) {
		Integer orgCode = userBean.getOrgCode();

		LambdaQueryWrapper<YgglMainEmp> ygglMainEmpsLambdaQueryWrapper = new LambdaQueryWrapper<>();
		ygglMainEmpsLambdaQueryWrapper
				.select(YgglMainEmp::getId, YgglMainEmp::getEmpNum, YgglMainEmp::getName, YgglMainEmp::getPhone)
				.eq(YgglMainEmp::getOrgCode, orgCode)
				.and(i -> i.isNull(YgglMainEmp::getBmgwId).or().eq(YgglMainEmp::getBmgwId, 0));
		// .and(lqw -> lqw.notIn(id != null,
		// YgglMainEmp::getBmgwId,Arrays.asList(id)).or().isNull(YgglMainEmp::getBmgwId))
		List<YgglMainEmp> ygglMainEmps = YgglMainEmp.builder().build().selectList(ygglMainEmpsLambdaQueryWrapper);
		// List<ZzglBmgwMEmpDto> zzglBmgwMEmpDtos =
		// zzglBmgwMMapper.selectOtherListByOrgCode(orgCode,id);
		return ResultUtil.data(ygglMainEmps);
	}

	/**
	 * 添加/修改部门
	 * 
	 * @param
	 * @return
	 */
	@PostMapping(value = "/dept")
	@ApiOperation(value = "添加/修改部门", httpMethod = "POST", notes = "接口发布说明")
245
	public Result<ZzglBmgwM> adddept(@CurrentUser UserBean userBean, @RequestBody ZzglBmgwM zzglBmgwM) {
246 247 248 249 250 251 252
		
		Integer count = zzglBmgwMMapper.selectCount(new QueryWrapper<ZzglBmgwM>().lambda()
				.eq(ZzglBmgwM::getOrgCode, userBean.getOrgCode()));
		if (count <= 0) {
			// 根部门upId 默认为0
			zzglBmgwM.setUpId(0);
		}
253 254
		
		if (zzglBmgwM.getLeader() == null && StrUtil.length(StrUtil.trim(zzglBmgwM.getName())) == 0) 
255
			return ResultUtil.error("部门岗位名称不能为空");
256 257 258
		
		Boolean notId = zzglBmgwM.getId() == null;
		if (notId && zzglBmgwM.getType() == null)
yuquan.zhu committed
259
			zzglBmgwM.setType((Integer) 0);
260 261 262 263
			zzglBmgwM.setOrgCode(userBean.getOrgCode());
			zzglBmgwM.insertOrUpdate();
			
		return notId ? ResultUtil.data(zzglBmgwM) : ResultUtil.success();
yuquan.zhu committed
264
	}
265 266
	
	
yuquan.zhu committed
267 268 269 270 271 272 273 274
	/**
	 * 删除部门岗位
	 * 
	 * @param 部门岗位ids [1,2,3,4]
	 * @return
	 */
	@DeleteMapping(value = "/dept")
	@ApiOperation(value = "删除部门岗位", httpMethod = "DELETE", notes = "接口发布说明")
275
	@Log(title = "删除岗位", businessType = BusinessType.DELETE)
yuquan.zhu committed
276 277
	public Result<Integer> deldepts(@CurrentUser UserBean userBean, @RequestBody List<Integer> ids) {
		YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build();
278
		
yuquan.zhu committed
279
		zzglLogDgjlMapper.insertbydeldept(ids, userBean.getEmpNum());
280 281 282
		ygglMainEmp.update(new UpdateWrapper<YgglMainEmp>().lambda()
				.set(YgglMainEmp::getBmgwId, null)
				.in(YgglMainEmp::getBmgwId, ids));
yuquan.zhu committed
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301
		zzglBmgwMMapper.deleteBatchIds(ids);

		return ResultUtil.success();
	}

	/**
	 * 批量修改/删除员工部门
	 * 
	 * @param 部门岗位id
	 * @return
	 */
	@PostMapping(value = "/empdept")
	@ApiOperation(value = "批量修改/删除员工部门", httpMethod = "POST", notes = "接口发布说明")
	public Result<Void> updatelistempdept(@CurrentUser UserBean userBean, @RequestBody UpEmpDeptDto upEmpDeptDto) {
		Integer dpetId = upEmpDeptDto.getDpetId();
		List<Integer> empNums = upEmpDeptDto.getEmpNum();
		YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build();
		zzglLogDgjlMapper.insertbyaddemp(empNums, userBean.getEmpNum(), dpetId, userBean.getOrgCode(),
				dpetId == null || dpetId == 0 ? "岗位删除员工" : upEmpDeptDto.getIsdg() == null ? "岗位添加员工" : "员工调岗");
tangzhaoqian committed
302 303 304 305 306 307 308 309
		// 清楚 leader 主管标记
		if ((dpetId == null || dpetId == 0) || upEmpDeptDto.getIsdg() == null) {
			ZzglBmgwM.builder().leader(null).build()
				.update(new UpdateWrapper<ZzglBmgwM>().lambda()
						.eq(ZzglBmgwM::getOrgCode, userBean.getOrgCode())
						.in(ZzglBmgwM::getLeader, empNums));
		}
		
310 311 312 313
		ygglMainEmp.update(new UpdateWrapper<YgglMainEmp>().lambda()
				.set(YgglMainEmp::getBmgwId, dpetId)
				.eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()).in(YgglMainEmp::getEmpNum, empNums));

yuquan.zhu committed
314 315
		return ResultUtil.success();
	}
316
	
yuquan.zhu committed
317 318 319 320 321 322 323 324 325 326 327 328 329
	/**
	 * 岗位权限
	 * 
	 * @param 部门岗位id
	 * @return
	 */
	@GetMapping(value = "/auth/{id}")
	@ApiOperation(value = "获取岗位岗位权限", httpMethod = "GET", notes = "接口发布说明")
	public Result<List<ZzglAuth>> auth(@CurrentUser UserBean userBean, @PathVariable Integer id) {
		Integer orgCode = userBean.getOrgCode();
		ArrayList<Integer> list = new ArrayList<Integer>();
		List<ZzglBmgwM> zzglBmgwMs = new LambdaQueryChainWrapper<ZzglBmgwM>(zzglBmgwMMapper)
				.eq(ZzglBmgwM::getOrgCode, orgCode).list();
330
				ZzglBmgwM.getupDepts(list, id, zzglBmgwMs);
yuquan.zhu committed
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363
		if (list == null || list.size() == 0) {
			return ResultUtil.error("部门信息不存在,请先添加部门!");
		} else {
			LambdaQueryWrapper<ZzglAuth> wp = new LambdaQueryWrapper<>();
			wp.select(ZzglAuth::getMenuId, ZzglAuth::getBmgwId).eq(ZzglAuth::getOrgCode, orgCode)
					.and(i -> i.in(ZzglAuth::getBmgwId, list.toArray()));
			List<ZzglAuth> zas = ZzglAuth.builder().build().selectList(wp);
			return ResultUtil.data(zas);
		}
	}

	/**
	 * 批量修改/删除岗位权限
	 * 
	 * @param 部门岗位id
	 * @param 菜单ids
	 * @return
	 */
	@PostMapping(value = "/auth/{id}")
	@ApiOperation(value = "批量修改/删除岗位权限", httpMethod = "POST", notes = "接口发布说明")
	public Result<Void> auth(@CurrentUser UserBean userBean, @PathVariable Integer id, @RequestBody List<String> ids) {
		Integer orgCode = userBean.getOrgCode();
		ZzglAuth.builder().build().delete(
				new QueryWrapper<ZzglAuth>().lambda().eq(ZzglAuth::getOrgCode, orgCode).eq(ZzglAuth::getBmgwId, id));
		ids.forEach(o -> {
			ZzglAuth za = ZzglAuth.builder().build();
			za.setBmgwId(id);
			za.setOrgCode(orgCode);
			za.setMenuId(o);
			za.insert();
		});
		return ResultUtil.success();
	}
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498
	
	@Autowired
	private ZzglMenuMapper zzglMenuMapper;
	
	/**
	 * 获取-菜单权限列表
	 * 
	 * @return
	 */
	@GetMapping(value = "/menu")
	@ApiOperation(value = "获取-菜单权限列表", httpMethod = "GET", notes = "接口发布说明")
	public Result<List<ZzglMenu>> selectMenu(@CurrentUser UserBean userBean) {
		
		List<ZzglMenu> list = zzglMenuMapper.selectList(null);
		
		return ResultUtil.data(list);
	}
	
	/**
	 * 获取-菜单权限-搜索
	 * 
	 * @return
	 */
//	@PostMapping(value = "/querymenu")
//	@ApiOperation(value = "获取-菜单权限-搜索", httpMethod = "POST", notes = "接口发布说明")
//	public Result<List<Tree<String>>> queryMenu(@CurrentUser UserBean userBean,@RequestBody ZzglMenuQueryDto zzglMenuQueryDto) {
//		
//		List<ZzglMenu> list = zzglMenuMapper.queryList(zzglMenuQueryDto);
//		
//		//配置
//		TreeNodeConfig treeNodeConfig = new TreeNodeConfig();
//		// 自定义属性名 都要默认值的
////		treeNodeConfig.setIdKey("id");
////		treeNodeConfig.setParentIdKey("upId");
//		treeNodeConfig.setNameKey("menuName");
//		// 最大递归深度
////		treeNodeConfig.setDeep(10);
//
//		//转换器
//		List<Tree<String>> treeNodes = TreeUtil.build(list, "0", treeNodeConfig,
//		        (treeNode, tree) -> {
//		            tree.setId(Convert.toStr(treeNode.getMenuId()));
//		            tree.setParentId(Convert.toStr(treeNode.getParentId()));
////				            tree.setWeight(treeNode.getWeight());
//		            tree.setName(treeNode.getMenuName());
//		            // 扩展属性 ...
//		            tree.putExtra("icon", treeNode.getIcon());
//		            tree.putExtra("isFrame", treeNode.getIsFrame());
//		            tree.putExtra("menuType", treeNode.getMenuType());
//		            tree.putExtra("orderNum", treeNode.getOrderNum());
//		            tree.putExtra("path", treeNode.getPath());
//		            tree.putExtra("perms", treeNode.getPerms());
//		            tree.putExtra("remark", treeNode.getRemark());
//		            tree.putExtra("visible", treeNode.getVisible());
////				    tree.putExtra("other", new Object());
//		        });
//		
//		return ResultUtil.data(treeNodes);
//	}
	
	/**
	 * 新增-菜单权限
	 * 
	 * @param 部门岗位id
	 * @return
	 */
	@PostMapping(value = "/menu")
	@ApiOperation(value = "新增-菜单权限", httpMethod = "POST", notes = "接口发布说明")
	public Result<List<ZzglMenu>> insertPostMenus(@Validated @RequestBody ZzglMenu zzglMenu) {
		
		Integer conut = zzglMenuMapper.selectCount(new QueryWrapper<ZzglMenu>().lambda()
				.eq(ZzglMenu::getMenuId, zzglMenu.getParentId()));
		if (conut <= 0) {
			return ResultUtil.error("上级权限不存在!");
		}
		
		return zzglMenu.insert() ? ResultUtil.success() : ResultUtil.error();
	}
	
	/**
	 * 删除-菜单权限
	 * 
	 * @param 部门岗位id
	 * @return
	 */
	@DeleteMapping(value = "/menu/{id}")
	@ApiOperation(value = "删除-菜单权限", httpMethod = "DELETE", notes = "接口发布说明")
	public Result<List<ZzglMenu>> deletePostMenus(@Validated @RequestBody Integer id) {
		
		return zzglMenuMapper.deleteById(id) > 0 ? ResultUtil.success() : ResultUtil.error();
	}
	
	/**
	 * 修改-菜单权限
	 * 
	 * @param 部门岗位id
	 * @return
	 */
	@PutMapping(value = "/menu/{id}")
	@ApiOperation(value = "修改-菜单权限", httpMethod = "PUT", notes = "接口发布说明")
	public Result<List<ZzglMenu>> updatePostMenus(@Validated @RequestBody ZzglMenu zzglMenu) {
		
		return zzglMenu.updateById() ? ResultUtil.success() : ResultUtil.error();
	}
	
	/**
	 * 获取-该岗位的菜单权限
	 * 
	 * @param 部门岗位id
	 * @return
	 */
	@GetMapping(value = "/menu/{id}")
	@ApiOperation(value = "获取-该岗位的菜单权限", httpMethod = "GET", notes = "接口发布说明")
	public Result<List<Integer>> selectMenuByPostId(@CurrentUser UserBean userBean,@PathVariable Integer id) {
		
		return ResultUtil.data(zzglBmgwMService.selectMenuByPostId(id));
	}
	
	/**
	 * 修改-该岗位的菜单权限
	 * 
	 * @param 部门岗位id
	 * @return
	 */
	@PutMapping(value = "/post_menu")
	@ApiOperation(value = "修改-该岗位的菜单权限", httpMethod = "PUT", notes = "接口发布说明")
	public Result<List<ZzglMenu>> updatePostMenus(@CurrentUser UserBean userBean,@RequestBody ZzglPostMenuDto zzglPostMenuDto) {
		
		Integer delCount = zzglPostMenuMapper.delete(new QueryWrapper<ZzglPostMenu>().lambda()
				.eq(ZzglPostMenu::getBmgwId, zzglPostMenuDto.getId()));
		Integer updateCount = zzglPostMenuMapper.insertPostMenus(zzglPostMenuDto.getId(),zzglPostMenuDto.getMenus());
		
		return ResultUtil.success();
	}
	
yuquan.zhu committed
499
}