change - add设备台账、设备参数

main
yinq 6 months ago
parent 72f5419739
commit ca32fb9b7e

@ -0,0 +1,106 @@
package com.os.mes.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.mes.base.domain.BaseDeviceLedger;
import com.os.mes.base.service.IBaseDeviceLedgerService;
import com.os.common.utils.poi.ExcelUtil;
import com.os.common.core.page.TableDataInfo;
/**
* Controller
*
* @author Yinq
* @date 2024-05-10
*/
@RestController
@RequestMapping("/mes/base/baseDeviceLedger")
public class BaseDeviceLedgerController extends BaseController
{
@Autowired
private IBaseDeviceLedgerService baseDeviceLedgerService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('mes/base:baseDeviceLedger:list')")
@GetMapping("/list")
public TableDataInfo list(BaseDeviceLedger baseDeviceLedger)
{
startPage();
List<BaseDeviceLedger> list = baseDeviceLedgerService.selectBaseDeviceLedgerList(baseDeviceLedger);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('mes/base:baseDeviceLedger:export')")
@Log(title = "设备台账", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BaseDeviceLedger baseDeviceLedger)
{
List<BaseDeviceLedger> list = baseDeviceLedgerService.selectBaseDeviceLedgerList(baseDeviceLedger);
ExcelUtil<BaseDeviceLedger> util = new ExcelUtil<BaseDeviceLedger>(BaseDeviceLedger.class);
util.exportExcel(response, list, "设备台账数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('mes/base:baseDeviceLedger:query')")
@GetMapping(value = "/{objId}")
public AjaxResult getInfo(@PathVariable("objId") Long objId)
{
return success(baseDeviceLedgerService.selectBaseDeviceLedgerByObjId(objId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('mes/base:baseDeviceLedger:add')")
@Log(title = "设备台账", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BaseDeviceLedger baseDeviceLedger)
{
baseDeviceLedger.setCreateBy(getUsername());
return toAjax(baseDeviceLedgerService.insertBaseDeviceLedger(baseDeviceLedger));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('mes/base:baseDeviceLedger:edit')")
@Log(title = "设备台账", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BaseDeviceLedger baseDeviceLedger)
{
baseDeviceLedger.setUpdateBy(getUsername());
return toAjax(baseDeviceLedgerService.updateBaseDeviceLedger(baseDeviceLedger));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('mes/base:baseDeviceLedger:remove')")
@Log(title = "设备台账", businessType = BusinessType.DELETE)
@DeleteMapping("/{objIds}")
public AjaxResult remove(@PathVariable Long[] objIds)
{
return toAjax(baseDeviceLedgerService.deleteBaseDeviceLedgerByObjIds(objIds));
}
}

@ -0,0 +1,106 @@
package com.os.mes.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.mes.base.domain.BaseDeviceParam;
import com.os.mes.base.service.IBaseDeviceParamService;
import com.os.common.utils.poi.ExcelUtil;
import com.os.common.core.page.TableDataInfo;
/**
* Controller
*
* @author Yinq
* @date 2024-05-10
*/
@RestController
@RequestMapping("/mes/base/baseDeviceParam")
public class BaseDeviceParamController extends BaseController
{
@Autowired
private IBaseDeviceParamService baseDeviceParamService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('mes/base:baseDeviceParam:list')")
@GetMapping("/list")
public TableDataInfo list(BaseDeviceParam baseDeviceParam)
{
startPage();
List<BaseDeviceParam> list = baseDeviceParamService.selectBaseDeviceParamList(baseDeviceParam);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('mes/base:baseDeviceParam:export')")
@Log(title = "设备参数", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BaseDeviceParam baseDeviceParam)
{
List<BaseDeviceParam> list = baseDeviceParamService.selectBaseDeviceParamList(baseDeviceParam);
ExcelUtil<BaseDeviceParam> util = new ExcelUtil<BaseDeviceParam>(BaseDeviceParam.class);
util.exportExcel(response, list, "设备参数数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('mes/base:baseDeviceParam:query')")
@GetMapping(value = "/{objId}")
public AjaxResult getInfo(@PathVariable("objId") Long objId)
{
return success(baseDeviceParamService.selectBaseDeviceParamByObjId(objId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('mes/base:baseDeviceParam:add')")
@Log(title = "设备参数", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BaseDeviceParam baseDeviceParam)
{
baseDeviceParam.setCreateBy(getUsername());
return toAjax(baseDeviceParamService.insertBaseDeviceParam(baseDeviceParam));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('mes/base:baseDeviceParam:edit')")
@Log(title = "设备参数", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BaseDeviceParam baseDeviceParam)
{
baseDeviceParam.setUpdateBy(getUsername());
return toAjax(baseDeviceParamService.updateBaseDeviceParam(baseDeviceParam));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('mes/base:baseDeviceParam:remove')")
@Log(title = "设备参数", businessType = BusinessType.DELETE)
@DeleteMapping("/{objIds}")
public AjaxResult remove(@PathVariable Long[] objIds)
{
return toAjax(baseDeviceParamService.deleteBaseDeviceParamByObjIds(objIds));
}
}

@ -0,0 +1,254 @@
package com.os.mes.base.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.os.common.annotation.Excel;
import com.os.common.core.domain.BaseEntity;
/**
* base_device_ledger
*
* @author Yinq
* @date 2024-05-10
*/
public class BaseDeviceLedger extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键标识 */
private Long objId;
/** 设备编号 */
@Excel(name = "设备编号")
private String deviceCode;
/** 设备名称 */
@Excel(name = "设备名称")
private String deviceName;
/** 设备型号 */
@Excel(name = "设备型号")
private String deviceModel;
/** 设备类型1生产设备 2计量设备 */
@Excel(name = "设备类型", readConverterExp = "1=生产设备,2=计量设备")
private String deviceType;
/** IP地址 */
@Excel(name = "IP地址")
private String deviceAddress;
/** 设备状态0使用 1停用 2报废 */
@Excel(name = "设备状态", readConverterExp = "0=使用,1=停用,2=报废")
private String deviceStatus;
/** 使用部门 */
@Excel(name = "使用部门")
private String usedDepartment;
/** 成本中心 */
@Excel(name = "成本中心")
private String costCenter;
/** 生产厂商 */
@Excel(name = "生产厂商")
private String manufacturer;
/** 启用日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "启用日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date enableDate;
/** 所属工位 */
@Excel(name = "所属工位")
private String productLineCode;
/** 启用标识 */
@Excel(name = "启用标识")
private String isFlag;
/** 工厂编号 */
@Excel(name = "工厂编号")
private String factoryCode;
/** 班组编号 */
@Excel(name = "班组编号")
private String teamCode;
/** 资产编号 */
@Excel(name = "资产编号")
private String assetCode;
public void setObjId(Long objId)
{
this.objId = objId;
}
public Long getObjId()
{
return objId;
}
public void setDeviceCode(String deviceCode)
{
this.deviceCode = deviceCode;
}
public String getDeviceCode()
{
return deviceCode;
}
public void setDeviceName(String deviceName)
{
this.deviceName = deviceName;
}
public String getDeviceName()
{
return deviceName;
}
public void setDeviceModel(String deviceModel)
{
this.deviceModel = deviceModel;
}
public String getDeviceModel()
{
return deviceModel;
}
public void setDeviceType(String deviceType)
{
this.deviceType = deviceType;
}
public String getDeviceType()
{
return deviceType;
}
public void setDeviceAddress(String deviceAddress)
{
this.deviceAddress = deviceAddress;
}
public String getDeviceAddress()
{
return deviceAddress;
}
public void setDeviceStatus(String deviceStatus)
{
this.deviceStatus = deviceStatus;
}
public String getDeviceStatus()
{
return deviceStatus;
}
public void setUsedDepartment(String usedDepartment)
{
this.usedDepartment = usedDepartment;
}
public String getUsedDepartment()
{
return usedDepartment;
}
public void setCostCenter(String costCenter)
{
this.costCenter = costCenter;
}
public String getCostCenter()
{
return costCenter;
}
public void setManufacturer(String manufacturer)
{
this.manufacturer = manufacturer;
}
public String getManufacturer()
{
return manufacturer;
}
public void setEnableDate(Date enableDate)
{
this.enableDate = enableDate;
}
public Date getEnableDate()
{
return enableDate;
}
public void setProductLineCode(String productLineCode)
{
this.productLineCode = productLineCode;
}
public String getProductLineCode()
{
return productLineCode;
}
public void setIsFlag(String isFlag)
{
this.isFlag = isFlag;
}
public String getIsFlag()
{
return isFlag;
}
public void setFactoryCode(String factoryCode)
{
this.factoryCode = factoryCode;
}
public String getFactoryCode()
{
return factoryCode;
}
public void setTeamCode(String teamCode)
{
this.teamCode = teamCode;
}
public String getTeamCode()
{
return teamCode;
}
public void setAssetCode(String assetCode)
{
this.assetCode = assetCode;
}
public String getAssetCode()
{
return assetCode;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("objId", getObjId())
.append("deviceCode", getDeviceCode())
.append("deviceName", getDeviceName())
.append("deviceModel", getDeviceModel())
.append("deviceType", getDeviceType())
.append("deviceAddress", getDeviceAddress())
.append("deviceStatus", getDeviceStatus())
.append("usedDepartment", getUsedDepartment())
.append("costCenter", getCostCenter())
.append("manufacturer", getManufacturer())
.append("enableDate", getEnableDate())
.append("productLineCode", getProductLineCode())
.append("isFlag", getIsFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("factoryCode", getFactoryCode())
.append("teamCode", getTeamCode())
.append("assetCode", getAssetCode())
.toString();
}
}

@ -0,0 +1,188 @@
package com.os.mes.base.domain;
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;
/**
* base_device_param
*
* @author Yinq
* @date 2024-05-10
*/
public class BaseDeviceParam extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private Long objId;
/**
*
*/
@Excel(name = "参数编号")
private String paramCode;
/**
*
*/
@Excel(name = "参数名称")
private String paramName;
/**
*
*/
@Excel(name = "网络地址")
private String paramNetwork;
/**
*
*/
@Excel(name = "参数地址")
private String paramAddress;
/**
* 0int 1float
*/
@Excel(name = "参数类型", readConverterExp = "0=int,1=float")
private String paramType;
/**
*
*/
@Excel(name = "设备编号")
private String deviceCode;
/**
*
*/
@Excel(name = "设备名称")
private String deviceName;
/**
* ()
*/
@Excel(name = "读取频率(毫秒)")
private Long readFrequency;
/**
*
*/
@Excel(name = "启用标识")
private String isFlag;
/**
*
*/
@Excel(name = "工位名称")
private String productLineName;
public String getDeviceName() {
return deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public String getProductLineName() {
return productLineName;
}
public void setProductLineName(String productLineName) {
this.productLineName = productLineName;
}
public void setObjId(Long objId) {
this.objId = objId;
}
public Long getObjId() {
return objId;
}
public void setParamCode(String paramCode) {
this.paramCode = paramCode;
}
public String getParamCode() {
return paramCode;
}
public void setParamName(String paramName) {
this.paramName = paramName;
}
public String getParamName() {
return paramName;
}
public void setParamNetwork(String paramNetwork) {
this.paramNetwork = paramNetwork;
}
public String getParamNetwork() {
return paramNetwork;
}
public void setParamAddress(String paramAddress) {
this.paramAddress = paramAddress;
}
public String getParamAddress() {
return paramAddress;
}
public void setParamType(String paramType) {
this.paramType = paramType;
}
public String getParamType() {
return paramType;
}
public void setDeviceCode(String deviceCode) {
this.deviceCode = deviceCode;
}
public String getDeviceCode() {
return deviceCode;
}
public void setReadFrequency(Long readFrequency) {
this.readFrequency = readFrequency;
}
public Long getReadFrequency() {
return readFrequency;
}
public void setIsFlag(String isFlag) {
this.isFlag = isFlag;
}
public String getIsFlag() {
return isFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("objId", getObjId())
.append("paramCode", getParamCode())
.append("paramName", getParamName())
.append("paramNetwork", getParamNetwork())
.append("paramAddress", getParamAddress())
.append("paramType", getParamType())
.append("deviceCode", getDeviceCode())
.append("readFrequency", getReadFrequency())
.append("isFlag", getIsFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

@ -0,0 +1,61 @@
package com.os.mes.base.mapper;
import java.util.List;
import com.os.mes.base.domain.BaseDeviceLedger;
/**
* Mapper
*
* @author Yinq
* @date 2024-05-10
*/
public interface BaseDeviceLedgerMapper
{
/**
*
*
* @param objId
* @return
*/
public BaseDeviceLedger selectBaseDeviceLedgerByObjId(Long objId);
/**
*
*
* @param baseDeviceLedger
* @return
*/
public List<BaseDeviceLedger> selectBaseDeviceLedgerList(BaseDeviceLedger baseDeviceLedger);
/**
*
*
* @param baseDeviceLedger
* @return
*/
public int insertBaseDeviceLedger(BaseDeviceLedger baseDeviceLedger);
/**
*
*
* @param baseDeviceLedger
* @return
*/
public int updateBaseDeviceLedger(BaseDeviceLedger baseDeviceLedger);
/**
*
*
* @param objId
* @return
*/
public int deleteBaseDeviceLedgerByObjId(Long objId);
/**
*
*
* @param objIds
* @return
*/
public int deleteBaseDeviceLedgerByObjIds(Long[] objIds);
}

@ -0,0 +1,61 @@
package com.os.mes.base.mapper;
import java.util.List;
import com.os.mes.base.domain.BaseDeviceParam;
/**
* Mapper
*
* @author Yinq
* @date 2024-05-10
*/
public interface BaseDeviceParamMapper {
/**
*
*
* @param objId
* @return
*/
public BaseDeviceParam selectBaseDeviceParamByObjId(Long objId);
/**
*
*
* @param baseDeviceParam
* @return
*/
public List<BaseDeviceParam> selectBaseDeviceParamList(BaseDeviceParam baseDeviceParam);
/**
*
*
* @param baseDeviceParam
* @return
*/
public int insertBaseDeviceParam(BaseDeviceParam baseDeviceParam);
/**
*
*
* @param baseDeviceParam
* @return
*/
public int updateBaseDeviceParam(BaseDeviceParam baseDeviceParam);
/**
*
*
* @param objId
* @return
*/
public int deleteBaseDeviceParamByObjId(Long objId);
/**
*
*
* @param objIds
* @return
*/
public int deleteBaseDeviceParamByObjIds(Long[] objIds);
}

@ -0,0 +1,61 @@
package com.os.mes.base.service;
import java.util.List;
import com.os.mes.base.domain.BaseDeviceLedger;
/**
* Service
*
* @author Yinq
* @date 2024-05-10
*/
public interface IBaseDeviceLedgerService
{
/**
*
*
* @param objId
* @return
*/
public BaseDeviceLedger selectBaseDeviceLedgerByObjId(Long objId);
/**
*
*
* @param baseDeviceLedger
* @return
*/
public List<BaseDeviceLedger> selectBaseDeviceLedgerList(BaseDeviceLedger baseDeviceLedger);
/**
*
*
* @param baseDeviceLedger
* @return
*/
public int insertBaseDeviceLedger(BaseDeviceLedger baseDeviceLedger);
/**
*
*
* @param baseDeviceLedger
* @return
*/
public int updateBaseDeviceLedger(BaseDeviceLedger baseDeviceLedger);
/**
*
*
* @param objIds
* @return
*/
public int deleteBaseDeviceLedgerByObjIds(Long[] objIds);
/**
*
*
* @param objId
* @return
*/
public int deleteBaseDeviceLedgerByObjId(Long objId);
}

@ -0,0 +1,61 @@
package com.os.mes.base.service;
import java.util.List;
import com.os.mes.base.domain.BaseDeviceParam;
/**
* Service
*
* @author Yinq
* @date 2024-05-10
*/
public interface IBaseDeviceParamService
{
/**
*
*
* @param objId
* @return
*/
public BaseDeviceParam selectBaseDeviceParamByObjId(Long objId);
/**
*
*
* @param baseDeviceParam
* @return
*/
public List<BaseDeviceParam> selectBaseDeviceParamList(BaseDeviceParam baseDeviceParam);
/**
*
*
* @param baseDeviceParam
* @return
*/
public int insertBaseDeviceParam(BaseDeviceParam baseDeviceParam);
/**
*
*
* @param baseDeviceParam
* @return
*/
public int updateBaseDeviceParam(BaseDeviceParam baseDeviceParam);
/**
*
*
* @param objIds
* @return
*/
public int deleteBaseDeviceParamByObjIds(Long[] objIds);
/**
*
*
* @param objId
* @return
*/
public int deleteBaseDeviceParamByObjId(Long objId);
}

@ -0,0 +1,96 @@
package com.os.mes.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.mes.base.mapper.BaseDeviceLedgerMapper;
import com.os.mes.base.domain.BaseDeviceLedger;
import com.os.mes.base.service.IBaseDeviceLedgerService;
/**
* Service
*
* @author Yinq
* @date 2024-05-10
*/
@Service
public class BaseDeviceLedgerServiceImpl implements IBaseDeviceLedgerService
{
@Autowired
private BaseDeviceLedgerMapper baseDeviceLedgerMapper;
/**
*
*
* @param objId
* @return
*/
@Override
public BaseDeviceLedger selectBaseDeviceLedgerByObjId(Long objId)
{
return baseDeviceLedgerMapper.selectBaseDeviceLedgerByObjId(objId);
}
/**
*
*
* @param baseDeviceLedger
* @return
*/
@Override
public List<BaseDeviceLedger> selectBaseDeviceLedgerList(BaseDeviceLedger baseDeviceLedger)
{
return baseDeviceLedgerMapper.selectBaseDeviceLedgerList(baseDeviceLedger);
}
/**
*
*
* @param baseDeviceLedger
* @return
*/
@Override
public int insertBaseDeviceLedger(BaseDeviceLedger baseDeviceLedger)
{
baseDeviceLedger.setCreateTime(DateUtils.getNowDate());
return baseDeviceLedgerMapper.insertBaseDeviceLedger(baseDeviceLedger);
}
/**
*
*
* @param baseDeviceLedger
* @return
*/
@Override
public int updateBaseDeviceLedger(BaseDeviceLedger baseDeviceLedger)
{
baseDeviceLedger.setUpdateTime(DateUtils.getNowDate());
return baseDeviceLedgerMapper.updateBaseDeviceLedger(baseDeviceLedger);
}
/**
*
*
* @param objIds
* @return
*/
@Override
public int deleteBaseDeviceLedgerByObjIds(Long[] objIds)
{
return baseDeviceLedgerMapper.deleteBaseDeviceLedgerByObjIds(objIds);
}
/**
*
*
* @param objId
* @return
*/
@Override
public int deleteBaseDeviceLedgerByObjId(Long objId)
{
return baseDeviceLedgerMapper.deleteBaseDeviceLedgerByObjId(objId);
}
}

@ -0,0 +1,96 @@
package com.os.mes.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.mes.base.mapper.BaseDeviceParamMapper;
import com.os.mes.base.domain.BaseDeviceParam;
import com.os.mes.base.service.IBaseDeviceParamService;
/**
* Service
*
* @author Yinq
* @date 2024-05-10
*/
@Service
public class BaseDeviceParamServiceImpl implements IBaseDeviceParamService
{
@Autowired
private BaseDeviceParamMapper baseDeviceParamMapper;
/**
*
*
* @param objId
* @return
*/
@Override
public BaseDeviceParam selectBaseDeviceParamByObjId(Long objId)
{
return baseDeviceParamMapper.selectBaseDeviceParamByObjId(objId);
}
/**
*
*
* @param baseDeviceParam
* @return
*/
@Override
public List<BaseDeviceParam> selectBaseDeviceParamList(BaseDeviceParam baseDeviceParam)
{
return baseDeviceParamMapper.selectBaseDeviceParamList(baseDeviceParam);
}
/**
*
*
* @param baseDeviceParam
* @return
*/
@Override
public int insertBaseDeviceParam(BaseDeviceParam baseDeviceParam)
{
baseDeviceParam.setCreateTime(DateUtils.getNowDate());
return baseDeviceParamMapper.insertBaseDeviceParam(baseDeviceParam);
}
/**
*
*
* @param baseDeviceParam
* @return
*/
@Override
public int updateBaseDeviceParam(BaseDeviceParam baseDeviceParam)
{
baseDeviceParam.setUpdateTime(DateUtils.getNowDate());
return baseDeviceParamMapper.updateBaseDeviceParam(baseDeviceParam);
}
/**
*
*
* @param objIds
* @return
*/
@Override
public int deleteBaseDeviceParamByObjIds(Long[] objIds)
{
return baseDeviceParamMapper.deleteBaseDeviceParamByObjIds(objIds);
}
/**
*
*
* @param objId
* @return
*/
@Override
public int deleteBaseDeviceParamByObjId(Long objId)
{
return baseDeviceParamMapper.deleteBaseDeviceParamByObjId(objId);
}
}

@ -0,0 +1,142 @@
<?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.mes.base.mapper.BaseDeviceLedgerMapper">
<resultMap type="BaseDeviceLedger" id="BaseDeviceLedgerResult">
<result property="objId" column="obj_id" />
<result property="deviceCode" column="device_code" />
<result property="deviceName" column="device_name" />
<result property="deviceModel" column="device_model" />
<result property="deviceType" column="device_type" />
<result property="deviceAddress" column="device_address" />
<result property="deviceStatus" column="device_status" />
<result property="usedDepartment" column="used_department" />
<result property="costCenter" column="cost_center" />
<result property="manufacturer" column="manufacturer" />
<result property="enableDate" column="enable_date" />
<result property="productLineCode" column="product_line_code" />
<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="factoryCode" column="factory_code" />
<result property="teamCode" column="team_code" />
<result property="assetCode" column="asset_code" />
</resultMap>
<sql id="selectBaseDeviceLedgerVo">
select obj_id, device_code, device_name, device_model, device_type, device_address, device_status, used_department, cost_center, manufacturer, enable_date, product_line_code, is_flag, create_by, create_time, update_by, update_time, factory_code, team_code, asset_code from base_device_ledger
</sql>
<select id="selectBaseDeviceLedgerList" parameterType="BaseDeviceLedger" resultMap="BaseDeviceLedgerResult">
<include refid="selectBaseDeviceLedgerVo"/>
<where>
<if test="deviceCode != null and deviceCode != ''"> and device_code = #{deviceCode}</if>
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
<if test="deviceModel != null and deviceModel != ''"> and device_model = #{deviceModel}</if>
<if test="deviceType != null and deviceType != ''"> and device_type = #{deviceType}</if>
<if test="deviceAddress != null and deviceAddress != ''"> and device_address = #{deviceAddress}</if>
<if test="deviceStatus != null and deviceStatus != ''"> and device_status = #{deviceStatus}</if>
<if test="usedDepartment != null and usedDepartment != ''"> and used_department = #{usedDepartment}</if>
<if test="costCenter != null and costCenter != ''"> and cost_center = #{costCenter}</if>
<if test="manufacturer != null and manufacturer != ''"> and manufacturer = #{manufacturer}</if>
<if test="enableDate != null "> and enable_date = #{enableDate}</if>
<if test="productLineCode != null and productLineCode != ''"> and product_line_code = #{productLineCode}</if>
<if test="isFlag != null and isFlag != ''"> and is_flag = #{isFlag}</if>
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if>
<if test="teamCode != null and teamCode != ''"> and team_code = #{teamCode}</if>
<if test="assetCode != null and assetCode != ''"> and asset_code = #{assetCode}</if>
</where>
</select>
<select id="selectBaseDeviceLedgerByObjId" parameterType="Long" resultMap="BaseDeviceLedgerResult">
<include refid="selectBaseDeviceLedgerVo"/>
where obj_id = #{objId}
</select>
<insert id="insertBaseDeviceLedger" parameterType="BaseDeviceLedger" useGeneratedKeys="true" keyProperty="objId">
insert into base_device_ledger
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="deviceCode != null and deviceCode != ''">device_code,</if>
<if test="deviceName != null">device_name,</if>
<if test="deviceModel != null">device_model,</if>
<if test="deviceType != null">device_type,</if>
<if test="deviceAddress != null">device_address,</if>
<if test="deviceStatus != null">device_status,</if>
<if test="usedDepartment != null">used_department,</if>
<if test="costCenter != null">cost_center,</if>
<if test="manufacturer != null">manufacturer,</if>
<if test="enableDate != null">enable_date,</if>
<if test="productLineCode != null">product_line_code,</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="factoryCode != null">factory_code,</if>
<if test="teamCode != null">team_code,</if>
<if test="assetCode != null">asset_code,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deviceCode != null and deviceCode != ''">#{deviceCode},</if>
<if test="deviceName != null">#{deviceName},</if>
<if test="deviceModel != null">#{deviceModel},</if>
<if test="deviceType != null">#{deviceType},</if>
<if test="deviceAddress != null">#{deviceAddress},</if>
<if test="deviceStatus != null">#{deviceStatus},</if>
<if test="usedDepartment != null">#{usedDepartment},</if>
<if test="costCenter != null">#{costCenter},</if>
<if test="manufacturer != null">#{manufacturer},</if>
<if test="enableDate != null">#{enableDate},</if>
<if test="productLineCode != null">#{productLineCode},</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="factoryCode != null">#{factoryCode},</if>
<if test="teamCode != null">#{teamCode},</if>
<if test="assetCode != null">#{assetCode},</if>
</trim>
</insert>
<update id="updateBaseDeviceLedger" parameterType="BaseDeviceLedger">
update base_device_ledger
<trim prefix="SET" suffixOverrides=",">
<if test="deviceCode != null and deviceCode != ''">device_code = #{deviceCode},</if>
<if test="deviceName != null">device_name = #{deviceName},</if>
<if test="deviceModel != null">device_model = #{deviceModel},</if>
<if test="deviceType != null">device_type = #{deviceType},</if>
<if test="deviceAddress != null">device_address = #{deviceAddress},</if>
<if test="deviceStatus != null">device_status = #{deviceStatus},</if>
<if test="usedDepartment != null">used_department = #{usedDepartment},</if>
<if test="costCenter != null">cost_center = #{costCenter},</if>
<if test="manufacturer != null">manufacturer = #{manufacturer},</if>
<if test="enableDate != null">enable_date = #{enableDate},</if>
<if test="productLineCode != null">product_line_code = #{productLineCode},</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="factoryCode != null">factory_code = #{factoryCode},</if>
<if test="teamCode != null">team_code = #{teamCode},</if>
<if test="assetCode != null">asset_code = #{assetCode},</if>
</trim>
where obj_id = #{objId}
</update>
<delete id="deleteBaseDeviceLedgerByObjId" parameterType="Long">
delete from base_device_ledger where obj_id = #{objId}
</delete>
<delete id="deleteBaseDeviceLedgerByObjIds" parameterType="String">
delete from base_device_ledger where obj_id in
<foreach item="objId" collection="array" open="(" separator="," close=")">
#{objId}
</foreach>
</delete>
</mapper>

@ -0,0 +1,132 @@
<?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.mes.base.mapper.BaseDeviceParamMapper">
<resultMap type="BaseDeviceParam" id="BaseDeviceParamResult">
<result property="objId" column="obj_id"/>
<result property="paramCode" column="param_code"/>
<result property="paramName" column="param_name"/>
<result property="paramNetwork" column="param_network"/>
<result property="paramAddress" column="param_address"/>
<result property="paramType" column="param_type"/>
<result property="deviceCode" column="device_code"/>
<result property="deviceName" column="device_name"/>
<result property="productLineName" column="product_line_name"/>
<result property="readFrequency" column="read_frequency"/>
<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"/>
</resultMap>
<sql id="selectBaseDeviceParamVo">
select dp.obj_id,
dp.param_code,
dp.param_name,
dp.param_network,
dp.param_address,
dp.param_type,
dp.device_code,
dp.read_frequency,
dp.is_flag,
dp.create_by,
dp.create_time,
dp.update_by,
dp.update_time,
dl.device_name,
pl.product_line_name
from base_device_param dp
left join base_device_ledger dl on dl.device_code = dp.device_code
left join base_product_line pl on pl.product_line_code = dl.product_line_code
</sql>
<select id="selectBaseDeviceParamList" parameterType="BaseDeviceParam" resultMap="BaseDeviceParamResult">
<include refid="selectBaseDeviceParamVo"/>
<where>
<if test="paramCode != null and paramCode != ''">and dp.param_code = #{paramCode}</if>
<if test="paramName != null and paramName != ''">and dp.param_name like concat('%', #{paramName}, '%')</if>
<if test="paramNetwork != null and paramNetwork != ''">and dp.param_network = #{paramNetwork}</if>
<if test="paramAddress != null and paramAddress != ''">and dp.param_address = #{paramAddress}</if>
<if test="paramType != null and paramType != ''">and dp.param_type = #{paramType}</if>
<if test="deviceCode != null and deviceCode != ''">and dp.device_code = #{deviceCode}</if>
<if test="readFrequency != null ">and dp.read_frequency = #{readFrequency}</if>
<if test="isFlag != null and isFlag != ''">and dp.is_flag = #{isFlag}</if>
<if test="createBy != null and createBy != ''">and dp.create_by = #{createBy}</if>
<if test="createTime != null ">and dp.create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''">and dp.update_by = #{updateBy}</if>
<if test="updateTime != null ">and dp.update_time = #{updateTime}</if>
</where>
</select>
<select id="selectBaseDeviceParamByObjId" parameterType="Long" resultMap="BaseDeviceParamResult">
<include refid="selectBaseDeviceParamVo"/>
where dp.obj_id = #{objId}
</select>
<insert id="insertBaseDeviceParam" parameterType="BaseDeviceParam" useGeneratedKeys="true" keyProperty="objId">
insert into base_device_param
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="paramCode != null">param_code,</if>
<if test="paramName != null">param_name,</if>
<if test="paramNetwork != null">param_network,</if>
<if test="paramAddress != null">param_address,</if>
<if test="paramType != null">param_type,</if>
<if test="deviceCode != null">device_code,</if>
<if test="readFrequency != null">read_frequency,</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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="paramCode != null">#{paramCode},</if>
<if test="paramName != null">#{paramName},</if>
<if test="paramNetwork != null">#{paramNetwork},</if>
<if test="paramAddress != null">#{paramAddress},</if>
<if test="paramType != null">#{paramType},</if>
<if test="deviceCode != null">#{deviceCode},</if>
<if test="readFrequency != null">#{readFrequency},</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>
</trim>
</insert>
<update id="updateBaseDeviceParam" parameterType="BaseDeviceParam">
update base_device_param
<trim prefix="SET" suffixOverrides=",">
<if test="paramCode != null">param_code = #{paramCode},</if>
<if test="paramName != null">param_name = #{paramName},</if>
<if test="paramNetwork != null">param_network = #{paramNetwork},</if>
<if test="paramAddress != null">param_address = #{paramAddress},</if>
<if test="paramType != null">param_type = #{paramType},</if>
<if test="deviceCode != null">device_code = #{deviceCode},</if>
<if test="readFrequency != null">read_frequency = #{readFrequency},</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>
</trim>
where obj_id = #{objId}
</update>
<delete id="deleteBaseDeviceParamByObjId" parameterType="Long">
delete
from base_device_param
where obj_id = #{objId}
</delete>
<delete id="deleteBaseDeviceParamByObjIds" parameterType="String">
delete from base_device_param where obj_id in
<foreach item="objId" collection="array" open="(" separator="," close=")">
#{objId}
</foreach>
</delete>
</mapper>
Loading…
Cancel
Save