新增指定规格的枚举类保存基本操作

This commit is contained in:
weizhiqiang 2022-09-12 10:22:25 +08:00
parent b08fd62b14
commit 14e3d8caf0
6 changed files with 251 additions and 0 deletions

View file

@ -0,0 +1,46 @@
/*******************************************************************************
* Copyright 卫志强 QQ598748873@qq.com Inc. All rights reserved. 开源地址https://gitee.com/doc_wei01/skyeye
******************************************************************************/
package com.skyeye.eve.controller;
import com.skyeye.annotation.api.Api;
import com.skyeye.annotation.api.ApiImplicitParams;
import com.skyeye.annotation.api.ApiOperation;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
import com.skyeye.eve.entity.classenum.SkyeyeClassEnumApiMation;
import com.skyeye.eve.service.SkyeyeClassEnumService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @ClassName: SkyeyeClassEnumController
* @Description: 基本框架---具备某个特征的枚举类管理控制类
* @author: skyeye云系列--卫志强
* @date: 2022/9/11 19:50
* @Copyright: 2022 https://gitee.com/doc_wei01/skyeye Inc. All rights reserved.
* 注意本内容仅限购买后使用.禁止私自外泄以及用于其他的商业目的
*/
@RestController
@Api(value = "枚举类管理", tags = "枚举类管理", modelName = "系统公共模块")
public class SkyeyeClassEnumController {
@Autowired
private SkyeyeClassEnumService skyeyeClassEnumService;
/**
* 批量新增枚举类
*
* @param inputObject 入参以及用户信息等获取对象
* @param outputObject 出参以及提示信息的返回值对象
*/
@ApiOperation(id = "writeClassEnum", value = "批量新增枚举类", method = "POST", allUse = "0")
@ApiImplicitParams(classBean = SkyeyeClassEnumApiMation.class)
@RequestMapping("/post/SkyeyeClassEnumController/writeClassEnum")
public void writeClassEnum(InputObject inputObject, OutputObject outputObject) {
skyeyeClassEnumService.writeClassEnum(inputObject, outputObject);
}
}

View file

@ -0,0 +1,18 @@
/*******************************************************************************
* Copyright 卫志强 QQ598748873@qq.com Inc. All rights reserved. 开源地址https://gitee.com/doc_wei01/skyeye
******************************************************************************/
package com.skyeye.eve.dao;
import com.skyeye.eve.entity.classenum.SkyeyeClassEnumMation;
/**
* @ClassName: SkyeyeClassEnumDao
* @Description: 基本框架---具备某个特征的枚举类管理数据层
* @author: skyeye云系列--卫志强
* @date: 2022/9/11 19:51
* @Copyright: 2022 https://gitee.com/doc_wei01/skyeye Inc. All rights reserved.
* 注意本内容仅限购买后使用.禁止私自外泄以及用于其他的商业目的
*/
public interface SkyeyeClassEnumDao extends SkyeyeBaseMapper<SkyeyeClassEnumMation> {
}

View file

@ -0,0 +1,41 @@
/*******************************************************************************
* Copyright 卫志强 QQ598748873@qq.com Inc. All rights reserved. 开源地址https://gitee.com/doc_wei01/skyeye
******************************************************************************/
package com.skyeye.eve.entity.classenum;
import com.skyeye.annotation.api.ApiModel;
import com.skyeye.annotation.api.ApiModelProperty;
import com.skyeye.common.base.classenum.dto.SkyeyeEnumDto;
import com.skyeye.common.entity.CommonOperatorUserInfo;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
* @ClassName: SkyeyeClassEnumApiMation
* @Description: 具备某个特征的枚举类表对应的实体类BOX
* @author: skyeye云系列--卫志强
* @date: 2022/9/11 23:14
* @Copyright: 2022 https://gitee.com/doc_wei01/skyeye Inc. All rights reserved.
* 注意本内容仅限购买后使用.禁止私自外泄以及用于其他的商业目的
*/
@Data
@ApiModel("具备某个特征的枚举类表对应的实体类BOX")
public class SkyeyeClassEnumApiMation extends CommonOperatorUserInfo implements Serializable {
/**
* 服务名
*/
@ApiModelProperty(value = "服务名", required = "required")
private String springApplicationName;
/**
* 枚举信息
*/
@ApiModelProperty(value = "枚举信息", required = "required")
private Map<String, List<SkyeyeEnumDto>> valueList;
}

View file

