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