图片上传

master
赵嘉伟 3 years ago
parent 657ba6c4f4
commit 3bf40f9fbc

@ -9,8 +9,8 @@ import org.springframework.stereotype.Repository;
* Mapper * Mapper
* </p> * </p>
* *
* @author Leon.L * @author zjw
* @since 2021-07-11 * @since 2021-09-09
*/ */
@Repository @Repository
public interface UploadPicturesMapper extends BaseMapper<UploadPictures> { public interface UploadPicturesMapper extends BaseMapper<UploadPictures> {

@ -14,8 +14,8 @@ import java.time.LocalDateTime;
* *
* </p> * </p>
* *
* @author Leon.L * @author zjw
* @since 2021-07-11 * @since 2021-09-09
*/ */
@TableName("Z_UPLOAD_PICTURES") @TableName("Z_UPLOAD_PICTURES")
@ -79,6 +79,8 @@ public class UploadPictures extends Model<UploadPictures> {
*/ */
@TableField("MODIFIED_DATE_TIME") @TableField("MODIFIED_DATE_TIME")
private LocalDateTime modifiedDateTime; private LocalDateTime modifiedDateTime;
@TableField("STATUS")
private String status;
public String getHandle() { public String getHandle() {
@ -169,6 +171,14 @@ public class UploadPictures extends Model<UploadPictures> {
this.modifiedDateTime = modifiedDateTime; this.modifiedDateTime = modifiedDateTime;
} }
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public static final String HANDLE = "HANDLE"; public static final String HANDLE = "HANDLE";
public static final String SITE = "SITE"; public static final String SITE = "SITE";
@ -191,6 +201,8 @@ public static final String MODIFIED_USER = "MODIFIED_USER";
public static final String MODIFIED_DATE_TIME = "MODIFIED_DATE_TIME"; public static final String MODIFIED_DATE_TIME = "MODIFIED_DATE_TIME";
public static final String STATUS = "STATUS";
@Override @Override
protected Serializable pkVal() { protected Serializable pkVal() {
@ -211,6 +223,7 @@ public static final String MODIFIED_DATE_TIME = "MODIFIED_DATE_TIME";
", createdDateTime = " + createdDateTime + ", createdDateTime = " + createdDateTime +
", modifiedUser = " + modifiedUser + ", modifiedUser = " + modifiedUser +
", modifiedDateTime = " + modifiedDateTime + ", modifiedDateTime = " + modifiedDateTime +
", status = " + status +
"}"; "}";
} }
} }

@ -12,7 +12,7 @@ import javax.servlet.http.HttpServletResponse;
*/ */
public interface FileUploadedService { public interface FileUploadedService {
public void uploadAttachment(MultipartFile fileItem, String site, String taskNo, String fileType); public void uploadAttachment(MultipartFile fileItem, String site, String taskNo, String fileType,String status);
public String showFile(HttpServletRequest request, HttpServletResponse response) throws Exception ; public String showFile(HttpServletRequest request, HttpServletResponse response) throws Exception ;

@ -12,8 +12,8 @@ import java.util.List;
* *
* </p> * </p>
* *
* @author Leon.L * @author zjw
* @since 2021-07-11 * @since 2021-09-09
*/ */
public interface UploadPicturesService extends IService<UploadPictures> { public interface UploadPicturesService extends IService<UploadPictures> {

@ -178,6 +178,9 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
@Autowired @Autowired
private CommonService commonService; private CommonService commonService;
@Autowired
private WorkCenterMapper workCenterMapper;
@Override @Override
public IPage<AbnormalBill> selectPage(FrontPage<AbnormalBill> frontPage, AbnormalBill abnormalBill) { public IPage<AbnormalBill> selectPage(FrontPage<AbnormalBill> frontPage, AbnormalBill abnormalBill) {
@ -296,8 +299,16 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
public String anomalyReportDevice(AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose) { public String anomalyReportDevice(AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose) {
String message = this.generateAbnormalBill(abnormalBill, abnormalBillDispose, null, null); String message = this.generateAbnormalBill(abnormalBill, abnormalBillDispose, null, null);
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
String site = CommonMethods.getSite();
String user = CommonMethods.getUser(); String user = CommonMethods.getUser();
//异常代码 //异常代码
//通过设备找到异常车间
Resrce resrce = new Resrce();
resrce.setSite(site);
resrce.setResrce(abnormalBill.getResrce());
WorkCenter workCenterByResrce = workCenterMapper.findWorkCenterByResrce(resrce);
abnormalBill.setWorkCenter(workCenterByResrce.getWorkCenter());
List<NcCodeDto> ncCodesAndNcGroups = ncCodeService.findNcCodeDescriptionByNcCode(abnormalBill.getNcCode()); List<NcCodeDto> ncCodesAndNcGroups = ncCodeService.findNcCodeDescriptionByNcCode(abnormalBill.getNcCode());
List<AbnormalNcCode> abnormalNcCodes = new LinkedList<>(); List<AbnormalNcCode> abnormalNcCodes = new LinkedList<>();
for(int i = 0; i < ncCodesAndNcGroups.size(); i ++){ for(int i = 0; i < ncCodesAndNcGroups.size(); i ++){
@ -764,8 +775,9 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
//判断输入的责任划分用户组是否正确,并返回对应的用户组下的用户 //判断输入的责任划分用户组是否正确,并返回对应的用户组下的用户
// nwaUserService.checkUserGroup(site,abnormalBillDispose.getDutySendUserGroup()); // nwaUserService.checkUserGroup(site,abnormalBillDispose.getDutySendUserGroup());
//只有质量异常和其他异常会上传图片
if(!StringUtil.isBlank(abnormalBill.getFileName())){ if(!StringUtil.isBlank(abnormalBill.getFileName())){
//放置图片 //放置图片,新建状态
this.fileUpload(abnormalBill); this.fileUpload(abnormalBill);
} }
@ -833,14 +845,10 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
public void fileUpload(AbnormalBill abnormalBill){ public void fileUpload(AbnormalBill abnormalBill){
String user = CommonMethods.getUser(); String user = CommonMethods.getUser();
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
List<String> name = null; List<String> name = Arrays.asList(abnormalBill.getFileName().split(","));
if(StringUtil.notBlank(abnormalBill.getFileName())){ if(name.size() != 0){
name = Arrays.asList(abnormalBill.getFileName().split(","));
}
if(name != null && name.size() != 0){
//String uuid = UUID.randomUUID().toString();
UploadPictures uploadPictures = new UploadPictures(); UploadPictures uploadPictures = new UploadPictures();
uploadPictures.setHandle("UploadPicturesBO:"+abnormalBill.getSite()+","+abnormalBill.getAbnormalNo()); uploadPictures.setHandle("UploadPicturesBO:"+abnormalBill.getSite()+","+abnormalBill.getAbnormalNo()+","+abnormalBill.getStatus());
uploadPictures.setSite(abnormalBill.getSite()); uploadPictures.setSite(abnormalBill.getSite());
uploadPictures.setPicturePath(abnormalBill.getFilePath()); uploadPictures.setPicturePath(abnormalBill.getFilePath());
StringBuilder pictureAddress = new StringBuilder(); StringBuilder pictureAddress = new StringBuilder();
@ -851,6 +859,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
pictureAddress.append(abnormalBill.getFilePath()).append("/").append(name.get(i)); pictureAddress.append(abnormalBill.getFilePath()).append("/").append(name.get(i));
} }
} }
uploadPictures.setStatus(abnormalBill.getStatus());
uploadPictures.setPictureAddress(pictureAddress.toString()); uploadPictures.setPictureAddress(pictureAddress.toString());
uploadPictures.setObjectBo(abnormalBill.getHandle()); uploadPictures.setObjectBo(abnormalBill.getHandle());
uploadPictures.setNum(abnormalBill.getFileNum()); uploadPictures.setNum(abnormalBill.getFileNum());
@ -869,6 +878,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
UploadPictures uploadPictures = new UploadPictures(); UploadPictures uploadPictures = new UploadPictures();
uploadPictures.setSite(site); uploadPictures.setSite(site);
uploadPictures.setObjectBo(abnormalBill.getHandle()); uploadPictures.setObjectBo(abnormalBill.getHandle());
uploadPictures.setStatus(abnormalBill.getStatus());
List<UploadPictures> uploadPictures1 = uploadPicturesService.selectList(uploadPictures); List<UploadPictures> uploadPictures1 = uploadPicturesService.selectList(uploadPictures);
if(uploadPictures1 != null && uploadPictures1.size() == 1){ if(uploadPictures1 != null && uploadPictures1.size() == 1){
return uploadPictures1.get(0); return uploadPictures1.get(0);

@ -20,10 +20,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream; import java.io.*;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/** /**
* @Description TODO * @Description TODO
@ -53,24 +50,39 @@ public class FileUploadedServiceImpl implements FileUploadedService {
* @return * @return
*/ */
@Override @Override
public void uploadAttachment(MultipartFile fileItem,String site,String taskNo,String fileType) { public void uploadAttachment(MultipartFile fileItem,String site,String taskNo,String fileType,String status) {
if (StringUtil.isBlank(site)) { if (StringUtil.isBlank(site)) {
site = CommonMethods.getSite(); site = CommonMethods.getSite();
} }
String ftpPath = taskNo + "/" + status;
//上传附件名称 //上传附件名称
String fileName = fileItem.getOriginalFilename(); String fileName = fileItem.getOriginalFilename();
try { try {
Ftp ftp = new Ftp(host, port,username,password); Ftp ftp = new Ftp(host, port,username,password);
ftp.upload(ftpPath, fileName, fileItem.getInputStream());
ftp.upload(taskNo, fileName, fileItem.getInputStream());
ftp.close(); ftp.close();
} catch (IOException e) { } catch (IOException e) {
logger.info(e.getMessage()); logger.info(e.getMessage());
throw BusinessException.build("" + e.getMessage()); throw BusinessException.build("上传图片失败:" + e.getMessage());
} }
// try{
// FTPClient ftpClient = new FTPClient();
// ftpClient.connect(host,port);
// ftpClient.login(username,password);
// InputStream inputStream = fileItem.getInputStream();
// FileInputStream fileInputStream= (FileInputStream) inputStream;
// ftpClient.changeWorkingDirectory(ftpPath);
// ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
// ftpClient.storeFile("ces",fileInputStream);
// ftpClient.logout();
// }catch (Exception e){
// throw BusinessException.build("上传图片失败:" + e.getMessage());
// }
} }
@Override
public String showFile(HttpServletRequest request, HttpServletResponse response) throws Exception { public String showFile(HttpServletRequest request, HttpServletResponse response) throws Exception {
String path = request.getParameter("PATH"); String path = request.getParameter("PATH");
// InputStream in = null; // InputStream in = null;
@ -79,8 +91,7 @@ public class FileUploadedServiceImpl implements FileUploadedService {
String coderPath = new String(path.getBytes("ISO8859_1")); String coderPath = new String(path.getBytes("ISO8859_1"));
String newPath = new String(coderPath.getBytes("GBK"), FTPClient.DEFAULT_CONTROL_ENCODING); String newPath = new String(coderPath.getBytes("GBK"), FTPClient.DEFAULT_CONTROL_ENCODING);
// //
// in = ftpClient.getFtp(path);
// in = ftpClient.getFtp(newPath);
FTPClient ftpClient = new FTPClient(); FTPClient ftpClient = new FTPClient();
ftpClient.connect(host,port); ftpClient.connect(host,port);
ftpClient.login(username,password); ftpClient.login(username,password);
@ -101,7 +112,7 @@ public class FileUploadedServiceImpl implements FileUploadedService {
// 检验文件是否存在 // 检验文件是否存在
InputStream in = ftpClient.retrieveFileStream(new String(file.getBytes("GBK"),FTP.DEFAULT_CONTROL_ENCODING)); InputStream in = ftpClient.retrieveFileStream(new String(file.getBytes("GBK"),FTP.DEFAULT_CONTROL_ENCODING));
if(in == null || ftpClient.getReplyCode() == FTPReply.FILE_UNAVAILABLE){ if(in == null || ftpClient.getReplyCode() == FTPReply.FILE_UNAVAILABLE){
return "该文件不存在"; throw BusinessException.build("预览图片失败,该文件不存在");
} }
ByteArrayOutputStream outStream = new ByteArrayOutputStream(); ByteArrayOutputStream outStream = new ByteArrayOutputStream();
@ -115,13 +126,13 @@ public class FileUploadedServiceImpl implements FileUploadedService {
out.write(data); out.write(data);
out.flush(); out.flush();
}catch (Exception e){ }catch (Exception e){
return "图片获取失败"+e.getMessage(); throw BusinessException.build("预览图片失败"+e.getMessage());
}finally { }finally {
out.close(); out.close();
// in.close(); // in.close();
} }
return "渲染图片成功"; return null;
} }
@Override @Override
@ -173,6 +184,8 @@ public class FileUploadedServiceImpl implements FileUploadedService {
String site = request.getParameter("site"); String site = request.getParameter("site");
String taskNo = request.getParameter("taskNo"); String taskNo = request.getParameter("taskNo");
String fileType = request.getParameter("fileType"); String fileType = request.getParameter("fileType");
String status = request.getParameter("status");
String ftpPath = taskNo + "/" + status;
if (StringUtil.isBlank(site)) { if (StringUtil.isBlank(site)) {
site = CommonMethods.getSite(); site = CommonMethods.getSite();
@ -181,11 +194,11 @@ public class FileUploadedServiceImpl implements FileUploadedService {
String fileName = fileItem.getName(); String fileName = fileItem.getName();
try { try {
Ftp ftp = new Ftp(host, port,username,password); Ftp ftp = new Ftp(host, port,username,password);
ftp.upload(taskNo, fileName, fileItem.getInputStream()); ftp.upload(ftpPath, fileName, fileItem.getInputStream());
ftp.close(); ftp.close();
} catch (IOException e) { } catch (IOException e) {
logger.info(e.getMessage()); logger.info(e.getMessage());
throw BusinessException.build("" + e.getMessage()); throw BusinessException.build("上传图片失败" + e.getMessage());
} }
} }
} }

@ -1,14 +1,14 @@
package com.foreverwin.mesnac.anomaly.service.impl; package com.foreverwin.mesnac.anomaly.service.impl;
import com.foreverwin.modular.core.util.FrontPage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.anomaly.model.UploadPictures; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.foreverwin.mesnac.anomaly.mapper.UploadPicturesMapper; import com.foreverwin.mesnac.anomaly.mapper.UploadPicturesMapper;
import com.foreverwin.mesnac.anomaly.model.UploadPictures;
import com.foreverwin.mesnac.anomaly.service.UploadPicturesService; import com.foreverwin.mesnac.anomaly.service.UploadPicturesService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.foreverwin.modular.core.util.FrontPage;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.List;
@ -17,8 +17,8 @@ import java.util.List;
* *
* </p> * </p>
* *
* @author Leon.L * @author zjw
* @since 2021-07-11 * @since 2021-09-09
*/ */
@Service @Service
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)

@ -15,11 +15,12 @@
<result column="CREATED_DATE_TIME" property="createdDateTime" /> <result column="CREATED_DATE_TIME" property="createdDateTime" />
<result column="MODIFIED_USER" property="modifiedUser" /> <result column="MODIFIED_USER" property="modifiedUser" />
<result column="MODIFIED_DATE_TIME" property="modifiedDateTime" /> <result column="MODIFIED_DATE_TIME" property="modifiedDateTime" />
<result column="STATUS" property="status" />
</resultMap> </resultMap>
<!-- 通用查询结果列 --> <!-- 通用查询结果列 -->
<sql id="Base_Column_List"> <sql id="Base_Column_List">
HANDLE, SITE, PICTURE_PATH, PICTURE_ADDRESS, OBJECT_BO, NUM, TYPE, CREATED_USER, CREATED_DATE_TIME, MODIFIED_USER, MODIFIED_DATE_TIME HANDLE, SITE, PICTURE_PATH, PICTURE_ADDRESS, OBJECT_BO, NUM, TYPE, CREATED_USER, CREATED_DATE_TIME, MODIFIED_USER, MODIFIED_DATE_TIME, STATUS
</sql> </sql>
<!-- BaseMapper标准查询/修改/删除 --> <!-- BaseMapper标准查询/修改/删除 -->
@ -64,6 +65,7 @@
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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.modifiedUser!=null"> AND MODIFIED_USER=#{ew.entity.modifiedUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if> <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
</where> </where>
</select> </select>
@ -85,6 +87,7 @@
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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.modifiedUser!=null"> AND MODIFIED_USER=#{ew.entity.modifiedUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if> <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
</if> </if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere"> <if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment} ${ew.sqlSegment}
@ -114,6 +117,7 @@
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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.modifiedUser!=null"> AND MODIFIED_USER=#{ew.entity.modifiedUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if> <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
</if> </if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere"> <if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment} ${ew.sqlSegment}
@ -143,6 +147,7 @@
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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.modifiedUser!=null"> AND MODIFIED_USER=#{ew.entity.modifiedUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if> <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
</if> </if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere"> <if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment} ${ew.sqlSegment}
@ -172,6 +177,7 @@
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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.modifiedUser!=null"> AND MODIFIED_USER=#{ew.entity.modifiedUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if> <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
</if> </if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere"> <if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment} ${ew.sqlSegment}
@ -201,6 +207,7 @@
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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.modifiedUser!=null"> AND MODIFIED_USER=#{ew.entity.modifiedUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if> <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
</if> </if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere"> <if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment} ${ew.sqlSegment}
@ -230,6 +237,7 @@
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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.modifiedUser!=null"> AND MODIFIED_USER=#{ew.entity.modifiedUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if> <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
</if> </if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere"> <if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment} ${ew.sqlSegment}
@ -255,6 +263,7 @@
<if test="createdDateTime!=null">CREATED_DATE_TIME,</if> <if test="createdDateTime!=null">CREATED_DATE_TIME,</if>
<if test="modifiedUser!=null">MODIFIED_USER,</if> <if test="modifiedUser!=null">MODIFIED_USER,</if>
<if test="modifiedDateTime!=null">MODIFIED_DATE_TIME,</if> <if test="modifiedDateTime!=null">MODIFIED_DATE_TIME,</if>
<if test="status!=null">STATUS,</if>
</trim> VALUES </trim> VALUES
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
#{handle}, #{handle},
@ -268,6 +277,7 @@
<if test="createdDateTime!=null">#{createdDateTime},</if> <if test="createdDateTime!=null">#{createdDateTime},</if>
<if test="modifiedUser!=null">#{modifiedUser},</if> <if test="modifiedUser!=null">#{modifiedUser},</if>
<if test="modifiedDateTime!=null">#{modifiedDateTime},</if> <if test="modifiedDateTime!=null">#{modifiedDateTime},</if>
<if test="status!=null">#{status},</if>
</trim> </trim>
</insert> </insert>
@ -288,6 +298,7 @@
#{createdDateTime}, #{createdDateTime},
#{modifiedUser}, #{modifiedUser},
#{modifiedDateTime}, #{modifiedDateTime},
#{status},
</trim> </trim>
</insert> </insert>
@ -304,6 +315,7 @@
<if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</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.modifiedUser!=null">MODIFIED_USER=#{et.modifiedUser},</if>
<if test="et.modifiedDateTime!=null">MODIFIED_DATE_TIME=#{et.modifiedDateTime},</if> <if test="et.modifiedDateTime!=null">MODIFIED_DATE_TIME=#{et.modifiedDateTime},</if>
<if test="et.status!=null">STATUS=#{et.status},</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> </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>
@ -320,6 +332,7 @@
CREATED_DATE_TIME=#{et.createdDateTime}, CREATED_DATE_TIME=#{et.createdDateTime},
MODIFIED_USER=#{et.modifiedUser}, MODIFIED_USER=#{et.modifiedUser},
MODIFIED_DATE_TIME=#{et.modifiedDateTime}, MODIFIED_DATE_TIME=#{et.modifiedDateTime},
STATUS=#{et.status},
</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> </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>
@ -336,6 +349,7 @@
<if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</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.modifiedUser!=null">MODIFIED_USER=#{et.modifiedUser},</if>
<if test="et.modifiedDateTime!=null">MODIFIED_DATE_TIME=#{et.modifiedDateTime},</if> <if test="et.modifiedDateTime!=null">MODIFIED_DATE_TIME=#{et.modifiedDateTime},</if>
<if test="et.status!=null">STATUS=#{et.status},</if>
</trim> </trim>
<where> <where>
<if test="ew!=null"> <if test="ew!=null">
@ -351,6 +365,7 @@
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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.modifiedUser!=null"> AND MODIFIED_USER=#{ew.entity.modifiedUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if> <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
</if> </if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere"> <if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment} ${ew.sqlSegment}
@ -397,6 +412,7 @@
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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.modifiedUser!=null"> AND MODIFIED_USER=#{ew.entity.modifiedUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if> <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
<if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
</if> </if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere"> <if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment} ${ew.sqlSegment}

@ -30,11 +30,11 @@ public interface ResrceMapper extends BaseMapper<Resrce> {
*/ */
List<Map<String, Object>> selectResourceTypeResourceList(@Param("site") String site); List<Map<String, Object>> selectResourceTypeResourceList(@Param("site") String site);
Resrce findByResrce(@Param("site")String site,@Param("resrce")String resrce); Resrce findByResrce(@Param("site") String site, @Param("resrce") String resrce);
List<Resrce> findAllResrce(@Param("site")String site); List<Resrce> findAllResrce(@Param("site") String site);
List<Resrce> findResourceListByResourceType(@Param("site")String site,@Param("resourceTypeBo")String resourceTypeBo); List<Resrce> findResourceListByResourceType(@Param("site") String site, @Param("resourceTypeBo") String resourceTypeBo);
List<Map<String, Object>> selectResourceOperation(@Param("resourceBo") String resourceBo); List<Map<String, Object>> selectResourceOperation(@Param("resourceBo") String resourceBo);
@ -44,4 +44,7 @@ public interface ResrceMapper extends BaseMapper<Resrce> {
String isInspectByResrce(@Param("site") String site, @Param("resrce") String resrce); String isInspectByResrce(@Param("site") String site, @Param("resrce") String resrce);
} }

@ -2,6 +2,7 @@ package com.foreverwin.mesnac.meapi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.meapi.model.Resrce;
import com.foreverwin.mesnac.meapi.model.WorkCenter; import com.foreverwin.mesnac.meapi.model.WorkCenter;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@ -22,10 +23,10 @@ public interface WorkCenterMapper extends BaseMapper<WorkCenter> {
List<WorkCenter> getWorkShopList(@Param("site")String site, @Param("locale")String locale); List<WorkCenter> getWorkShopList(@Param("site")String site, @Param("locale")String locale);
WorkCenter findWorkCenterDescriptionByResrce(@Param("resrceBo")String resourceBo, WorkCenter findWorkCenterByResrce(@Param("resrce") Resrce resrce);
@Param("locale")String locale);
WorkCenter findWorkCenterDescriptionByWorkCenter(@Param("site")String site, WorkCenter findWorkCenterDescriptionByWorkCenter(@Param("site")String site,
@Param("workCenter")String workCenter, @Param("workCenter")String workCenter,
@Param("locale")String locale); @Param("locale")String locale);
} }

@ -487,11 +487,17 @@
WHERE WC.WC_CATEGORY = 'LEVEL4' AND WC.SITE = #{site} WHERE WC.WC_CATEGORY = 'LEVEL4' AND WC.SITE = #{site}
</select> </select>
<select id="findWorkCenterDescriptionByResrce" resultMap="BaseResultMap"> <select id="findWorkCenterByResrce" resultMap="BaseResultMap">
SELECT WCT.DESCRIPTION DESCRIPTION,SUBSTR(WCM.WORK_CENTER_BO,INSTR(WCM.WORK_CENTER_BO,',',-1)+1) WORK_CENTER SELECT wc.WORK_CENTER WORK_CENTER,wct.DESCRIPTION DESCRIPTION
FROM WORK_CENTER_MEMBER WCM FROM RESRCE r
INNER JOIN WORK_CENTER_T WCT ON WCM.WORK_CENTER_BO = WCT.WORK_CENTER_BO AND WCT.LOCALE = #{locale} LEFT JOIN WORK_CENTER_MEMBER wcm ON wcm.WORK_CENTER_OR_RESOURCE_GBO = r.HANDLE
WHERE WCM.WORK_CENTER_OR_RESOURCE_GBO = #{resrceBo} LEFT JOIN WORK_CENTER_MEMBER wcm2 ON wcm2.WORK_CENTER_OR_RESOURCE_GBO = wcm.WORK_CENTER_BO
LEFT JOIN WORK_CENTER wc ON wc.HANDLE = wcm2.WORK_CENTER_BO
LEFT JOIN WORK_CENTER_T wct ON wct.WORK_CENTER_BO = wc.HANDLE AND wct.LOCALE = 'zh'
<where>
r.SITE = #{resrce.site} AND
r.RESRCE = #{resrce.resrce}
</where>
</select> </select>
<select id="findWorkCenterDescriptionByWorkCenter" resultMap="BaseResultMap"> <select id="findWorkCenterDescriptionByWorkCenter" resultMap="BaseResultMap">

Loading…
Cancel
Save