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