Merge branch 'dev'

This commit is contained in:
wangliwen 2023-01-03 15:34:51 +08:00
commit c53e1ca8ce
8 changed files with 291 additions and 0 deletions

View File

@ -0,0 +1,115 @@
package io.renren.modules.date_snapshot.controller;
import io.renren.common.annotation.LogOperation;
import io.renren.common.constant.Constant;
import io.renren.common.page.PageData;
import io.renren.common.utils.ExcelUtils;
import io.renren.common.utils.Result;
import io.renren.common.validator.AssertUtils;
import io.renren.common.validator.ValidatorUtils;
import io.renren.common.validator.group.AddGroup;
import io.renren.common.validator.group.DefaultGroup;
import io.renren.common.validator.group.UpdateGroup;
import io.renren.modules.date_snapshot.dto.SysDateSnapshotDTO;
import io.renren.modules.date_snapshot.excel.SysDateSnapshotExcel;
import io.renren.modules.date_snapshot.service.SysDateSnapshotService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
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 wangliwen wangliwen2@hisense.com
* @since 1.0 2023-01-03
*/
@RestController
@RequestMapping("date_snapshot/sysdatesnapshot")
@Api(tags = "运行数据快照(资源数量、申请数量)")
public class SysDateSnapshotController {
@Autowired
private SysDateSnapshotService sysDateSnapshotService;
@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")
})
// @RequiresPermissions("date_snapshot:sysdatesnapshot:page")
public Result<PageData<SysDateSnapshotDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params) {
PageData<SysDateSnapshotDTO> page = sysDateSnapshotService.page(params);
return new Result<PageData<SysDateSnapshotDTO>>().ok(page);
}
@GetMapping("{id}")
@ApiOperation("信息")
// @RequiresPermissions("date_snapshot:sysdatesnapshot:info")
public Result<SysDateSnapshotDTO> get(@PathVariable("id") Long id) {
SysDateSnapshotDTO data = sysDateSnapshotService.get(id);
return new Result<SysDateSnapshotDTO>().ok(data);
}
@PostMapping
@ApiOperation("保存")
@LogOperation("保存")
// @RequiresPermissions("date_snapshot:sysdatesnapshot:save")
public Result save(@RequestBody SysDateSnapshotDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
sysDateSnapshotService.save(dto);
return new Result();
}
@PutMapping
@ApiOperation("修改")
@LogOperation("修改")
// @RequiresPermissions("date_snapshot:sysdatesnapshot:update")
public Result update(@RequestBody SysDateSnapshotDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
sysDateSnapshotService.update(dto);
return new Result();
}
@DeleteMapping
@ApiOperation("删除")
@LogOperation("删除")
// @RequiresPermissions("date_snapshot:sysdatesnapshot:delete")
public Result delete(@RequestBody Long[] ids) {
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
sysDateSnapshotService.delete(ids);
return new Result();
}
@GetMapping("export")
@ApiOperation("导出")
@LogOperation("导出")
// @RequiresPermissions("date_snapshot:sysdatesnapshot:export")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<SysDateSnapshotDTO> list = sysDateSnapshotService.list(params);
ExcelUtils.exportExcelToTarget(response, null, "运行数据快照(资源数量、申请数量)", list, SysDateSnapshotExcel.class);
}
}

View File

@ -0,0 +1,16 @@
package io.renren.modules.date_snapshot.dao;
import io.renren.common.dao.BaseDao;
import io.renren.modules.date_snapshot.entity.SysDateSnapshotEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 运行数据快照资源数量申请数量
*
* @author wangliwen wangliwen2@hisense.com
* @since 1.0 2023-01-03
*/
@Mapper
public interface SysDateSnapshotDao extends BaseDao<SysDateSnapshotEntity> {
}

View File