@ -0,0 +1,57 @@
/*******************************************************************************
* Copyright 卫志强 QQ598748873@qq.com Inc. All rights reserved. 开源地址https://gitee.com/doc_wei01/skyeye
******************************************************************************/
package com.skyeye.eve.entity.classenum;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.skyeye.annotation.api.ApiModel;
import com.skyeye.common.base.classenum.dto.SkyeyeEnumDto;
import com.skyeye.common.entity.CommonOperatorUserInfo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* @ClassName: SkyeyeClassEnumMation
* @Description: 具备某个特征的枚举类表对应的实体类
* @author: skyeye云系列--卫志强
* @date: 2022/9/11 23:14
* @Copyright: 2022 https://gitee.com/doc_wei01/skyeye Inc. All rights reserved.
* 注意本内容仅限购买后使用.禁止私自外泄以及用于其他的商业目的
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName(value = "skyeye_class_enum", autoResultMap = true)
@ApiModel("具备某个特征的枚举类表对应的实体类")
public class SkyeyeClassEnumMation extends CommonOperatorUserInfo implements Serializable {
@TableId("id")
private String id;
/**
* 服务名
*/
@TableField("spring_application_name")
private String springApplicationName;
/**
* 枚举类的className
*/
@TableField("class_name")
private String className;
/**
* 枚举对应的值
*/
@TableField(value = "value_list", typeHandler = FastjsonTypeHandler.class)
private List<SkyeyeEnumDto> valueList;
}

View file

@ -0,0 +1,24 @@
/*******************************************************************************
* Copyright 卫志强 QQ598748873@qq.com Inc. All rights reserved. 开源地址https://gitee.com/doc_wei01/skyeye
******************************************************************************/
package com.skyeye.eve.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
import com.skyeye.eve.entity.classenum.SkyeyeClassEnumMation;
/**
* @ClassName: SkyeyeClassEnumService
* @Description: 基本框架---具备某个特征的枚举类管理服务接口层
* @author: skyeye云系列--卫志强
* @date: 2022/9/11 19:52
* @Copyright: 2022 https://gitee.com/doc_wei01/skyeye Inc. All rights reserved.
* 注意本内容仅限购买后使用.禁止私自外泄以及用于其他的商业目的
*/
public interface SkyeyeClassEnumService extends IService<SkyeyeClassEnumMation> {
void writeClassEnum(InputObject inputObject, OutputObject outputObject);
}

View file

@ -0,0 +1,65 @@
/*******************************************************************************
* Copyright 卫志强 QQ598748873@qq.com Inc. All rights reserved. 开源地址https://gitee.com/doc_wei01/skyeye
******************************************************************************/
package com.skyeye.eve.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
import com.skyeye.common.util.DataCommonUtil;
import com.skyeye.common.util.mybatisplus.MybatisPlusUtil;
import com.skyeye.eve.dao.SkyeyeClassEnumDao;
import com.skyeye.eve.entity.classenum.SkyeyeClassEnumApiMation;
import com.skyeye.eve.entity.classenum.SkyeyeClassEnumMation;
import com.skyeye.eve.service.SkyeyeClassEnumService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* @ClassName: SkyeyeClassEnumServiceImpl
* @Description: 基本框架---具备某个特征的枚举类管理服务类
* @author: skyeye云系列--卫志强
* @date: 2022/9/11 20:26
* @Copyright: 2022 https://gitee.com/doc_wei01/skyeye Inc. All rights reserved.
* 注意本内容仅限购买后使用.禁止私自外泄以及用于其他的商业目的
*/
@Service
public class SkyeyeClassEnumServiceImpl extends ServiceImpl<SkyeyeClassEnumDao, SkyeyeClassEnumMation> implements SkyeyeClassEnumService {
@Autowired
private SkyeyeClassEnumDao skyeyeClassEnumDao;
/**
* 批量新增枚举类
*
* @param inputObject 入参以及用户信息等获取对象
* @param outputObject 出参以及提示信息的返回值对象
*/
@Override
public void writeClassEnum(InputObject inputObject, OutputObject outputObject) {
SkyeyeClassEnumApiMation skyeyeClassEnumApiMation = inputObject.getParams(SkyeyeClassEnumApiMation.class);
// 根据服务名删除枚举信息
QueryWrapper<SkyeyeClassEnumMation> wrapper = new QueryWrapper<>();
wrapper.eq(MybatisPlusUtil.toColumns(SkyeyeClassEnumMation::getSpringApplicationName), skyeyeClassEnumApiMation.getSpringApplicationName());
remove(wrapper);
// 解析数据并添加
List<SkyeyeClassEnumMation> skyeyeClassEnumMationList = new ArrayList<>();
skyeyeClassEnumApiMation.getValueList().forEach((className, enumDto) -> {
SkyeyeClassEnumMation skyeyeClassEnumMation = new SkyeyeClassEnumMation();
skyeyeClassEnumMation.setClassName(className);
skyeyeClassEnumMation.setValueList(enumDto);
skyeyeClassEnumMation.setSpringApplicationName(skyeyeClassEnumApiMation.getSpringApplicationName());
DataCommonUtil.setCommonDataByGenericity(skyeyeClassEnumMation, "0dc9dd4cd4d446ae9455215fe753c44e");
skyeyeClassEnumMationList.add(skyeyeClassEnumMation);
});
saveBatch(skyeyeClassEnumMationList);
}
}