Commit 851b52d5 authored by wanmin@bu2.cn's avatar wanmin@bu2.cn

理财推荐

parent e741d97e
......@@ -48,7 +48,6 @@ public class DappsDTO implements Serializable {
private Integer sort;
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
@ApiModelProperty(value = "收录时间")
private Date createTime;
}
\ No newline at end of file
}
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-22
*/
@Data
@ApiModel(value = "理财推荐")
public class FinancialDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Long id;
@ApiModelProperty(value = "产品名称")
private String name;
@ApiModelProperty(value = "logo")
private String logo;
@ApiModelProperty(value = "链接")
private String link;
@ApiModelProperty(value = "项目方")
private String ascription;
@ApiModelProperty(value = "排序")
private Integer sort;
@ApiModelProperty(value = "收益率")
private Float rateOfReturn;
@ApiModelProperty(value = "链类型")
private String chainCode;
@ApiModelProperty(value = "标签")
private String tag;
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
@ApiModelProperty(value = "创建时间")
private Date createTime;
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
@ApiModelProperty(value = "更新时间")
private Date updateTime;
@ApiModelProperty(value = "创建人")
private String creator;
@ApiModelProperty(value = "更新人")
private String updator;
}
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.FinancialDTO;
import com.roo.excel.FinancialExcel;
import com.roo.service.FinancialService;
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-22
*/
@RestController
@RequestMapping("financial")
@Api(tags="理财推荐")
public class FinancialController {
@Autowired
private FinancialService financialService;
@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('financial:financial:page')")
public Result<PageData<FinancialDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<FinancialDTO> page = financialService.page(params);
return new Result<PageData<FinancialDTO>>().ok(page);
}
@GetMapping("{id}")
@ApiOperation("信息")
@PreAuthorize("hasAuthority('financial:financial:info')")
public Result<FinancialDTO> get(@PathVariable("id") Long id){
FinancialDTO data = financialService.get(id);
return new Result<FinancialDTO>().ok(data);
}
@PostMapping
@ApiOperation("保存")
@LogOperation("保存")
@PreAuthorize("hasAuthority('financial:financial:save')")
public Result save(@RequestBody FinancialDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
financialService.save(dto);
return new Result();
}
@PutMapping
@ApiOperation("修改")
@LogOperation("修改")
@PreAuthorize("hasAuthority('financial:financial:update')")
public Result update(@RequestBody FinancialDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
financialService.update(dto);
return new Result();
}
@DeleteMapping
@ApiOperation("删除")
@LogOperation("删除")
@PreAuthorize("hasAuthority('financial:financial:delete')")
public Result delete(@RequestBody Long[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
financialService.delete(ids);
return new Result();
}
@GetMapping("export")
@ApiOperation("导出")
@LogOperation("导出")
@PreAuthorize("hasAuthority('financial:financial:export')")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<FinancialDTO> list = financialService.list(params);
ExcelUtils.exportExcelToTarget(response, null, "理财推荐", list, FinancialExcel.class);
}
}
package com.roo.dao;
import com.roo.commons.mybatis.dao.BaseDao;
import com.roo.entity.FinancialEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 理财推荐
*
* @author momin 460363410@qq.com
* @since 1.0 2021-07-22
*/
@Mapper
public interface FinancialDao extends BaseDao<FinancialEntity> {
}
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-22
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("roo_wallet.t_financial")
public class FinancialEntity {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId
private Long id;
/**
* 产品名称
*/
private String name;
/**
* logo
*/
private String logo;
/**
* 链接
*/
private String link;
/**
* 项目方
*/
private String ascription;
/**
* 排序
*/
private Integer sort;
/**
* 收益率
*/
private Float rateOfReturn;
/**
* 链类型
*/
private String chainCode;
/**
* 标签
*/
private String tag;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
private Date createTime;
/**
* 更新时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
private String creator;
/**
* 更新人
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private String updator;
}
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-22
*/
@Data
@ContentRowHeight(20)
@HeadRowHeight(20)
@ColumnWidth(25)
public class FinancialExcel {
@ExcelProperty(value = "主键", index = 0)
private Long id;
@ExcelProperty(value = "产品名称", index = 1)
private String name;
@ExcelProperty(value = "logo", index = 2)
private String logo;
@ExcelProperty(value = "链接", index = 3)
private String link;
@ExcelProperty(value = "项目方", index = 4)
private String ascription;
@ExcelProperty(value = "排序", index = 5)
private Integer sort;
@ExcelProperty(value = "收益率", index = 6)
private Float rateOfReturn;
@ExcelProperty(value = "链类型", index = 7)
private String chainCode;
@ExcelProperty(value = "标签", index = 8)
private String tag;
@ExcelProperty(value = "创建时间", index = 9)
private Date createTime;
@ExcelProperty(value = "更新时间", index = 10)
private Date updateTime;
@ExcelProperty(value = "创建人", index = 11)
private String creator;
@ExcelProperty(value = "更新人", index = 12)
private String updator;
}
package com.roo.service;
import com.roo.commons.mybatis.service.CrudService;
import com.roo.dto.FinancialDTO;
import com.roo.entity.FinancialEntity;
/**
* 理财推荐
*
* @author momin 460363410@qq.com
* @since 1.0 2021-07-22
*/
public interface FinancialService extends CrudService<FinancialEntity, FinancialDTO> {
}
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.FinancialDao;
import com.roo.dto.FinancialDTO;
import com.roo.entity.FinancialEntity;
import com.roo.service.FinancialService;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* 理财推荐
*
* @author momin 460363410@qq.com
* @since 1.0 2021-07-22
*/
@Service
public class FinancialServiceImpl extends CrudServiceImpl<FinancialDao, FinancialEntity, FinancialDTO> implements FinancialService {
@Override
public QueryWrapper<FinancialEntity> getWrapper(Map<String, Object> params){
QueryWrapper<FinancialEntity> wrapper = new QueryWrapper<>();
return wrapper;
}
}
<?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.FinancialDao">
<resultMap type="com.roo.entity.FinancialEntity" id="tFinancialMap">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="logo" column="logo"/>
<result property="link" column="link"/>
<result property="ascription" column="ascription"/>
<result property="sort" column="sort"/>
<result property="rateOfReturn" column="rate_of_return"/>
<result property="chainCode" column="chain_code"/>
<result property="tag" column="tag"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<result property="creator" column="creator"/>
<result property="updator" column="updator"/>
</resultMap>
</mapper>
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