package com.by4cloud.platformx.business.controller;
|
|
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.ArrayUtil;
|
import cn.hutool.core.collection.CollUtil;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.by4cloud.platformx.common.core.util.R;
|
import com.by4cloud.platformx.common.log.annotation.SysLog;
|
import com.by4cloud.platformx.business.entity.HistoryOverdue;
|
import com.by4cloud.platformx.business.service.HistoryOverdueService;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
import com.by4cloud.platformx.common.excel.annotation.ResponseExcel;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import org.springdoc.core.annotations.ParameterObject;
|
import org.springframework.http.HttpHeaders;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.Operation;
|
import lombok.RequiredArgsConstructor;
|
import org.springframework.web.bind.annotation.*;
|
|
import java.util.List;
|
import java.util.Objects;
|
|
/**
|
* 历史逾期
|
*
|
* @author syt
|
* @date 2026-04-29 11:31:18
|
*/
|
@RestController
|
@RequiredArgsConstructor
|
@RequestMapping("/historyOverdue" )
|
@Tag(description = "historyOverdue" , name = "历史逾期管理" )
|
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
public class HistoryOverdueController {
|
|
private final HistoryOverdueService historyOverdueService;
|
|
/**
|
* 分页查询
|
* @param page 分页对象
|
* @param historyOverdue 历史逾期
|
* @return
|
*/
|
@Operation(summary = "分页查询" , description = "分页查询" )
|
@GetMapping("/page" )
|
@PreAuthorize("@pms.hasPermission('business_historyOverdue_view')" )
|
public R getHistoryOverduePage(@ParameterObject Page page, @ParameterObject HistoryOverdue historyOverdue) {
|
LambdaQueryWrapper<HistoryOverdue> wrapper = Wrappers.lambdaQuery();
|
wrapper.like(StrUtil.isNotBlank(historyOverdue.getBusGuestName()),HistoryOverdue::getBusGuestName,historyOverdue.getBusGuestName());
|
wrapper.like(StrUtil.isNotBlank(historyOverdue.getContractName()),HistoryOverdue::getContractName,historyOverdue.getContractName());
|
wrapper.orderByDesc(HistoryOverdue::getCreateTime);
|
return R.ok(historyOverdueService.page(page, wrapper));
|
}
|
|
|
/**
|
* 通过id查询历史逾期
|
* @param id id
|
* @return R
|
*/
|
@Operation(summary = "通过id查询" , description = "通过id查询" )
|
@GetMapping("/{id}" )
|
@PreAuthorize("@pms.hasPermission('business_historyOverdue_view')" )
|
public R getById(@PathVariable("id" ) Long id) {
|
return R.ok(historyOverdueService.getById(id));
|
}
|
|
/**
|
* 新增历史逾期
|
* @param historyOverdue 历史逾期
|
* @return R
|
*/
|
@Operation(summary = "新增历史逾期" , description = "新增历史逾期" )
|
@SysLog("新增历史逾期" )
|
@PostMapping
|
@PreAuthorize("@pms.hasPermission('business_historyOverdue_add')" )
|
public R save(@RequestBody HistoryOverdue historyOverdue) {
|
return R.ok(historyOverdueService.save(historyOverdue));
|
}
|
|
/**
|
* 修改历史逾期
|
* @param historyOverdue 历史逾期
|
* @return R
|
*/
|
@Operation(summary = "修改历史逾期" , description = "修改历史逾期" )
|
@SysLog("修改历史逾期" )
|
@PutMapping
|
@PreAuthorize("@pms.hasPermission('business_historyOverdue_edit')" )
|
public R updateById(@RequestBody HistoryOverdue historyOverdue) {
|
return R.ok(historyOverdueService.updateById(historyOverdue));
|
}
|
|
/**
|
* 通过id删除历史逾期
|
* @param ids id列表
|
* @return R
|
*/
|
@Operation(summary = "通过id删除历史逾期" , description = "通过id删除历史逾期" )
|
@SysLog("通过id删除历史逾期" )
|
@DeleteMapping
|
@PreAuthorize("@pms.hasPermission('business_historyOverdue_del')" )
|
public R removeById(@RequestBody Long[] ids) {
|
return R.ok(historyOverdueService.removeBatchByIds(CollUtil.toList(ids)));
|
}
|
|
|
/**
|
* 导出excel 表格
|
* @param historyOverdue 查询条件
|
* @param ids 导出指定ID
|
* @return excel 文件流
|
*/
|
@ResponseExcel
|
@GetMapping("/export")
|
@PreAuthorize("@pms.hasPermission('business_historyOverdue_export')" )
|
public List<HistoryOverdue> export(HistoryOverdue historyOverdue,Long[] ids) {
|
return historyOverdueService.list(Wrappers.lambdaQuery(historyOverdue).in(ArrayUtil.isNotEmpty(ids), HistoryOverdue::getId, ids));
|
}
|
}
|