新增dnc接口,接收设备每日运行时长数据

master
zpl 3 years ago
parent 8927e05849
commit 9b4f90c47f

@ -54,4 +54,10 @@ public class ResourceMQConsume {
logger.info("接收设备参数数据:" + text);
resourceMQProcess.resourceParamProcess(text);
}
@JmsListener(destination = "resource.runtime.process", containerFactory = "defaultFactory", concurrency = "5")
public void resourceRunTimeProcess(String text) {
logger.info("接收设备每日运行时长:" + text);
resourceMQProcess.resourceRunTimeProcess(text);
}
}

@ -3,6 +3,7 @@ package com.foreverwin.mesnac.equip.consumer;
import com.foreverwin.mesnac.equip.service.EdcDataResourceService;
import com.foreverwin.mesnac.equip.service.ResourceFaultReceiveService;
import com.foreverwin.mesnac.equip.service.ResourceRunTimeService;
import com.foreverwin.mesnac.equip.service.ResourceStatusReceiveService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -31,6 +32,9 @@ public class ResourceMQProcess {
@Autowired
private EdcDataResourceService edcDataResourceService;
@Autowired
private ResourceRunTimeService resourceRunTimeService;
/**
*
*
@ -73,4 +77,18 @@ public class ResourceMQProcess {
}
}
/**
*
* @param text
* @return
*/
public void resourceRunTimeProcess(String text){
try {
resourceRunTimeService.saveResourceRunTimeByMq(text);
logger.info("设备运行时长数据记录成功");
} catch (Exception e) {
logger.error("设备运行时长数据记录失败:"+e.getMessage());
}
}
}

@ -0,0 +1,122 @@
package com.foreverwin.mesnac.equip.controller;
import com.foreverwin.modular.core.util.R;
import com.foreverwin.modular.core.util.FrontPage;
import com.foreverwin.modular.core.util.CommonMethods;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.foreverwin.mesnac.equip.service.ResourceRunTimeService;
import com.foreverwin.mesnac.equip.model.ResourceRunTime;
import java.util.List;
/**
*
* @author pavel.liu
* @since 2021-09-27
*/
@RestController
@RequestMapping("/Z-RESOURCE-RUN-TIME")
public class ResourceRunTimeController {
@Autowired
public ResourceRunTimeService resourceRunTimeService;
/**
* id
*
* @param id
* @return
*/
@ResponseBody
@GetMapping("/{id:.+}")
public R getResourceRunTimeById(@PathVariable String id) {
return R.ok( resourceRunTimeService.getById(id));
}
/**
*
*
* @return
*/
@ResponseBody
@GetMapping("")
public R getResourceRunTimeList(ResourceRunTime resourceRunTime){
List<ResourceRunTime> result;
QueryWrapper<ResourceRunTime> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(resourceRunTime);
result = resourceRunTimeService.list(queryWrapper);
return R.ok(result);
}
/**
*
*
* @param frontPage
* @return
*/
@ResponseBody
@GetMapping("/page")
public R page(FrontPage<ResourceRunTime> frontPage, ResourceRunTime resourceRunTime){
IPage result;
QueryWrapper<ResourceRunTime> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(resourceRunTime);
if (frontPage.getGlobalQuery() != null && !"".equals(frontPage.getGlobalQuery().trim())) {
//TODO modify global query
queryWrapper.lambda().and(wrapper -> wrapper
.like(ResourceRunTime::getHandle, frontPage.getGlobalQuery())
.or().like(ResourceRunTime::getSite, frontPage.getGlobalQuery())
.or().like(ResourceRunTime::getResrce, frontPage.getGlobalQuery())
.or().like(ResourceRunTime::getCreatedUser, frontPage.getGlobalQuery())
.or().like(ResourceRunTime::getModifiedUser, frontPage.getGlobalQuery())
);
}
result = resourceRunTimeService.page(frontPage.getPagePlus(), queryWrapper);
return R.ok(result);
}
/**
*
* @param resourceRunTime
* @return null
*/
@PostMapping
public R save(@RequestBody ResourceRunTime resourceRunTime) {
return R.ok(resourceRunTimeService.save(resourceRunTime));
}
/**
*
* @param resourceRunTime
* @return null
*/
@PutMapping
public R updateById(@RequestBody ResourceRunTime resourceRunTime) {
return R.ok(resourceRunTimeService.updateById(resourceRunTime));
}
/**
* id
* @param id ID
* @return 0 1
*/
@ResponseBody
@RequestMapping(method = RequestMethod.DELETE, value = "/{id:.+}")
public R removeById(@PathVariable("id") String id){
return R.ok(resourceRunTimeService.removeById(id));
}
/**
*
* @param ids ID
* @return 0 1
*/
@ResponseBody
@RequestMapping(method = RequestMethod.POST, value = "/delete-batch")
public R removeByIds(List<String> ids){
return R.ok(resourceRunTimeService.removeByIds(ids));
}
}

