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