|
@@ -0,0 +1,82 @@
|
|
|
+/*
|
|
|
+ * Copyright (c) 2025 GaoKunW
|
|
|
+ *
|
|
|
+ */
|
|
|
+
|
|
|
+package org.eco.vip.auth.controller.position;
|
|
|
+
|
|
|
+
|
|
|
+import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
+import jakarta.annotation.Resource;
|
|
|
+import jakarta.validation.Valid;
|
|
|
+import jakarta.validation.constraints.NotEmpty;
|
|
|
+import org.eco.vip.auth.domain.position.pojo.PositionBO;
|
|
|
+import org.eco.vip.auth.domain.position.pojo.PositionVO;
|
|
|
+import org.eco.vip.auth.service.position.IPositionService;
|
|
|
+import org.eco.vip.orm.pojo.CommonResult;
|
|
|
+import org.eco.vip.orm.pojo.PageResult;
|
|
|
+import org.eco.vip.security.annotation.PermissionsResource;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import static org.eco.vip.orm.pojo.CommonResult.fail;
|
|
|
+import static org.eco.vip.orm.pojo.CommonResult.success;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @description PositionController
|
|
|
+ *
|
|
|
+ * @author GaoKunW
|
|
|
+ * @date 2025/7/4 16:03
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/system/position")
|
|
|
+@Validated
|
|
|
+@PermissionsResource("position")
|
|
|
+public class PositionController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IPositionService positionService;
|
|
|
+
|
|
|
+ @GetMapping("/page")
|
|
|
+ public CommonResult<PageResult<PositionVO>> page(PositionBO positionBO) {
|
|
|
+ return success(positionService.selectPage(positionBO));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/list")
|
|
|
+ public CommonResult<List<PositionVO>> list(PositionBO positionBO) {
|
|
|
+ return success(positionService.selectList(positionBO));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/add")
|
|
|
+ @SaCheckPermission("system:position:add")
|
|
|
+ public CommonResult<String> add(@RequestBody @Valid PositionBO positionBO) {
|
|
|
+ boolean result = positionService.insert(positionBO);
|
|
|
+ if (!result) {
|
|
|
+ return fail("新增职位失败!");
|
|
|
+ }
|
|
|
+ return success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @DeleteMapping("/edit")
|
|
|
+ public CommonResult<String> edit(@RequestBody @Valid PositionBO positionBO) {
|
|
|
+ return success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/delete")
|
|
|
+ @SaCheckPermission("system:position:delete")
|
|
|
+ public CommonResult<String> delete(@RequestBody @Valid @NotEmpty(message = "集合不能为空") List<String> ids) {
|
|
|
+ boolean result = positionService.delete(ids);
|
|
|
+ if (!result) {
|
|
|
+ return fail("删除职位失败!");
|
|
|
+ }
|
|
|
+
|
|
|
+ return success();
|
|
|
+ }
|
|
|
+}
|