@ -0,0 +1,18 @@
package com.foreverwin.mesnac.equip.mapper;
import com.foreverwin.mesnac.equip.model.ResourceRunTime;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* Mapper
* </p>
*
* @author pavel.liu
* @since 2021-09-27
*/
@Repository
public interface ResourceRunTimeMapper extends BaseMapper<ResourceRunTime> {
}

@ -0,0 +1,158 @@
package com.foreverwin.mesnac.equip.model;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.IdType;
/**
* <p>
*
* </p>
*
* @author pavel.liu
* @since 2021-09-27
*/
@TableName("Z_RESOURCE_RUN_TIME")
public class ResourceRunTime extends Model<ResourceRunTime> {
private static final long serialVersionUID = 1L;
@TableId(value = "HANDLE", type = IdType.INPUT)
private String handle;
@TableField("SITE")
private String site;
@TableField("SEND_DATE")
private LocalDateTime sendDate;
@TableField("RESRCE")
private String resrce;
@TableField("RUN_TIME")
private Double runTime;
@TableField("CREATED_USER")
private String createdUser;
@TableField("CREATED_DATA_TIME")
private LocalDateTime createdDataTime;
@TableField("MODIFIED_USER")
private String modifiedUser;
@TableField("MODIFIED_DATE_TIME")
private LocalDateTime modifiedDateTime;
public String getHandle() {
return handle;
}
public void setHandle(String handle) {
this.handle = handle;
}
public String getSite() {
return site;
}
public void setSite(String site) {
this.site = site;
}
public LocalDateTime getSendDate() {
return sendDate;
}
public void setSendDate(LocalDateTime sendDate) {
this.sendDate = sendDate;
}
public String getResrce() {
return resrce;
}
public void setResrce(String resrce) {
this.resrce = resrce;
}
public Double getRunTime() {
return runTime;
}
public void setRunTime(Double runTime) {
this.runTime = runTime;
}
public String getCreatedUser() {
return createdUser;
}
public void setCreatedUser(String createdUser) {
this.createdUser = createdUser;
}
public LocalDateTime getCreatedDataTime() {
return createdDataTime;
}
public void setCreatedDataTime(LocalDateTime createdDataTime) {
this.createdDataTime = createdDataTime;
}
public String getModifiedUser() {
return modifiedUser;
}
public void setModifiedUser(String modifiedUser) {
this.modifiedUser = modifiedUser;
}
public LocalDateTime getModifiedDateTime() {
return modifiedDateTime;
}
public void setModifiedDateTime(LocalDateTime modifiedDateTime) {
this.modifiedDateTime = modifiedDateTime;
}
public static final String HANDLE = "HANDLE";
public static final String SITE = "SITE";
public static final String SEND_DATE = "SEND_DATE";
public static final String RESRCE = "RESRCE";
public static final String RUN_TIME = "RUN_TIME";
public static final String CREATED_USER = "CREATED_USER";
public static final String CREATED_DATA_TIME = "CREATED_DATA_TIME";
public static final String MODIFIED_USER = "MODIFIED_USER";
public static final String MODIFIED_DATE_TIME = "MODIFIED_DATE_TIME";
@Override
protected Serializable pkVal() {
return this.handle;
}
@Override
public String toString() {
return "ResourceRunTime{" +
"handle = " + handle +
", site = " + site +
", sendDate = " + sendDate +
", resrce = " + resrce +
", runTime = " + runTime +
", createdUser = " + createdUser +
", createdDataTime = " + createdDataTime +
", modifiedUser = " + modifiedUser +
", modifiedDateTime = " + modifiedDateTime +
"}";
}
}

