change - add统计单元信息、统计计量信息

main
yinq 6 months ago
parent 5e573e9c04
commit 8beb4adab0

@ -2,6 +2,8 @@ package com.os.ems.base.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.os.ems.base.domain.TreeSelects;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -44,6 +46,15 @@ public class EmsBaseMonitorInfoController extends BaseController
return success(list);
}
/**
*
* */
@PostMapping("/monitorInfoTree")
public AjaxResult getMonitorInfoTree(EmsBaseMonitorInfo baseMonitorInfo) {
List<TreeSelects> list = emsBaseMonitorInfoService.selectBaseMonitorInfoTreeList(baseMonitorInfo);
return success(list);
}
/**
*
*/

@ -0,0 +1,100 @@
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.EmsBaseMonitorWorkUnit;
import com.os.ems.base.service.IEmsBaseMonitorWorkUnitService;
import com.os.common.utils.poi.ExcelUtil;
import com.os.common.core.page.TableDataInfo;
/**
* Controller
*
* @author Yinq
* @date 2024-05-09
*/
@RestController
@RequestMapping("/ems/base/baseMonitorWorkUnit")
public class EmsBaseMonitorWorkUnitController extends BaseController {
@Autowired
private IEmsBaseMonitorWorkUnitService emsBaseMonitorWorkUnitService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('ems/base:baseMonitorWorkUnit:list')")
@GetMapping("/list")
public TableDataInfo list(EmsBaseMonitorWorkUnit emsBaseMonitorWorkUnit) {
startPage();
List<EmsBaseMonitorWorkUnit> list = emsBaseMonitorWorkUnitService.selectEmsBaseMonitorWorkUnitList(emsBaseMonitorWorkUnit);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ems/base:baseMonitorWorkUnit:export')")
@Log(title = "统计计量信息" , businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, EmsBaseMonitorWorkUnit emsBaseMonitorWorkUnit) {
List<EmsBaseMonitorWorkUnit> list = emsBaseMonitorWorkUnitService.selectEmsBaseMonitorWorkUnitList(emsBaseMonitorWorkUnit);
ExcelUtil<EmsBaseMonitorWorkUnit> util = new ExcelUtil<EmsBaseMonitorWorkUnit>(EmsBaseMonitorWorkUnit.class);
util.exportExcel(response, list, "统计计量信息数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ems/base:baseMonitorWorkUnit:query')")
@GetMapping(value = "/{objId}")
public AjaxResult getInfo(@PathVariable("objId") Long objId) {
return success(emsBaseMonitorWorkUnitService.selectEmsBaseMonitorWorkUnitByObjId(objId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ems/base:baseMonitorWorkUnit:add')")
@Log(title = "统计计量信息" , businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody EmsBaseMonitorWorkUnit emsBaseMonitorWorkUnit) {
emsBaseMonitorWorkUnit.setCreateBy(getUsername());
return toAjax(emsBaseMonitorWorkUnitService.insertEmsBaseMonitorWorkUnit(emsBaseMonitorWorkUnit));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ems/base:baseMonitorWorkUnit:edit')")
@Log(title = "统计计量信息" , businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EmsBaseMonitorWorkUnit emsBaseMonitorWorkUnit) {
emsBaseMonitorWorkUnit.setUpdateBy(getUsername());
return toAjax(emsBaseMonitorWorkUnitService.updateEmsBaseMonitorWorkUnit(emsBaseMonitorWorkUnit));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ems/base:baseMonitorWorkUnit:remove')")
@Log(title = "统计计量信息" , businessType = BusinessType.DELETE)
@DeleteMapping("/{objIds}")
public AjaxResult remove(@PathVariable Long[] objIds) {
return toAjax(emsBaseMonitorWorkUnitService.deleteEmsBaseMonitorWorkUnitByObjIds(objIds));
}
}

@ -0,0 +1,115 @@
package com.os.ems.base.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.os.ems.base.domain.TreeSelects;
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.EmsBaseWorkUnit;
import com.os.ems.base.service.IEmsBaseWorkUnitService;
import com.os.common.utils.poi.ExcelUtil;
/**
* Controller
*
* @author Yinq
* @date 2024-05-09
*/
@RestController
@RequestMapping("/ems/base/baseWorkUnit")
public class EmsBaseWorkUnitController extends BaseController
{
@Autowired
private IEmsBaseWorkUnitService emsBaseWorkUnitService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('ems/base:baseWorkUnit:list')")
@GetMapping("/list")
public AjaxResult list(EmsBaseWorkUnit emsBaseWorkUnit)
{
List<EmsBaseWorkUnit> list = emsBaseWorkUnitService.selectEmsBaseWorkUnitList(emsBaseWorkUnit);
return success(list);
}
/**
*
*/
@PostMapping("/workUnitTree")
public AjaxResult getMonitorInfoTree(EmsBaseWorkUnit baseWorkUnit) {
List<TreeSelects> list = emsBaseWorkUnitService.selectBaseWorkUnitTreeList(baseWorkUnit);
return success(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ems/base:baseWorkUnit:export')")
@Log(title = "统计单元信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, EmsBaseWorkUnit emsBaseWorkUnit)
{
List<EmsBaseWorkUnit> list = emsBaseWorkUnitService.selectEmsBaseWorkUnitList(emsBaseWorkUnit);
ExcelUtil<EmsBaseWorkUnit> util = new ExcelUtil<EmsBaseWorkUnit>(EmsBaseWorkUnit.class);
util.exportExcel(response, list, "统计单元信息数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ems/base:baseWorkUnit:query')")
@GetMapping(value = "/{objId}")
public AjaxResult getInfo(@PathVariable("objId") Long objId)
{
return success(emsBaseWorkUnitService.selectEmsBaseWorkUnitByObjId(objId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ems/base:baseWorkUnit:add')")
@Log(title = "统计单元信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody EmsBaseWorkUnit emsBaseWorkUnit)
{
emsBaseWorkUnit.setCreateBy(getUsername());
return toAjax(emsBaseWorkUnitService.insertEmsBaseWorkUnit(emsBaseWorkUnit));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ems/base:baseWorkUnit:edit')")
@Log(title = "统计单元信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EmsBaseWorkUnit emsBaseWorkUnit)
{
emsBaseWorkUnit.setUpdateBy(getUsername());
return toAjax(emsBaseWorkUnitService.updateEmsBaseWorkUnit(emsBaseWorkUnit));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ems/base:baseWorkUnit:remove')")
@Log(title = "统计单元信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{objIds}")
public AjaxResult remove(@PathVariable Long[] objIds)
{
return toAjax(emsBaseWorkUnitService.deleteEmsBaseWorkUnitByObjIds(objIds));
}
}

@ -1,17 +1,21 @@
package com.os.ems.base.domain;
import com.os.common.core.domain.BaseEntity;
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.TreeEntity;
import java.util.ArrayList;
import java.util.List;
/**
* ems_base_monitor_info
*
* @author Yinq
* @date 2024-05-08
*/
public class EmsBaseMonitorInfo extends TreeEntity
public class EmsBaseMonitorInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
@ -20,7 +24,7 @@ public class EmsBaseMonitorInfo extends TreeEntity
/** 计量设备编号 */
@Excel(name = "计量设备编号")
private String monitorId;
private String monitorCode;
/** 计量设备名称 */
@Excel(name = "计量设备名称")
@ -82,6 +86,56 @@ public class EmsBaseMonitorInfo extends TreeEntity
@Excel(name = "表具层级")
private Long monitorHierarchy;
private List<EmsBaseMonitorInfo> children = new ArrayList<EmsBaseMonitorInfo>();
private String parentName;
private Long parentId;
private Integer orderNum;
private String ancestors;
public List<EmsBaseMonitorInfo> getChildren() {
return children;
}
public void setChildren(List<EmsBaseMonitorInfo> children) {
this.children = children;
}
public String getParentName() {
return parentName;
}
public void setParentName(String parentName) {
this.parentName = parentName;
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public Integer getOrderNum() {
return orderNum;
}
public void setOrderNum(Integer orderNum) {
this.orderNum = orderNum;
}
public String getAncestors() {
return ancestors;
}
public void setAncestors(String ancestors) {
this.ancestors = ancestors;
}
public void setObjId(Long objId)
{
this.objId = objId;
@ -91,15 +145,15 @@ public class EmsBaseMonitorInfo extends TreeEntity
{
return objId;
}
public void setMonitorId(String monitorId)
{
this.monitorId = monitorId;
public String getMonitorCode() {
return monitorCode;
}
public String getMonitorId()
{
return monitorId;
public void setMonitorCode(String monitorCode) {
this.monitorCode = monitorCode;
}
public void setMonitorName(String monitorName)
{
this.monitorName = monitorName;
@ -240,14 +294,11 @@ public class EmsBaseMonitorInfo extends TreeEntity
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("objId", getObjId())
.append("parentId", getParentId())
.append("monitorId", getMonitorId())
.append("monitorName", getMonitorName())
.append("monitorAddr", getMonitorAddr())
.append("monitorType", getMonitorType())
.append("monitorStatus", getMonitorStatus())
.append("collectDeviceId", getCollectDeviceId())
.append("ancestors", getAncestors())
.append("grade", getGrade())
.append("meterTypeId", getMeterTypeId())
.append("correctValue", getCorrectValue())

@ -0,0 +1,236 @@
package com.os.ems.base.domain;
import java.math.BigDecimal;
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_monitor_work_unit
*
* @author Yinq
* @date 2024-05-09
*/
public class EmsBaseMonitorWorkUnit extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private Long objId;
/**
*
*/
@Excel(name = "计量设备编号")
private String monitorCode;
/**
*
*/
@Excel(name = "计量设备名称")
private String monitorName;
/**
*
*/
@Excel(name = "统计单元编号")
private String workUnitCode;
/**
*
*/
@Excel(name = "统计单元名称")
private String workUnitName;
/**
* 0 1
*/
@Excel(name = "计量设备状态" , readConverterExp = "0=启用,1=停用")
private Long monitorStatus;
/**
*
*/
@Excel(name = "计量设备类型")
private Long monitorType;
/**
* 0 1
*/
@Excel(name = "计算方式" , readConverterExp = "0=加,1=减")
private Long formulaMode;
/**
*
*/
@Excel(name = "比率")
private BigDecimal proportion;
/**
* 0 1
*/
@Excel(name = "启用标识" , readConverterExp = "0=启用,1=停用")
private String isFlag;
/**
*
*/
@Excel(name = "创建人")
private String createdBy;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "创建时间" , width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date createdTime;
/**
*
*/
@Excel(name = "修改人")
private String updatedBy;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "修改时间" , width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date updatedTime;
public String getMonitorName() {
return monitorName;
}
public void setMonitorName(String monitorName) {
this.monitorName = monitorName;
}
public String getWorkUnitName() {
return workUnitName;
}
public void setWorkUnitName(String workUnitName) {
this.workUnitName = workUnitName;
}
public void setObjId(Long objId) {
this.objId = objId;
}
public Long getObjId() {
return objId;
}
public void setMonitorCode(String monitorCode) {
this.monitorCode = monitorCode;
}
public String getMonitorCode() {
return monitorCode;
}
public void setWorkUnitCode(String workUnitCode) {
this.workUnitCode = workUnitCode;
}
public String getWorkUnitCode() {
return workUnitCode;
}
public void setMonitorStatus(Long monitorStatus) {
this.monitorStatus = monitorStatus;
}
public Long getMonitorStatus() {
return monitorStatus;
}
public void setMonitorType(Long monitorType) {
this.monitorType = monitorType;
}
public Long getMonitorType() {
return monitorType;
}
public void setFormulaMode(Long formulaMode) {
this.formulaMode = formulaMode;
}
public Long getFormulaMode() {
return formulaMode;
}
public void setProportion(BigDecimal proportion) {
this.proportion = proportion;
}
public BigDecimal getProportion() {
return proportion;
}
public void setIsFlag(String isFlag) {
this.isFlag = isFlag;
}
public String getIsFlag() {
return isFlag;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public String getCreatedBy() {
return createdBy;
}
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
public Date getCreatedTime() {
return createdTime;
}
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}
public String getUpdatedBy() {
return updatedBy;
}
public void setUpdatedTime(Date updatedTime) {
this.updatedTime = updatedTime;
}
public Date getUpdatedTime() {
return updatedTime;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("objId" , getObjId())
.append("monitorCode" , getMonitorCode())
.append("workUnitCode" , getWorkUnitCode())
.append("monitorStatus" , getMonitorStatus())
.append("monitorType" , getMonitorType())
.append("formulaMode" , getFormulaMode())
.append("proportion" , getProportion())
.append("remark" , getRemark())
.append("isFlag" , getIsFlag())
.append("createdBy" , getCreatedBy())
.append("createdTime" , getCreatedTime())
.append("updatedBy" , getUpdatedBy())
.append("updatedTime" , getUpdatedTime())
.toString();
}
}

@ -0,0 +1,251 @@
package com.os.ems.base.domain;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.os.common.core.domain.BaseEntity;
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.TreeEntity;
/**
* ems_base_work_unit
*
* @author Yinq
* @date 2024-05-09
*/
public class EmsBaseWorkUnit extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键标识 */
private Long objId;
/** 统计单元编号 */
@Excel(name = "统计单元编号")
private String workUnitCode;
/** 统计单元名称 */
@Excel(name = "统计单元名称")
private String workUnitName;
/** 统计区域 */
@Excel(name = "统计区域")
private String workUnitAddress;
/** 排序 */
@Excel(name = "排序")
private Long workUnitSort;
/** 产线/工位 */
@Excel(name = "产线/工位")
private String productLineCode;
/** 统计单元类型1建筑 */
@Excel(name = "统计单元类型", readConverterExp = "1=建筑")
private Long workUnitType;
/** 启用标识(0启用 1停用) */
@Excel(name = "启用标识(0启用 1停用)")
private String isFlag;
/** 创建人 */
@Excel(name = "创建人")
private String createdBy;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date createdTime;
/** 更新人 */
@Excel(name = "更新人")
private String updatedBy;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date updatedTime;
private List<EmsBaseWorkUnit> children = new ArrayList<EmsBaseWorkUnit>();
private String parentName;
private Long parentId;
private Integer orderNum;
private String ancestors;
public List<EmsBaseWorkUnit> getChildren() {
return children;
}
public void setChildren(List<EmsBaseWorkUnit> children) {
this.children = children;
}
public String getParentName() {
return parentName;
}
public void setParentName(String parentName) {
this.parentName = parentName;
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public Integer getOrderNum() {
return orderNum;
}
public void setOrderNum(Integer orderNum) {
this.orderNum = orderNum;
}
public String getAncestors() {
return ancestors;
}
public void setAncestors(String ancestors) {
this.ancestors = ancestors;
}
public void setObjId(Long objId)
{
this.objId = objId;
}
public Long getObjId()
{
return objId;
}
public void setWorkUnitCode(String workUnitCode)
{
this.workUnitCode = workUnitCode;
}
public String getWorkUnitCode()
{
return workUnitCode;
}
public void setWorkUnitName(String workUnitName)
{
this.workUnitName = workUnitName;
}
public String getWorkUnitName()
{
return workUnitName;
}
public void setWorkUnitAddress(String workUnitAddress)
{
this.workUnitAddress = workUnitAddress;
}
public String getWorkUnitAddress()
{
return workUnitAddress;
}
public void setWorkUnitSort(Long workUnitSort)
{
this.workUnitSort = workUnitSort;
}
public Long getWorkUnitSort()
{
return workUnitSort;
}
public void setProductLineCode(String productLineCode)
{
this.productLineCode = productLineCode;
}
public String getProductLineCode()
{
return productLineCode;
}
public void setWorkUnitType(Long workUnitType)
{
this.workUnitType = workUnitType;
}
public Long getWorkUnitType()
{
return workUnitType;
}
public void setIsFlag(String isFlag)
{
this.isFlag = isFlag;
}
public String getIsFlag()
{
return isFlag;
}
public void setCreatedBy(String createdBy)
{
this.createdBy = createdBy;
}
public String getCreatedBy()
{
return createdBy;
}
public void setCreatedTime(Date createdTime)
{
this.createdTime = createdTime;
}
public Date getCreatedTime()
{
return createdTime;
}
public void setUpdatedBy(String updatedBy)
{
this.updatedBy = updatedBy;
}
public String getUpdatedBy()
{
return updatedBy;
}
public void setUpdatedTime(Date updatedTime)
{
this.updatedTime = updatedTime;
}
public Date getUpdatedTime()
{
return updatedTime;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("objId", getObjId())
.append("workUnitCode", getWorkUnitCode())
.append("parentId", getParentId())
.append("workUnitName", getWorkUnitName())
.append("workUnitAddress", getWorkUnitAddress())
.append("ancestors", getAncestors())
.append("workUnitSort", getWorkUnitSort())
.append("productLineCode", getProductLineCode())
.append("workUnitType", getWorkUnitType())
.append("isFlag", getIsFlag())
.append("createdBy", getCreatedBy())
.append("createdTime", getCreatedTime())
.append("updatedBy", getUpdatedBy())
.append("updatedTime", getUpdatedTime())
.toString();
}
}

@ -0,0 +1,102 @@
package com.os.ems.base.domain;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.os.common.core.domain.entity.SysDept;
import com.os.common.core.domain.entity.SysMenu;
import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;
/**
* Treeselect
*
* @author ruoyi
*/
public class TreeSelects implements Serializable
{
private static final long serialVersionUID = 1L;
/** 节点ID */
private Long id;
/** 节点名称 */
private String label;
private String code;
/** 子节点 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<TreeSelects> children;
public TreeSelects()
{
}
public TreeSelects(SysDept dept)
{
this.id = dept.getDeptId();
this.label = dept.getDeptName();
this.children = dept.getChildren().stream().map(TreeSelects::new).collect(Collectors.toList());
}
public TreeSelects(EmsBaseMonitorInfo baseMonitorInfo){
this.id = baseMonitorInfo.getObjId();
this.label = baseMonitorInfo.getMonitorName();
this.code = baseMonitorInfo.getMonitorCode();
this.children = baseMonitorInfo.getChildren().stream().map(TreeSelects::new).collect(Collectors.toList());
}
public TreeSelects(EmsBaseWorkUnit baseWorkUnit){
this.id = baseWorkUnit.getObjId();
this.label = baseWorkUnit.getWorkUnitName();
this.code = baseWorkUnit.getWorkUnitCode();
this.children = baseWorkUnit.getChildren().stream().map(TreeSelects::new).collect(Collectors.toList());
}
public TreeSelects(SysMenu menu)
{
this.id = menu.getMenuId();
this.label = menu.getMenuName();
this.children = menu.getChildren().stream().map(TreeSelects::new).collect(Collectors.toList());
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public Long getId()
{
return id;
}
public void setId(Long id)
{
this.id = id;
}
public String getLabel()
{
return label;
}
public void setLabel(String label)
{
this.label = label;
}
public List<TreeSelects> getChildren()
{
return children;
}
public void setChildren(List<TreeSelects> children)
{
this.children = children;
}
}

@ -0,0 +1,61 @@
package com.os.ems.base.mapper;
import java.util.List;
import com.os.ems.base.domain.EmsBaseMonitorWorkUnit;
/**
* Mapper
*
* @author Yinq
* @date 2024-05-09
*/
public interface EmsBaseMonitorWorkUnitMapper
{
/**
*
*
* @param objId
* @return
*/
public EmsBaseMonitorWorkUnit selectEmsBaseMonitorWorkUnitByObjId(Long objId);
/**
*
*
* @param emsBaseMonitorWorkUnit
* @return
*/
public List<EmsBaseMonitorWorkUnit> selectEmsBaseMonitorWorkUnitList(EmsBaseMonitorWorkUnit emsBaseMonitorWorkUnit);
/**
*
*
* @param emsBaseMonitorWorkUnit
* @return
*/
public int insertEmsBaseMonitorWorkUnit(EmsBaseMonitorWorkUnit emsBaseMonitorWorkUnit);
/**
*
*
* @param emsBaseMonitorWorkUnit
* @return
*/
public int updateEmsBaseMonitorWorkUnit(EmsBaseMonitorWorkUnit emsBaseMonitorWorkUnit);
/**
*
*
* @param objId
* @return
*/
public int deleteEmsBaseMonitorWorkUnitByObjId(Long objId);
/**
*
*
* @param objIds
* @return
*/
public int deleteEmsBaseMonitorWorkUnitByObjIds(Long[] objIds);
}

@ -0,0 +1,61 @@
package com.os.ems.base.mapper;
import java.util.List;
import com.os.ems.base.domain.EmsBaseWorkUnit;
/**
* Mapper
*
* @author Yinq
* @date 2024-05-09
*/
public interface EmsBaseWorkUnitMapper
{
/**
*
*
* @param objId
* @return
*/
public EmsBaseWorkUnit selectEmsBaseWorkUnitByObjId(Long objId);
/**
*
*
* @param emsBaseWorkUnit
* @return
*/
public List<EmsBaseWorkUnit> selectEmsBaseWorkUnitList(EmsBaseWorkUnit emsBaseWorkUnit);
/**
*
*
* @param emsBaseWorkUnit
* @return
*/
public int insertEmsBaseWorkUnit(EmsBaseWorkUnit emsBaseWorkUnit);
/**
*
*
* @param emsBaseWorkUnit
* @return
*/
public int updateEmsBaseWorkUnit(EmsBaseWorkUnit emsBaseWorkUnit);
/**
*
*
* @param objId
* @return
*/
public int deleteEmsBaseWorkUnitByObjId(Long objId);
/**
*
*
* @param objIds
* @return
*/
public int deleteEmsBaseWorkUnitByObjIds(Long[] objIds);
}

@ -2,6 +2,7 @@ package com.os.ems.base.service;
import java.util.List;
import com.os.ems.base.domain.EmsBaseMonitorInfo;
import com.os.ems.base.domain.TreeSelects;
/**
* Service
@ -58,4 +59,25 @@ public interface IEmsBaseMonitorInfoService
* @return
*/
public int deleteEmsBaseMonitorInfoByObjId(Long objId);
/**
*
* */
List<TreeSelects> selectBaseMonitorInfoTreeList(EmsBaseMonitorInfo baseMonitorInfo);
/**
*
*
* @param
* @return
*/
public List<TreeSelects> buildMonitorInfoTreeSelect(List<EmsBaseMonitorInfo> baseMonitorInfos);
/**
*
*
* @param
* @return
*/
public List<EmsBaseMonitorInfo> buildMonitorInfoTree(List<EmsBaseMonitorInfo> baseMonitorInfos);
}

@ -0,0 +1,61 @@
package com.os.ems.base.service;
import java.util.List;
import com.os.ems.base.domain.EmsBaseMonitorWorkUnit;
/**
* Service
*
* @author Yinq
* @date 2024-05-09
*/
public interface IEmsBaseMonitorWorkUnitService
{
/**
*
*
* @param objId
* @return
*/
public EmsBaseMonitorWorkUnit selectEmsBaseMonitorWorkUnitByObjId(Long objId);
/**
*
*
* @param emsBaseMonitorWorkUnit
* @return
*/
public List<EmsBaseMonitorWorkUnit> selectEmsBaseMonitorWorkUnitList(EmsBaseMonitorWorkUnit emsBaseMonitorWorkUnit);
/**
*
*
* @param emsBaseMonitorWorkUnit
* @return
*/
public int insertEmsBaseMonitorWorkUnit(EmsBaseMonitorWorkUnit emsBaseMonitorWorkUnit);
/**
*
*
* @param emsBaseMonitorWorkUnit
* @return
*/
public int updateEmsBaseMonitorWorkUnit(EmsBaseMonitorWorkUnit emsBaseMonitorWorkUnit);
/**
*
*
* @param objIds
* @return
*/
public int deleteEmsBaseMonitorWorkUnitByObjIds(Long[] objIds);
/**
*
*
* @param objId
* @return
*/
public int deleteEmsBaseMonitorWorkUnitByObjId(Long objId);
}

@ -0,0 +1,69 @@
package com.os.ems.base.service;
import java.util.List;
import com.os.ems.base.domain.EmsBaseWorkUnit;
import com.os.ems.base.domain.TreeSelects;
/**
* Service
*
* @author Yinq
* @date 2024-05-09
*/
public interface IEmsBaseWorkUnitService
{
/**
*
*
* @param objId
* @return
*/
public EmsBaseWorkUnit selectEmsBaseWorkUnitByObjId(Long objId);
/**
*
*
* @param emsBaseWorkUnit
* @return
*/
public List<EmsBaseWorkUnit> selectEmsBaseWorkUnitList(EmsBaseWorkUnit emsBaseWorkUnit);
/**
*
*
* @param emsBaseWorkUnit
* @return
*/
public int insertEmsBaseWorkUnit(EmsBaseWorkUnit emsBaseWorkUnit);
/**
*
*
* @param emsBaseWorkUnit
* @return
*/
public int updateEmsBaseWorkUnit(EmsBaseWorkUnit emsBaseWorkUnit);
/**
*
*
* @param objIds
* @return
*/
public int deleteEmsBaseWorkUnitByObjIds(Long[] objIds);
/**
*
*
* @param objId
* @return
*/
public int deleteEmsBaseWorkUnitByObjId(Long objId);
List<TreeSelects> selectBaseWorkUnitTreeList(EmsBaseWorkUnit baseWorkUnit);
public List<TreeSelects> buildWorkUnitTreeSelect(List<EmsBaseWorkUnit> baseWorkUnits);
public List<EmsBaseWorkUnit> buildWorkUnitTree(List<EmsBaseWorkUnit> baseWorkUnits);
}

@ -1,7 +1,13 @@
package com.os.ems.base.service.impl;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
import com.os.common.utils.DateUtils;
import com.os.common.utils.StringUtils;
import com.os.ems.base.domain.TreeSelects;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.os.ems.base.mapper.EmsBaseMonitorInfoMapper;
@ -93,4 +99,95 @@ public class EmsBaseMonitorInfoServiceImpl implements IEmsBaseMonitorInfoService
{
return emsBaseMonitorInfoMapper.deleteEmsBaseMonitorInfoByObjId(objId);
}
/**
*
* */
@Override
public List<TreeSelects> selectBaseMonitorInfoTreeList(EmsBaseMonitorInfo baseMonitorInfo) {
List<EmsBaseMonitorInfo> baseMonitorInfos = selectEmsBaseMonitorInfoList(baseMonitorInfo);
return buildMonitorInfoTreeSelect(baseMonitorInfos);
}
/**
*
*
* @param
* @return
*/
@Override
public List<TreeSelects> buildMonitorInfoTreeSelect(List<EmsBaseMonitorInfo> baseMonitorInfos)
{
List<EmsBaseMonitorInfo> deptTrees = buildMonitorInfoTree(baseMonitorInfos);
return deptTrees.stream().map(TreeSelects::new).collect(Collectors.toList());
}
/**
*
*
* @param
* @return
*/
@Override
public List<EmsBaseMonitorInfo> buildMonitorInfoTree(List<EmsBaseMonitorInfo> baseMonitorInfos)
{
List<EmsBaseMonitorInfo> returnList = new ArrayList<EmsBaseMonitorInfo>();
List<Long> tempList = baseMonitorInfos.stream().map(EmsBaseMonitorInfo::getObjId).collect(Collectors.toList());
for (EmsBaseMonitorInfo baseMonitorInfo : baseMonitorInfos)
{
// 如果是顶级节点, 遍历该父节点的所有子节点
if (!tempList.contains(baseMonitorInfo.getParentId()))
{
recursionFn(baseMonitorInfos, baseMonitorInfo);
returnList.add(baseMonitorInfo);
}
}
if (returnList.isEmpty())
{
returnList = baseMonitorInfos;
}
return returnList;
}
/**
*
*/
private void recursionFn(List<EmsBaseMonitorInfo> list, EmsBaseMonitorInfo t)
{
// 得到子节点列表
List<EmsBaseMonitorInfo> childList = getChildList(list, t);
t.setChildren(childList);
for (EmsBaseMonitorInfo tChild : childList)
{
if (hasChild(list, tChild))
{
recursionFn(list, tChild);
}
}
}
/**
*
*/
private List<EmsBaseMonitorInfo> getChildList(List<EmsBaseMonitorInfo> list, EmsBaseMonitorInfo t)
{
List<EmsBaseMonitorInfo> tlist = new ArrayList<EmsBaseMonitorInfo>();
Iterator<EmsBaseMonitorInfo> it = list.iterator();
while (it.hasNext())
{
EmsBaseMonitorInfo n = (EmsBaseMonitorInfo) it.next();
if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getObjId().longValue())
{
tlist.add(n);
}
}
return tlist;
}
/**
*
*/
private boolean hasChild(List<EmsBaseMonitorInfo> list, EmsBaseMonitorInfo t)
{
return getChildList(list, t).size() > 0;
}
}

@ -0,0 +1,97 @@
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.EmsBaseMonitorWorkUnitMapper;
import com.os.ems.base.domain.EmsBaseMonitorWorkUnit;
import com.os.ems.base.service.IEmsBaseMonitorWorkUnitService;
/**
* Service
*
* @author Yinq
* @date 2024-05-09
*/
@Service
public class EmsBaseMonitorWorkUnitServiceImpl implements IEmsBaseMonitorWorkUnitService
{
@Autowired
private EmsBaseMonitorWorkUnitMapper emsBaseMonitorWorkUnitMapper;
/**
*
*
* @param objId
* @return
*/
@Override
public EmsBaseMonitorWorkUnit selectEmsBaseMonitorWorkUnitByObjId(Long objId)
{
return emsBaseMonitorWorkUnitMapper.selectEmsBaseMonitorWorkUnitByObjId(objId);
}
/**
*
*
* @param emsBaseMonitorWorkUnit
* @return
*/
@Override
public List<EmsBaseMonitorWorkUnit> selectEmsBaseMonitorWorkUnitList(EmsBaseMonitorWorkUnit emsBaseMonitorWorkUnit)
{
emsBaseMonitorWorkUnit.setCreateTime(DateUtils.getNowDate());
return emsBaseMonitorWorkUnitMapper.selectEmsBaseMonitorWorkUnitList(emsBaseMonitorWorkUnit);
}
/**
*
*
* @param emsBaseMonitorWorkUnit
* @return
*/
@Override
public int insertEmsBaseMonitorWorkUnit(EmsBaseMonitorWorkUnit emsBaseMonitorWorkUnit)
{
emsBaseMonitorWorkUnit.setUpdateTime(DateUtils.getNowDate());
return emsBaseMonitorWorkUnitMapper.insertEmsBaseMonitorWorkUnit(emsBaseMonitorWorkUnit);
}
/**
*
*
* @param emsBaseMonitorWorkUnit
* @return
*/
@Override
public int updateEmsBaseMonitorWorkUnit(EmsBaseMonitorWorkUnit emsBaseMonitorWorkUnit)
{
return emsBaseMonitorWorkUnitMapper.updateEmsBaseMonitorWorkUnit(emsBaseMonitorWorkUnit);
}
/**
*
*
* @param objIds
* @return
*/
@Override
public int deleteEmsBaseMonitorWorkUnitByObjIds(Long[] objIds)
{
return emsBaseMonitorWorkUnitMapper.deleteEmsBaseMonitorWorkUnitByObjIds(objIds);
}
/**
*
*
* @param objId
* @return
*/
@Override
public int deleteEmsBaseMonitorWorkUnitByObjId(Long objId)
{
return emsBaseMonitorWorkUnitMapper.deleteEmsBaseMonitorWorkUnitByObjId(objId);
}
}

@ -0,0 +1,177 @@
package com.os.ems.base.service.impl;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
import com.os.common.utils.DateUtils;
import com.os.common.utils.StringUtils;
import com.os.ems.base.domain.TreeSelects;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.os.ems.base.mapper.EmsBaseWorkUnitMapper;
import com.os.ems.base.domain.EmsBaseWorkUnit;
import com.os.ems.base.service.IEmsBaseWorkUnitService;
/**
* Service
*
* @author Yinq
* @date 2024-05-09
*/
@Service
public class EmsBaseWorkUnitServiceImpl implements IEmsBaseWorkUnitService
{
@Autowired
private EmsBaseWorkUnitMapper emsBaseWorkUnitMapper;
/**
*
*
* @param objId
* @return
*/
@Override
public EmsBaseWorkUnit selectEmsBaseWorkUnitByObjId(Long objId)
{
return emsBaseWorkUnitMapper.selectEmsBaseWorkUnitByObjId(objId);
}
/**
*
*
* @param emsBaseWorkUnit
* @return
*/
@Override
public List<EmsBaseWorkUnit> selectEmsBaseWorkUnitList(EmsBaseWorkUnit emsBaseWorkUnit)
{
return emsBaseWorkUnitMapper.selectEmsBaseWorkUnitList(emsBaseWorkUnit);
}
/**
*
*
* @param emsBaseWorkUnit
* @return
*/
@Override
public int insertEmsBaseWorkUnit(EmsBaseWorkUnit emsBaseWorkUnit)
{
emsBaseWorkUnit.setCreateTime(DateUtils.getNowDate());
return emsBaseWorkUnitMapper.insertEmsBaseWorkUnit(emsBaseWorkUnit);
}
/**
*
*
* @param emsBaseWorkUnit
* @return
*/
@Override
public int updateEmsBaseWorkUnit(EmsBaseWorkUnit emsBaseWorkUnit)
{
emsBaseWorkUnit.setUpdateTime(DateUtils.getNowDate());
return emsBaseWorkUnitMapper.updateEmsBaseWorkUnit(emsBaseWorkUnit);
}
/**
*
*
* @param objIds
* @return
*/
@Override
public int deleteEmsBaseWorkUnitByObjIds(Long[] objIds)
{
return emsBaseWorkUnitMapper.deleteEmsBaseWorkUnitByObjIds(objIds);
}
/**
*
*
* @param objId
* @return
*/
@Override
public int deleteEmsBaseWorkUnitByObjId(Long objId)
{
return emsBaseWorkUnitMapper.deleteEmsBaseWorkUnitByObjId(objId);
}
@Override
public List<TreeSelects> selectBaseWorkUnitTreeList(EmsBaseWorkUnit baseWorkUnit) {
List<EmsBaseWorkUnit> baseWorkUnits = selectEmsBaseWorkUnitList(baseWorkUnit);
return buildWorkUnitTreeSelect(baseWorkUnits);
}
@Override
public List<TreeSelects> buildWorkUnitTreeSelect(List<EmsBaseWorkUnit> baseWorkUnits) {
List<EmsBaseWorkUnit> baseWorkUnitsTrees = buildWorkUnitTree(baseWorkUnits);
return baseWorkUnitsTrees.stream().map(TreeSelects::new).collect(Collectors.toList());
}
@Override
public List<EmsBaseWorkUnit> buildWorkUnitTree(List<EmsBaseWorkUnit> baseWorkUnits) {
List<EmsBaseWorkUnit> returnList = new ArrayList<EmsBaseWorkUnit>();
List<Long> tempList = baseWorkUnits.stream().map(EmsBaseWorkUnit::getObjId).collect(Collectors.toList());
for (EmsBaseWorkUnit baseWorkUnit : baseWorkUnits)
{
// 如果是顶级节点, 遍历该父节点的所有子节点
if (!tempList.contains(baseWorkUnit.getParentId()))
{
recursionFn(baseWorkUnits, baseWorkUnit);
returnList.add(baseWorkUnit);
}
}
if (returnList.isEmpty())
{
returnList = baseWorkUnits;
}
return returnList;
}
/**
*
*/
private void recursionFn(List<EmsBaseWorkUnit> list, EmsBaseWorkUnit t)
{
// 得到子节点列表
List<EmsBaseWorkUnit> childList = getChildList(list, t);
t.setChildren(childList);
for (EmsBaseWorkUnit tChild : childList)
{
if (hasChild(list, tChild))
{
recursionFn(list, tChild);
}
}
}
/**
*
*/
private List<EmsBaseWorkUnit> getChildList(List<EmsBaseWorkUnit> list, EmsBaseWorkUnit t)
{
List<EmsBaseWorkUnit> tlist = new ArrayList<EmsBaseWorkUnit>();
Iterator<EmsBaseWorkUnit> it = list.iterator();
while (it.hasNext())
{
EmsBaseWorkUnit n = (EmsBaseWorkUnit) it.next();
if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getObjId().longValue())
{
tlist.add(n);
}
}
return tlist;
}
/**
*
*/
private boolean hasChild(List<EmsBaseWorkUnit> list, EmsBaseWorkUnit t)
{
return getChildList(list, t).size() > 0;
}
}

@ -7,7 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="EmsBaseMonitorInfo" id="EmsBaseMonitorInfoResult">
<result property="objId" column="obj_id" />
<result property="parentId" column="parent_id" />
<result property="monitorId" column="monitor_id" />
<result property="monitorCode" column="monitor_code" />
<result property="monitorName" column="monitor_name" />
<result property="monitorAddr" column="monitor_addr" />
<result property="monitorType" column="monitor_type" />
@ -31,14 +31,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectEmsBaseMonitorInfoVo">
select obj_id, parent_id, monitor_id, monitor_name, monitor_addr, monitor_type, monitor_status, collect_device_id, ancestors, grade, meter_type_id, correct_value, pt, ct, is_ammeter, is_key_monitor, is_circuit, create_by, create_time, update_by, update_time, public_share_type, monitor_hierarchy from ems_base_monitor_info
select obj_id, parent_id, monitor_code, monitor_name, monitor_addr, monitor_type, monitor_status, collect_device_id, ancestors, grade, meter_type_id, correct_value, pt, ct, is_ammeter, is_key_monitor, is_circuit, create_by, create_time, update_by, update_time, public_share_type, monitor_hierarchy from ems_base_monitor_info
</sql>
<select id="selectEmsBaseMonitorInfoList" parameterType="EmsBaseMonitorInfo" resultMap="EmsBaseMonitorInfoResult">
<include refid="selectEmsBaseMonitorInfoVo"/>
<where>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="monitorId != null and monitorId != ''"> and monitor_id = #{monitorId}</if>
<if test="monitorCode != null and monitorCode != ''"> and monitor_code = #{monitorCode}</if>
<if test="monitorName != null and monitorName != ''"> and monitor_name like concat('%', #{monitorName}, '%')</if>
<if test="monitorAddr != null and monitorAddr != ''"> and monitor_addr = #{monitorAddr}</if>
<if test="monitorType != null "> and monitor_type = #{monitorType}</if>
@ -71,7 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
insert into ems_base_monitor_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="parentId != null">parent_id,</if>
<if test="monitorId != null and monitorId != ''">monitor_id,</if>
<if test="monitorCode != null and monitorCode != ''">monitor_code,</if>
<if test="monitorName != null">monitor_name,</if>
<if test="monitorAddr != null">monitor_addr,</if>
<if test="monitorType != null">monitor_type,</if>
@ -95,7 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="parentId != null">#{parentId},</if>
<if test="monitorId != null and monitorId != ''">#{monitorId},</if>
<if test="monitorCode != null and monitorCode != ''">#{monitorCode},</if>
<if test="monitorName != null">#{monitorName},</if>
<if test="monitorAddr != null">#{monitorAddr},</if>
<if test="monitorType != null">#{monitorType},</if>
@ -123,7 +123,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update ems_base_monitor_info
<trim prefix="SET" suffixOverrides=",">
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="monitorId != null and monitorId != ''">monitor_id = #{monitorId},</if>
<if test="monitorCode != null and monitorCode != ''">monitor_code = #{monitorCode},</if>
<if test="monitorName != null">monitor_name = #{monitorName},</if>
<if test="monitorAddr != null">monitor_addr = #{monitorAddr},</if>
<if test="monitorType != null">monitor_type = #{monitorType},</if>

@ -0,0 +1,133 @@
<?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.EmsBaseMonitorWorkUnitMapper">
<resultMap type="EmsBaseMonitorWorkUnit" id="EmsBaseMonitorWorkUnitResult">
<result property="objId" column="obj_id"/>
<result property="monitorCode" column="monitor_code"/>
<result property="monitorName" column="monitor_code"/>
<result property="workUnitCode" column="work_unit_code"/>
<result property="workUnitName" column="work_unit_name"/>
<result property="monitorStatus" column="monitor_status"/>
<result property="monitorType" column="monitor_type"/>
<result property="formulaMode" column="formula_mode"/>
<result property="proportion" column="proportion"/>
<result property="remark" column="remark"/>
<result property="isFlag" column="is_flag"/>
<result property="createdBy" column="created_by"/>
<result property="createdTime" column="created_time"/>
<result property="updatedBy" column="updated_by"/>
<result property="updatedTime" column="updated_time"/>
</resultMap>
<sql id="selectEmsBaseMonitorWorkUnitVo">
select ebmwu.obj_id,
ebmwu.monitor_code,
ebmi.monitor_name,
ebmwu.work_unit_code,
ebwu.work_unit_name,
ebmwu.monitor_status,
ebmwu.monitor_type,
ebmwu.formula_mode,
ebmwu.proportion,
ebmwu.remark,
ebmwu.is_flag,
ebmwu.created_by,
ebmwu.created_time,
ebmwu.updated_by,
ebmwu.updated_time
from ems_base_monitor_work_unit ebmwu
left join ems_base_monitor_info ebmi on ebmi.monitor_code = ebmwu.monitor_code
left join ems_base_work_unit ebwu on ebwu.work_unit_code = ebmwu.work_unit_code
</sql>
<select id="selectEmsBaseMonitorWorkUnitList" parameterType="EmsBaseMonitorWorkUnit"
resultMap="EmsBaseMonitorWorkUnitResult">
<include refid="selectEmsBaseMonitorWorkUnitVo"/>
<where>
<if test="monitorCode != null and monitorCode != ''">and ebmwu.monitor_code = #{monitorCode}</if>
<if test="workUnitCode != null and workUnitCode != ''">and ebmwu.work_unit_code = #{workUnitCode}</if>
<if test="monitorStatus != null ">and ebmwu.monitor_status = #{monitorStatus}</if>
<if test="monitorType != null ">and ebmwu.monitor_type = #{monitorType}</if>
<if test="formulaMode != null ">and ebmwu.formula_mode = #{formulaMode}</if>
<if test="proportion != null ">and ebmwu.proportion = #{proportion}</if>
<if test="isFlag != null and isFlag != ''">and ebmwu.is_flag = #{isFlag}</if>
<if test="createdBy != null and createdBy != ''">and ebmwu.created_by = #{createdBy}</if>
<if test="createdTime != null ">and ebmwu.created_time = #{createdTime}</if>
<if test="updatedBy != null and updatedBy != ''">and ebmwu.updated_by = #{updatedBy}</if>
<if test="updatedTime != null ">and ebmwu.updated_time = #{updatedTime}</if>
</where>
</select>
<select id="selectEmsBaseMonitorWorkUnitByObjId" parameterType="Long" resultMap="EmsBaseMonitorWorkUnitResult">
<include refid="selectEmsBaseMonitorWorkUnitVo"/>
where ebmwu.obj_id = #{objId}
</select>
<insert id="insertEmsBaseMonitorWorkUnit" parameterType="EmsBaseMonitorWorkUnit" useGeneratedKeys="true"
keyProperty="objId">
insert into ems_base_monitor_work_unit
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="monitorCode != null and monitorCode != ''">monitor_code,</if>
<if test="workUnitCode != null">work_unit_code,</if>
<if test="monitorStatus != null">monitor_status,</if>
<if test="monitorType != null">monitor_type,</if>
<if test="formulaMode != null">formula_mode,</if>
<if test="proportion != null">proportion,</if>
<if test="remark != null">remark,</if>
<if test="isFlag != null">is_flag,</if>
<if test="createdBy != null">created_by,</if>
<if test="createdTime != null">created_time,</if>
<if test="updatedBy != null">updated_by,</if>
<if test="updatedTime != null">updated_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="monitorCode != null and monitorCode != ''">#{monitorCode},</if>
<if test="workUnitCode != null">#{workUnitCode},</if>
<if test="monitorStatus != null">#{monitorStatus},</if>
<if test="monitorType != null">#{monitorType},</if>
<if test="formulaMode != null">#{formulaMode},</if>
<if test="proportion != null">#{proportion},</if>
<if test="remark != null">#{remark},</if>
<if test="isFlag != null">#{isFlag},</if>
<if test="createdBy != null">#{createdBy},</if>
<if test="createdTime != null">#{createdTime},</if>
<if test="updatedBy != null">#{updatedBy},</if>
<if test="updatedTime != null">#{updatedTime},</if>
</trim>
</insert>
<update id="updateEmsBaseMonitorWorkUnit" parameterType="EmsBaseMonitorWorkUnit">
update ems_base_monitor_work_unit
<trim prefix="SET" suffixOverrides=",">
<if test="monitorCode != null and monitorCode != ''">monitor_code = #{monitorCode},</if>
<if test="workUnitCode != null">work_unit_code = #{workUnitCode},</if>
<if test="monitorStatus != null">monitor_status = #{monitorStatus},</if>
<if test="monitorType != null">monitor_type = #{monitorType},</if>
<if test="formulaMode != null">formula_mode = #{formulaMode},</if>
<if test="proportion != null">proportion = #{proportion},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="isFlag != null">is_flag = #{isFlag},</if>
<if test="createdBy != null">created_by = #{createdBy},</if>
<if test="createdTime != null">created_time = #{createdTime},</if>
<if test="updatedBy != null">updated_by = #{updatedBy},</if>
<if test="updatedTime != null">updated_time = #{updatedTime},</if>
</trim>
where obj_id = #{objId}
</update>
<delete id="deleteEmsBaseMonitorWorkUnitByObjId" parameterType="Long">
delete
from ems_base_monitor_work_unit
where obj_id = #{objId}
</delete>
<delete id="deleteEmsBaseMonitorWorkUnitByObjIds" parameterType="String">
delete from ems_base_monitor_work_unit where obj_id in
<foreach item="objId" collection="array" open="(" separator="," close=")">
#{objId}
</foreach>
</delete>
</mapper>

@ -0,0 +1,116 @@
<?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.EmsBaseWorkUnitMapper">
<resultMap type="EmsBaseWorkUnit" id="EmsBaseWorkUnitResult">
<result property="objId" column="obj_id" />
<result property="workUnitCode" column="work_unit_code" />
<result property="parentId" column="parent_id" />
<result property="workUnitName" column="work_unit_name" />
<result property="workUnitAddress" column="work_unit_address" />
<result property="ancestors" column="ancestors" />
<result property="workUnitSort" column="work_unit_sort" />
<result property="productLineCode" column="product_line_code" />
<result property="workUnitType" column="work_unit_type" />
<result property="isFlag" column="is_flag" />
<result property="createdBy" column="created_by" />
<result property="createdTime" column="created_time" />
<result property="updatedBy" column="updated_by" />
<result property="updatedTime" column="updated_time" />
</resultMap>
<sql id="selectEmsBaseWorkUnitVo">
select obj_id, work_unit_code, parent_id, work_unit_name, work_unit_address, ancestors, work_unit_sort, product_line_code, work_unit_type, is_flag, created_by, created_time, updated_by, updated_time from ems_base_work_unit
</sql>
<select id="selectEmsBaseWorkUnitList" parameterType="EmsBaseWorkUnit" resultMap="EmsBaseWorkUnitResult">
<include refid="selectEmsBaseWorkUnitVo"/>
<where>
<if test="workUnitCode != null and workUnitCode != ''"> and work_unit_code = #{workUnitCode}</if>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="workUnitName != null and workUnitName != ''"> and work_unit_name like concat('%', #{workUnitName}, '%')</if>
<if test="workUnitAddress != null and workUnitAddress != ''"> and work_unit_address = #{workUnitAddress}</if>
<if test="ancestors != null and ancestors != ''"> and ancestors = #{ancestors}</if>
<if test="workUnitSort != null "> and work_unit_sort = #{workUnitSort}</if>
<if test="productLineCode != null and productLineCode != ''"> and product_line_code = #{productLineCode}</if>
<if test="workUnitType != null "> and work_unit_type = #{workUnitType}</if>
<if test="isFlag != null and isFlag != ''"> and is_flag = #{isFlag}</if>
<if test="createdBy != null and createdBy != ''"> and created_by = #{createdBy}</if>
<if test="createdTime != null "> and created_time = #{createdTime}</if>
<if test="updatedBy != null and updatedBy != ''"> and updated_by = #{updatedBy}</if>
<if test="updatedTime != null "> and updated_time = #{updatedTime}</if>
</where>
</select>
<select id="selectEmsBaseWorkUnitByObjId" parameterType="Long" resultMap="EmsBaseWorkUnitResult">
<include refid="selectEmsBaseWorkUnitVo"/>
where obj_id = #{objId}
</select>
<insert id="insertEmsBaseWorkUnit" parameterType="EmsBaseWorkUnit" useGeneratedKeys="true" keyProperty="objId">
insert into ems_base_work_unit
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="workUnitCode != null and workUnitCode != ''">work_unit_code,</if>
<if test="parentId != null">parent_id,</if>
<if test="workUnitName != null">work_unit_name,</if>
<if test="workUnitAddress != null">work_unit_address,</if>
<if test="ancestors != null">ancestors,</if>
<if test="workUnitSort != null">work_unit_sort,</if>
<if test="productLineCode != null">product_line_code,</if>
<if test="workUnitType != null">work_unit_type,</if>
<if test="isFlag != null">is_flag,</if>
<if test="createdBy != null">created_by,</if>
<if test="createdTime != null">created_time,</if>
<if test="updatedBy != null">updated_by,</if>
<if test="updatedTime != null">updated_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="workUnitCode != null and workUnitCode != ''">#{workUnitCode},</if>
<if test="parentId != null">#{parentId},</if>
<if test="workUnitName != null">#{workUnitName},</if>
<if test="workUnitAddress != null">#{workUnitAddress},</if>
<if test="ancestors != null">#{ancestors},</if>
<if test="workUnitSort != null">#{workUnitSort},</if>
<if test="productLineCode != null">#{productLineCode},</if>
<if test="workUnitType != null">#{workUnitType},</if>
<if test="isFlag != null">#{isFlag},</if>
<if test="createdBy != null">#{createdBy},</if>
<if test="createdTime != null">#{createdTime},</if>
<if test="updatedBy != null">#{updatedBy},</if>
<if test="updatedTime != null">#{updatedTime},</if>
</trim>
</insert>
<update id="updateEmsBaseWorkUnit" parameterType="EmsBaseWorkUnit">
update ems_base_work_unit
<trim prefix="SET" suffixOverrides=",">
<if test="workUnitCode != null and workUnitCode != ''">work_unit_code = #{workUnitCode},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="workUnitName != null">work_unit_name = #{workUnitName},</if>
<if test="workUnitAddress != null">work_unit_address = #{workUnitAddress},</if>
<if test="ancestors != null">ancestors = #{ancestors},</if>
<if test="workUnitSort != null">work_unit_sort = #{workUnitSort},</if>
<if test="productLineCode != null">product_line_code = #{productLineCode},</if>
<if test="workUnitType != null">work_unit_type = #{workUnitType},</if>
<if test="isFlag != null">is_flag = #{isFlag},</if>
<if test="createdBy != null">created_by = #{createdBy},</if>
<if test="createdTime != null">created_time = #{createdTime},</if>
<if test="updatedBy != null">updated_by = #{updatedBy},</if>
<if test="updatedTime != null">updated_time = #{updatedTime},</if>
</trim>
where obj_id = #{objId}
</update>
<delete id="deleteEmsBaseWorkUnitByObjId" parameterType="Long">
delete from ems_base_work_unit where obj_id = #{objId}
</delete>
<delete id="deleteEmsBaseWorkUnitByObjIds" parameterType="String">
delete from ems_base_work_unit where obj_id in
<foreach item="objId" collection="array" open="(" separator="," close=")">
#{objId}
</foreach>
</delete>
</mapper>
Loading…
Cancel
Save