wangliang 4 жил өмнө
parent
commit
611fc0af28

+ 88 - 0
teachcloud-report/src/main/java/com/qmth/teachcloud/report/api/SysOrgController.java

@@ -0,0 +1,88 @@
+package com.qmth.teachcloud.report.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.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 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(@RequestBody SysOrg org) {
+        boolean isSuccess = sysOrgService.saveOrg(org);
+        return ResultUtil.ok(isSuccess);
+    }
+
+    /**
+     * 启用/禁用
+     * @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);
+    }
+
+}
+