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