Merge remote-tracking branch 'origin/station' into station
This commit is contained in:
commit
ba319f5246
|
@ -0,0 +1,57 @@
|
||||||
|
package org.jeecg.modules.base.entity.postgre;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class SysDefaultNuclide implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 核素名称
|
||||||
|
*/
|
||||||
|
@Excel(name = "核素名称", width = 15)
|
||||||
|
private String nuclideName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 核素用途
|
||||||
|
*/
|
||||||
|
@Excel(name = "核素用途", width = 15)
|
||||||
|
private Integer useType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 核素类型
|
||||||
|
*/
|
||||||
|
@Excel(name = "核素类型", width = 8)
|
||||||
|
private String nuclideType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
|
private String createBy;
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
package org.jeecg.modules.system.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.io.FileUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||||
|
import org.jeecg.common.exception.JeecgBootException;
|
||||||
|
import org.jeecg.common.system.base.controller.JeecgController;
|
||||||
|
import org.jeecg.common.util.security.JdbcSecurityUtil;
|
||||||
|
import org.jeecg.modules.base.entity.postgre.SysDataSource;
|
||||||
|
import org.jeecg.modules.base.entity.postgre.SysDefaultNuclide;
|
||||||
|
import org.jeecg.modules.system.service.ISysDataSourceService;
|
||||||
|
import org.jeecg.modules.system.service.ISysDefaultNuclideService;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Api(tags = "核素默认配置")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("sys/defaultNuclide")
|
||||||
|
public class SysDefaultNuclideController extends JeecgController<SysDefaultNuclide, ISysDefaultNuclideService> {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ISysDefaultNuclideService sysDefaultNuclideService;
|
||||||
|
|
||||||
|
@AutoLog(value = "核素默认配置-获取全部数据")
|
||||||
|
@ApiOperation(value = "核素默认配置-获取全部数据", notes = "核素默认配置-获取全部数据")
|
||||||
|
@GetMapping(value = "/findPage")
|
||||||
|
public Result<?> findPage(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||||
|
HttpServletRequest req, Integer useType) {
|
||||||
|
Result<IPage<SysDefaultNuclide>> iPageResult = sysDefaultNuclideService.queryNuclideByType(pageNo, pageSize, useType);
|
||||||
|
return Result.ok(iPageResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
@AutoLog(value = "核素默认配置-添加")
|
||||||
|
@ApiOperation(value = "核素默认配置-添加", notes = "核素默认配置-添加")
|
||||||
|
@PostMapping(value = "/add")
|
||||||
|
public Result<?> add() {
|
||||||
|
String path = "/Users/later/Library/Containers/com.tencent.xinWeChat/Data/Library/Application Support/com.tencent.xinWeChat/2.0b4.0.9/1cbf41e7428fb5b814d0c66ac2155730/Message/MessageTemp/7a75277a2ac9468655241c0718e9804e/OpenData/P_default.nuclide";
|
||||||
|
List<String> strings = FileUtil.readLines(path, "utf-8");
|
||||||
|
List<SysDefaultNuclide> data = Lists.newArrayList();
|
||||||
|
for (String f : strings) {
|
||||||
|
SysDefaultNuclide nuclide = new SysDefaultNuclide();
|
||||||
|
nuclide.setNuclideName(f);
|
||||||
|
nuclide.setNuclideType("G");
|
||||||
|
nuclide.setUseType(2);
|
||||||
|
data.add(nuclide);
|
||||||
|
}
|
||||||
|
sysDefaultNuclideService.saveBatch(data);
|
||||||
|
System.out.println(strings.toString());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
package org.jeecg.modules.system.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.jeecg.modules.base.entity.postgre.SysDefaultNuclide;
|
||||||
|
|
||||||
|
public interface SysDefaultNuclideMapper extends BaseMapper<SysDefaultNuclide> {
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package org.jeecg.modules.system.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import org.jeecg.modules.base.entity.postgre.SysDefaultNuclide;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 核素默认配置
|
||||||
|
*/
|
||||||
|
public interface ISysDefaultNuclideService extends IService<SysDefaultNuclide> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过核素用途获取核素数据
|
||||||
|
* @param useType 核素用途
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
|
||||||
|
Result<IPage<SysDefaultNuclide>> queryNuclideByType(Integer pageNo, Integer pageSize, Integer useType);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package org.jeecg.modules.system.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import org.jeecg.modules.base.entity.postgre.SysDefaultNuclide;
|
||||||
|
import org.jeecg.modules.system.mapper.SysDefaultNuclideMapper;
|
||||||
|
import org.jeecg.modules.system.service.ISysDefaultNuclideService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class SysDefaultNuclideServiceImpl extends ServiceImpl<SysDefaultNuclideMapper, SysDefaultNuclide> implements ISysDefaultNuclideService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<IPage<SysDefaultNuclide>> queryNuclideByType(Integer pageNo, Integer pageSize, Integer useType) {
|
||||||
|
Result<IPage<SysDefaultNuclide>> result = new Result<>();
|
||||||
|
Page<SysDefaultNuclide> page = new Page<>(pageNo, pageSize);
|
||||||
|
LambdaQueryWrapper<SysDefaultNuclide> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(null != useType, SysDefaultNuclide::getUseType, useType);
|
||||||
|
IPage<SysDefaultNuclide> pageList = this.page(page, queryWrapper);
|
||||||
|
result.setSuccess(true);
|
||||||
|
result.setResult(pageList);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user