l3能源成本分摊(部分完成留存)
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
package com.klp.ems.controller;
|
||||
|
||||
import com.klp.common.annotation.RepeatSubmit;
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.validate.AddGroup;
|
||||
import com.klp.common.core.validate.EditGroup;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.ems.domain.vo.WmsEnergyAreaLinkVo;
|
||||
import com.klp.ems.domain.bo.WmsEnergyAreaLinkBo;
|
||||
import com.klp.ems.service.IWmsEnergyAreaLinkService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* EMS能源与库区映射关系
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-12-08
|
||||
*/
|
||||
@Validated
|
||||
@RestController
|
||||
@RequestMapping("/ems/energy/link")
|
||||
public class WmsEnergyAreaLinkController extends BaseController {
|
||||
|
||||
private final IWmsEnergyAreaLinkService iWmsEnergyAreaLinkService;
|
||||
|
||||
public WmsEnergyAreaLinkController(IWmsEnergyAreaLinkService iWmsEnergyAreaLinkService) {
|
||||
this.iWmsEnergyAreaLinkService = iWmsEnergyAreaLinkService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<WmsEnergyAreaLinkVo> list(WmsEnergyAreaLinkBo bo, PageQuery pageQuery) {
|
||||
return iWmsEnergyAreaLinkService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询详情
|
||||
*/
|
||||
@GetMapping("/{linkId}")
|
||||
public R<WmsEnergyAreaLinkVo> getInfo(@PathVariable @NotNull(message = "主键不能为空") Long linkId) {
|
||||
return R.ok(iWmsEnergyAreaLinkService.queryById(linkId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@Log(title = "EMS能源与库区映射关系", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody WmsEnergyAreaLinkBo bo) {
|
||||
return toAjax(iWmsEnergyAreaLinkService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@Log(title = "EMS能源与库区映射关系", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WmsEnergyAreaLinkBo bo) {
|
||||
return toAjax(iWmsEnergyAreaLinkService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@Log(title = "EMS能源与库区映射关系", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{linkId}")
|
||||
public R<Void> remove(@PathVariable @NotNull(message = "主键不能为空") Long linkId) {
|
||||
return toAjax(iWmsEnergyAreaLinkService.deleteById(linkId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
@Log(title = "EMS能源与库区映射关系", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/batch")
|
||||
public R<Void> removeBatch(@RequestBody @NotEmpty(message = "主键集合不能为空") List<Long> linkIds) {
|
||||
return toAjax(iWmsEnergyAreaLinkService.deleteByIds(linkIds));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.klp.ems.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* EMS能源与库区映射关系表
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-12-08
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("wms_energy_area_link")
|
||||
public class WmsEnergyAreaLink extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(value = "link_id", type = IdType.AUTO)
|
||||
private Long linkId;
|
||||
|
||||
/**
|
||||
* EMS能源类型ID,关联ems_energy_type.energy_type_id
|
||||
*/
|
||||
private Long energyTypeId;
|
||||
|
||||
/**
|
||||
* EMS计量设备ID,关联ems_meter.meter_id
|
||||
*/
|
||||
private Long meterId;
|
||||
|
||||
/**
|
||||
* EMS区域ID,关联ems_location.location_id
|
||||
*/
|
||||
private Long locationId;
|
||||
|
||||
/**
|
||||
* 逻辑库区ID,必须绑定 wms_warehouse.warehouse_id
|
||||
*/
|
||||
private Long warehouseId;
|
||||
|
||||
/**
|
||||
* 实际库区ID,关联wms_actual_warehouse.actual_warehouse_id
|
||||
*/
|
||||
private Long actualWarehouseId;
|
||||
|
||||
/**
|
||||
* 是否启用 1=是 0=否
|
||||
*/
|
||||
private Integer isEnabled;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.klp.ems.domain.bo;
|
||||
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* EMS能源与库区映射关系 BO
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-12-08
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class WmsEnergyAreaLinkBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
private Long linkId;
|
||||
|
||||
/**
|
||||
* EMS能源类型ID
|
||||
*/
|
||||
private Long energyTypeId;
|
||||
|
||||
/**
|
||||
* EMS计量设备ID
|
||||
*/
|
||||
private Long meterId;
|
||||
|
||||
/**
|
||||
* EMS区域ID
|
||||
*/
|
||||
private Long locationId;
|
||||
|
||||
/**
|
||||
* 逻辑库区ID
|
||||
*/
|
||||
private Long warehouseId;
|
||||
|
||||
/**
|
||||
* 实际库区ID
|
||||
*/
|
||||
private Long actualWarehouseId;
|
||||
|
||||
/**
|
||||
* 是否启用 1=是 0=否
|
||||
*/
|
||||
private Integer isEnabled;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.klp.ems.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 能源-库区绑定详情 VO
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class EnergyLinkDetailVo {
|
||||
|
||||
/**
|
||||
* 绑定ID
|
||||
*/
|
||||
private Long linkId;
|
||||
|
||||
/**
|
||||
* 设备ID
|
||||
*/
|
||||
private Long meterId;
|
||||
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
private String meterCode;
|
||||
|
||||
/**
|
||||
* 能源类型ID
|
||||
*/
|
||||
private Long energyTypeId;
|
||||
|
||||
/**
|
||||
* 能源类型名称
|
||||
*/
|
||||
private String energyTypeName;
|
||||
|
||||
/**
|
||||
* 设备型号
|
||||
*/
|
||||
private String model;
|
||||
|
||||
/**
|
||||
* 制造商
|
||||
*/
|
||||
private String manufacturer;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.klp.ems.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 库区-设备绑定矩阵 VO
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class EnergyLinkMatrixVo {
|
||||
|
||||
/**
|
||||
* 库区ID
|
||||
*/
|
||||
private Long warehouseId;
|
||||
|
||||
/**
|
||||
* 库区名称
|
||||
*/
|
||||
private String warehouseName;
|
||||
|
||||
/**
|
||||
* 库区编码
|
||||
*/
|
||||
private String warehouseCode;
|
||||
|
||||
/**
|
||||
* 绑定的设备列表
|
||||
*/
|
||||
private List<EnergyLinkDetailVo> links;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.klp.ems.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 能源绑定统计信息 VO
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class EnergyLinkStatisticsVo {
|
||||
|
||||
/**
|
||||
* 库区总数
|
||||
*/
|
||||
private Long totalWarehouses;
|
||||
|
||||
/**
|
||||
* 设备总数
|
||||
*/
|
||||
private Long totalMeters;
|
||||
|
||||
/**
|
||||
* 绑定总数
|
||||
*/
|
||||
private Long totalLinks;
|
||||
|
||||
/**
|
||||
* 能源类型总数
|
||||
*/
|
||||
private Long totalEnergyTypes;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.klp.ems.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 最近一次抄表时间范围 VO
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class LatestMeterReadTimeVo {
|
||||
|
||||
/**
|
||||
* 最近一次抄表的开始时间(上一次抄表的结束时间)
|
||||
*/
|
||||
private LocalDateTime startTime;
|
||||
|
||||
/**
|
||||
* 最近一次抄表的结束时间
|
||||
*/
|
||||
private LocalDateTime endTime;
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.klp.ems.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* EMS能源与库区映射关系 VO
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-12-08
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class WmsEnergyAreaLinkVo {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
private Long linkId;
|
||||
|
||||
/**
|
||||
* EMS能源类型ID
|
||||
*/
|
||||
private Long energyTypeId;
|
||||
|
||||
/**
|
||||
* 能源类型名称
|
||||
*/
|
||||
private String energyTypeName;
|
||||
|
||||
/**
|
||||
* EMS计量设备ID
|
||||
*/
|
||||
private Long meterId;
|
||||
|
||||
/**
|
||||
* 计量设备编号
|
||||
*/
|
||||
private String meterCode;
|
||||
|
||||
/**
|
||||
* EMS区域ID
|
||||
*/
|
||||
private Long locationId;
|
||||
|
||||
/**
|
||||
* 区域名称
|
||||
*/
|
||||
private String locationName;
|
||||
|
||||
/**
|
||||
* 逻辑库区ID
|
||||
*/
|
||||
private Long warehouseId;
|
||||
|
||||
/**
|
||||
* 库区名称
|
||||
*/
|
||||
private String warehouseName;
|
||||
|
||||
/**
|
||||
* 实际库区ID
|
||||
*/
|
||||
private Long actualWarehouseId;
|
||||
|
||||
/**
|
||||
* 实际库区名称
|
||||
*/
|
||||
private String actualWarehouseName;
|
||||
|
||||
/**
|
||||
* 是否启用 1=是 0=否
|
||||
*/
|
||||
private Integer isEnabled;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.klp.ems.mapper;
|
||||
|
||||
import com.klp.ems.domain.WmsEnergyAreaLink;
|
||||
import com.klp.ems.domain.vo.WmsEnergyAreaLinkVo;
|
||||
import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* EMS能源与库区映射关系 Mapper接口
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-12-08
|
||||
*/
|
||||
public interface WmsEnergyAreaLinkMapper extends BaseMapperPlus<WmsEnergyAreaLinkMapper, WmsEnergyAreaLink, WmsEnergyAreaLinkVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.klp.ems.service;
|
||||
|
||||
import com.klp.ems.domain.WmsEnergyAreaLink;
|
||||
import com.klp.ems.domain.vo.WmsEnergyAreaLinkVo;
|
||||
import com.klp.ems.domain.bo.WmsEnergyAreaLinkBo;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* EMS能源与库区映射关系 Service接口
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-12-08
|
||||
*/
|
||||
public interface IWmsEnergyAreaLinkService {
|
||||
|
||||
/**
|
||||
* 查询单条
|
||||
*/
|
||||
WmsEnergyAreaLinkVo queryById(Long linkId);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
TableDataInfo<WmsEnergyAreaLinkVo> queryPageList(WmsEnergyAreaLinkBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询全部列表
|
||||
*/
|
||||
List<WmsEnergyAreaLinkVo> queryList(WmsEnergyAreaLinkBo bo);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
Boolean insertByBo(WmsEnergyAreaLinkBo bo);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
Boolean updateByBo(WmsEnergyAreaLinkBo bo);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
Boolean deleteById(Long linkId);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
Boolean deleteByIds(Collection<Long> linkIds);
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package com.klp.ems.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.klp.common.utils.StringUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.klp.ems.domain.bo.WmsEnergyAreaLinkBo;
|
||||
import com.klp.ems.domain.vo.WmsEnergyAreaLinkVo;
|
||||
import com.klp.ems.domain.WmsEnergyAreaLink;
|
||||
import com.klp.ems.mapper.WmsEnergyAreaLinkMapper;
|
||||
import com.klp.ems.service.IWmsEnergyAreaLinkService;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* EMS能源与库区映射关系 Service业务层处理
|
||||
*
|
||||
* @author Joshi
|
||||
* @date 2025-12-08
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class WmsEnergyAreaLinkServiceImpl implements IWmsEnergyAreaLinkService {
|
||||
|
||||
private final WmsEnergyAreaLinkMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询单条
|
||||
*/
|
||||
@Override
|
||||
public WmsEnergyAreaLinkVo queryById(Long linkId) {
|
||||
return baseMapper.selectVoById(linkId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<WmsEnergyAreaLinkVo> queryPageList(WmsEnergyAreaLinkBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<WmsEnergyAreaLink> lqw = buildQueryWrapper(bo);
|
||||
Page<WmsEnergyAreaLinkVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全部列表
|
||||
*/
|
||||
@Override
|
||||
public List<WmsEnergyAreaLinkVo> queryList(WmsEnergyAreaLinkBo bo) {
|
||||
LambdaQueryWrapper<WmsEnergyAreaLink> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(WmsEnergyAreaLinkBo bo) {
|
||||
WmsEnergyAreaLink add = BeanUtil.toBean(bo, WmsEnergyAreaLink.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setLinkId(add.getLinkId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(WmsEnergyAreaLinkBo bo) {
|
||||
WmsEnergyAreaLink update = BeanUtil.toBean(bo, WmsEnergyAreaLink.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteById(Long linkId) {
|
||||
return baseMapper.deleteById(linkId) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteByIds(Collection<Long> linkIds) {
|
||||
return baseMapper.deleteBatchIds(linkIds) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建查询条件
|
||||
*/
|
||||
private LambdaQueryWrapper<WmsEnergyAreaLink> buildQueryWrapper(WmsEnergyAreaLinkBo bo) {
|
||||
LambdaQueryWrapper<WmsEnergyAreaLink> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getEnergyTypeId() != null, WmsEnergyAreaLink::getEnergyTypeId, bo.getEnergyTypeId());
|
||||
lqw.eq(bo.getMeterId() != null, WmsEnergyAreaLink::getMeterId, bo.getMeterId());
|
||||
lqw.eq(bo.getWarehouseId() != null, WmsEnergyAreaLink::getWarehouseId, bo.getWarehouseId());
|
||||
lqw.eq(bo.getIsEnabled() != null, WmsEnergyAreaLink::getIsEnabled, bo.getIsEnabled());
|
||||
lqw.orderByDesc(WmsEnergyAreaLink::getLinkId);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据有效性验证
|
||||
*/
|
||||
private void validEntityBeforeSave(WmsEnergyAreaLink entity) {
|
||||
if (StringUtils.isBlank(entity.getRemark())) {
|
||||
entity.setRemark("");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
<?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.klp.ems.mapper.WmsEnergyAreaLinkMapper">
|
||||
|
||||
<resultMap type="com.klp.ems.domain.WmsEnergyAreaLink" id="WmsEnergyAreaLinkResult">
|
||||
<result property="linkId" column="link_id"/>
|
||||
<result property="energyTypeId" column="energy_type_id"/>
|
||||
<result property="meterId" column="meter_id"/>
|
||||
<result property="locationId" column="location_id"/>
|
||||
<result property="warehouseId" column="warehouse_id"/>
|
||||
<result property="actualWarehouseId" column="actual_warehouse_id"/>
|
||||
<result property="isEnabled" column="is_enabled"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="com.klp.ems.domain.vo.WmsEnergyAreaLinkVo" id="WmsEnergyAreaLinkVoResult">
|
||||
<result property="linkId" column="link_id"/>
|
||||
<result property="energyTypeId" column="energy_type_id"/>
|
||||
<result property="energyTypeName" column="energy_type_name"/>
|
||||
<result property="meterId" column="meter_id"/>
|
||||
<result property="meterCode" column="meter_code"/>
|
||||
<result property="locationId" column="location_id"/>
|
||||
<result property="locationName" column="location_name"/>
|
||||
<result property="warehouseId" column="warehouse_id"/>
|
||||
<result property="warehouseName" column="warehouse_name"/>
|
||||
<result property="actualWarehouseId" column="actual_warehouse_id"/>
|
||||
<result property="actualWarehouseName" column="actual_warehouse_name"/>
|
||||
<result property="isEnabled" column="is_enabled"/>
|
||||
<result property="remark" column="remark"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 查询列表 -->
|
||||
<select id="selectVoList" resultMap="WmsEnergyAreaLinkVoResult">
|
||||
SELECT
|
||||
l.link_id,
|
||||
l.energy_type_id,
|
||||
et.name AS energy_type_name,
|
||||
l.meter_id,
|
||||
m.meter_code,
|
||||
l.location_id,
|
||||
loc.location_name,
|
||||
l.warehouse_id,
|
||||
w.warehouse_name,
|
||||
l.actual_warehouse_id,
|
||||
aw.actual_warehouse_name,
|
||||
l.is_enabled,
|
||||
l.remark
|
||||
FROM wms_energy_area_link l
|
||||
LEFT JOIN ems_energy_type et ON l.energy_type_id = et.energy_type_id
|
||||
LEFT JOIN ems_meter m ON l.meter_id = m.meter_id
|
||||
LEFT JOIN ems_location loc ON l.location_id = loc.location_id
|
||||
LEFT JOIN wms_warehouse w ON l.warehouse_id = w.warehouse_id
|
||||
LEFT JOIN wms_actual_warehouse aw ON l.actual_warehouse_id = aw.actual_warehouse_id
|
||||
WHERE 1=1
|
||||
<if test="energyTypeId != null">
|
||||
AND l.energy_type_id = #{energyTypeId}
|
||||
</if>
|
||||
<if test="meterId != null">
|
||||
AND l.meter_id = #{meterId}
|
||||
</if>
|
||||
<if test="warehouseId != null">
|
||||
AND l.warehouse_id = #{warehouseId}
|
||||
</if>
|
||||
<if test="isEnabled != null">
|
||||
AND l.is_enabled = #{isEnabled}
|
||||
</if>
|
||||
ORDER BY l.link_id DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user