123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- package com.qmth.distributed.print.api;
- import com.qmth.boot.api.constant.ApiConstant;
- import com.qmth.distributed.print.business.service.PrintCommonService;
- import com.qmth.teachcloud.common.bean.dto.OrgDto;
- import com.qmth.teachcloud.common.entity.SysOrg;
- import com.qmth.teachcloud.common.service.SysOrgService;
- import com.qmth.teachcloud.common.util.Result;
- import com.qmth.teachcloud.common.util.ResultUtil;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.validation.BindingResult;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.RestController;
- import javax.annotation.Resource;
- import javax.validation.Valid;
- import java.util.List;
- /**
- * <p>
- * 学校组织架构 前端控制器
- * </p>
- *
- * @author xf
- * @since 2021-03-23
- */
- @Api(tags = "组织架构Controller")
- @RestController
- @RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + "/${prefix.url.sys}/org")
- public class SysOrgController {
- @Autowired
- private SysOrgService sysOrgService;
- @Resource
- PrintCommonService printCommonService;
- /**
- * 查询机构树
- *
- * @return
- */
- @ApiOperation(value = "查询")
- @RequestMapping(value = "/list", method = RequestMethod.POST)
- public Result list() {
- List<OrgDto> orgDtoList = sysOrgService.listOrgTree();
- return ResultUtil.ok(orgDtoList);
- }
- /**
- * 新增/修改
- *
- * @param org
- * @return
- */
- @ApiOperation(value = "新增/修改")
- @RequestMapping(value = "/save", method = RequestMethod.POST)
- public Result save(@Valid @RequestBody SysOrg org, BindingResult bindingResult) {
- if (bindingResult.hasErrors()) {
- return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
- }
- return ResultUtil.ok(sysOrgService.saveOrg(org));
- }
- /**
- * 启用/禁用
- *
- * @param org
- * @return
- */
- @ApiOperation(value = "启用/禁用")
- @RequestMapping(value = "/enable", method = RequestMethod.POST)
- public Result enable(@RequestBody SysOrg org) {
- boolean isSuccess = printCommonService.enable(org);
- return ResultUtil.ok(isSuccess);
- }
- /**
- * 删除
- *
- * @param org
- * @return
- */
- @ApiOperation(value = "删除")
- @RequestMapping(value = "/remove", method = RequestMethod.POST)
- public Result remove(@RequestBody SysOrg org) {
- boolean isSuccess = printCommonService.remove(org.getId());
- return ResultUtil.ok(isSuccess);
- }
- }
|