|
package org.springblade.modules.extra.controller;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import io.swagger.annotations.ApiParam;
|
import lombok.AllArgsConstructor;
|
import org.springblade.core.boot.ctrl.BladeController;
|
import org.springblade.core.mp.support.Condition;
|
import org.springblade.core.mp.support.Query;
|
import org.springblade.core.tool.api.R;
|
import org.springblade.core.tool.utils.Func;
|
import org.springblade.modules.extra.entity.Extra;
|
import org.springblade.modules.extra.service.ExtraService;
|
import org.springblade.modules.extra.vo.ExtraVO;
|
import org.springframework.web.bind.annotation.*;
|
|
/**
|
* 加班控制器
|
* @author zhongrj
|
* @since 2022-02-28
|
*/
|
@RestController
|
@AllArgsConstructor
|
@RequestMapping("/extra")
|
public class ExtraController extends BladeController {
|
|
private final ExtraService extraService;
|
|
/**
|
* 详情
|
*/
|
@GetMapping("/detail")
|
public R<Extra> detail(Extra extra) {
|
Extra detail = extraService.getOne(Condition.getQueryWrapper(extra));
|
return R.data(detail);
|
}
|
|
/**
|
* 分页
|
*/
|
@GetMapping("/list")
|
public R<IPage<Extra>> list(Extra extra, Query query) {
|
IPage<Extra> pages = extraService.page(Condition.getPage(query), Condition.getQueryWrapper(extra));
|
return R.data(pages);
|
}
|
|
/**
|
* 自定义分页
|
*/
|
@GetMapping("/page")
|
public R<IPage<ExtraVO>> page(ExtraVO extra, Query query) {
|
IPage<ExtraVO> pages = extraService.selectExtraPage(Condition.getPage(query), extra);
|
return R.data(pages);
|
}
|
|
/**
|
* 新增
|
*/
|
@PostMapping("/save")
|
public R save(@RequestBody Extra extra) {
|
return R.data(extraService.save(extra));
|
}
|
|
|
/**
|
* 修改
|
*/
|
@PostMapping("/update")
|
public R update(@RequestBody Extra extra) {
|
return R.data(extraService.updateById(extra));
|
}
|
|
/**
|
* 新增或修改
|
*/
|
@PostMapping("/submit")
|
public R submit(@RequestBody Extra extra) {
|
return R.status(extraService.saveOrUpdate(extra));
|
}
|
|
|
/**
|
* 删除
|
*/
|
@PostMapping("/remove")
|
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
|
return R.status(extraService.removeByIds(Func.toLongList(ids)));
|
}
|
|
|
}
|