模拟数据生成
This commit is contained in:
parent
282b8626a3
commit
368265541a
@ -0,0 +1,157 @@
|
||||
package com.zhgd.xmgl.modules.frontier.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.jeecg.common.util.oConvertUtils;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import com.zhgd.xmgl.modules.frontier.entity.MockFrontierProtectionDevCurrentDataConfig;
|
||||
import com.zhgd.xmgl.modules.frontier.service.IMockFrontierProtectionDevCurrentDataConfigService;
|
||||
|
||||
import org.simpleframework.xml.core.Validate;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
|
||||
|
||||
/**
|
||||
* @Title: Controller
|
||||
* @Description: 模拟临边防护设备实时数据配置
|
||||
* @author: pds
|
||||
* @date: 2025-05-13
|
||||
* @version: V1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/xmgl/mockFrontierProtectionDevCurrentDataConfig")
|
||||
@Slf4j
|
||||
@Api(tags = "模拟临边防护设备实时数据配置相关Api")
|
||||
public class MockFrontierProtectionDevCurrentDataConfigController {
|
||||
@Autowired
|
||||
private IMockFrontierProtectionDevCurrentDataConfigService mockFrontierProtectionDevCurrentDataConfigService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "模拟临边防护设备实时数据配置管理", operType = "分页查询", operDesc = "分页列表查询模拟临边防护设备实时数据配置信息")
|
||||
@ApiOperation(value = "分页列表查询模拟临边防护设备实时数据配置信息", notes = "分页列表查询模拟临边防护设备实时数据配置信息", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"),
|
||||
})
|
||||
@GetMapping(value = "/page")
|
||||
public Result<IPage<MockFrontierProtectionDevCurrentDataConfig>> queryPageList(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
return Result.success(mockFrontierProtectionDevCurrentDataConfigService.queryPageList(param));
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "模拟临边防护设备实时数据配置管理", operType = "列表查询", operDesc = "列表查询模拟临边防护设备实时数据配置信息")
|
||||
@ApiOperation(value = "列表查询模拟临边防护设备实时数据配置信息", notes = "列表查询模拟临边防护设备实时数据配置信息", httpMethod = "GET")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<MockFrontierProtectionDevCurrentDataConfig>> queryList(@ApiIgnore @RequestParam HashMap<String, Object> param) {
|
||||
return Result.success(mockFrontierProtectionDevCurrentDataConfigService.queryList(param));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param mockFrontierProtectionDevCurrentDataConfig
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "模拟临边防护设备实时数据配置管理", operType = "添加", operDesc = "添加模拟临边防护设备实时数据配置信息")
|
||||
@ApiOperation(value = "添加模拟临边防护设备实时数据配置信息", notes = "添加模拟临边防护设备实时数据配置信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<MockFrontierProtectionDevCurrentDataConfig> add(@RequestBody @Validate MockFrontierProtectionDevCurrentDataConfig mockFrontierProtectionDevCurrentDataConfig) {
|
||||
mockFrontierProtectionDevCurrentDataConfigService.add(mockFrontierProtectionDevCurrentDataConfig);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param mockFrontierProtectionDevCurrentDataConfig
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "模拟临边防护设备实时数据配置管理", operType = "编辑", operDesc = "编辑模拟临边防护设备实时数据配置信息")
|
||||
@ApiOperation(value = "编辑模拟临边防护设备实时数据配置信息", notes = "编辑模拟临边防护设备实时数据配置信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<MockFrontierProtectionDevCurrentDataConfig> edit(@RequestBody MockFrontierProtectionDevCurrentDataConfig mockFrontierProtectionDevCurrentDataConfig) {
|
||||
mockFrontierProtectionDevCurrentDataConfigService.edit(mockFrontierProtectionDevCurrentDataConfig);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "模拟临边防护设备实时数据配置管理", operType = "删除", operDesc = "删除模拟临边防护设备实时数据配置信息")
|
||||
@ApiOperation(value = "删除模拟临边防护设备实时数据配置信息", notes = "删除模拟临边防护设备实时数据配置信息", httpMethod = "POST")
|
||||
@ApiImplicitParam(name = "id", value = "模拟临边防护设备实时数据配置ID", paramType = "body", required = true, dataType = "String", example = "{\"id\":\"1\"}")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<MockFrontierProtectionDevCurrentDataConfig> delete(@ApiIgnore @RequestBody HashMap<String, Object> map) {
|
||||
mockFrontierProtectionDevCurrentDataConfigService.delete(MapUtils.getString(map, "id"));
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "模拟临边防护设备实时数据配置管理", operType = "通过id查询", operDesc = "通过id查询模拟临边防护设备实时数据配置信息")
|
||||
@ApiOperation(value = "通过id查询模拟临边防护设备实时数据配置信息", notes = "通过id查询模拟临边防护设备实时数据配置信息", httpMethod = "GET")
|
||||
@ApiImplicitParam(name = "id", value = "模拟临边防护设备实时数据配置ID", paramType = "query", required = true, dataType = "Integer")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<MockFrontierProtectionDevCurrentDataConfig> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
return Result.success(mockFrontierProtectionDevCurrentDataConfigService.queryById(id));
|
||||
}
|
||||
|
||||
@OperLog(operModul = "模拟临边防护设备实时数据配置管理", operType = "保存", operDesc = "保存模拟临边防护设备实时数据配置信息")
|
||||
@ApiOperation(value = "保存模拟临边防护设备实时数据配置信息", notes = "保存模拟临边防护设备实时数据配置信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/save")
|
||||
public Result<MockFrontierProtectionDevCurrentDataConfig> saveEntity(@RequestBody MockFrontierProtectionDevCurrentDataConfig mockFrontierProtectionDevCurrentDataConfig) {
|
||||
mockFrontierProtectionDevCurrentDataConfigService.saveEntity(mockFrontierProtectionDevCurrentDataConfig);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,117 @@
|
||||
package com.zhgd.xmgl.modules.frontier.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* @Description: 模拟临边防护设备实时数据配置
|
||||
* @author: pds
|
||||
* @date: 2025-05-13
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("mock_frontier_protection_dev_current_data_config")
|
||||
@ApiModel(value = "MockFrontierProtectionDevCurrentDataConfig实体类", description = "MockFrontierProtectionDevCurrentDataConfig")
|
||||
public class MockFrontierProtectionDevCurrentDataConfig implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "id")
|
||||
private java.lang.Long id;
|
||||
/**
|
||||
* 所属项目SN
|
||||
*/
|
||||
@ApiModelProperty(value = "所属项目SN")
|
||||
private java.lang.String projectSn;
|
||||
/**
|
||||
* 设备sn(多个,分隔)
|
||||
*/
|
||||
@ApiModelProperty(value = "设备sn(多个,分隔)")
|
||||
private java.lang.String devSns;
|
||||
/**
|
||||
* 每个设备随机生成数量
|
||||
*/
|
||||
@ApiModelProperty(value = "每个设备随机生成数量")
|
||||
private java.lang.Integer devGenerateNum;
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "开始时间")
|
||||
private java.util.Date startTime;
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "结束时间")
|
||||
private java.util.Date endTime;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private java.util.Date createDate;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private java.util.Date updateDate;
|
||||
/**
|
||||
* 剩余电量百分比(0-100)开始
|
||||
*/
|
||||
@ApiModelProperty(value = "剩余电量百分比(0-100)开始")
|
||||
private java.lang.Float batteryBegin;
|
||||
/**
|
||||
* 剩余电量百分比(0-100)结束
|
||||
*/
|
||||
@ApiModelProperty(value = "剩余电量百分比(0-100)结束")
|
||||
private java.lang.Float batteryEnd;
|
||||
/**
|
||||
* 线锁1 状态 1-正常;2-断开;3-正常断开(多个数字,分割)
|
||||
*/
|
||||
@ApiModelProperty(value = "线锁1 状态 1-正常;2-断开;3-正常断开(多个数字,分割)")
|
||||
private java.lang.String portStatus1s;
|
||||
/**
|
||||
* 线锁2 状态 1-正常;2-断开;3-正常断开(多个数字,分割)
|
||||
*/
|
||||
@ApiModelProperty(value = "线锁2 状态 1-正常;2-断开;3-正常断开(多个数字,分割)")
|
||||
private java.lang.String portStatus2s;
|
||||
/**
|
||||
* 磁锁1 状态 1-正常;2-报警;3-失效(多个数字,分割)
|
||||
*/
|
||||
@ApiModelProperty(value = "磁锁1 状态 1-正常;2-报警;3-失效(多个数字,分割)")
|
||||
private java.lang.String magStatus1s;
|
||||
/**
|
||||
* 磁锁2 状态 1-正常;2-报警;3-失效(多个数字,分割)
|
||||
*/
|
||||
@ApiModelProperty(value = "磁锁2 状态 1-正常;2-报警;3-失效(多个数字,分割)")
|
||||
private java.lang.String magStatus2s;
|
||||
/**
|
||||
* 防翻越 1-正常;2-报警;3-失效(多个数字,分割)
|
||||
*/
|
||||
@ApiModelProperty(value = "防翻越 1-正常;2-报警;3-失效(多个数字,分割)")
|
||||
private java.lang.String antiCrosses;
|
||||
/**
|
||||
* 人员靠近 1-正常;2-入侵;3-正常入侵(多个数字,分割)
|
||||
*/
|
||||
@ApiModelProperty(value = "人员靠近 1-正常;2-入侵;3-正常入侵(多个数字,分割)")
|
||||
private java.lang.String proximitys;
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
package com.zhgd.xmgl.modules.frontier.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.zhgd.xmgl.modules.frontier.entity.MockFrontierProtectionDevCurrentDataConfig;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 模拟临边防护设备实时数据配置
|
||||
* @author: pds
|
||||
* @date: 2025-05-13
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface MockFrontierProtectionDevCurrentDataConfigMapper extends BaseMapper<MockFrontierProtectionDevCurrentDataConfig> {
|
||||
|
||||
/**
|
||||
* 分页列表查询模拟临边防护设备实时数据配置信息
|
||||
*
|
||||
* @param page
|
||||
* @param queryWrapper
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
IPage<MockFrontierProtectionDevCurrentDataConfig> queryList(Page<MockFrontierProtectionDevCurrentDataConfig> page, @Param(Constants.WRAPPER) QueryWrapper<MockFrontierProtectionDevCurrentDataConfig> queryWrapper, @Param("param") HashMap<String, Object> param);
|
||||
|
||||
/**
|
||||
* 列表查询模拟临边防护设备实时数据配置信息
|
||||
*
|
||||
* @param queryWrapper
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<MockFrontierProtectionDevCurrentDataConfig> queryList(@Param(Constants.WRAPPER) QueryWrapper<MockFrontierProtectionDevCurrentDataConfig> queryWrapper, @Param("param") HashMap<String, Object> param);
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询模拟临边防护设备实时数据配置信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
MockFrontierProtectionDevCurrentDataConfig queryById(String id);
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
<?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.zhgd.xmgl.modules.frontier.mapper.MockFrontierProtectionDevCurrentDataConfigMapper">
|
||||
<select id="queryList"
|
||||
resultType="com.zhgd.xmgl.modules.frontier.entity.MockFrontierProtectionDevCurrentDataConfig">
|
||||
select * from (
|
||||
select t.*
|
||||
from mock_frontier_protection_dev_current_data_config t
|
||||
)t
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
<select id="queryById"
|
||||
resultType="com.zhgd.xmgl.modules.frontier.entity.MockFrontierProtectionDevCurrentDataConfig">
|
||||
select * from (
|
||||
select t.*
|
||||
from mock_frontier_protection_dev_current_data_config t
|
||||
)t
|
||||
where t.id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
@ -0,0 +1,66 @@
|
||||
package com.zhgd.xmgl.modules.frontier.service;
|
||||
|
||||
import com.zhgd.xmgl.modules.frontier.entity.MockFrontierProtectionDevCurrentDataConfig;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 模拟临边防护设备实时数据配置
|
||||
* @author: pds
|
||||
* @date: 2025-05-13
|
||||
* @version: V1.0
|
||||
*/
|
||||
public interface IMockFrontierProtectionDevCurrentDataConfigService extends IService<MockFrontierProtectionDevCurrentDataConfig> {
|
||||
/**
|
||||
* 分页列表查询模拟临边防护设备实时数据配置信息
|
||||
*
|
||||
* @param param 参数map
|
||||
* @return
|
||||
*/
|
||||
IPage<MockFrontierProtectionDevCurrentDataConfig> queryPageList(HashMap<String, Object> param);
|
||||
|
||||
/**
|
||||
* 列表查询模拟临边防护设备实时数据配置信息
|
||||
*
|
||||
* @param param 参数map
|
||||
* @return
|
||||
*/
|
||||
List<MockFrontierProtectionDevCurrentDataConfig> queryList(HashMap<String, Object> param);
|
||||
|
||||
/**
|
||||
* 添加模拟临边防护设备实时数据配置信息
|
||||
*
|
||||
* @param mockFrontierProtectionDevCurrentDataConfig 模拟临边防护设备实时数据配置
|
||||
* @return
|
||||
*/
|
||||
void add(MockFrontierProtectionDevCurrentDataConfig mockFrontierProtectionDevCurrentDataConfig);
|
||||
|
||||
/**
|
||||
* 编辑模拟临边防护设备实时数据配置信息
|
||||
*
|
||||
* @param mockFrontierProtectionDevCurrentDataConfig 模拟临边防护设备实时数据配置
|
||||
* @return
|
||||
*/
|
||||
void edit(MockFrontierProtectionDevCurrentDataConfig mockFrontierProtectionDevCurrentDataConfig);
|
||||
|
||||
/**
|
||||
* 根据id删除模拟临边防护设备实时数据配置信息
|
||||
*
|
||||
* @param id 模拟临边防护设备实时数据配置的id
|
||||
* @return
|
||||
*/
|
||||
void delete(String id);
|
||||
|
||||
/**
|
||||
* 根据id查询模拟临边防护设备实时数据配置信息
|
||||
*
|
||||
* @param id 模拟临边防护设备实时数据配置的id
|
||||
* @return
|
||||
*/
|
||||
MockFrontierProtectionDevCurrentDataConfig queryById(String id);
|
||||
|
||||
void saveEntity(MockFrontierProtectionDevCurrentDataConfig config);
|
||||
}
|
||||
@ -0,0 +1,103 @@
|
||||
package com.zhgd.xmgl.modules.frontier.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.xmgl.modules.frontier.entity.MockFrontierProtectionDevCurrentDataConfig;
|
||||
import com.zhgd.xmgl.modules.frontier.mapper.MockFrontierProtectionDevCurrentDataConfigMapper;
|
||||
import com.zhgd.xmgl.modules.frontier.service.IMockFrontierProtectionDevCurrentDataConfigService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.util.PageUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.zhgd.xmgl.util.RefUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* @Description: 模拟临边防护设备实时数据配置
|
||||
* @author: pds
|
||||
* @date: 2025-05-13
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class MockFrontierProtectionDevCurrentDataConfigServiceImpl extends ServiceImpl<MockFrontierProtectionDevCurrentDataConfigMapper, MockFrontierProtectionDevCurrentDataConfig> implements IMockFrontierProtectionDevCurrentDataConfigService {
|
||||
@Autowired
|
||||
private MockFrontierProtectionDevCurrentDataConfigMapper mockFrontierProtectionDevCurrentDataConfigMapper;
|
||||
|
||||
@Override
|
||||
public IPage<MockFrontierProtectionDevCurrentDataConfig> queryPageList(HashMap<String, Object> param) {
|
||||
QueryWrapper<MockFrontierProtectionDevCurrentDataConfig> queryWrapper = this.getQueryWrapper(param);
|
||||
Page<MockFrontierProtectionDevCurrentDataConfig> page = PageUtil.getPage(param);
|
||||
IPage<MockFrontierProtectionDevCurrentDataConfig> pageList = baseMapper.queryList(page, queryWrapper, param);
|
||||
pageList.setRecords(this.dealList(pageList.getRecords()));
|
||||
return pageList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MockFrontierProtectionDevCurrentDataConfig> queryList(HashMap<String, Object> param) {
|
||||
QueryWrapper<MockFrontierProtectionDevCurrentDataConfig> queryWrapper = getQueryWrapper(param);
|
||||
return dealList(baseMapper.queryList(queryWrapper, param));
|
||||
}
|
||||
|
||||
private QueryWrapper<MockFrontierProtectionDevCurrentDataConfig> getQueryWrapper(HashMap<String, Object> param) {
|
||||
QueryWrapper<MockFrontierProtectionDevCurrentDataConfig> queryWrapper = QueryGenerator.initPageQueryWrapper(MockFrontierProtectionDevCurrentDataConfig.class, param, true);
|
||||
queryWrapper.orderByDesc(RefUtil.fieldNameUlc(MockFrontierProtectionDevCurrentDataConfig::getId));
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
private List<MockFrontierProtectionDevCurrentDataConfig> dealList(List<MockFrontierProtectionDevCurrentDataConfig> list) {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(MockFrontierProtectionDevCurrentDataConfig mockFrontierProtectionDevCurrentDataConfig) {
|
||||
mockFrontierProtectionDevCurrentDataConfig.setId(null);
|
||||
baseMapper.insert(mockFrontierProtectionDevCurrentDataConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void edit(MockFrontierProtectionDevCurrentDataConfig mockFrontierProtectionDevCurrentDataConfig) {
|
||||
MockFrontierProtectionDevCurrentDataConfig oldMockFrontierProtectionDevCurrentDataConfig = baseMapper.selectById(mockFrontierProtectionDevCurrentDataConfig.getId());
|
||||
if (oldMockFrontierProtectionDevCurrentDataConfig == null) {
|
||||
throw new OpenAlertException("未找到对应实体");
|
||||
}
|
||||
baseMapper.updateById(mockFrontierProtectionDevCurrentDataConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(String id) {
|
||||
MockFrontierProtectionDevCurrentDataConfig mockFrontierProtectionDevCurrentDataConfig = baseMapper.selectById(id);
|
||||
if (mockFrontierProtectionDevCurrentDataConfig == null) {
|
||||
throw new OpenAlertException("未找到对应实体");
|
||||
}
|
||||
baseMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MockFrontierProtectionDevCurrentDataConfig queryById(String id) {
|
||||
MockFrontierProtectionDevCurrentDataConfig entity = baseMapper.queryById(id);
|
||||
if (entity == null) {
|
||||
throw new OpenAlertException("未找到对应实体");
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveEntity(MockFrontierProtectionDevCurrentDataConfig config) {
|
||||
MockFrontierProtectionDevCurrentDataConfig dbConfig = this.getOne(new LambdaQueryWrapper<MockFrontierProtectionDevCurrentDataConfig>()
|
||||
.eq(MockFrontierProtectionDevCurrentDataConfig::getProjectSn, config.getProjectSn()));
|
||||
if (dbConfig == null) {
|
||||
this.add(config);
|
||||
} else {
|
||||
config.setId(dbConfig.getId());
|
||||
this.edit(config);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user