update 初始化计量线路信息
parent
9867708a97
commit
46c8350e1a
@ -0,0 +1,98 @@
|
||||
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.EmsBaseLineInfo;
|
||||
import com.os.ems.base.service.IEmsBaseLineInfoService;
|
||||
import com.os.common.utils.poi.ExcelUtil;
|
||||
|
||||
/**
|
||||
* 计量线路信息Controller
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-08-13
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/ems/base/baseLineInfo")
|
||||
public class EmsBaseLineInfoController extends BaseController {
|
||||
@Autowired
|
||||
private IEmsBaseLineInfoService emsBaseLineInfoService;
|
||||
|
||||
/**
|
||||
* 查询计量线路信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ems/base:baseLineInfo:list')")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(EmsBaseLineInfo emsBaseLineInfo) {
|
||||
List<EmsBaseLineInfo> list = emsBaseLineInfoService.selectEmsBaseLineInfoList(emsBaseLineInfo);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出计量线路信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ems/base:baseLineInfo:export')")
|
||||
@Log(title = "计量线路信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, EmsBaseLineInfo emsBaseLineInfo) {
|
||||
List<EmsBaseLineInfo> list = emsBaseLineInfoService.selectEmsBaseLineInfoList(emsBaseLineInfo);
|
||||
ExcelUtil<EmsBaseLineInfo> util = new ExcelUtil<EmsBaseLineInfo>(EmsBaseLineInfo.class);
|
||||
util.exportExcel(response, list, "计量线路信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取计量线路信息详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ems/base:baseLineInfo:query')")
|
||||
@GetMapping(value = "/{objId}")
|
||||
public AjaxResult getInfo(@PathVariable("objId") Long objId) {
|
||||
return success(emsBaseLineInfoService.selectEmsBaseLineInfoByObjId(objId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增计量线路信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ems/base:baseLineInfo:add')")
|
||||
@Log(title = "计量线路信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody EmsBaseLineInfo emsBaseLineInfo) {
|
||||
emsBaseLineInfo.setCreateBy(getUsername());
|
||||
return toAjax(emsBaseLineInfoService.insertEmsBaseLineInfo(emsBaseLineInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改计量线路信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ems/base:baseLineInfo:edit')")
|
||||
@Log(title = "计量线路信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody EmsBaseLineInfo emsBaseLineInfo) {
|
||||
emsBaseLineInfo.setUpdateBy(getUsername());
|
||||
return toAjax(emsBaseLineInfoService.updateEmsBaseLineInfo(emsBaseLineInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除计量线路信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ems/base:baseLineInfo:remove')")
|
||||
@Log(title = "计量线路信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{objIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] objIds) {
|
||||
return toAjax(emsBaseLineInfoService.deleteEmsBaseLineInfoByObjIds(objIds));
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.os.ems.base.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.os.ems.base.domain.EmsBaseLineInfo;
|
||||
|
||||
/**
|
||||
* 计量线路信息Mapper接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-08-13
|
||||
*/
|
||||
public interface EmsBaseLineInfoMapper
|
||||
{
|
||||
/**
|
||||
* 查询计量线路信息
|
||||
*
|
||||
* @param objId 计量线路信息主键
|
||||
* @return 计量线路信息
|
||||
*/
|
||||
public EmsBaseLineInfo selectEmsBaseLineInfoByObjId(Long objId);
|
||||
|
||||
/**
|
||||
* 查询计量线路信息列表
|
||||
*
|
||||
* @param emsBaseLineInfo 计量线路信息
|
||||
* @return 计量线路信息集合
|
||||
*/
|
||||
public List<EmsBaseLineInfo> selectEmsBaseLineInfoList(EmsBaseLineInfo emsBaseLineInfo);
|
||||
|
||||
/**
|
||||
* 新增计量线路信息
|
||||
*
|
||||
* @param emsBaseLineInfo 计量线路信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEmsBaseLineInfo(EmsBaseLineInfo emsBaseLineInfo);
|
||||
|
||||
/**
|
||||
* 修改计量线路信息
|
||||
*
|
||||
* @param emsBaseLineInfo 计量线路信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEmsBaseLineInfo(EmsBaseLineInfo emsBaseLineInfo);
|
||||
|
||||
/**
|
||||
* 删除计量线路信息
|
||||
*
|
||||
* @param objId 计量线路信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmsBaseLineInfoByObjId(Long objId);
|
||||
|
||||
/**
|
||||
* 批量删除计量线路信息
|
||||
*
|
||||
* @param objIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmsBaseLineInfoByObjIds(Long[] objIds);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.os.ems.base.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.os.ems.base.domain.EmsBaseLineInfo;
|
||||
|
||||
/**
|
||||
* 计量线路信息Service接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-08-13
|
||||
*/
|
||||
public interface IEmsBaseLineInfoService
|
||||
{
|
||||
/**
|
||||
* 查询计量线路信息
|
||||
*
|
||||
* @param objId 计量线路信息主键
|
||||
* @return 计量线路信息
|
||||
*/
|
||||
public EmsBaseLineInfo selectEmsBaseLineInfoByObjId(Long objId);
|
||||
|
||||
/**
|
||||
* 查询计量线路信息列表
|
||||
*
|
||||
* @param emsBaseLineInfo 计量线路信息
|
||||
* @return 计量线路信息集合
|
||||
*/
|
||||
public List<EmsBaseLineInfo> selectEmsBaseLineInfoList(EmsBaseLineInfo emsBaseLineInfo);
|
||||
|
||||
/**
|
||||
* 新增计量线路信息
|
||||
*
|
||||
* @param emsBaseLineInfo 计量线路信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEmsBaseLineInfo(EmsBaseLineInfo emsBaseLineInfo);
|
||||
|
||||
/**
|
||||
* 修改计量线路信息
|
||||
*
|
||||
* @param emsBaseLineInfo 计量线路信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEmsBaseLineInfo(EmsBaseLineInfo emsBaseLineInfo);
|
||||
|
||||
/**
|
||||
* 批量删除计量线路信息
|
||||
*
|
||||
* @param objIds 需要删除的计量线路信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmsBaseLineInfoByObjIds(Long[] objIds);
|
||||
|
||||
/**
|
||||
* 删除计量线路信息信息
|
||||
*
|
||||
* @param objId 计量线路信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmsBaseLineInfoByObjId(Long objId);
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
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.EmsBaseLineInfoMapper;
|
||||
import com.os.ems.base.domain.EmsBaseLineInfo;
|
||||
import com.os.ems.base.service.IEmsBaseLineInfoService;
|
||||
|
||||
/**
|
||||
* 计量线路信息Service业务层处理
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-08-13
|
||||
*/
|
||||
@Service
|
||||
public class EmsBaseLineInfoServiceImpl implements IEmsBaseLineInfoService
|
||||
{
|
||||
@Autowired
|
||||
private EmsBaseLineInfoMapper emsBaseLineInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询计量线路信息
|
||||
*
|
||||
* @param objId 计量线路信息主键
|
||||
* @return 计量线路信息
|
||||
*/
|
||||
@Override
|
||||
public EmsBaseLineInfo selectEmsBaseLineInfoByObjId(Long objId)
|
||||
{
|
||||
return emsBaseLineInfoMapper.selectEmsBaseLineInfoByObjId(objId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询计量线路信息列表
|
||||
*
|
||||
* @param emsBaseLineInfo 计量线路信息
|
||||
* @return 计量线路信息
|
||||
*/
|
||||
@Override
|
||||
public List<EmsBaseLineInfo> selectEmsBaseLineInfoList(EmsBaseLineInfo emsBaseLineInfo)
|
||||
{
|
||||
return emsBaseLineInfoMapper.selectEmsBaseLineInfoList(emsBaseLineInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增计量线路信息
|
||||
*
|
||||
* @param emsBaseLineInfo 计量线路信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertEmsBaseLineInfo(EmsBaseLineInfo emsBaseLineInfo)
|
||||
{
|
||||
emsBaseLineInfo.setCreateTime(DateUtils.getNowDate());
|
||||
return emsBaseLineInfoMapper.insertEmsBaseLineInfo(emsBaseLineInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改计量线路信息
|
||||
*
|
||||
* @param emsBaseLineInfo 计量线路信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateEmsBaseLineInfo(EmsBaseLineInfo emsBaseLineInfo)
|
||||
{
|
||||
emsBaseLineInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
return emsBaseLineInfoMapper.updateEmsBaseLineInfo(emsBaseLineInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除计量线路信息
|
||||
*
|
||||
* @param objIds 需要删除的计量线路信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEmsBaseLineInfoByObjIds(Long[] objIds)
|
||||
{
|
||||
return emsBaseLineInfoMapper.deleteEmsBaseLineInfoByObjIds(objIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除计量线路信息信息
|
||||
*
|
||||
* @param objId 计量线路信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEmsBaseLineInfoByObjId(Long objId)
|
||||
{
|
||||
return emsBaseLineInfoMapper.deleteEmsBaseLineInfoByObjId(objId);
|
||||
}
|
||||
}
|
@ -0,0 +1,149 @@
|
||||
<?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.EmsBaseLineInfoMapper">
|
||||
|
||||
<resultMap type="EmsBaseLineInfo" id="EmsBaseLineInfoResult">
|
||||
<result property="objId" column="obj_id"/>
|
||||
<result property="parentId" column="parent_id"/>
|
||||
<result property="monitorCode" column="monitor_code"/>
|
||||
<result property="monitorName" column="monitor_name"/>
|
||||
<result property="lineType" column="line_type"/>
|
||||
<result property="ancestors" column="ancestors"/>
|
||||
<result property="grade" column="grade"/>
|
||||
<result property="meterTypeId" column="meter_type_id"/>
|
||||
<result property="correctValue" column="correct_value"/>
|
||||
<result property="isAmmeter" column="is_ammeter"/>
|
||||
<result property="isKeyMonitor" column="is_key_monitor"/>
|
||||
<result property="isCircuit" column="is_circuit"/>
|
||||
<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="monitorAddr" column="monitor_addr" />
|
||||
<result property="monitorType" column="monitor_type" />
|
||||
<result property="monitorStatus" column="monitor_status" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEmsBaseLineInfoVo">
|
||||
select ebli.obj_id,
|
||||
ebli.parent_id,
|
||||
ebli.monitor_code,
|
||||
ebmi.monitor_name,
|
||||
ebmi.monitor_addr,
|
||||
ebmi.monitor_type,
|
||||
ebmi.monitor_status,
|
||||
ebli.line_type,
|
||||
ebli.ancestors,
|
||||
ebli.grade,
|
||||
ebli.meter_type_id,
|
||||
ebli.correct_value,
|
||||
ebli.is_ammeter,
|
||||
ebli.is_key_monitor,
|
||||
ebli.is_circuit,
|
||||
ebli.create_by,
|
||||
ebli.create_time,
|
||||
ebli.update_by,
|
||||
ebli.update_time
|
||||
from ems_base_line_info ebli
|
||||
left join ems_base_monitor_info ebmi on ebmi.monitor_code = ebli.monitor_code
|
||||
</sql>
|
||||
|
||||
<select id="selectEmsBaseLineInfoList" parameterType="EmsBaseLineInfo" resultMap="EmsBaseLineInfoResult">
|
||||
<include refid="selectEmsBaseLineInfoVo"/>
|
||||
<where>
|
||||
<if test="parentId != null ">and ebli.parent_id = #{parentId}</if>
|
||||
<if test="monitorCode != null and monitorCode != ''">and ebli.monitor_code = #{monitorCode}</if>
|
||||
<if test="monitorName != null and monitorName != ''">and ebli.monitor_name like concat('%', #{monitorName},
|
||||
'%')
|
||||
</if>
|
||||
<if test="lineType != null ">and ebli.line_type = #{lineType}</if>
|
||||
<if test="ancestors != null and ancestors != ''">and ebli.ancestors = #{ancestors}</if>
|
||||
<if test="grade != null ">and ebli.grade = #{grade}</if>
|
||||
<if test="meterTypeId != null and meterTypeId != ''">and ebli.meter_type_id = #{meterTypeId}</if>
|
||||
<if test="correctValue != null ">and ebli.correct_value = #{correctValue}</if>
|
||||
<if test="isAmmeter != null and isAmmeter != ''">and ebli.is_ammeter = #{isAmmeter}</if>
|
||||
<if test="isKeyMonitor != null ">and ebli.is_key_monitor = #{isKeyMonitor}</if>
|
||||
<if test="isCircuit != null ">and ebli.is_circuit = #{isCircuit}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectEmsBaseLineInfoByObjId" parameterType="Long" resultMap="EmsBaseLineInfoResult">
|
||||
<include refid="selectEmsBaseLineInfoVo"/>
|
||||
where ebli.obj_id = #{objId}
|
||||
</select>
|
||||
|
||||
<insert id="insertEmsBaseLineInfo" parameterType="EmsBaseLineInfo" useGeneratedKeys="true" keyProperty="objId">
|
||||
insert into ems_base_line_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="parentId != null">parent_id,</if>
|
||||
<if test="monitorCode != null and monitorCode != ''">monitor_code,</if>
|
||||
<if test="monitorName != null">monitor_name,</if>
|
||||
<if test="lineType != null">line_type,</if>
|
||||
<if test="ancestors != null">ancestors,</if>
|
||||
<if test="grade != null">grade,</if>
|
||||
<if test="meterTypeId != null">meter_type_id,</if>
|
||||
<if test="correctValue != null">correct_value,</if>
|
||||
<if test="isAmmeter != null">is_ammeter,</if>
|
||||
<if test="isKeyMonitor != null">is_key_monitor,</if>
|
||||
<if test="isCircuit != null">is_circuit,</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>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="parentId != null">#{parentId},</if>
|
||||
<if test="monitorCode != null and monitorCode != ''">#{monitorCode},</if>
|
||||
<if test="monitorName != null">#{monitorName},</if>
|
||||
<if test="lineType != null">#{lineType},</if>
|
||||
<if test="ancestors != null">#{ancestors},</if>
|
||||
<if test="grade != null">#{grade},</if>
|
||||
<if test="meterTypeId != null">#{meterTypeId},</if>
|
||||
<if test="correctValue != null">#{correctValue},</if>
|
||||
<if test="isAmmeter != null">#{isAmmeter},</if>
|
||||
<if test="isKeyMonitor != null">#{isKeyMonitor},</if>
|
||||
<if test="isCircuit != null">#{isCircuit},</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>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateEmsBaseLineInfo" parameterType="EmsBaseLineInfo">
|
||||
update ems_base_line_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="parentId != null">parent_id = #{parentId},</if>
|
||||
<if test="monitorCode != null and monitorCode != ''">monitor_code = #{monitorCode},</if>
|
||||
<if test="monitorName != null">monitor_name = #{monitorName},</if>
|
||||
<if test="lineType != null">line_type = #{lineType},</if>
|
||||
<if test="ancestors != null">ancestors = #{ancestors},</if>
|
||||
<if test="grade != null">grade = #{grade},</if>
|
||||
<if test="meterTypeId != null">meter_type_id = #{meterTypeId},</if>
|
||||
<if test="correctValue != null">correct_value = #{correctValue},</if>
|
||||
<if test="isAmmeter != null">is_ammeter = #{isAmmeter},</if>
|
||||
<if test="isKeyMonitor != null">is_key_monitor = #{isKeyMonitor},</if>
|
||||
<if test="isCircuit != null">is_circuit = #{isCircuit},</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>
|
||||
</trim>
|
||||
where obj_id = #{objId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteEmsBaseLineInfoByObjId" parameterType="Long">
|
||||
delete
|
||||
from ems_base_line_info
|
||||
where obj_id = #{objId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteEmsBaseLineInfoByObjIds" parameterType="String">
|
||||
delete from ems_base_line_info where obj_id in
|
||||
<foreach item="objId" collection="array" open="(" separator="," close=")">
|
||||
#{objId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue