package com.gear.admin.controller.swx;; 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.swx.domain.SwxMoneyLog; import com.gear.swx.service.ISwxMoneyLogService; import com.gear.common.utils.poi.ExcelUtil; /** * 资金日志Controller * * @author czx * @date 2023-11-20 */ @RestController @RequestMapping("/swx/moneyLog") public class SwxMoneyLogController extends BaseController { @Autowired private ISwxMoneyLogService swxMoneyLogService; /** * 查询资金日志列表 */ @PreAuthorize("@ss.hasPermi('swx:moneyLog:list')") @GetMapping("/list") public Result> list(SwxMoneyLog swxMoneyLog, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name="pageSize", defaultValue="10") Integer pageSize){ QueryWrapper queryWrapper = WhereBuilder.build(swxMoneyLog); Page page = new Page(pageNo, pageSize); IPage pageList = swxMoneyLogService.page(page, queryWrapper); return Result.OK(pageList); } /** * 导出资金日志列表 */ @PreAuthorize("@ss.hasPermi('swx:moneyLog:export')") @Log(title = "资金日志", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, SwxMoneyLog swxMoneyLog){ QueryWrapper queryWrapper = WhereBuilder.build(swxMoneyLog); List list = swxMoneyLogService.list(queryWrapper); ExcelUtil util = new ExcelUtil(SwxMoneyLog.class); util.exportExcel(response, list, "资金日志数据"); } /** * 获取资金日志详细信息 */ @PreAuthorize("@ss.hasPermi('swx:moneyLog:query')") @GetMapping(value = "/{id}") public Result getInfo(@PathVariable("id") String id){ SwxMoneyLog swxMoneyLog = swxMoneyLogService.getById(id); if(swxMoneyLog==null) { return Result.error("未找到对应数据"); } return Result.OK(swxMoneyLog); } /** * 新增资金日志 */ @PreAuthorize("@ss.hasPermi('swx:moneyLog:add')") @Log(title = "资金日志", businessType = BusinessType.INSERT) @PostMapping public Result add(@RequestBody SwxMoneyLog swxMoneyLog){ swxMoneyLogService.save(swxMoneyLog); return Result.ok("添加成功!"); } /** * 修改资金日志 */ @PreAuthorize("@ss.hasPermi('swx:moneyLog:edit')") @Log(title = "资金日志", businessType = BusinessType.UPDATE) @PutMapping public Result edit(@RequestBody SwxMoneyLog swxMoneyLog){ swxMoneyLogService.updateById(swxMoneyLog); return Result.ok("编辑成功!"); } /** * 删除资金日志 */ @PreAuthorize("@ss.hasPermi('swx:moneyLog:remove')") @Log(title = "资金日志", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public Result remove(@PathVariable List ids){ swxMoneyLogService.removeBatchByIds(ids); return Result.ok("删除成功!"); } }