change - add采集设备信息
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,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>
|
Loading…
Reference in New Issue