Merge remote-tracking branch 'mesnac/master'
commit
eae2dfd36a
@ -0,0 +1,141 @@
|
||||
package com.foreverwin.mesnac.production.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.foreverwin.mesnac.production.model.SfcHoldLog;
|
||||
import com.foreverwin.mesnac.production.service.SfcHoldLogService;
|
||||
import com.foreverwin.modular.core.util.FrontPage;
|
||||
import com.foreverwin.modular.core.util.R;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Philip
|
||||
* @since 2021-08-19
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/Z-SFC-HOLD-LOG")
|
||||
public class SfcHoldLogController {
|
||||
|
||||
@Autowired
|
||||
public SfcHoldLogService sfcHoldLogService;
|
||||
|
||||
/**
|
||||
* 查询所有数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping("/sfcHold")
|
||||
public R sfcHold(@RequestBody Map<String,Object> map){
|
||||
List<SfcHoldLog> sfcHoldLogList = (List<SfcHoldLog>) map.get("sfcHoldLogList");
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
sfcHoldLogList = mapper.convertValue(sfcHoldLogList, new TypeReference<List<SfcHoldLog>>() {
|
||||
});
|
||||
sfcHoldLogService.sfcHold(sfcHoldLogList);
|
||||
return R.ok();
|
||||
}
|
||||
/**
|
||||
* 根据id查询
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@GetMapping("/{id:.+}")
|
||||
public R getSfcHoldLogById(@PathVariable String id) {
|
||||
return R.ok( sfcHoldLogService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@GetMapping("")
|
||||
public R getSfcHoldLogList(SfcHoldLog sfcHoldLog){
|
||||
List<SfcHoldLog> result;
|
||||
QueryWrapper<SfcHoldLog> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.setEntity(sfcHoldLog);
|
||||
result = sfcHoldLogService.list(queryWrapper);
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询数据
|
||||
*
|
||||
* @param frontPage 分页信息
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@GetMapping("/page")
|
||||
public R page(FrontPage<SfcHoldLog> frontPage, SfcHoldLog sfcHoldLog){
|
||||
IPage result;
|
||||
QueryWrapper<SfcHoldLog> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.setEntity(sfcHoldLog);
|
||||
if (frontPage.getGlobalQuery() != null && !"".equals(frontPage.getGlobalQuery().trim())) {
|
||||
//TODO modify global query
|
||||
queryWrapper.lambda().and(wrapper -> wrapper
|
||||
.like(SfcHoldLog::getHandle, frontPage.getGlobalQuery())
|
||||
.or().like(SfcHoldLog::getSite, frontPage.getGlobalQuery())
|
||||
.or().like(SfcHoldLog::getSfcDispatchBo, frontPage.getGlobalQuery())
|
||||
.or().like(SfcHoldLog::getSfc, frontPage.getGlobalQuery())
|
||||
.or().like(SfcHoldLog::getStepId, frontPage.getGlobalQuery())
|
||||
.or().like(SfcHoldLog::getOperation, frontPage.getGlobalQuery())
|
||||
.or().like(SfcHoldLog::getType, frontPage.getGlobalQuery())
|
||||
.or().like(SfcHoldLog::getCreateUser, frontPage.getGlobalQuery())
|
||||
);
|
||||
}
|
||||
result = sfcHoldLogService.page(frontPage.getPagePlus(), queryWrapper);
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param sfcHoldLog 传递的实体
|
||||
* @return null 失败 实体成功
|
||||
*/
|
||||
@PostMapping
|
||||
public R save(@RequestBody SfcHoldLog sfcHoldLog) {
|
||||
return R.ok(sfcHoldLogService.save(sfcHoldLog));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param sfcHoldLog 传递的实体
|
||||
* @return null 失败 实体成功
|
||||
*/
|
||||
@PutMapping
|
||||
public R updateById(@RequestBody SfcHoldLog sfcHoldLog) {
|
||||
return R.ok(sfcHoldLogService.updateById(sfcHoldLog));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id删除对象
|
||||
* @param id 实体ID
|
||||
* @return 0 失败 1 成功
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = "/{id:.+}")
|
||||
public R removeById(@PathVariable("id") String id){
|
||||
return R.ok(sfcHoldLogService.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(sfcHoldLogService.removeByIds(ids));
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.foreverwin.mesnac.production.mapper;
|
||||
|
||||
import com.foreverwin.mesnac.production.model.SfcHoldLog;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产品条码保留记录 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author Philip
|
||||
* @since 2021-08-19
|
||||
*/
|
||||
@Repository
|
||||
public interface SfcHoldLogMapper extends BaseMapper<SfcHoldLog> {
|
||||
|
||||
}
|
@ -0,0 +1,201 @@
|
||||
package com.foreverwin.mesnac.production.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产品条码保留记录
|
||||
* </p>
|
||||
*
|
||||
* @author Philip
|
||||
* @since 2021-08-19
|
||||
*/
|
||||
|
||||
@TableName("Z_SFC_HOLD_LOG")
|
||||
|
||||
public class SfcHoldLog extends Model<SfcHoldLog> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "HANDLE", type = IdType.INPUT)
|
||||
private String handle;
|
||||
/**
|
||||
* 站点
|
||||
*/
|
||||
@TableField("SITE")
|
||||
private String site;
|
||||
/**
|
||||
* 派工单主键
|
||||
*/
|
||||
@TableField("SFC_DISPATCH_BO")
|
||||
private String sfcDispatchBo;
|
||||
/**
|
||||
* 产品条码
|
||||
*/
|
||||
@TableField("SFC")
|
||||
private String sfc;
|
||||
/**
|
||||
* 步骤
|
||||
*/
|
||||
@TableField("STEP_ID")
|
||||
private String stepId;
|
||||
/**
|
||||
* 工序
|
||||
*/
|
||||
@TableField("OPERATION")
|
||||
private String operation;
|
||||
/**
|
||||
* 保留时长
|
||||
*/
|
||||
@TableField("HOLD_DURATION")
|
||||
private BigDecimal holdDuration;
|
||||
/**
|
||||
* 类型:暂停取消
|
||||
*/
|
||||
@TableField("TYPE")
|
||||
private String type;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField("CREATE_USER")
|
||||
private String createUser;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField("CREATED_DATE_TIME")
|
||||
private LocalDateTime createdDateTime;
|
||||
|
||||
|
||||
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 String getSfcDispatchBo() {
|
||||
return sfcDispatchBo;
|
||||
}
|
||||
|
||||
public void setSfcDispatchBo(String sfcDispatchBo) {
|
||||
this.sfcDispatchBo = sfcDispatchBo;
|
||||
}
|
||||
|
||||
public String getSfc() {
|
||||
return sfc;
|
||||
}
|
||||
|
||||
public void setSfc(String sfc) {
|
||||
this.sfc = sfc;
|
||||
}
|
||||
|
||||
public String getStepId() {
|
||||
return stepId;
|
||||
}
|
||||
|
||||
public void setStepId(String stepId) {
|
||||
this.stepId = stepId;
|
||||
}
|
||||
|
||||
public String getOperation() {
|
||||
return operation;
|
||||
}
|
||||
|
||||
public void setOperation(String operation) {
|
||||
this.operation = operation;
|
||||
}
|
||||
|
||||
public BigDecimal getHoldDuration() {
|
||||
return holdDuration;
|
||||
}
|
||||
|
||||
public void setHoldDuration(BigDecimal holdDuration) {
|
||||
this.holdDuration = holdDuration;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getCreateUser() {
|
||||
return createUser;
|
||||
}
|
||||
|
||||
public void setCreateUser(String createUser) {
|
||||
this.createUser = createUser;
|
||||
}
|
||||
|
||||
public LocalDateTime getCreatedDateTime() {
|
||||
return createdDateTime;
|
||||
}
|
||||
|
||||
public void setCreatedDateTime(LocalDateTime createdDateTime) {
|
||||
this.createdDateTime = createdDateTime;
|
||||
}
|
||||
|
||||
public static final String HANDLE = "HANDLE";
|
||||
|
||||
public static final String SITE = "SITE";
|
||||
|
||||
public static final String SFC_DISPATCH_BO = "SFC_DISPATCH_BO";
|
||||
|
||||
public static final String SFC = "SFC";
|
||||
|
||||
public static final String STEP_ID = "STEP_ID";
|
||||
|
||||
public static final String OPERATION = "OPERATION";
|
||||
|
||||
public static final String HOLD_DURATION = "HOLD_DURATION";
|
||||
|
||||
public static final String TYPE = "TYPE";
|
||||
|
||||
public static final String CREATE_USER = "CREATE_USER";
|
||||
|
||||
public static final String CREATED_DATE_TIME = "CREATED_DATE_TIME";
|
||||
|
||||
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
return this.handle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SfcHoldLog{" +
|
||||
"handle = " + handle +
|
||||
", site = " + site +
|
||||
", sfcDispatchBo = " + sfcDispatchBo +
|
||||
", sfc = " + sfc +
|
||||
", stepId = " + stepId +
|
||||
", operation = " + operation +
|
||||
", holdDuration = " + holdDuration +
|
||||
", type = " + type +
|
||||
", createUser = " + createUser +
|
||||
", createdDateTime = " + createdDateTime +
|
||||
"}";
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.foreverwin.mesnac.production.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.foreverwin.mesnac.production.model.SfcHoldLog;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.foreverwin.modular.core.util.FrontPage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产品条码保留记录 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Philip
|
||||
* @since 2021-08-19
|
||||
*/
|
||||
public interface SfcHoldLogService extends IService<SfcHoldLog> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param frontPage
|
||||
* @return
|
||||
*/
|
||||
IPage<SfcHoldLog> selectPage(FrontPage<SfcHoldLog> frontPage, SfcHoldLog sfcHoldLog);
|
||||
|
||||
List<SfcHoldLog> selectList(SfcHoldLog sfcHoldLog);
|
||||
|
||||
void sfcHold(List<SfcHoldLog> sfcHoldLogList);
|
||||
}
|
@ -0,0 +1,127 @@
|
||||
package com.foreverwin.mesnac.production.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.foreverwin.mesnac.common.dto.SfcDispatchDto;
|
||||
import com.foreverwin.mesnac.common.enums.HandleEnum;
|
||||
import com.foreverwin.mesnac.common.service.SfcDispatchCommonService;
|
||||
import com.foreverwin.mesnac.common.util.ExceptionUtil;
|
||||
import com.foreverwin.mesnac.meapi.dto.SfcDto;
|
||||
import com.foreverwin.mesnac.production.mapper.SfcHoldLogMapper;
|
||||
import com.foreverwin.mesnac.production.mapper.SplitSfcMapper;
|
||||
import com.foreverwin.mesnac.production.model.SfcHoldLog;
|
||||
import com.foreverwin.mesnac.production.service.SfcHoldLogService;
|
||||
import com.foreverwin.modular.core.exception.BaseException;
|
||||
import com.foreverwin.modular.core.meext.MEServices;
|
||||
import com.foreverwin.modular.core.util.CommonMethods;
|
||||
import com.foreverwin.modular.core.util.FrontPage;
|
||||
import com.sap.me.production.SfcStateServiceInterface;
|
||||
import com.sap.me.production.UpdateSfcStatusRequest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产品条码保留记录 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author Philip
|
||||
* @since 2021-08-19
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class SfcHoldLogServiceImpl extends ServiceImpl<SfcHoldLogMapper, SfcHoldLog> implements SfcHoldLogService {
|
||||
|
||||
@Autowired
|
||||
private SfcDispatchCommonService sfcDispatchCommonService;
|
||||
@Autowired
|
||||
private SfcHoldLogMapper sfcHoldLogMapper;
|
||||
@Autowired
|
||||
private SplitSfcMapper splitSfcMapper;
|
||||
@Override
|
||||
public IPage<SfcHoldLog> selectPage(FrontPage<SfcHoldLog> frontPage, SfcHoldLog sfcHoldLog) {
|
||||
QueryWrapper<SfcHoldLog> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.setEntity(sfcHoldLog);
|
||||
return super.page(frontPage.getPagePlus(), queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SfcHoldLog> selectList(SfcHoldLog sfcHoldLog) {
|
||||
QueryWrapper<SfcHoldLog> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.setEntity(sfcHoldLog);
|
||||
return super.list(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sfcHold(List<SfcHoldLog> sfcHoldLogList) {
|
||||
for (SfcHoldLog sfcHoldLog:sfcHoldLogList){
|
||||
String site = CommonMethods.getSite();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
String sfc = sfcHoldLog.getSfc();
|
||||
String type = sfcHoldLog.getType();
|
||||
String sfcBo = HandleEnum.SFC.getHandle(site, sfc);
|
||||
SfcDto sfcData = splitSfcMapper.getSfcData(sfcBo);
|
||||
if (sfcData==null){
|
||||
throw new BaseException("未找到产品条码信息");
|
||||
}
|
||||
if (sfcHoldLog.getType().equals("HOLD")&&!sfcData.getStatus().equals("403")){
|
||||
throw new BaseException("产品状态不可暂停");
|
||||
}
|
||||
if (sfcHoldLog.getType().equals("CANCEL")&&!sfcData.getStatus().equals("404")){
|
||||
throw new BaseException("产品状态不可取消暂停");
|
||||
}
|
||||
String stepId = sfcData.getStepId();
|
||||
String operation = sfcData.getOperation();
|
||||
SfcDispatchDto sfcDispatchDto = new SfcDispatchDto();
|
||||
sfcDispatchDto.setSfc(sfc);
|
||||
sfcDispatchDto.setStepId(stepId);
|
||||
sfcDispatchDto.setOperation(operation);
|
||||
SfcDispatchDto sfcDispatchBySfc = sfcDispatchCommonService.findSfcDispatchBySfc(sfcDispatchDto);
|
||||
SfcStateServiceInterface sfcStateServiceInterface = null;
|
||||
BigDecimal holdDuration=null;
|
||||
try {
|
||||
sfcStateServiceInterface = MEServices.create("com.sap.me.production", "SfcStateService", CommonMethods.getSite());
|
||||
UpdateSfcStatusRequest updateSfcStatusRequest = new UpdateSfcStatusRequest();
|
||||
updateSfcStatusRequest.setSfcRef(sfcBo);
|
||||
if (type.equals("HOLD")){
|
||||
updateSfcStatusRequest.setStatusRef(HandleEnum.STATUS.getHandle(site,"404"));
|
||||
}else {
|
||||
updateSfcStatusRequest.setStatusRef(HandleEnum.STATUS.getHandle(site,"403"));
|
||||
//计算保留时长
|
||||
QueryWrapper<SfcHoldLog> ueryWrapper=new QueryWrapper<>();
|
||||
ueryWrapper.eq(SfcHoldLog.STEP_ID,stepId);
|
||||
ueryWrapper.eq(SfcHoldLog.SFC,sfc);
|
||||
List<SfcHoldLog> list = list(ueryWrapper);
|
||||
LocalDateTime holdTime = list.get(0).getCreatedDateTime();
|
||||
long workHourSeconds = Duration.between(holdTime, now).getSeconds();
|
||||
holdDuration = new BigDecimal(workHourSeconds).divide(BigDecimal.valueOf(3600), 2, RoundingMode.HALF_UP);
|
||||
}
|
||||
sfcStateServiceInterface.updateSfcStatus(updateSfcStatusRequest);
|
||||
} catch (Exception e) {
|
||||
ExceptionUtil.throwException(e);
|
||||
}
|
||||
sfcHoldLog.setHandle(UUID.randomUUID().toString());
|
||||
sfcHoldLog.setSite(site);
|
||||
sfcHoldLog.setSfcDispatchBo(sfcDispatchBySfc.getHandle());
|
||||
sfcHoldLog.setStepId(stepId);
|
||||
sfcHoldLog.setOperation(operation);
|
||||
sfcHoldLog.setHoldDuration(holdDuration);
|
||||
sfcHoldLog.setCreateUser(CommonMethods.getUser());
|
||||
sfcHoldLog.setCreatedDateTime(now);
|
||||
save(sfcHoldLog);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,402 @@
|
||||
<?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.production.mapper.SfcHoldLogMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.foreverwin.mesnac.production.model.SfcHoldLog">
|
||||
<id column="HANDLE" property="handle" />
|
||||
<result column="SITE" property="site" />
|
||||
<result column="SFC_DISPATCH_BO" property="sfcDispatchBo" />
|
||||
<result column="SFC" property="sfc" />
|
||||
<result column="STEP_ID" property="stepId" />
|
||||
<result column="OPERATION" property="operation" />
|
||||
<result column="HOLD_DURATION" property="holdDuration" />
|
||||
<result column="TYPE" property="type" />
|
||||
<result column="CREATE_USER" property="createUser" />
|
||||
<result column="CREATED_DATE_TIME" property="createdDateTime" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
HANDLE, SITE, SFC_DISPATCH_BO, SFC, STEP_ID, OPERATION, HOLD_DURATION, TYPE, CREATE_USER, CREATED_DATE_TIME
|
||||
</sql>
|
||||
|
||||
<!-- BaseMapper标准查询/修改/删除 -->
|
||||
<select id="selectById" resultMap="BaseResultMap">
|
||||
SELECT <include refid="Base_Column_List"></include> FROM Z_SFC_HOLD_LOG WHERE HANDLE=#{handle}
|
||||
</select>
|
||||
|
||||
<select id="selectByMap" resultMap="BaseResultMap">
|
||||
SELECT <include refid="Base_Column_List"></include>
|
||||
FROM Z_SFC_HOLD_LOG
|
||||
<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_SFC_HOLD_LOG 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_SFC_HOLD_LOG
|
||||
<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.sfcDispatchBo!=null"> AND SFC_DISPATCH_BO=#{ew.entity.sfcDispatchBo}</if>
|
||||
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
|
||||
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
|
||||
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
|
||||
<if test="ew.entity.holdDuration!=null"> AND HOLD_DURATION=#{ew.entity.holdDuration}</if>
|
||||
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
|
||||
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
|
||||
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectCount" resultType="Integer">
|
||||
SELECT COUNT(1) FROM Z_SFC_HOLD_LOG
|
||||
<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.sfcDispatchBo!=null"> AND SFC_DISPATCH_BO=#{ew.entity.sfcDispatchBo}</if>
|
||||
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
|
||||
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
|
||||
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
|
||||
<if test="ew.entity.holdDuration!=null"> AND HOLD_DURATION=#{ew.entity.holdDuration}</if>
|
||||
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
|
||||
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
|
||||
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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_SFC_HOLD_LOG
|
||||
<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.sfcDispatchBo!=null"> AND SFC_DISPATCH_BO=#{ew.entity.sfcDispatchBo}</if>
|
||||
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
|
||||
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
|
||||
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
|
||||
<if test="ew.entity.holdDuration!=null"> AND HOLD_DURATION=#{ew.entity.holdDuration}</if>
|
||||
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
|
||||
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
|
||||
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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_SFC_HOLD_LOG
|
||||
<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.sfcDispatchBo!=null"> AND SFC_DISPATCH_BO=#{ew.entity.sfcDispatchBo}</if>
|
||||
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
|
||||
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
|
||||
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
|
||||
<if test="ew.entity.holdDuration!=null"> AND HOLD_DURATION=#{ew.entity.holdDuration}</if>
|
||||
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
|
||||
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
|
||||
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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_SFC_HOLD_LOG
|
||||
<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.sfcDispatchBo!=null"> AND SFC_DISPATCH_BO=#{ew.entity.sfcDispatchBo}</if>
|
||||
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
|
||||
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
|
||||
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
|
||||
<if test="ew.entity.holdDuration!=null"> AND HOLD_DURATION=#{ew.entity.holdDuration}</if>
|
||||
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
|
||||
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
|
||||
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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_SFC_HOLD_LOG
|
||||
<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.sfcDispatchBo!=null"> AND SFC_DISPATCH_BO=#{ew.entity.sfcDispatchBo}</if>
|
||||
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
|
||||
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
|
||||
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
|
||||
<if test="ew.entity.holdDuration!=null"> AND HOLD_DURATION=#{ew.entity.holdDuration}</if>
|
||||
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
|
||||
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
|
||||
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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_SFC_HOLD_LOG
|
||||
<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.sfcDispatchBo!=null"> AND SFC_DISPATCH_BO=#{ew.entity.sfcDispatchBo}</if>
|
||||
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
|
||||
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
|
||||
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
|
||||
<if test="ew.entity.holdDuration!=null"> AND HOLD_DURATION=#{ew.entity.holdDuration}</if>
|
||||
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
|
||||
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
|
||||
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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.production.model.SfcHoldLog">
|
||||
INSERT INTO Z_SFC_HOLD_LOG
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
HANDLE,
|
||||
<if test="site!=null">SITE,</if>
|
||||
<if test="sfcDispatchBo!=null">SFC_DISPATCH_BO,</if>
|
||||
<if test="sfc!=null">SFC,</if>
|
||||
<if test="stepId!=null">STEP_ID,</if>
|
||||
<if test="operation!=null">OPERATION,</if>
|
||||
<if test="holdDuration!=null">HOLD_DURATION,</if>
|
||||
<if test="type!=null">TYPE,</if>
|
||||
<if test="createUser!=null">CREATE_USER,</if>
|
||||
<if test="createdDateTime!=null">CREATED_DATE_TIME,</if>
|
||||
</trim> VALUES
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
#{handle},
|
||||
<if test="site!=null">#{site},</if>
|
||||
<if test="sfcDispatchBo!=null">#{sfcDispatchBo},</if>
|
||||
<if test="sfc!=null">#{sfc},</if>
|
||||
<if test="stepId!=null">#{stepId},</if>
|
||||
<if test="operation!=null">#{operation},</if>
|
||||
<if test="holdDuration!=null">#{holdDuration},</if>
|
||||
<if test="type!=null">#{type},</if>
|
||||
<if test="createUser!=null">#{createUser},</if>
|
||||
<if test="createdDateTime!=null">#{createdDateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="insertAllColumn" parameterType="com.foreverwin.mesnac.production.model.SfcHoldLog">
|
||||
INSERT INTO Z_SFC_HOLD_LOG
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<include refid="Base_Column_List"></include>
|
||||
</trim> VALUES
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
#{handle},
|
||||
#{site},
|
||||
#{sfcDispatchBo},
|
||||
#{sfc},
|
||||
#{stepId},
|
||||
#{operation},
|
||||
#{holdDuration},
|
||||
#{type},
|
||||
#{createUser},
|
||||
#{createdDateTime},
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
||||
<update id="updateById">
|
||||
UPDATE Z_SFC_HOLD_LOG <trim prefix="SET" suffixOverrides=",">
|
||||
<if test="et.site!=null">SITE=#{et.site},</if>
|
||||
<if test="et.sfcDispatchBo!=null">SFC_DISPATCH_BO=#{et.sfcDispatchBo},</if>
|
||||
<if test="et.sfc!=null">SFC=#{et.sfc},</if>
|
||||
<if test="et.stepId!=null">STEP_ID=#{et.stepId},</if>
|
||||
<if test="et.operation!=null">OPERATION=#{et.operation},</if>
|
||||
<if test="et.holdDuration!=null">HOLD_DURATION=#{et.holdDuration},</if>
|
||||
<if test="et.type!=null">TYPE=#{et.type},</if>
|
||||
<if test="et.createUser!=null">CREATE_USER=#{et.createUser},</if>
|
||||
<if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</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_SFC_HOLD_LOG <trim prefix="SET" suffixOverrides=",">
|
||||
SITE=#{et.site},
|
||||
SFC_DISPATCH_BO=#{et.sfcDispatchBo},
|
||||
SFC=#{et.sfc},
|
||||
STEP_ID=#{et.stepId},
|
||||
OPERATION=#{et.operation},
|
||||
HOLD_DURATION=#{et.holdDuration},
|
||||
TYPE=#{et.type},
|
||||
CREATE_USER=#{et.createUser},
|
||||
CREATED_DATE_TIME=#{et.createdDateTime},
|
||||
</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_SFC_HOLD_LOG <trim prefix="SET" suffixOverrides=",">
|
||||
<if test="et.site!=null">SITE=#{et.site},</if>
|
||||
<if test="et.sfcDispatchBo!=null">SFC_DISPATCH_BO=#{et.sfcDispatchBo},</if>
|
||||
<if test="et.sfc!=null">SFC=#{et.sfc},</if>
|
||||
<if test="et.stepId!=null">STEP_ID=#{et.stepId},</if>
|
||||
<if test="et.operation!=null">OPERATION=#{et.operation},</if>
|
||||
<if test="et.holdDuration!=null">HOLD_DURATION=#{et.holdDuration},</if>
|
||||
<if test="et.type!=null">TYPE=#{et.type},</if>
|
||||
<if test="et.createUser!=null">CREATE_USER=#{et.createUser},</if>
|
||||
<if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</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.sfcDispatchBo!=null"> AND SFC_DISPATCH_BO=#{ew.entity.sfcDispatchBo}</if>
|
||||
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
|
||||
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
|
||||
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
|
||||
<if test="ew.entity.holdDuration!=null"> AND HOLD_DURATION=#{ew.entity.holdDuration}</if>
|
||||
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
|
||||
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
|
||||
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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_SFC_HOLD_LOG WHERE HANDLE=#{handle}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByMap">
|
||||
DELETE FROM Z_SFC_HOLD_LOG
|
||||
<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_SFC_HOLD_LOG
|
||||
<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.sfcDispatchBo!=null"> AND SFC_DISPATCH_BO=#{ew.entity.sfcDispatchBo}</if>
|
||||
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
|
||||
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
|
||||
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
|
||||
<if test="ew.entity.holdDuration!=null"> AND HOLD_DURATION=#{ew.entity.holdDuration}</if>
|
||||
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
|
||||
<if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
|
||||
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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_SFC_HOLD_LOG WHERE HANDLE IN (
|
||||
<foreach item="item" index="index" collection="coll" separator=",">#{item}
|
||||
</foreach>)
|
||||
</delete>
|
||||
<!-- BaseMapper标准查询/修改/删除 -->
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue