zss
2025-02-17 087991c76f078defe5eb55d84223021b4199fb3d
cnas-server/src/main/java/com/yuanchu/mom/controller/DeviceBorrowController.java
@@ -3,6 +3,7 @@
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuanchu.mom.annotation.ValueAuth;
import com.yuanchu.mom.pojo.DeviceBorrow;
import com.yuanchu.mom.service.DeviceBorrowService;
import com.yuanchu.mom.utils.JackSonUtil;
@@ -32,6 +33,7 @@
    //分页
    @PostMapping("/deviceBorrowPage")
    @ValueAuth
    public Result deviceBorrowPage(@RequestBody Map<String, Object> data) throws Exception {
        Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class);
        DeviceBorrow deviceBorrow = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), DeviceBorrow.class);
@@ -40,24 +42,28 @@
    //查询
    @GetMapping("/getDeviceBorrow")
    @ValueAuth
    public Result getDeviceBorrow(Integer id) {
        return Result.success(deviceBorrowService.getDeviceBorrow(id));
    }
    //新增
    @PostMapping("/saveDeviceBorrow")
    @ValueAuth
    public Result saveDeviceBorrow(@RequestBody DeviceBorrow deviceBorrow) {
        return Result.success(deviceBorrowService.saveDeviceBorrow(deviceBorrow));
    }
    //删除
    @PostMapping("/deleteDeviceBorrow")
    @ValueAuth
    public Result deleteDeviceBorrow(Integer id) {
        return Result.success(deviceBorrowService.removeById(id));
    }
    //导出
    @PostMapping("/deviceBorrowExport")
    @ValueAuth
    public Result deviceBorrowExport(@RequestParam("deviceId") Integer deviceId, HttpServletResponse response) throws Exception {
        List<DeviceBorrow> deviceBorrows = deviceBorrowService.getDeviceBorrowBydeviceId(deviceId);
        response.setHeader("requestType", "excel");