123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- package com.benyun.controller;
- import com.benyun.boot.core.vo.Result;
- import com.benyun.vo.ApplyEventVo;
- import lombok.RequiredArgsConstructor;
- import com.benyun.entity.Apply;
- import com.benyun.service.ApplyService;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import org.beetl.sql.core.engine.PageQuery;
- import java.util.List;
- /**
- * @author makejava
- * create on 2023-03-17 10:03:25
- */
- @RestController
- @RequestMapping("apply")
- @RequiredArgsConstructor(onConstructor_ = {@Autowired})
- @CrossOrigin
- public class ApplyController {
- /**
- * 服务对象
- */
- private final ApplyService applyService;
- /**
- * 查询所有数据
- *
- * @return 所有数据
- */
- @GetMapping("/queryAll")
- public Result<List<Apply>> queryAll() {
- return Result.success(applyService.queryAll());
- }
- /**
- * 查询所有数据
- *
- * @return 所有数据
- */
- @GetMapping("/queryList")
- public Result<List<Apply>> queryList(@RequestParam(required = false) String applyName) {
- return Result.success(applyService.queryList(applyName));
- }
- /**
- * 分页查询数据
- *
- * @return 所有数据
- */
- @GetMapping("/queryPage")
- public Result<List<Apply>> queryPage(@RequestParam Integer pageNum, @RequestParam Integer pageSize, Apply apply) {
- PageQuery<Apply> pageQuery = new PageQuery<Apply>();
- pageQuery.setPageSize(pageSize);
- pageQuery.setPageNumber(pageNum);
- pageQuery.setParas(apply);
- return applyService.queryByPage(pageQuery);
- }
- /**
- * 通过主键查询单条数据
- *
- * @param id 主键
- * @return 单条数据
- */
- @GetMapping("/queryOne")
- public Result<Apply> queryOne(@RequestParam("id") String id) {
- return Result.success(applyService.queryById(id));
- }
- /**
- * 新增数据
- *
- * @param apply 实体对象
- * @return 新增结果
- */
- @PostMapping("/create")
- public Result<?> create(@RequestBody Apply apply) {
- applyService.insert(apply);
- return Result.success(apply);
- }
- /**
- * 修改数据
- *
- * @param apply 实体对象
- * @return 修改结果
- */
- @PostMapping("/update")
- public Result<?> update(@RequestBody Apply apply) {
- return applyService.updateById(apply) ? Result.success() : Result.failure();
- }
- /**
- * 删除数据
- *
- * @param id 主键
- * @return 删除结果
- */
- @PostMapping("/delete")
- public Result<Boolean> delete(@RequestParam("id") String id) {
- return Result.success(this.applyService.deleteById(id));
- }
- /**
- * 通过应用id查询应用的事件数据
- *
- * @return 所有数据
- */
- @GetMapping("/queryApplyEventByUUId")
- public Result<ApplyEventVo> queryApplyEventByUUId(@RequestParam("uuid") String uuid) {
- return Result.success(applyService.queryApplyEventByUUId(uuid));
- }
- }
|