package com.by4cloud.platform.processing.controller; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.by4cloud.platform.common.core.util.R; import com.by4cloud.platform.common.log.annotation.SysLog; import com.by4cloud.platform.processing.entity.CustomerUseCar; import com.by4cloud.platform.processing.service.CustomerUseCarService; import org.springframework.security.access.prepost.PreAuthorize; import com.by4cloud.platform.common.excel.annotation.ResponseExcel; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; import java.util.List; /** * 客户使用车表 * * @author zzl * @date 2025-10-20 10:38:04 */ @RestController @RequiredArgsConstructor @RequestMapping("/customerusecar" ) @Api(value = "customerusecar", tags = "客户使用车表管理") public class CustomerUseCarController { private final CustomerUseCarService customerUseCarService; /** * 分页查询 * @param page 分页对象 * @param customerUseCar 客户使用车表 * @return */ @ApiOperation(value = "分页查询", notes = "分页查询") @GetMapping("/page" ) @PreAuthorize("@pms.hasPermission('processing_customerusecar_view')" ) public R getCustomerUseCarPage(Page page, CustomerUseCar customerUseCar) { return R.ok(customerUseCarService.page(page, Wrappers.query(customerUseCar))); } /** * 通过id查询客户使用车表 * @param id id * @return R */ @ApiOperation(value = "通过id查询", notes = "通过id查询") @GetMapping("/{id}" ) @PreAuthorize("@pms.hasPermission('processing_customerusecar_view')" ) public R getById(@PathVariable("id" ) Integer id) { return R.ok(customerUseCarService.getById(id)); } /** * 新增客户使用车表 * @param customerUseCar 客户使用车表 * @return R */ @ApiOperation(value = "新增客户使用车表", notes = "新增客户使用车表") @SysLog("新增客户使用车表" ) @PostMapping @PreAuthorize("@pms.hasPermission('processing_customerusecar_add')" ) public R save(@RequestBody CustomerUseCar customerUseCar) { return R.ok(customerUseCarService.save(customerUseCar)); } /** * 修改客户使用车表 * @param customerUseCar 客户使用车表 * @return R */ @ApiOperation(value = "修改客户使用车表", notes = "修改客户使用车表") @SysLog("修改客户使用车表" ) @PutMapping @PreAuthorize("@pms.hasPermission('processing_customerusecar_edit')" ) public R updateById(@RequestBody CustomerUseCar customerUseCar) { return R.ok(customerUseCarService.updateById(customerUseCar)); } /** * 通过id删除客户使用车表 * @param id id * @return R */ @ApiOperation(value = "通过id删除客户使用车表", notes = "通过id删除客户使用车表") @SysLog("通过id删除客户使用车表" ) @DeleteMapping("/{id}" ) @PreAuthorize("@pms.hasPermission('processing_customerusecar_del')" ) public R removeById(@PathVariable Integer id) { return R.ok(customerUseCarService.removeById(id)); } /** * 导出excel 表格 * @param customerUseCar 查询条件 * @return excel 文件流 */ @ResponseExcel @GetMapping("/export") @PreAuthorize("@pms.hasPermission('processing_customerusecar_export')" ) public List export(CustomerUseCar customerUseCar) { return customerUseCarService.list(Wrappers.query(customerUseCar)); } }