Commit d0d54c84 authored by wanmin@bu2.cn's avatar wanmin@bu2.cn

币种详情

parent 851b52d5
package com.roo.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.roo.commons.tools.utils.DateUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 代币详情
*
* @author momin 460363410@qq.com
* @since 1.0 2021-07-24
*/
@Data
@ApiModel(value = "代币详情")
public class TokenResourceDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Long id;
@ApiModelProperty(value = "block_chain_code")
private String chainCode;
@ApiModelProperty(value = "符号")
private String symbol;
@ApiModelProperty(value = "合约地址")
private String contractId;
@ApiModelProperty(value = "资源:JSON")
private Object resource;
@ApiModelProperty(value = "详情")
private String detail;
@ApiModelProperty(value = "发行量")
private Long totalSupply;
@ApiModelProperty(value = "是否限制供应")
private Boolean isUpper;
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
@ApiModelProperty(value = "创建时间")
private Date createDate;
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
@ApiModelProperty(value = "更新时间")
private Date updateDate;
}
package com.roo.controller;
import com.roo.commons.log.annotation.LogOperation;
import com.roo.commons.tools.constant.Constant;
import com.roo.commons.tools.page.PageData;
import com.roo.commons.tools.utils.Result;
import com.roo.commons.tools.utils.ExcelUtils;
import com.roo.commons.tools.validator.AssertUtils;
import com.roo.commons.tools.validator.ValidatorUtils;
import com.roo.commons.tools.validator.group.AddGroup;
import com.roo.commons.tools.validator.group.DefaultGroup;
import com.roo.commons.tools.validator.group.UpdateGroup;
import com.roo.dto.TokenResourceDTO;
import com.roo.excel.TokenResourceExcel;
import com.roo.service.TokenResourceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 代币详情
*
* @author momin 460363410@qq.com
* @since 1.0 2021-07-24
*/
@RestController
@RequestMapping("tokenresource")
@Api(tags="代币详情")
public class TokenResourceController {
@Autowired
private TokenResourceService tokenResourceService;
@GetMapping("page")
@ApiOperation("分页")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
})
@PreAuthorize("hasAuthority('tokenresource:tokenresource:page')")
public Result<PageData<TokenResourceDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<TokenResourceDTO> page = tokenResourceService.page(params);
return new Result<PageData<TokenResourceDTO>>().ok(page);
}
@GetMapping("{id}")
@ApiOperation("信息")
@PreAuthorize("hasAuthority('tokenresource:tokenresource:info')")
public Result<TokenResourceDTO> get(@PathVariable("id") Long id){
TokenResourceDTO data = tokenResourceService.get(id);
return new Result<TokenResourceDTO>().ok(data);
}
@PostMapping
@ApiOperation("保存")
@LogOperation("保存")
@PreAuthorize("hasAuthority('tokenresource:tokenresource:save')")
public Result save(@RequestBody TokenResourceDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
tokenResourceService.save(dto);
return new Result();
}
@PutMapping
@ApiOperation("修改")
@LogOperation("修改")
@PreAuthorize("hasAuthority('tokenresource:tokenresource:update')")
public Result update(@RequestBody TokenResourceDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
tokenResourceService.update(dto);
return new Result();
}
@DeleteMapping
@ApiOperation("删除")
@LogOperation("删除")
@PreAuthorize("hasAuthority('tokenresource:tokenresource:delete')")
public Result delete(@RequestBody Long[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
tokenResourceService.delete(ids);
return new Result();
}
@GetMapping("export")
@ApiOperation("导出")
@LogOperation("导出")
@PreAuthorize("hasAuthority('tokenresource:tokenresource:export')")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<TokenResourceDTO> list = tokenResourceService.list(params);
ExcelUtils.exportExcelToTarget(response, null, "代币详情", list, TokenResourceExcel.class);
}
}
package com.roo.dao;
import com.roo.commons.mybatis.dao.BaseDao;
import com.roo.entity.TokenResourceEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 代币详情
*
* @author momin 460363410@qq.com
* @since 1.0 2021-07-24
*/
@Mapper
public interface TokenResourceDao extends BaseDao<TokenResourceEntity> {
}
\ No newline at end of file
package com.roo.entity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.baomidou.mybatisplus.annotation.*;
import java.util.Date;
/**
* 代币详情
*
* @author momin 460363410@qq.com
* @since 1.0 2021-07-24
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("roo_wallet.t_token_resource")
public class TokenResourceEntity {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId
private Long id;
/**
* block_chain_code
*/
private String chainCode;
/**
* 符号
*/
private String symbol;
/**
* 合约地址
*/
private String contractId;
/**
* 资源:JSON
*/
private Object resource;
/**
* 详情
*/
private String detail;
/**
* 发行量
*/
private Long totalSupply;
/**
* 是否限制供应
*/
private Boolean isUpper;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
private Date createDate;
/**
* 更新时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateDate;
}
package com.roo.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
import java.util.Date;
/**
* 代币详情
*
* @author momin 460363410@qq.com
* @since 1.0 2021-07-24
*/
@Data
@ContentRowHeight(20)
@HeadRowHeight(20)
@ColumnWidth(25)
public class TokenResourceExcel {
@ExcelProperty(value = "主键", index = 0)
private Long id;
@ExcelProperty(value = "block_chain_code", index = 1)
private String chainCode;
@ExcelProperty(value = "符号", index = 2)
private String symbol;
@ExcelProperty(value = "合约地址", index = 3)
private String contractId;
@ExcelProperty(value = "资源:JSON", index = 4)
private Object resource;
@ExcelProperty(value = "详情", index = 5)
private String detail;
@ExcelProperty(value = "发行量", index = 6)
private Long totalSupply;
@ExcelProperty(value = "是否限制供应", index = 7)
private Boolean isUpper;
@ExcelProperty(value = "创建时间", index = 8)
private Date createDate;
@ExcelProperty(value = "更新时间", index = 9)
private Date updateDate;
}
\ No newline at end of file
package com.roo.service;
import com.roo.commons.mybatis.service.CrudService;
import com.roo.dto.TokenResourceDTO;
import com.roo.entity.TokenResourceEntity;
/**
* 代币详情
*
* @author momin 460363410@qq.com
* @since 1.0 2021-07-24
*/
public interface TokenResourceService extends CrudService<TokenResourceEntity, TokenResourceDTO> {
}
\ No newline at end of file
package com.roo.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.roo.commons.mybatis.service.impl.CrudServiceImpl;
import com.roo.dao.TokenResourceDao;
import com.roo.dto.TokenResourceDTO;
import com.roo.entity.TokenResourceEntity;
import com.roo.service.TokenResourceService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* 代币详情
*
* @author momin 460363410@qq.com
* @since 1.0 2021-07-24
*/
@Service
public class TokenResourceServiceImpl extends CrudServiceImpl<TokenResourceDao, TokenResourceEntity, TokenResourceDTO> implements TokenResourceService {
@Override
public QueryWrapper<TokenResourceEntity> getWrapper(Map<String, Object> params){
QueryWrapper<TokenResourceEntity> wrapper = new QueryWrapper<>();
return wrapper;
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.roo.dao.TokenResourceDao">
<resultMap type="com.roo.entity.TokenResourceEntity" id="tokenResourceMap">
<result property="id" column="id"/>
<result property="chainCode" column="chain_code"/>
<result property="symbol" column="symbol"/>
<result property="contractId" column="contract_id"/>
<result property="resource" column="resource"/>
<result property="detail" column="detail"/>
<result property="totalSupply" column="total_supply"/>
<result property="isUpper" column="is_upper"/>
<result property="createDate" column="create_date"/>
<result property="updateDate" column="update_date"/>
</resultMap>
</mapper>
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment