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