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