@ -0,0 +1,34 @@
package io.renren.modules.date_snapshot.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 运行数据快照资源数量申请数量
*
* @author wangliwen wangliwen2@hisense.com
* @since 1.0 2023-01-03
*/
@Data
@ApiModel(value = "运行数据快照(资源数量、申请数量)")
public class SysDateSnapshotDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Long id;
@ApiModelProperty(value = "数据快照类型1每周快照 2每月快照")
private Integer type;
@ApiModelProperty(value = "创建人")
private Long creator;
@ApiModelProperty(value = "创建时间")
private Date createDate;
@ApiModelProperty(value = "数据快照内容")
private List<Map<String, Object>> snapshot;
}

View File

@ -0,0 +1,35 @@
package io.renren.modules.date_snapshot.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import io.renren.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
* 运行数据快照资源数量申请数量
*
* @author wangliwen wangliwen2@hisense.com
* @since 1.0 2023-01-03
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName(value = "sys_date_snapshot", autoResultMap = true)
public class SysDateSnapshotEntity extends BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 数据快照类型1每周快照 2每月快照
*/
private Integer type;
/**
* 数据快照内容
*/
@TableField(value = "`snapshot`", typeHandler = FastjsonTypeHandler.class)
private List<Map<String, Object>> snapshot;
}

View File

@ -0,0 +1,30 @@
package io.renren.modules.date_snapshot.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;
/**
* 运行数据快照资源数量申请数量
*
* @author wangliwen wangliwen2@hisense.com
* @since 1.0 2023-01-03
*/
@Data
@ContentRowHeight(20)
@HeadRowHeight(20)
@ColumnWidth(25)
public class SysDateSnapshotExcel {
@ExcelProperty(value = "主键", index = 0)
private Object id;
@ExcelProperty(value = "数据快照类型1每周快照 2每月快照", index = 1)
private Object type;
@ExcelProperty(value = "创建人", index = 2)
private Object creator;
@ExcelProperty(value = "创建时间", index = 3)
private Object createDate;
@ExcelProperty(value = "数据快照内容", index = 4)
private Object snapshot;
}

View File

@ -0,0 +1,15 @@
package io.renren.modules.date_snapshot.service;
import io.renren.common.service.CrudService;
import io.renren.modules.date_snapshot.dto.SysDateSnapshotDTO;
import io.renren.modules.date_snapshot.entity.SysDateSnapshotEntity;
/**
* 运行数据快照资源数量申请数量
*
* @author wangliwen wangliwen2@hisense.com
* @since 1.0 2023-01-03
*/
public interface SysDateSnapshotService extends CrudService<SysDateSnapshotEntity, SysDateSnapshotDTO> {
}

View File

@ -0,0 +1,31 @@
package io.renren.modules.date_snapshot.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.modules.date_snapshot.dao.SysDateSnapshotDao;
import io.renren.modules.date_snapshot.dto.SysDateSnapshotDTO;
import io.renren.modules.date_snapshot.entity.SysDateSnapshotEntity;
import io.renren.modules.date_snapshot.service.SysDateSnapshotService;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* 运行数据快照资源数量申请数量
*
* @author wangliwen wangliwen2@hisense.com
* @since 1.0 2023-01-03
*/
@Service
public class SysDateSnapshotServiceImpl extends CrudServiceImpl<SysDateSnapshotDao, SysDateSnapshotEntity, SysDateSnapshotDTO> implements SysDateSnapshotService {
@Override
public QueryWrapper<SysDateSnapshotEntity> getWrapper(Map<String, Object> params) {
QueryWrapper<SysDateSnapshotEntity> wrapper = new QueryWrapper<>();
return wrapper;
}
}

View File

@ -0,0 +1,15 @@
<?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="io.renren.modules.date_snapshot.dao.SysDateSnapshotDao">
<resultMap type="io.renren.modules.date_snapshot.entity.SysDateSnapshotEntity" id="sysDateSnapshotMap">
<result property="id" column="id"/>
<result property="type" column="type"/>
<result property="creator" column="creator"/>
<result property="createDate" column="create_date"/>
<result property="snapshot" column="snapshot"
typeHandler="com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler"/>
</resultMap>
</mapper>