package org.dromara.eims.controller;
|
|
import java.util.List;
|
|
import lombok.RequiredArgsConstructor;
|
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.validation.constraints.*;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import org.springframework.web.bind.annotation.*;
|
import org.springframework.validation.annotation.Validated;
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
import org.dromara.common.log.annotation.Log;
|
import org.dromara.common.web.core.BaseController;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.validate.AddGroup;
|
import org.dromara.common.core.validate.EditGroup;
|
import org.dromara.common.log.enums.BusinessType;
|
import org.dromara.common.excel.utils.ExcelUtil;
|
import org.dromara.eims.domain.vo.EimsFixtureBorrowVo;
|
import org.dromara.eims.domain.bo.EimsFixtureBorrowBo;
|
import org.dromara.eims.service.IEimsFixtureBorrowService;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
/**
|
* 借用记录
|
*
|
* @author zhuguifei
|
* @date 2025-02-18
|
*/
|
@Validated
|
@RequiredArgsConstructor
|
@RestController
|
@RequestMapping("/eims/fixBorrow")
|
public class EimsFixtureBorrowController extends BaseController {
|
|
private final IEimsFixtureBorrowService eimsFixtureBorrowService;
|
|
/**
|
* 查询借用记录列表
|
*/
|
@SaCheckPermission("eims:fixtureBorrow:list")
|
@GetMapping("/list")
|
public TableDataInfo<EimsFixtureBorrowVo> list(EimsFixtureBorrowBo bo, PageQuery pageQuery) {
|
return eimsFixtureBorrowService.queryPageList(bo, pageQuery);
|
}
|
|
/**
|
* 导出借用记录列表
|
*/
|
@SaCheckPermission("eims:fixtureBorrow:export")
|
@Log(title = "借用记录", businessType = BusinessType.EXPORT)
|
@PostMapping("/export")
|
public void export(EimsFixtureBorrowBo bo, HttpServletResponse response) {
|
List<EimsFixtureBorrowVo> list = eimsFixtureBorrowService.queryList(bo);
|
ExcelUtil.exportExcel(list, "借用记录", EimsFixtureBorrowVo.class, response);
|
}
|
|
/**
|
* 获取借用记录详细信息
|
*
|
* @param id 主键
|
*/
|
@SaCheckPermission("eims:fixtureBorrow:query")
|
@GetMapping("/{id}")
|
public R<EimsFixtureBorrowVo> getInfo(@NotNull(message = "主键不能为空")
|
@PathVariable Long id) {
|
return R.ok(eimsFixtureBorrowService.queryById(id));
|
}
|
|
/**
|
* 新增借用记录
|
*/
|
@SaCheckPermission("eims:fixtureBorrow:add")
|
@Log(title = "借用记录", businessType = BusinessType.INSERT)
|
@RepeatSubmit()
|
@PostMapping()
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody EimsFixtureBorrowBo bo) {
|
return toAjax(eimsFixtureBorrowService.insertByBo(bo));
|
}
|
|
/**
|
* 修改借用记录
|
*/
|
@SaCheckPermission("eims:fixtureBorrow:edit")
|
@Log(title = "借用记录", businessType = BusinessType.UPDATE)
|
@RepeatSubmit()
|
@PutMapping()
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody EimsFixtureBorrowBo bo) {
|
return toAjax(eimsFixtureBorrowService.updateByBo(bo));
|
}
|
|
/**
|
* 删除借用记录
|
*
|
* @param ids 主键串
|
*/
|
@SaCheckPermission("eims:fixtureBorrow:remove")
|
@Log(title = "借用记录", businessType = BusinessType.DELETE)
|
@DeleteMapping("/{ids}")
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
@PathVariable Long[] ids) {
|
return toAjax(eimsFixtureBorrowService.deleteWithValidByIds(List.of(ids), true));
|
}
|
}
|