Publish apes-Authon via gitea-publish skill
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
package cn.apes.cloud.controller;
|
||||
|
||||
import cn.apes.cloud.domain.entity.SysQuota;
|
||||
import cn.apes.cloud.service.impl.SysQuotaServiceImpl;
|
||||
import cn.apes.commons.Res;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/quota")
|
||||
public class SysQuotaController {
|
||||
|
||||
@Autowired
|
||||
private SysQuotaServiceImpl sysQuotaService;
|
||||
|
||||
@PostMapping("/page")
|
||||
public Res pageQuota(@RequestBody JSONObject data) {
|
||||
int pageIndex = data.getIntValue("pageIndex");
|
||||
int pageSize = data.getIntValue("pageSize");
|
||||
if (pageIndex <= 0) pageIndex = 1;
|
||||
if (pageSize <= 0) pageSize = 10;
|
||||
String appKey = data.getString("appKey");
|
||||
String quotaName = data.getString("quotaName");
|
||||
String quotaCode = data.getString("quotaCode");
|
||||
return Res.success(sysQuotaService.pageQuota(pageIndex, pageSize, appKey, quotaName, quotaCode));
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
public Res addQuota(@RequestBody SysQuota quota) {
|
||||
return sysQuotaService.addQuota(quota);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public Res updateQuota(@RequestBody SysQuota quota) {
|
||||
return sysQuotaService.updateQuota(quota);
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
public Res deleteQuota(@RequestBody JSONObject data) {
|
||||
Long id = data.getLong("id");
|
||||
return sysQuotaService.deleteQuota(id);
|
||||
}
|
||||
|
||||
@GetMapping("/detail")
|
||||
public Res getDetail(@RequestParam Long id) {
|
||||
SysQuota quota = sysQuotaService.getById(id);
|
||||
if (quota == null) return Res.fail("配额不存在");
|
||||
return Res.success(quota);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user