change - add采集设备信息

maser
yinq 1 year ago
parent 8807a30867
commit 5a97dae043

@ -0,0 +1,109 @@
package com.os.ems.base.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.os.common.annotation.Log;
import com.os.common.core.controller.BaseController;
import com.os.common.core.domain.AjaxResult;
import com.os.common.enums.BusinessType;
import com.os.ems.base.domain.EmsBaseCollectDeviceInfo;
import com.os.ems.base.service.IEmsBaseCollectDeviceInfoService;
import com.os.common.utils.poi.ExcelUtil;
import com.os.common.core.page.TableDataInfo;
/**
* Controller
*
* @author Yinq
* @date 2024-05-20
*/
@RestController
@RequestMapping("/ems/base/baseCollectDeviceInfo")
public class EmsBaseCollectDeviceInfoController extends BaseController {
@Autowired
private IEmsBaseCollectDeviceInfoService emsBaseCollectDeviceInfoService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('ems/base:baseCollectDeviceInfo:list')")
@GetMapping("/list")
public TableDataInfo list(EmsBaseCollectDeviceInfo emsBaseCollectDeviceInfo) {
startPage();
List<EmsBaseCollectDeviceInfo> list = emsBaseCollectDeviceInfoService.selectEmsBaseCollectDeviceInfoList(emsBaseCollectDeviceInfo);
return getDataTable(list);
}
/**
*
*/
@GetMapping("/getCollectDeviceInfo")
public AjaxResult getCollectDeviceInfo(EmsBaseCollectDeviceInfo emsBaseCollectDeviceInfo) {
List<EmsBaseCollectDeviceInfo> list = emsBaseCollectDeviceInfoService.selectEmsBaseCollectDeviceInfoList(emsBaseCollectDeviceInfo);
return success(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ems/base:baseCollectDeviceInfo:export')")
@Log(title = "采集设备信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, EmsBaseCollectDeviceInfo emsBaseCollectDeviceInfo) {
List<EmsBaseCollectDeviceInfo> list = emsBaseCollectDeviceInfoService.selectEmsBaseCollectDeviceInfoList(emsBaseCollectDeviceInfo);
ExcelUtil<EmsBaseCollectDeviceInfo> util = new ExcelUtil<EmsBaseCollectDeviceInfo>(EmsBaseCollectDeviceInfo.class);
util.exportExcel(response, list, "采集设备信息数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ems/base:baseCollectDeviceInfo:query')")
@GetMapping(value = "/{objId}")
public AjaxResult getInfo(@PathVariable("objId") Long objId) {
return success(emsBaseCollectDeviceInfoService.selectEmsBaseCollectDeviceInfoByObjId(objId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ems/base:baseCollectDeviceInfo:add')")
@Log(title = "采集设备信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody EmsBaseCollectDeviceInfo emsBaseCollectDeviceInfo) {
emsBaseCollectDeviceInfo.setCreateBy(getUsername());
return toAjax(emsBaseCollectDeviceInfoService.insertEmsBaseCollectDeviceInfo(emsBaseCollectDeviceInfo));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ems/base:baseCollectDeviceInfo:edit')")
@Log(title = "采集设备信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EmsBaseCollectDeviceInfo emsBaseCollectDeviceInfo) {
emsBaseCollectDeviceInfo.setUpdateBy(getUsername());
return toAjax(emsBaseCollectDeviceInfoService.updateEmsBaseCollectDeviceInfo(emsBaseCollectDeviceInfo));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ems/base:baseCollectDeviceInfo:remove')")
@Log(title = "采集设备信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{objIds}")
public AjaxResult remove(@PathVariable Long[] objIds) {
return toAjax(emsBaseCollectDeviceInfoService.deleteEmsBaseCollectDeviceInfoByObjIds(objIds));
}
}

@ -0,0 +1,194 @@
package com.os.ems.base.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.os.common.annotation.Excel;
import com.os.common.core.domain.BaseEntity;
/**
* ems_base_collect_device_info
*
* @author Yinq
* @date 2024-05-20
*/
public class EmsBaseCollectDeviceInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private Long objId;
/**
*
*/
@Excel(name = "采集设备编号")
private String collectDeviceId;
/**
*
*/
@Excel(name = "采集设备名称")
private String collectDeviceName;
/**
*
*/
@Excel(name = "能源类型")
private Long energyTypeId;
/**
*
*/
@Excel(name = "能源类型名称")
private String energyTypeName;
/**
*
*/
@Excel(name = "型号")
private String model;
/**
*
*/
@Excel(name = "生产厂家")
private String manufacturer;
/**
*
*/
@Excel(name = "通讯地址")
private String ipAddress;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "生产日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date produceDate;
/**
*
*/
@Excel(name = "安装地址")
private String settingAddress;
/**
* 0 1
*/
@Excel(name = "启用标识", readConverterExp = "0=启用,1=停用")
private String isFlag;
public String getEnergyTypeName() {
return energyTypeName;
}
public void setEnergyTypeName(String energyTypeName) {
this.energyTypeName = energyTypeName;
}
public void setObjId(Long objId) {
this.objId = objId;
}
public Long getObjId() {
return objId;
}
public void setCollectDeviceId(String collectDeviceId) {
this.collectDeviceId = collectDeviceId;
}
public String getCollectDeviceId() {
return collectDeviceId;
}
public void setCollectDeviceName(String collectDeviceName) {
this.collectDeviceName = collectDeviceName;
}
public String getCollectDeviceName() {
return collectDeviceName;
}
public void setEnergyTypeId(Long energyTypeId) {
this.energyTypeId = energyTypeId;
}
public Long getEnergyTypeId() {
return energyTypeId;
}
public void setModel(String model) {
this.model = model;
}
public String getModel() {
return model;
}
public void setManufacturer(String manufacturer) {
this.manufacturer = manufacturer;
}
public String getManufacturer() {
return manufacturer;
}
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
}
public String getIpAddress() {
return ipAddress;
}
public void setProduceDate(Date produceDate) {
this.produceDate = produceDate;
}
public Date getProduceDate() {
return produceDate;
}
public void setSettingAddress(String settingAddress) {
this.settingAddress = settingAddress;
}
public String getSettingAddress() {
return settingAddress;
}
public void setIsFlag(String isFlag) {
this.isFlag = isFlag;
}
public String getIsFlag() {
return isFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("objId", getObjId())
.append("collectDeviceId", getCollectDeviceId())
.append("collectDeviceName", getCollectDeviceName())
.append("energyTypeId", getEnergyTypeId())
.append("model", getModel())
.append("manufacturer", getManufacturer())
.append("ipAddress", getIpAddress())
.append("produceDate", getProduceDate())
.append("settingAddress", getSettingAddress())
.append("isFlag", getIsFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

@ -0,0 +1,61 @@
package com.os.ems.base.mapper;
import java.util.List;
import com.os.ems.base.domain.EmsBaseCollectDeviceInfo;
/**
* Mapper
*
* @author Yinq
* @date 2024-05-20
*/
public interface EmsBaseCollectDeviceInfoMapper {
/**
*
*
* @param objId
* @return
*/
public EmsBaseCollectDeviceInfo selectEmsBaseCollectDeviceInfoByObjId(Long objId);
/**
*
*
* @param emsBaseCollectDeviceInfo
* @return
*/
public List<EmsBaseCollectDeviceInfo> selectEmsBaseCollectDeviceInfoList(EmsBaseCollectDeviceInfo emsBaseCollectDeviceInfo);
/**
*
*
* @param emsBaseCollectDeviceInfo
* @return
*/
public int insertEmsBaseCollectDeviceInfo(EmsBaseCollectDeviceInfo emsBaseCollectDeviceInfo);
/**
*
*
* @param emsBaseCollectDeviceInfo
* @return
*/
public int updateEmsBaseCollectDeviceInfo(EmsBaseCollectDeviceInfo emsBaseCollectDeviceInfo);
/**
*
*
* @param objId
* @return
*/
public int deleteEmsBaseCollectDeviceInfoByObjId(Long objId);
/**
*
*
* @param objIds
* @return
*/
public int deleteEmsBaseCollectDeviceInfoByObjIds(Long[] objIds);
}

@ -0,0 +1,61 @@
package com.os.ems.base.service;
import java.util.List;
import com.os.ems.base.domain.EmsBaseCollectDeviceInfo;
/**
* Service
*
* @author Yinq
* @date 2024-05-20
*/
public interface IEmsBaseCollectDeviceInfoService {
/**
*
*
* @param objId
* @return
*/
public EmsBaseCollectDeviceInfo selectEmsBaseCollectDeviceInfoByObjId(Long objId);
/**
*
*
* @param emsBaseCollectDeviceInfo
* @return
*/
public List<EmsBaseCollectDeviceInfo> selectEmsBaseCollectDeviceInfoList(EmsBaseCollectDeviceInfo emsBaseCollectDeviceInfo);
/**
*
*
* @param emsBaseCollectDeviceInfo
* @return
*/
public int insertEmsBaseCollectDeviceInfo(EmsBaseCollectDeviceInfo emsBaseCollectDeviceInfo);
/**
*
*
* @param emsBaseCollectDeviceInfo
* @return
*/
public int updateEmsBaseCollectDeviceInfo(EmsBaseCollectDeviceInfo emsBaseCollectDeviceInfo);
/**
*
*
* @param objIds
* @return
*/
public int deleteEmsBaseCollectDeviceInfoByObjIds(Long[] objIds);
/**
*
*
* @param objId
* @return
*/
public int deleteEmsBaseCollectDeviceInfoByObjId(Long objId);
}

@ -0,0 +1,90 @@
package com.os.ems.base.service.impl;
import java.util.List;
import com.os.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.os.ems.base.mapper.EmsBaseCollectDeviceInfoMapper;
import com.os.ems.base.domain.EmsBaseCollectDeviceInfo;
import com.os.ems.base.service.IEmsBaseCollectDeviceInfoService;
/**
* Service
*
* @author Yinq
* @date 2024-05-20
*/
@Service
public class EmsBaseCollectDeviceInfoServiceImpl implements IEmsBaseCollectDeviceInfoService {
@Autowired
private EmsBaseCollectDeviceInfoMapper emsBaseCollectDeviceInfoMapper;
/**
*
*
* @param objId
* @return
*/
@Override
public EmsBaseCollectDeviceInfo selectEmsBaseCollectDeviceInfoByObjId(Long objId) {
return emsBaseCollectDeviceInfoMapper.selectEmsBaseCollectDeviceInfoByObjId(objId);
}
/**
*
*
* @param emsBaseCollectDeviceInfo
* @return
*/
@Override
public List<EmsBaseCollectDeviceInfo> selectEmsBaseCollectDeviceInfoList(EmsBaseCollectDeviceInfo emsBaseCollectDeviceInfo) {
return emsBaseCollectDeviceInfoMapper.selectEmsBaseCollectDeviceInfoList(emsBaseCollectDeviceInfo);
}
/**
*
*
* @param emsBaseCollectDeviceInfo
* @return
*/
@Override
public int insertEmsBaseCollectDeviceInfo(EmsBaseCollectDeviceInfo emsBaseCollectDeviceInfo) {
emsBaseCollectDeviceInfo.setCreateTime(DateUtils.getNowDate());
return emsBaseCollectDeviceInfoMapper.insertEmsBaseCollectDeviceInfo(emsBaseCollectDeviceInfo);
}
/**
*
*
* @param emsBaseCollectDeviceInfo
* @return
*/
@Override
public int updateEmsBaseCollectDeviceInfo(EmsBaseCollectDeviceInfo emsBaseCollectDeviceInfo) {
emsBaseCollectDeviceInfo.setUpdateTime(DateUtils.getNowDate());
return emsBaseCollectDeviceInfoMapper.updateEmsBaseCollectDeviceInfo(emsBaseCollectDeviceInfo);
}
/**
*
*
* @param objIds
* @return
*/
@Override
public int deleteEmsBaseCollectDeviceInfoByObjIds(Long[] objIds) {
return emsBaseCollectDeviceInfoMapper.deleteEmsBaseCollectDeviceInfoByObjIds(objIds);
}
/**
*
*
* @param objId
* @return
*/
@Override
public int deleteEmsBaseCollectDeviceInfoByObjId(Long objId) {
return emsBaseCollectDeviceInfoMapper.deleteEmsBaseCollectDeviceInfoByObjId(objId);
}
}

@ -0,0 +1,141 @@
<?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.os.ems.base.mapper.EmsBaseCollectDeviceInfoMapper">
<resultMap type="EmsBaseCollectDeviceInfo" id="EmsBaseCollectDeviceInfoResult">
<result property="objId" column="obj_id"/>
<result property="collectDeviceId" column="collect_device_id"/>
<result property="collectDeviceName" column="collect_device_name"/>
<result property="energyTypeId" column="energy_type_id"/>
<result property="energyTypeName" column="energy_name"/>
<result property="model" column="model"/>
<result property="manufacturer" column="manufacturer"/>
<result property="ipAddress" column="ip_address"/>
<result property="produceDate" column="produce_date"/>
<result property="settingAddress" column="setting_address"/>
<result property="isFlag" column="is_flag"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectEmsBaseCollectDeviceInfoVo">
select ebcdi.obj_id,
ebcdi.collect_device_id,
ebcdi.collect_device_name,
ebcdi.energy_type_id,
ebet.energy_name,
ebcdi.model,
ebcdi.manufacturer,
ebcdi.ip_address,
ebcdi.produce_date,
ebcdi.setting_address,
ebcdi.is_flag,
ebcdi.create_by,
ebcdi.create_time,
ebcdi.update_by,
ebcdi.update_time,
ebcdi.remark
from ems_base_collect_device_info ebcdi
left join ems_base_energy_type ebet on ebcdi.energy_type_id = ebet.energy_type_id
</sql>
<select id="selectEmsBaseCollectDeviceInfoList" parameterType="EmsBaseCollectDeviceInfo"
resultMap="EmsBaseCollectDeviceInfoResult">
<include refid="selectEmsBaseCollectDeviceInfoVo"/>
<where>
<if test="collectDeviceId != null and collectDeviceId != ''">and ebcdi.collect_device_id = #{collectDeviceId}
</if>
<if test="collectDeviceName != null and collectDeviceName != ''">and ebcdi.collect_device_name like concat('%',
#{collectDeviceName}, '%')
</if>
<if test="energyTypeId != null ">and ebcdi.energy_type_id = #{energyTypeId}</if>
<if test="model != null and model != ''">and ebcdi.model = #{model}</if>
<if test="manufacturer != null and manufacturer != ''">and ebcdi.manufacturer = #{manufacturer}</if>
<if test="ipAddress != null and ipAddress != ''">and ebcdi.ip_address = #{ipAddress}</if>
<if test="produceDate != null ">and ebcdi.produce_date = #{produceDate}</if>
<if test="settingAddress != null and settingAddress != ''">and ebcdi.setting_address = #{settingAddress}</if>
<if test="isFlag != null and isFlag != ''">and ebcdi.is_flag = #{isFlag}</if>
</where>
</select>
<select id="selectEmsBaseCollectDeviceInfoByObjId" parameterType="Long" resultMap="EmsBaseCollectDeviceInfoResult">
<include refid="selectEmsBaseCollectDeviceInfoVo"/>
where ebcdi.obj_id = #{objId}
</select>
<insert id="insertEmsBaseCollectDeviceInfo" parameterType="EmsBaseCollectDeviceInfo" useGeneratedKeys="true"
keyProperty="objId">
insert into ems_base_collect_device_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="collectDeviceId != null">collect_device_id,</if>
<if test="collectDeviceName != null">collect_device_name,</if>
<if test="energyTypeId != null">energy_type_id,</if>
<if test="model != null">model,</if>
<if test="manufacturer != null">manufacturer,</if>
<if test="ipAddress != null">ip_address,</if>
<if test="produceDate != null">produce_date,</if>
<if test="settingAddress != null">setting_address,</if>
<if test="isFlag != null">is_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="collectDeviceId != null">#{collectDeviceId},</if>
<if test="collectDeviceName != null">#{collectDeviceName},</if>
<if test="energyTypeId != null">#{energyTypeId},</if>
<if test="model != null">#{model},</if>
<if test="manufacturer != null">#{manufacturer},</if>
<if test="ipAddress != null">#{ipAddress},</if>
<if test="produceDate != null">#{produceDate},</if>
<if test="settingAddress != null">#{settingAddress},</if>
<if test="isFlag != null">#{isFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateEmsBaseCollectDeviceInfo" parameterType="EmsBaseCollectDeviceInfo">
update ems_base_collect_device_info
<trim prefix="SET" suffixOverrides=",">
<if test="collectDeviceId != null">collect_device_id = #{collectDeviceId},</if>
<if test="collectDeviceName != null">collect_device_name = #{collectDeviceName},</if>
<if test="energyTypeId != null">energy_type_id = #{energyTypeId},</if>
<if test="model != null">model = #{model},</if>
<if test="manufacturer != null">manufacturer = #{manufacturer},</if>
<if test="ipAddress != null">ip_address = #{ipAddress},</if>
<if test="produceDate != null">produce_date = #{produceDate},</if>
<if test="settingAddress != null">setting_address = #{settingAddress},</if>
<if test="isFlag != null">is_flag = #{isFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where obj_id = #{objId}
</update>
<delete id="deleteEmsBaseCollectDeviceInfoByObjId" parameterType="Long">
delete
from ems_base_collect_device_info
where obj_id = #{objId}
</delete>
<delete id="deleteEmsBaseCollectDeviceInfoByObjIds" parameterType="String">
delete from ems_base_collect_device_info where obj_id in
<foreach item="objId" collection="array" open="(" separator="," close=")">
#{objId}
</foreach>
</delete>
</mapper>

@ -54,7 +54,7 @@ public class BaseMaterialInfo extends BaseEntity {
private String materialType;
/**
* 1 2
* 1 2
*/
@Excel(name = "计量单位")
private String materialUnit;

Loading…
Cancel
Save