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