package com.gear.admin.controller.finance;
|
|
import java.util.List;
|
import javax.servlet.http.HttpServletResponse;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.gear.common.builder.WhereBuilder;
|
import com.gear.common.vo.Result;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.*;
|
import com.gear.common.annotation.Log;
|
import com.gear.common.core.controller.BaseController;
|
import com.gear.common.enums.BusinessType;
|
import com.gear.finance.domain.FinanceMoneyLog;
|
import com.gear.finance.service.IFinanceMoneyLogService;
|
import com.gear.common.utils.poi.ExcelUtil;
|
|
/**
|
* 资金流水Controller
|
*
|
* @author czx
|
* @date 2023-11-16
|
*/
|
@RestController
|
@RequestMapping("/finance/moneyLog")
|
public class FinanceMoneyLogController extends BaseController
|
{
|
@Autowired
|
private IFinanceMoneyLogService financeMoneyLogService;
|
|
/**
|
* 查询资金流水列表
|
*/
|
@PreAuthorize("@ss.hasPermi('finance:moneyLog:list')")
|
@GetMapping("/list")
|
public Result<IPage<FinanceMoneyLog>> list(FinanceMoneyLog financeMoneyLog,
|
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize){
|
QueryWrapper<FinanceMoneyLog> queryWrapper = WhereBuilder.build(financeMoneyLog);
|
Page<FinanceMoneyLog> page = new Page<FinanceMoneyLog>(pageNo, pageSize);
|
IPage<FinanceMoneyLog> pageList = financeMoneyLogService.page(page, queryWrapper);
|
return Result.OK(pageList);
|
}
|
|
/**
|
* 导出资金流水列表
|
*/
|
@PreAuthorize("@ss.hasPermi('finance:moneyLog:export')")
|
@Log(title = "资金流水", businessType = BusinessType.EXPORT)
|
@PostMapping("/export")
|
public void export(HttpServletResponse response, FinanceMoneyLog financeMoneyLog){
|
QueryWrapper<FinanceMoneyLog> queryWrapper = WhereBuilder.build(financeMoneyLog);
|
List<FinanceMoneyLog> list = financeMoneyLogService.list(queryWrapper);
|
ExcelUtil<FinanceMoneyLog> util = new ExcelUtil<FinanceMoneyLog>(FinanceMoneyLog.class);
|
util.exportExcel(response, list, "资金流水数据");
|
}
|
|
/**
|
* 获取资金流水详细信息
|
*/
|
@PreAuthorize("@ss.hasPermi('finance:moneyLog:query')")
|
@GetMapping(value = "/{id}")
|
public Result<FinanceMoneyLog> getInfo(@PathVariable("id") String id){
|
FinanceMoneyLog financeMoneyLog = financeMoneyLogService.getById(id);
|
if(financeMoneyLog==null) {
|
return Result.error("未找到对应数据");
|
}
|
return Result.OK(financeMoneyLog);
|
}
|
|
/**
|
* 新增资金流水
|
*/
|
@PreAuthorize("@ss.hasPermi('finance:moneyLog:add')")
|
@Log(title = "资金流水", businessType = BusinessType.INSERT)
|
@PostMapping
|
public Result<String> add(@RequestBody FinanceMoneyLog financeMoneyLog){
|
financeMoneyLogService.save(financeMoneyLog);
|
return Result.ok("添加成功!");
|
}
|
|
/**
|
* 修改资金流水
|
*/
|
@PreAuthorize("@ss.hasPermi('finance:moneyLog:edit')")
|
@Log(title = "资金流水", businessType = BusinessType.UPDATE)
|
@PutMapping
|
public Result<String> edit(@RequestBody FinanceMoneyLog financeMoneyLog){
|
financeMoneyLogService.updateById(financeMoneyLog);
|
return Result.ok("编辑成功!");
|
}
|
|
/**
|
* 删除资金流水
|
*/
|
@PreAuthorize("@ss.hasPermi('finance:moneyLog:remove')")
|
@Log(title = "资金流水", businessType = BusinessType.DELETE)
|
@DeleteMapping("/{ids}")
|
public Result<String> remove(@PathVariable List<String> ids){
|
financeMoneyLogService.removeBatchByIds(ids);
|
return Result.ok("删除成功!");
|
}
|
}
|