Commit 9afc5cb7 authored by wanghao's avatar wanghao

1 初始化 柜 和 托盘信息

parent 55246658
......@@ -46,6 +46,8 @@ public interface TEquipmentInfoMapper
*/
public int insertTEquipmentInfo(TEquipmentInfo tEquipmentInfo);
public int insertBatch(@Param("equipmentInfos") List<TEquipmentInfo> equipmentInfos);
/**
* 修改生产设备信息
*
......
......@@ -2,6 +2,7 @@ package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.TStoreyInfo;
import org.apache.ibatis.annotations.Param;
/**
* 老化层信息Mapper接口
......@@ -49,6 +50,8 @@ public interface TStoreyInfoMapper
*/
public int insertTStoreyInfo(TStoreyInfo tStoreyInfo);
public int insertBatch(@Param("storeyInfos") List<TStoreyInfo> storeyInfos);
/**
* 修改老化层信息
*
......
......@@ -4,8 +4,9 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.zehong.system.domain.TTrayInfo;
import com.zehong.system.domain.*;
import com.zehong.system.mapper.*;
import com.zehong.system.service.ITStoreyInfoService;
import com.zehong.system.service.ITTrayInfoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -19,9 +20,6 @@ import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.exception.CustomException;
import com.zehong.common.utils.SecurityUtils;
import com.zehong.common.utils.StringUtils;
import com.zehong.system.domain.SysPost;
import com.zehong.system.domain.SysUserPost;
import com.zehong.system.domain.SysUserRole;
import com.zehong.system.service.ISysConfigService;
import com.zehong.system.service.ISysUserService;
......@@ -37,26 +35,29 @@ public class SysUserServiceImpl implements ISysUserService
{
private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class);
@Autowired
@Resource
private SysUserMapper userMapper;
@Autowired
@Resource
private SysRoleMapper roleMapper;
@Autowired
@Resource
private SysPostMapper postMapper;
@Autowired
@Resource
private SysUserRoleMapper userRoleMapper;
@Autowired
@Resource
private SysUserPostMapper userPostMapper;
@Autowired
@Resource
private ISysConfigService configService;
@Resource
private ITTrayInfoService trayInfoService;
private TEquipmentInfoMapper equipmentInfoMapper;
@Resource
private TStoreyInfoMapper tStoreyInfoMapper;
/**
* 根据条件分页查询用户列表
......@@ -92,6 +93,51 @@ public class SysUserServiceImpl implements ISysUserService
@Override
public SysUser selectUserById(Long userId)
{
// List<TEquipmentInfo> equipmentInfos1 = equipmentInfoMapper.selectTEquipmentInfoList(new TEquipmentInfo());
// List<TStoreyInfo> tStoreyInfos = tStoreyInfoMapper.selectTStoreyInfoList(new TStoreyInfo());
//
// if (tStoreyInfos.size() < 16) {
// TStoreyInfo storeyInfo;
// List<TStoreyInfo> storeyInfoList = new ArrayList<>();
//
// for (TEquipmentInfo tEquipmentInfo : equipmentInfos1) {
// String ip = tEquipmentInfo.getfIp();
// if (ip == null || !ip.matches("\\d+\\.\\d+\\.\\d+\\.\\d+")) {
// continue;
// }
//
// String[] split = ip.split("\\.");
// if (split.length != 4) {
// continue;
// }
//
// try {
// int start = Integer.parseInt(split[3]) + 9; // 起始值(如IP最后一段为81,则start=90)
// String baseIp = split[0] + "." + split[1] + "." + split[2] + ".";
// int code = 1;
//
// // 核心修改:循环10次(i从start递减到start-9,共10个值)
// for (int i = start; i >= start - 9; i--) {
// storeyInfo = new TStoreyInfo();
// storeyInfo.setfEquipmentId(tEquipmentInfo.getfEquipmentId());
// storeyInfo.setfStoreyCode(tEquipmentInfo.getfEquipmentCode() + "-" + code);
// storeyInfo.setfIp(baseIp + i); // 生成IP:如192.168.2.90、192.168.2.89...192.168.2.81
// storeyInfo.setfPort("501,502,503");
// storeyInfo.setfStatus("0");
// storeyInfo.setfCreateTime(new Date());
// storeyInfoList.add(storeyInfo);
// code++;
// }
// } catch (NumberFormatException e) {
// continue;
// }
// }
//
// if (!storeyInfoList.isEmpty()) {
// tStoreyInfoMapper.insertBatch(storeyInfoList);
// }
// }
return userMapper.selectUserById(userId);
}
......
......@@ -70,7 +70,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectTEquipmentInfoVo"/>
where f_equipment_code = #{fEquipmentCode}
</select>
<insert id="insertBatch" parameterType="list">
insert into t_equipment_info (f_equipment_code, f_equipment_name, f_equipment_type, f_ip, f_port,
f_create_time, f_status, f_power_outage_ip,
f_power_outage_port)
values
<foreach collection="equipmentInfos" item="item" separator=",">
(#{item.fEquipmentCode}, #{item.fEquipmentName}, #{item.fEquipmentType}, #{item.fIp}, #{item.fPort},
#{item.fCreateTime}, #{item.fStatus}, #{item.fPowerOutageIp}, #{item.fPowerOutagePort}
)
</foreach>
</insert>
<insert id="insertTEquipmentInfo" parameterType="TEquipmentInfo" useGeneratedKeys="true" keyProperty="fEquipmentId">
insert into t_equipment_info
<trim prefix="(" suffix=")" suffixOverrides=",">
......
......@@ -85,6 +85,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ORDER BY distance ASC
LIMIT 1
</select>
<insert id="insertBatch" parameterType="list">
insert into t_storey_info ( f_equipment_id, f_storey_code, f_ip, f_status, f_port, f_create_time) values
<foreach item="item" index="index" collection="storeyInfos" separator=",">
( #{item.fEquipmentId}, #{item.fStoreyCode}, #{item.fIp}, #{item.fStatus}, #{item.fPort}, #{item.fCreateTime})
</foreach>
</insert>
<insert id="insertTStoreyInfo" parameterType="TStoreyInfo">
insert into t_storey_info
<trim prefix="(" suffix=")" suffixOverrides=",">
......
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