|
|
@@ -1,22 +1,97 @@
|
|
|
package com.xunmei.system.controller;
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
-import com.xunmei.common.core.web.controller.BaseController;
|
|
|
import com.xunmei.common.core.web.domain.AjaxResult;
|
|
|
-import com.xunmei.common.security.annotation.RequiresPermissions;
|
|
|
import com.xunmei.system.api.domain.Org;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
import com.xunmei.system.service.IOrgService;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import javax.annotation.Resource;
|
|
|
+import com.xunmei.common.security.annotation.RequiresPermissions;
|
|
|
+import com.xunmei.common.core.web.controller.BaseController;
|
|
|
+
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * OrgController 前端控制器
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author luojun
|
|
|
+ * @since 2023-08-07
|
|
|
+ */
|
|
|
+@Api(tags = {"OrgController"})
|
|
|
@RestController
|
|
|
@RequestMapping("/org")
|
|
|
public class OrgController extends BaseController {
|
|
|
- @Autowired
|
|
|
+
|
|
|
+ private final Logger log = LoggerFactory.getLogger(getClass());
|
|
|
+ @Resource
|
|
|
private IOrgService orgService;
|
|
|
|
|
|
+
|
|
|
+ @ApiOperation(value = "新增")
|
|
|
+ @RequiresPermissions("system:org:add")
|
|
|
+ @PostMapping("/add")
|
|
|
+ public AjaxResult add(@RequestBody Org org){
|
|
|
+ try {
|
|
|
+ return orgService.add(org);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ return error();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "删除")
|
|
|
+ @RequiresPermissions("system:org:delete")
|
|
|
+ @DeleteMapping("/{id}")
|
|
|
+ public AjaxResult delete(@PathVariable("id") Long id){
|
|
|
+ try {
|
|
|
+ return orgService.delete(id);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ return error();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "更新")
|
|
|
+ @RequiresPermissions("system:org:update")
|
|
|
+ @PutMapping("/update")
|
|
|
+ public AjaxResult update(@RequestBody Org org){
|
|
|
+ try {
|
|
|
+ return orgService.updateData(org);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ return error();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "查询分页数据")
|
|
|
+ @RequiresPermissions("system:org:findByPage")
|
|
|
+ @GetMapping("/findByPage")
|
|
|
+ public AjaxResult findListByPage(Page<Org> page,Org org){
|
|
|
+ try {
|
|
|
+ return orgService.findListByPage(page, org);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ return error();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "id查询")
|
|
|
+ @RequiresPermissions("system:org:findById")
|
|
|
+ @GetMapping("/{id}")
|
|
|
+ public AjaxResult findById(@PathVariable Long id){
|
|
|
+ try {
|
|
|
+ return orgService.findById(id);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ return error();
|
|
|
+ }
|
|
|
+ }
|
|
|
/**
|
|
|
* 获取部门列表
|
|
|
*/
|
|
|
@@ -24,11 +99,7 @@ public class OrgController extends BaseController {
|
|
|
@GetMapping("/list")
|
|
|
public AjaxResult list(Page<Org> page, Org org)
|
|
|
{
|
|
|
- orgService.selectPage(page, org);
|
|
|
+ orgService.findListByPage(page, org);
|
|
|
return success(page);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
}
|