员工资源导入+产品报废
parent
b81b0fa1d5
commit
895046da7d
@ -1,24 +1,10 @@
|
||||
package com.foreverwin.mesnac.anomaly.service;
|
||||
|
||||
import com.foreverwin.mesnac.anomaly.dto.ScrapDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Author zhaojiawei
|
||||
* @Since 2021-07-28
|
||||
*/
|
||||
public interface ProductionScrap {
|
||||
/**
|
||||
* 判断产品条码在质量异常中是否为报废
|
||||
* @param sfc
|
||||
* @return
|
||||
*/
|
||||
boolean jgProductionIsScrap(String site,String sfc);
|
||||
|
||||
/**
|
||||
* 检索
|
||||
*/
|
||||
List<ScrapDto> getScrapDtoBysfc(String site,String sfc);
|
||||
}
|
||||
|
@ -0,0 +1,185 @@
|
||||
package com.foreverwin.mesnac.dataimport.handler;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.foreverwin.mesnac.common.enums.HandleEnum;
|
||||
import com.foreverwin.mesnac.common.util.StringUtil;
|
||||
import com.foreverwin.mesnac.dataimport.handler.base.BaseHandler;
|
||||
import com.foreverwin.mesnac.dataimport.reader.FileReader;
|
||||
import com.foreverwin.mesnac.dataimport.reader.FileReaderBuilder;
|
||||
import com.foreverwin.mesnac.dataimport.reader.RowVisitor;
|
||||
import com.foreverwin.mesnac.dataimport.service.MasterObjectDefine;
|
||||
import com.foreverwin.mesnac.dataimport.util.AppUtil;
|
||||
import com.foreverwin.mesnac.dispatch.mapper.UserResourceMapper;
|
||||
import com.foreverwin.mesnac.dispatch.model.UserResource;
|
||||
import com.foreverwin.mesnac.dispatch.service.UserResourceService;
|
||||
import com.foreverwin.modular.core.exception.BusinessException;
|
||||
import com.foreverwin.modular.core.util.CommonMethods;
|
||||
import com.foreverwin.modular.core.util.I18nUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
* @Author zhaojiawei
|
||||
* @Since 2021-07-29
|
||||
*/
|
||||
public class UserResourceHandler extends BaseHandler {
|
||||
|
||||
@Autowired
|
||||
private UserResourceMapper userResourceMapper;
|
||||
|
||||
@Autowired
|
||||
private UserResourceService userResourceService;
|
||||
|
||||
@Override
|
||||
public String importFile(String site, InputStream inputStream, String fileType, String mode) throws Exception {
|
||||
int row = 0;
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
Integer[] failedNumber = new Integer[]{0};
|
||||
|
||||
try {
|
||||
FileReader fileReader = new FileReaderBuilder().build(fileType);
|
||||
RowVisitor<JSONObject> visitor = getRowVisitor(site, mode, buffer, failedNumber);
|
||||
row = fileReader.visitor(visitor).read(inputStream, getHeaders());
|
||||
} catch (Exception e) {
|
||||
buffer.append(e.getMessage() + "\n");
|
||||
}
|
||||
|
||||
if (buffer.length() > 0) {
|
||||
buffer.insert(0, I18nUtil.getI18nText("MaterData.import.Summary", new Object[]{row + failedNumber[0], row, failedNumber[0]}) + "\n");
|
||||
throw BusinessException.build(buffer.toString());
|
||||
}
|
||||
buffer.insert(0, I18nUtil.getI18nText("MaterData.import.Summary", new Object[]{row + failedNumber[0], row, failedNumber[0]}) + "\n");
|
||||
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getHeaders() {
|
||||
return MasterObjectDefine.getHeadsMapping("USER_RESOURCE");
|
||||
}
|
||||
|
||||
public RowVisitor<JSONObject> getRowVisitor(String site, String mode, StringBuffer buffer, Integer[] failedNumber) {
|
||||
|
||||
return new RowVisitor<JSONObject>() {
|
||||
|
||||
@Override
|
||||
public int visit(long index, JSONObject jsonObject) {
|
||||
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
String user = CommonMethods.getUser();
|
||||
String resrce = StringUtil.toString(jsonObject.getString(jsonObject.getString("resrce")));
|
||||
String resrceDescription = StringUtil.toString(jsonObject.getString(jsonObject.getString("resrceDescription")));
|
||||
String userId = StringUtil.toString(jsonObject.getString(jsonObject.getString("userId")));
|
||||
String userDescription = StringUtil.toString(jsonObject.getString(jsonObject.getString("userDescription")));
|
||||
String temporaryUser = StringUtil.toString(jsonObject.getString(jsonObject.getString("temporaryUser")));
|
||||
String status = StringUtil.toString(jsonObject.getString(jsonObject.getString("status")));
|
||||
UserResource userResource = new UserResource();
|
||||
userResource.setHandle(HandleEnum.USER_RESOURCE.getHandle(site, resrce, userId));
|
||||
userResource.setSite(site);
|
||||
userResource.setResourceBo(HandleEnum.RESOURCE.getHandle(site,resrce));
|
||||
userResource.setResrce(resrce);
|
||||
userResource.setResrceDescription(resrceDescription);
|
||||
userResource.setUserId(userId);
|
||||
userResource.setUserDescription(userDescription);
|
||||
if("Y".equals(temporaryUser)){
|
||||
userResource.setTemporaryUser("true");
|
||||
}else {
|
||||
userResource.setTemporaryUser("false");
|
||||
}
|
||||
|
||||
if("Y".equals(status)){
|
||||
userResource.setStatus("true");
|
||||
}else {
|
||||
userResource.setStatus("false");
|
||||
}
|
||||
|
||||
UserResource result = userResourceMapper.selectById(userResource.getHandle());
|
||||
if(result == null){
|
||||
userResource.setCreatedUser(user);
|
||||
userResource.setCreatedDateTime(now);
|
||||
}
|
||||
userResource.setModifiedUser(user);
|
||||
userResource.setModifiedDateTime(now);
|
||||
|
||||
|
||||
|
||||
Object[] params = new Object[10];
|
||||
//错误信息提示
|
||||
params[0] = index;
|
||||
params[1] = resrce;
|
||||
boolean insert = false;
|
||||
try {
|
||||
|
||||
//如果资源为空或者员工编号为空,则直接跳过
|
||||
if (StringUtil.notEmpty(resrce) && StringUtil.notEmpty(userId)) {
|
||||
//站点
|
||||
jsonObject.put("site", site);
|
||||
//错误提示信息
|
||||
boolean resultMessage = false;
|
||||
// WorkCenterFullConfiguration result = WorkCenterWSClient.find(jsonObject);
|
||||
if (result != null) {
|
||||
if (AppUtil.canUpdate(mode)) {
|
||||
resultMessage = this.update(userResource);
|
||||
if (resultMessage) {
|
||||
return 1;
|
||||
}
|
||||
}else{
|
||||
throw BusinessException.build("第"+index+"行的数据不存在,不能更新,应该选更新插入");
|
||||
}
|
||||
} else {
|
||||
if (AppUtil.canInsert(mode)) {
|
||||
insert = true;
|
||||
// resultMessage = WorkCenterWSClient.insert(userResource);
|
||||
// if (resultMessage == null) {
|
||||
// return 1;
|
||||
// }
|
||||
} else if (AppUtil.canUpdate(mode)) {
|
||||
//resultMessage = "第" +index+ "行:" + I18nUtil.getI18nText("MaterData.import.upDateObjectNotExist") + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
// if (resultMessage != null) {
|
||||
// params[2] = resultMessage;
|
||||
// failedNumber[0]++;
|
||||
// if (insert) {
|
||||
// buffer.append("第" +index+ "行:" + I18nUtil.getI18nText("MaterData.import.insertfail.workcenter", params) + "\n");
|
||||
// } else {
|
||||
// buffer.append("第" +index+ "行:" + I18nUtil.getI18nText("MaterData.import.updatefail.workcenter", params) + "\n");
|
||||
// }
|
||||
// }
|
||||
}
|
||||
return 0;
|
||||
|
||||
} catch (Exception e) {
|
||||
params[2] = e.getMessage();
|
||||
failedNumber[0]++;
|
||||
if (insert) {
|
||||
buffer.append("第" +index+ "行:" + I18nUtil.getI18nText("MaterData.import.insertfail.workcenter", new Object[]{e.getMessage()}) + "\n");
|
||||
} else {
|
||||
buffer.append("第" +index+ "行:" + I18nUtil.getI18nText("MaterData.import.updatefail.workcenter", new Object[]{e.getMessage()}) + "\n");
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getHeader() {
|
||||
return null;
|
||||
}
|
||||
|
||||
boolean update(UserResource userResource){
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,153 @@
|
||||
package com.foreverwin.mesnac.production.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.foreverwin.mesnac.common.service.AnomalyService;
|
||||
import com.foreverwin.mesnac.production.model.SfcScrap;
|
||||
import com.foreverwin.mesnac.production.service.SfcScrapService;
|
||||
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.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author zjw
|
||||
* @since 2021-07-30
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/Z-SFC-SCRAP")
|
||||
public class SfcScrapController {
|
||||
|
||||
@Autowired
|
||||
public SfcScrapService sfcScrapService;
|
||||
|
||||
@Autowired
|
||||
private AnomalyService anomalyService;
|
||||
|
||||
/**
|
||||
* 根据id查询
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@GetMapping("/{id:.+}")
|
||||
public R getSfcScrapById(@PathVariable String id) {
|
||||
return R.ok( sfcScrapService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@GetMapping("")
|
||||
public R getSfcScrapList(SfcScrap sfcScrap){
|
||||
List<SfcScrap> result;
|
||||
QueryWrapper<SfcScrap> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.setEntity(sfcScrap);
|
||||
result = sfcScrapService.list(queryWrapper);
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询数据
|
||||
*
|
||||
* @param frontPage 分页信息
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@GetMapping("/page")
|
||||
public R page(FrontPage<SfcScrap> frontPage, SfcScrap sfcScrap){
|
||||
IPage result;
|
||||
QueryWrapper<SfcScrap> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.setEntity(sfcScrap);
|
||||
if (frontPage.getGlobalQuery() != null && !"".equals(frontPage.getGlobalQuery().trim())) {
|
||||
//TODO modify global query
|
||||
queryWrapper.lambda().and(wrapper -> wrapper
|
||||
.like(SfcScrap::getHandle, frontPage.getGlobalQuery())
|
||||
.or().like(SfcScrap::getSite, frontPage.getGlobalQuery())
|
||||
.or().like(SfcScrap::getSfc, frontPage.getGlobalQuery())
|
||||
.or().like(SfcScrap::getOperation, frontPage.getGlobalQuery())
|
||||
.or().like(SfcScrap::getStepId, frontPage.getGlobalQuery())
|
||||
.or().like(SfcScrap::getType, frontPage.getGlobalQuery())
|
||||
.or().like(SfcScrap::getReason, frontPage.getGlobalQuery())
|
||||
.or().like(SfcScrap::getCreatedUser, frontPage.getGlobalQuery())
|
||||
.or().like(SfcScrap::getModifiedUser, frontPage.getGlobalQuery())
|
||||
);
|
||||
}
|
||||
result = sfcScrapService.page(frontPage.getPagePlus(), queryWrapper);
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param sfcScrap 传递的实体
|
||||
* @return null 失败 实体成功
|
||||
*/
|
||||
@PostMapping
|
||||
public R save(@RequestBody SfcScrap sfcScrap) {
|
||||
return R.ok(sfcScrapService.save(sfcScrap));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param sfcScrap 传递的实体
|
||||
* @return null 失败 实体成功
|
||||
*/
|
||||
@PutMapping
|
||||
public R updateById(@RequestBody SfcScrap sfcScrap) {
|
||||
return R.ok(sfcScrapService.updateById(sfcScrap));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id删除对象
|
||||
* @param id 实体ID
|
||||
* @return 0 失败 1 成功
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = "/{id:.+}")
|
||||
public R removeById(@PathVariable("id") String id){
|
||||
return R.ok(sfcScrapService.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(sfcScrapService.removeByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 生产报废检索功能
|
||||
* @param site
|
||||
* @param sfc
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getScrapDtoBysfc")
|
||||
public R getScrapDtoBysfc(String site,String sfc){
|
||||
|
||||
|
||||
return R.ok(anomalyService.getScrapDtoBysfc(site,sfc));
|
||||
}
|
||||
|
||||
/**
|
||||
* 生产报废的报废功能
|
||||
* @param sfcScrap
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/scrap")
|
||||
public R scrap(@RequestBody HashMap<String,Object> param){
|
||||
return R.ok(sfcScrapService.scrap(param));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.foreverwin.mesnac.production.mapper;
|
||||
|
||||
import com.foreverwin.mesnac.production.model.SfcScrap;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产品报废 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author zjw
|
||||
* @since 2021-07-30
|
||||
*/
|
||||
@Repository
|
||||
public interface SfcScrapMapper extends BaseMapper<SfcScrap> {
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.foreverwin.mesnac.production.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.foreverwin.mesnac.production.model.SfcScrap;
|
||||
import com.foreverwin.modular.core.util.FrontPage;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 产品报废 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zjw
|
||||
* @since 2021-07-30
|
||||
*/
|
||||
public interface SfcScrapService extends IService<SfcScrap> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param frontPage
|
||||
* @return
|
||||
*/
|
||||
IPage<SfcScrap> selectPage(FrontPage<SfcScrap> frontPage, SfcScrap sfcScrap);
|
||||
|
||||
List<SfcScrap> selectList(SfcScrap sfcScrap);
|
||||
|
||||
List<SfcScrap> scrap(HashMap<String,Object> param) ;
|
||||
|
||||
}
|
@ -0,0 +1,434 @@
|
||||
<?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.SfcScrapMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.foreverwin.mesnac.production.model.SfcScrap">
|
||||
<id column="HANDLE" property="handle" />
|
||||
<result column="SITE" property="site" />
|
||||
<result column="SFC" property="sfc" />
|
||||
<result column="OPERATION" property="operation" />
|
||||
<result column="STEP_ID" property="stepId" />
|
||||
<result column="QTY" property="qty" />
|
||||
<result column="TYPE" property="type" />
|
||||
<result column="REASON" property="reason" />
|
||||
<result column="CREATED_USER" property="createdUser" />
|
||||
<result column="CREATED_DATE_TIME" property="createdDateTime" />
|
||||
<result column="MODIFIED_USER" property="modifiedUser" />
|
||||
<result column="MODIFIED_DATE_TIME" property="modifiedDateTime" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
HANDLE, SITE, SFC, OPERATION, STEP_ID, QTY, TYPE, REASON, CREATED_USER, CREATED_DATE_TIME, MODIFIED_USER, MODIFIED_DATE_TIME
|
||||
</sql>
|
||||
|
||||
<!-- BaseMapper标准查询/修改/删除 -->
|
||||
<select id="selectById" resultMap="BaseResultMap">
|
||||
SELECT <include refid="Base_Column_List"></include> FROM Z_SFC_SCRAP WHERE HANDLE=#{handle}
|
||||
</select>
|
||||
|
||||
<select id="selectByMap" resultMap="BaseResultMap">
|
||||
SELECT <include refid="Base_Column_List"></include>
|
||||
FROM Z_SFC_SCRAP
|
||||
<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_SCRAP 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_SCRAP
|
||||
<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.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
|
||||
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
|
||||
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
|
||||
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
|
||||
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
|
||||
<if test="ew.entity.reason!=null"> AND REASON=#{ew.entity.reason}</if>
|
||||
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
|
||||
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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_SFC_SCRAP
|
||||
<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.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
|
||||
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
|
||||
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
|
||||
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
|
||||
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
|
||||
<if test="ew.entity.reason!=null"> AND REASON=#{ew.entity.reason}</if>
|
||||
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
|
||||
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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_SFC_SCRAP
|
||||
<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.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
|
||||
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
|
||||
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
|
||||
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
|
||||
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
|
||||
<if test="ew.entity.reason!=null"> AND REASON=#{ew.entity.reason}</if>
|
||||
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
|
||||
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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_SFC_SCRAP
|
||||
<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.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
|
||||
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
|
||||
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
|
||||
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
|
||||
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
|
||||
<if test="ew.entity.reason!=null"> AND REASON=#{ew.entity.reason}</if>
|
||||
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
|
||||
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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_SFC_SCRAP
|
||||
<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.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
|
||||
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
|
||||
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
|
||||
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
|
||||
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
|
||||
<if test="ew.entity.reason!=null"> AND REASON=#{ew.entity.reason}</if>
|
||||
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
|
||||
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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_SFC_SCRAP
|
||||
<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.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
|
||||
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
|
||||
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
|
||||
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
|
||||
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
|
||||
<if test="ew.entity.reason!=null"> AND REASON=#{ew.entity.reason}</if>
|
||||
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
|
||||
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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_SFC_SCRAP
|
||||
<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.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
|
||||
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
|
||||
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
|
||||
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
|
||||
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
|
||||
<if test="ew.entity.reason!=null"> AND REASON=#{ew.entity.reason}</if>
|
||||
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
|
||||
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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.production.model.SfcScrap">
|
||||
INSERT INTO Z_SFC_SCRAP
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
HANDLE,
|
||||
<if test="site!=null">SITE,</if>
|
||||
<if test="sfc!=null">SFC,</if>
|
||||
<if test="operation!=null">OPERATION,</if>
|
||||
<if test="stepId!=null">STEP_ID,</if>
|
||||
<if test="qty!=null">QTY,</if>
|
||||
<if test="type!=null">TYPE,</if>
|
||||
<if test="reason!=null">REASON,</if>
|
||||
<if test="createdUser!=null">CREATED_USER,</if>
|
||||
<if test="createdDateTime!=null">CREATED_DATE_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="sfc!=null">#{sfc},</if>
|
||||
<if test="operation!=null">#{operation},</if>
|
||||
<if test="stepId!=null">#{stepId},</if>
|
||||
<if test="qty!=null">#{qty},</if>
|
||||
<if test="type!=null">#{type},</if>
|
||||
<if test="reason!=null">#{reason},</if>
|
||||
<if test="createdUser!=null">#{createdUser},</if>
|
||||
<if test="createdDateTime!=null">#{createdDateTime},</if>
|
||||
<if test="modifiedUser!=null">#{modifiedUser},</if>
|
||||
<if test="modifiedDateTime!=null">#{modifiedDateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="insertAllColumn" parameterType="com.foreverwin.mesnac.production.model.SfcScrap">
|
||||
INSERT INTO Z_SFC_SCRAP
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<include refid="Base_Column_List"></include>
|
||||
</trim> VALUES
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
#{handle},
|
||||
#{site},
|
||||
#{sfc},
|
||||
#{operation},
|
||||
#{stepId},
|
||||
#{qty},
|
||||
#{type},
|
||||
#{reason},
|
||||
#{createdUser},
|
||||
#{createdDateTime},
|
||||
#{modifiedUser},
|
||||
#{modifiedDateTime},
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
||||
<update id="updateById">
|
||||
UPDATE Z_SFC_SCRAP <trim prefix="SET" suffixOverrides=",">
|
||||
<if test="et.site!=null">SITE=#{et.site},</if>
|
||||
<if test="et.sfc!=null">SFC=#{et.sfc},</if>
|
||||
<if test="et.operation!=null">OPERATION=#{et.operation},</if>
|
||||
<if test="et.stepId!=null">STEP_ID=#{et.stepId},</if>
|
||||
<if test="et.qty!=null">QTY=#{et.qty},</if>
|
||||
<if test="et.type!=null">TYPE=#{et.type},</if>
|
||||
<if test="et.reason!=null">REASON=#{et.reason},</if>
|
||||
<if test="et.createdUser!=null">CREATED_USER=#{et.createdUser},</if>
|
||||
<if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</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_SFC_SCRAP <trim prefix="SET" suffixOverrides=",">
|
||||
SITE=#{et.site},
|
||||
SFC=#{et.sfc},
|
||||
OPERATION=#{et.operation},
|
||||
STEP_ID=#{et.stepId},
|
||||
QTY=#{et.qty},
|
||||
TYPE=#{et.type},
|
||||
REASON=#{et.reason},
|
||||
CREATED_USER=#{et.createdUser},
|
||||
CREATED_DATE_TIME=#{et.createdDateTime},
|
||||
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_SFC_SCRAP <trim prefix="SET" suffixOverrides=",">
|
||||
<if test="et.site!=null">SITE=#{et.site},</if>
|
||||
<if test="et.sfc!=null">SFC=#{et.sfc},</if>
|
||||
<if test="et.operation!=null">OPERATION=#{et.operation},</if>
|
||||
<if test="et.stepId!=null">STEP_ID=#{et.stepId},</if>
|
||||
<if test="et.qty!=null">QTY=#{et.qty},</if>
|
||||
<if test="et.type!=null">TYPE=#{et.type},</if>
|
||||
<if test="et.reason!=null">REASON=#{et.reason},</if>
|
||||
<if test="et.createdUser!=null">CREATED_USER=#{et.createdUser},</if>
|
||||
<if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</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.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
|
||||
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
|
||||
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
|
||||
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
|
||||
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
|
||||
<if test="ew.entity.reason!=null"> AND REASON=#{ew.entity.reason}</if>
|
||||
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
|
||||
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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_SFC_SCRAP WHERE HANDLE=#{handle}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByMap">
|
||||
DELETE FROM Z_SFC_SCRAP
|
||||
<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_SCRAP
|
||||
<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.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
|
||||
<if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
|
||||
<if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
|
||||
<if test="ew.entity.qty!=null"> AND QTY=#{ew.entity.qty}</if>
|
||||
<if test="ew.entity.type!=null"> AND TYPE=#{ew.entity.type}</if>
|
||||
<if test="ew.entity.reason!=null"> AND REASON=#{ew.entity.reason}</if>
|
||||
<if test="ew.entity.createdUser!=null"> AND CREATED_USER=#{ew.entity.createdUser}</if>
|
||||
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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_SFC_SCRAP WHERE HANDLE IN (
|
||||
<foreach item="item" index="index" collection="coll" separator=",">#{item}
|
||||
</foreach>)
|
||||
</delete>
|
||||
<!-- BaseMapper标准查询/修改/删除 -->
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue