Files
usdt/ruoyi-system/src/main/java/com/ruoyi/system/controller/Web3WalletController.java
T
2025-12-02 23:05:53 +08:00

154 lines
5.3 KiB
Java

package com.ruoyi.system.controller;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.select.Ids;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.Web3Wallet;
import com.ruoyi.system.domain.Web3WalletPlus;
import com.ruoyi.system.service.IWeb3WalletService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 钱包管理Controller
*
* @author luqj
* @date 2025-11-25
*/
@RestController
@RequestMapping("/system/wallet" )
public class Web3WalletController extends BaseController {
@Autowired
private IWeb3WalletService web3WalletService;
@PreAuthorize("@ss.hasPermi('system:wallet:getByIds')" )
@PostMapping("/getByIds" )
public AjaxResult getByIds(@RequestBody Ids ids) {
List<Web3WalletPlus> list = web3WalletService.getByIds(ids.getLongIds(), false, Web3WalletPlus::getUsdtBalance, Web3WalletPlus::getId);
return AjaxResult.success(list);
}
@PreAuthorize("@ss.hasPermi('system:wallet:user-getByIds')" )
@PostMapping("/user/getByIds" )
public AjaxResult userGetByIds(@RequestBody Ids ids) {
List<Web3WalletPlus> list = web3WalletService.getByIds(ids.getLongIds(), true, Web3WalletPlus::getUsdtBalance, Web3WalletPlus::getId);
return AjaxResult.success(list);
}
/**
* 查询钱包管理列表
*/
@PreAuthorize("@ss.hasPermi('system:wallet:list')" )
@GetMapping("/list" )
public TableDataInfo list(Web3Wallet web3Wallet) {
startPage();
List<Web3Wallet> list = web3WalletService.selectWeb3WalletList(web3Wallet, false);
return getDataTable(list);
}
/**
* 查询钱包管理列表
*/
@PreAuthorize("@ss.hasPermi('system:wallet:user-list')" )
@GetMapping("/user/list" )
public TableDataInfo userList(Web3Wallet web3Wallet) {
startPage();
List<Web3Wallet> list = web3WalletService.selectWeb3WalletList(web3Wallet, true);
return getDataTable(list);
}
/**
* 导出钱包管理列表
*/
@PreAuthorize("@ss.hasPermi('system:wallet:export')" )
@Log(title = "钱包管理" , businessType = BusinessType.EXPORT)
@GetMapping("/export" )
public AjaxResult export(Web3Wallet web3Wallet) {
List<Web3Wallet> list = web3WalletService.selectWeb3WalletList(web3Wallet, false);
ExcelUtil<Web3Wallet> util = new ExcelUtil<Web3Wallet>(Web3Wallet.class);
return util.exportExcel(list, "wallet" );
}
/**
* 获取钱包管理详细信息
*/
@PreAuthorize("@ss.hasPermi('system:wallet:query')" )
@GetMapping(value = "/{id}" )
public AjaxResult getInfo(@PathVariable("id" ) Long id) {
return AjaxResult.success(web3WalletService.selectWeb3WalletById(id, false));
}
/**
* 获取钱包管理详细信息
*/
@PreAuthorize("@ss.hasPermi('system:wallet:user-query')" )
@GetMapping(value = "/user/{id}" )
public AjaxResult userGetInfo(@PathVariable("id" ) Long id) {
return AjaxResult.success(web3WalletService.selectWeb3WalletById(id, true));
}
/**
* 新增钱包管理
*/
@PreAuthorize("@ss.hasPermi('system:wallet:add')" )
@Log(title = "钱包管理" , businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Web3Wallet web3Wallet) {
return toAjax(web3WalletService.insertWeb3Wallet(web3Wallet, false));
}
/**
* 新增钱包管理
*/
@PreAuthorize("@ss.hasPermi('system:wallet:user-add')" )
@Log(title = "钱包管理" , businessType = BusinessType.INSERT)
@PostMapping("/user" )
public AjaxResult userAdd(@RequestBody Web3Wallet web3Wallet) {
return toAjax(web3WalletService.insertWeb3Wallet(web3Wallet, true));
}
/**
* 修改钱包管理
*/
@PreAuthorize("@ss.hasPermi('system:wallet:edit')" )
@Log(title = "钱包管理" , businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Web3Wallet web3Wallet) {
return toAjax(web3WalletService.updateWeb3Wallet(web3Wallet, false));
}
@PreAuthorize("@ss.hasPermi('system:wallet:user-edit')" )
@Log(title = "钱包管理" , businessType = BusinessType.UPDATE)
@PutMapping("/user" )
public AjaxResult userEdit(@RequestBody Web3Wallet web3Wallet) {
return toAjax(web3WalletService.updateWeb3Wallet(web3Wallet, true));
}
/**
* 删除钱包管理
*/
@PreAuthorize("@ss.hasPermi('system:wallet:remove')" )
@Log(title = "钱包管理" , businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}" )
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(web3WalletService.deleteWeb3WalletByIds(ids, false));
}
/**
* 删除钱包管理
*/
@PreAuthorize("@ss.hasPermi('system:wallet:user-remove')" )
@Log(title = "钱包管理" , businessType = BusinessType.DELETE)
@DeleteMapping("/user/{ids}" )
public AjaxResult userRemove(@PathVariable Long[] ids) {
return toAjax(web3WalletService.deleteWeb3WalletByIds(ids, true));
}
}