@ -0,0 +1,30 @@
package com.foreverwin.mesnac.equip.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.equip.model.ResourceRunTime;
import com.baomidou.mybatisplus.extension.service.IService;
import com.foreverwin.modular.core.util.FrontPage;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author pavel.liu
* @since 2021-09-27
*/
public interface ResourceRunTimeService extends IService<ResourceRunTime> {
/**
*
* @param frontPage
* @return
*/
IPage<ResourceRunTime> selectPage(FrontPage<ResourceRunTime> frontPage, ResourceRunTime resourceRunTime);
List<ResourceRunTime> selectList(ResourceRunTime resourceRunTime);
void saveResourceRunTimeByMq(String text);
}

@ -0,0 +1,97 @@
package com.foreverwin.mesnac.equip.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.modular.core.exception.BusinessException;
import com.foreverwin.modular.core.util.CommonMethods;
import com.foreverwin.modular.core.util.FrontPage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.equip.model.ResourceRunTime;
import com.foreverwin.mesnac.equip.mapper.ResourceRunTimeMapper;
import com.foreverwin.mesnac.equip.service.ResourceRunTimeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/**
* <p>
*
* </p>
*
* @author pavel.liu
* @since 2021-09-27
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class ResourceRunTimeServiceImpl extends ServiceImpl<ResourceRunTimeMapper, ResourceRunTime> implements ResourceRunTimeService {
@Autowired
private ResourceRunTimeService resourceRunTimeService;
@Override
public IPage<ResourceRunTime> selectPage(FrontPage<ResourceRunTime> frontPage, ResourceRunTime resourceRunTime) {
QueryWrapper<ResourceRunTime> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(resourceRunTime);
return super.page(frontPage.getPagePlus(), queryWrapper);
}
@Override
public List<ResourceRunTime> selectList(ResourceRunTime resourceRunTime) {
QueryWrapper<ResourceRunTime> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(resourceRunTime);
return super.list(queryWrapper);
}
@Override
public void saveResourceRunTimeByMq(String text) {
String user = CommonMethods.getUser();
JSONObject jsonObject = JSONObject.parseObject(text);
String site = jsonObject.getString("SITE");
// 数据传输时间
String sendTime = jsonObject.getString("SEND_TIME");
DateTimeFormatter dataFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime dateTime = LocalDateTime.parse(sendTime,dataFormatter);
// 设备运行时间的日期
DateTimeFormatter dataFormatter2 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String sendDate = jsonObject.getString("SENE_DATE");
LocalDateTime dateDay = LocalDateTime.parse(sendDate + " 08:00:00",dataFormatter2);
if (StringUtil.isBlank(site)) {
throw BusinessException.build("站点不能为空!");
}
String resourceList = jsonObject.getString("RESOURCE_LIST");
JSONArray jsonArray = JSON.parseArray(resourceList);
List<ResourceRunTime> list = new ArrayList<>();
for (int i = 0; i < jsonArray.size(); i++) {
ResourceRunTime resourceRunTime = new ResourceRunTime();
// 设备编号、站点、创建时间-使用SEND_TIME、创建用户
resourceRunTime.setSite(site);
resourceRunTime.setCreatedDataTime(dateTime);
resourceRunTime.setCreatedUser(user);
resourceRunTime.setSendDate(dateDay);
JSONObject jsonObj = (JSONObject) jsonArray.get(i);
String runTime = jsonObj.getString("RUN_TIME");
String resource = jsonObj.getString("RESOURCE");
resourceRunTime.setRunTime(Double.valueOf(runTime));
resourceRunTime.setResrce(resource);
resourceRunTime.setHandle(UUID.randomUUID().toString());
list.add(resourceRunTime);
}
resourceRunTimeService.saveBatch(list);
}
}

@ -0,0 +1,386 @@
<?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.foreverwin.mesnac.equip.mapper.ResourceRunTimeMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.foreverwin.mesnac.equip.model.ResourceRunTime">
<id column="HANDLE" property="handle" />
<result column="SITE" property="site" />
<result column="SEND_DATE" property="sendDate" />
<result column="RESRCE" property="resrce" />
<result column="RUN_TIME" property="runTime" />
<result column="CREATED_USER" property="createdUser" />
<result column="CREATED_DATA_TIME" property="createdDataTime" />
<result column="MODIFIED_USER" property="modifiedUser" />
<result column="MODIFIED_DATE_TIME" property="modifiedDateTime" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
HANDLE, SITE, SEND_DATE, RESRCE, RUN_TIME, CREATED_USER, CREATED_DATA_TIME, MODIFIED_USER, MODIFIED_DATE_TIME
</sql>
<!-- BaseMapper标准查询/修改/删除 -->
<select id="selectById" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include> FROM Z_RESOURCE_RUN_TIME WHERE HANDLE=#{handle}
</select>
<select id="selectByMap" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include>
FROM Z_RESOURCE_RUN_TIME
<if test="cm!=null and !cm.isEmpty">
<where>
<foreach collection="cm.keys" item="k" separator="AND">
<if test="cm[k] != null">
${k} = #{cm[${k}]}
</if>
</foreach>
</where>
</if>
</select>
<select id="selectBatchIds" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include>
FROM Z_RESOURCE_RUN_TIME WHERE HANDLE IN (
<foreach item="item" index="index" collection="coll" separator=",">#{item}
</foreach>)
</select>
<select id="selectOne" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include> FROM Z_RESOURCE_RUN_TIME
<where>
<if test="ew.entity.handle!=null">
HANDLE=#{ew.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.sendDate!=null"> AND SEND_DATE=#{ew.entity.sendDate}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.runTime!=null"> AND RUN_TIME=#{ew.entity.runTime}</if>
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
<if test="ew.entity.createdDataTime!=null"> AND CREATED_DATA_TIME=#{ew.entity.createdDataTime}</if>
<if test="ew.entity.modifiedUser!=null"> AND MODIFIED_USER=#{ew.entity.modifiedUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</where>
</select>
<select id="selectCount" resultType="Integer">
SELECT COUNT(1) FROM Z_RESOURCE_RUN_TIME
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.sendDate!=null"> AND SEND_DATE=#{ew.entity.sendDate}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.runTime!=null"> AND RUN_TIME=#{ew.entity.runTime}</if>
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
<if test="ew.entity.createdDataTime!=null"> AND CREATED_DATA_TIME=#{ew.entity.createdDataTime}</if>
<if test="ew.entity.modifiedUser!=null"> AND MODIFIED_USER=#{ew.entity.modifiedUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectList" resultMap="BaseResultMap">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_RESOURCE_RUN_TIME
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.sendDate!=null"> AND SEND_DATE=#{ew.entity.sendDate}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.runTime!=null"> AND RUN_TIME=#{ew.entity.runTime}</if>
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
<if test="ew.entity.createdDataTime!=null"> AND CREATED_DATA_TIME=#{ew.entity.createdDataTime}</if>
<if test="ew.entity.modifiedUser!=null"> AND MODIFIED_USER=#{ew.entity.modifiedUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectMaps" resultType="HashMap">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_RESOURCE_RUN_TIME
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.sendDate!=null"> AND SEND_DATE=#{ew.entity.sendDate}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.runTime!=null"> AND RUN_TIME=#{ew.entity.runTime}</if>
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
<if test="ew.entity.createdDataTime!=null"> AND CREATED_DATA_TIME=#{ew.entity.createdDataTime}</if>
<if test="ew.entity.modifiedUser!=null"> AND MODIFIED_USER=#{ew.entity.modifiedUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectObjs" resultType="Object">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_RESOURCE_RUN_TIME
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.sendDate!=null"> AND SEND_DATE=#{ew.entity.sendDate}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.runTime!=null"> AND RUN_TIME=#{ew.entity.runTime}</if>
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
<if test="ew.entity.createdDataTime!=null"> AND CREATED_DATA_TIME=#{ew.entity.createdDataTime}</if>
<if test="ew.entity.modifiedUser!=null"> AND MODIFIED_USER=#{ew.entity.modifiedUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectPage" resultMap="BaseResultMap">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_RESOURCE_RUN_TIME
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.sendDate!=null"> AND SEND_DATE=#{ew.entity.sendDate}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.runTime!=null"> AND RUN_TIME=#{ew.entity.runTime}</if>
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
<if test="ew.entity.createdDataTime!=null"> AND CREATED_DATA_TIME=#{ew.entity.createdDataTime}</if>
<if test="ew.entity.modifiedUser!=null"> AND MODIFIED_USER=#{ew.entity.modifiedUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<select id="selectMapsPage" resultType="HashMap">
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_RESOURCE_RUN_TIME
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.sendDate!=null"> AND SEND_DATE=#{ew.entity.sendDate}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.runTime!=null"> AND RUN_TIME=#{ew.entity.runTime}</if>
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
<if test="ew.entity.createdDataTime!=null"> AND CREATED_DATA_TIME=#{ew.entity.createdDataTime}</if>
<if test="ew.entity.modifiedUser!=null"> AND MODIFIED_USER=#{ew.entity.modifiedUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</select>
<insert id="insert" parameterType="com.foreverwin.mesnac.equip.model.ResourceRunTime">
INSERT INTO Z_RESOURCE_RUN_TIME
<trim prefix="(" suffix=")" suffixOverrides=",">
HANDLE,
<if test="site!=null">SITE,</if>
<if test="sendDate!=null">SEND_DATE,</if>
<if test="resrce!=null">RESRCE,</if>
<if test="runTime!=null">RUN_TIME,</if>
<if test="createdUser!=null">CREATED_USER,</if>
<if test="createdDataTime!=null">CREATED_DATA_TIME,</if>
<if test="modifiedUser!=null">MODIFIED_USER,</if>
<if test="modifiedDateTime!=null">MODIFIED_DATE_TIME,</if>
</trim> VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{handle},
<if test="site!=null">#{site},</if>
<if test="sendDate!=null">#{sendDate},</if>
<if test="resrce!=null">#{resrce},</if>
<if test="runTime!=null">#{runTime},</if>
<if test="createdUser!=null">#{createdUser},</if>
<if test="createdDataTime!=null">#{createdDataTime},</if>
<if test="modifiedUser!=null">#{modifiedUser},</if>
<if test="modifiedDateTime!=null">#{modifiedDateTime},</if>
</trim>
</insert>
<insert id="insertAllColumn" parameterType="com.foreverwin.mesnac.equip.model.ResourceRunTime">
INSERT INTO Z_RESOURCE_RUN_TIME
<trim prefix="(" suffix=")" suffixOverrides=",">
<include refid="Base_Column_List"></include>
</trim> VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{handle},
#{site},
#{sendDate},
#{resrce},
#{runTime},
#{createdUser},
#{createdDataTime},
#{modifiedUser},
#{modifiedDateTime},
</trim>
</insert>
<update id="updateById">
UPDATE Z_RESOURCE_RUN_TIME <trim prefix="SET" suffixOverrides=",">
<if test="et.site!=null">SITE=#{et.site},</if>
<if test="et.sendDate!=null">SEND_DATE=#{et.sendDate},</if>
<if test="et.resrce!=null">RESRCE=#{et.resrce},</if>
<if test="et.runTime!=null">RUN_TIME=#{et.runTime},</if>
<if test="et.createdUser!=null">CREATED_USER=#{et.createdUser},</if>
<if test="et.createdDataTime!=null">CREATED_DATA_TIME=#{et.createdDataTime},</if>
<if test="et.modifiedUser!=null">MODIFIED_USER=#{et.modifiedUser},</if>
<if test="et.modifiedDateTime!=null">MODIFIED_DATE_TIME=#{et.modifiedDateTime},</if>
</trim> WHERE HANDLE=#{et.handle} <if test="et instanceof java.util.Map"><if test="et.MP_OPTLOCK_VERSION_ORIGINAL!=null">and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL}</if></if>
</update>
<update id="updateAllColumnById">
UPDATE Z_RESOURCE_RUN_TIME <trim prefix="SET" suffixOverrides=",">
SITE=#{et.site},
SEND_DATE=#{et.sendDate},
RESRCE=#{et.resrce},
RUN_TIME=#{et.runTime},
CREATED_USER=#{et.createdUser},
CREATED_DATA_TIME=#{et.createdDataTime},
MODIFIED_USER=#{et.modifiedUser},
MODIFIED_DATE_TIME=#{et.modifiedDateTime},
</trim> WHERE HANDLE=#{et.handle} <if test="et instanceof java.util.Map"><if test="et.MP_OPTLOCK_VERSION_ORIGINAL!=null">and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL}</if></if>
</update>
<update id="update">
UPDATE Z_RESOURCE_RUN_TIME <trim prefix="SET" suffixOverrides=",">
<if test="et.site!=null">SITE=#{et.site},</if>
<if test="et.sendDate!=null">SEND_DATE=#{et.sendDate},</if>
<if test="et.resrce!=null">RESRCE=#{et.resrce},</if>
<if test="et.runTime!=null">RUN_TIME=#{et.runTime},</if>
<if test="et.createdUser!=null">CREATED_USER=#{et.createdUser},</if>
<if test="et.createdDataTime!=null">CREATED_DATA_TIME=#{et.createdDataTime},</if>
<if test="et.modifiedUser!=null">MODIFIED_USER=#{et.modifiedUser},</if>
<if test="et.modifiedDateTime!=null">MODIFIED_DATE_TIME=#{et.modifiedDateTime},</if>
</trim>
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
HANDLE=#{ew.entity.handle}
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.sendDate!=null"> AND SEND_DATE=#{ew.entity.sendDate}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.runTime!=null"> AND RUN_TIME=#{ew.entity.runTime}</if>
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
<if test="ew.entity.createdDataTime!=null"> AND CREATED_DATA_TIME=#{ew.entity.createdDataTime}</if>
<if test="ew.entity.modifiedUser!=null"> AND MODIFIED_USER=#{ew.entity.modifiedUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</update>
<delete id="deleteById">
DELETE FROM Z_RESOURCE_RUN_TIME WHERE HANDLE=#{handle}
</delete>
<delete id="deleteByMap">
DELETE FROM Z_RESOURCE_RUN_TIME
<if test="cm!=null and !cm.isEmpty">
<where>
<foreach collection="cm.keys" item="k" separator="AND">
<if test="cm[k] != null">
${k} = #{cm[${k}]}
</if>
</foreach>
</where>
</if>
</delete>
<delete id="delete">
DELETE FROM Z_RESOURCE_RUN_TIME
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.sendDate!=null"> AND SEND_DATE=#{ew.entity.sendDate}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.runTime!=null"> AND RUN_TIME=#{ew.entity.runTime}</if>
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
<if test="ew.entity.createdDataTime!=null"> AND CREATED_DATA_TIME=#{ew.entity.createdDataTime}</if>
<if test="ew.entity.modifiedUser!=null"> AND MODIFIED_USER=#{ew.entity.modifiedUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
</if>
</delete>
<delete id="deleteBatchIds">
DELETE FROM Z_RESOURCE_RUN_TIME WHERE HANDLE IN (
<foreach item="item" index="index" collection="coll" separator=",">#{item}
</foreach>)
</delete>
<!-- BaseMapper标准查询/修改/删除 -->
</mapper>
Loading…
Cancel
Save