标签打印

Leon 4 years ago
parent 197dcabf68
commit 17a45bff59

@ -1,5 +1,6 @@
package com.foreverwin.mesnac.common.controller;
import com.foreverwin.modular.core.exception.BusinessException;
import com.foreverwin.modular.core.util.R;
import com.foreverwin.modular.core.util.FrontPage;
import com.foreverwin.modular.core.util.CommonMethods;
@ -15,8 +16,8 @@ import java.util.List;
/**
*
* @author Philip
* @since 2021-07-16
* @author Leon.L
* @since 2021-07-21
*/
@RestController
@RequestMapping("/Z-PRINT-LOG")
@ -25,112 +26,44 @@ public class PrintLogController {
@Autowired
public PrintLogService printLogService;
/**
* id
*
* @param id
* @return
*/
@ResponseBody
@GetMapping("/{id:.+}")
public R getPrintLogById(@PathVariable String id) {
return R.ok( printLogService.getById(id));
}
/**
*
*
* @return
*/
@ResponseBody
@GetMapping("")
public R getPrintLogList(PrintLog printLog){
@PostMapping("")
public R getPrintLogList(@RequestBody PrintLog printLog){
List<PrintLog> result;
QueryWrapper<PrintLog> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(printLog);
result = printLogService.list(queryWrapper);
return R.ok(result);
}
try {
String site = CommonMethods.getSite();
printLog.setSite(site);
/**
*
*
* @param frontPage
* @return
*/
@ResponseBody
@GetMapping("/page")
public R page(FrontPage<PrintLog> frontPage, PrintLog printLog){
IPage result;
QueryWrapper<PrintLog> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(printLog);
if (frontPage.getGlobalQuery() != null && !"".equals(frontPage.getGlobalQuery().trim())) {
//TODO modify global query
queryWrapper.lambda().and(wrapper -> wrapper
.like(PrintLog::getHandle, frontPage.getGlobalQuery())
.or().like(PrintLog::getSite, frontPage.getGlobalQuery())
.or().like(PrintLog::getCategory, frontPage.getGlobalQuery())
.or().like(PrintLog::getPrintName, frontPage.getGlobalQuery())
.or().like(PrintLog::getPrintTemplate, frontPage.getGlobalQuery())
.or().like(PrintLog::getPrintParam, frontPage.getGlobalQuery())
.or().like(PrintLog::getSfc, frontPage.getGlobalQuery())
.or().like(PrintLog::getResrce, frontPage.getGlobalQuery())
.or().like(PrintLog::getStepId, frontPage.getGlobalQuery())
.or().like(PrintLog::getOperation, frontPage.getGlobalQuery())
.or().like(PrintLog::getInventory, frontPage.getGlobalQuery())
.or().like(PrintLog::getComments, frontPage.getGlobalQuery())
.or().like(PrintLog::getOther1, frontPage.getGlobalQuery())
.or().like(PrintLog::getOther2, frontPage.getGlobalQuery())
.or().like(PrintLog::getOther3, frontPage.getGlobalQuery())
.or().like(PrintLog::getOther4, frontPage.getGlobalQuery())
.or().like(PrintLog::getOther5, frontPage.getGlobalQuery())
.or().like(PrintLog::getCreateUser, frontPage.getGlobalQuery())
.or().like(PrintLog::getModifyUser, frontPage.getGlobalQuery())
);
QueryWrapper<PrintLog> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(printLog);
result = printLogService.list(queryWrapper);
} catch (Exception e) {
return R.failed(e.getMessage());
}
result = printLogService.page(frontPage.getPagePlus(), queryWrapper);
return R.ok(result);
}
/**
*
* @param printLog
* @return null
*/
@PostMapping
public R save(@RequestBody PrintLog printLog) {
return R.ok(printLogService.save(printLog));
}
/**
*
* @param printLog
* @return null
*/
@PutMapping
public R updateById(@RequestBody PrintLog printLog) {
return R.ok(printLogService.updateById(printLog));
return R.ok(result);
}
/**
* id
* @param id ID
* @return 0 1
*/
@ResponseBody
@RequestMapping(method = RequestMethod.DELETE, value = "/{id:.+}")
public R removeById(@PathVariable("id") String id){
return R.ok(printLogService.removeById(id));
}
@PostMapping("/labelPrint")
public R labelPrint(@RequestBody List<PrintLog> requestList) {
try {
if (requestList == null || requestList.size() <= 0) {
throw BusinessException.build("请选择至少一笔记录进行操作!");
}
/**
*
* @param ids ID
* @return 0 1
*/
@ResponseBody
@RequestMapping(method = RequestMethod.POST, value = "/delete-batch")
public R removeByIds(List<String> ids){
return R.ok(printLogService.removeByIds(ids));
String site = CommonMethods.getSite();
String user = CommonMethods.getUser();
printLogService.labelPrint(site, user, requestList);
} catch (Exception e) {
return R.failed(e.getMessage());
}
return R.ok();
}
}

@ -15,8 +15,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
*
* </p>
*
* @author Philip
* @since 2021-07-16
* @author Leon.L
* @since 2021-07-21
*/
@TableName("Z_PRINT_LOG")
@ -79,8 +79,14 @@ public class PrintLog extends Model<PrintLog> {
*/
@TableField("INVENTORY")
private String inventory;
@TableField("ITEM_BO")
private String itemBo;
@TableField("COMMENTS")
private String comments;
@TableField("IS_PRINT")
private String isPrint;
@TableField("PRINT_NUM")
private Integer printNum;
@TableField("OTHER_1")
private String other1;
@TableField("OTHER_2")
@ -113,6 +119,12 @@ public class PrintLog extends Model<PrintLog> {
private LocalDateTime modifiedDateTime;
@TableField(value = "ITEM", exist = false)
private String item;
@TableField(value = "ITEM_DESCRIPTION", exist = false)
private String itemDescription;
public String getHandle() {
return handle;
}
@ -201,6 +213,14 @@ public class PrintLog extends Model<PrintLog> {
this.inventory = inventory;
}
public String getItemBo() {
return itemBo;
}
public void setItemBo(String itemBo) {
this.itemBo = itemBo;
}
public String getComments() {
return comments;
}
@ -209,6 +229,22 @@ public class PrintLog extends Model<PrintLog> {
this.comments = comments;
}
public String getIsPrint() {
return isPrint;
}
public void setIsPrint(String isPrint) {
this.isPrint = isPrint;
}
public Integer getPrintNum() {
return printNum;
}
public void setPrintNum(Integer printNum) {
this.printNum = printNum;
}
public String getOther1() {
return other1;
}
@ -281,6 +317,22 @@ public class PrintLog extends Model<PrintLog> {
this.modifiedDateTime = modifiedDateTime;
}
public String getItem() {
return item;
}
public void setItem(String item) {
this.item = item;
}
public String getItemDescription() {
return itemDescription;
}
public void setItemDescription(String itemDescription) {
this.itemDescription = itemDescription;
}
public static final String HANDLE = "HANDLE";
public static final String SITE = "SITE";
@ -303,8 +355,14 @@ public class PrintLog extends Model<PrintLog> {
public static final String INVENTORY = "INVENTORY";
public static final String ITEM_BO = "ITEM_BO";
public static final String COMMENTS = "COMMENTS";
public static final String IS_PRINT = "IS_PRINT";
public static final String PRINT_NUM = "PRINT_NUM";
public static final String OTHER_1 = "OTHER_1";
public static final String OTHER_2 = "OTHER_2";
@ -343,7 +401,10 @@ public class PrintLog extends Model<PrintLog> {
", stepId = " + stepId +
", operation = " + operation +
", inventory = " + inventory +
", itemBo = " + itemBo +
", comments = " + comments +
", isPrint = " + isPrint +
", printNum = " + printNum +
", other1 = " + other1 +
", other2 = " + other2 +
", other3 = " + other3 +

@ -3,6 +3,8 @@ package com.foreverwin.mesnac.common.service;
import com.foreverwin.mesnac.common.model.PrintLog;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
*
@ -19,4 +21,13 @@ public interface PrintLogService extends IService<PrintLog> {
* @param printLog
*/
void savePrintLog(String site, String user, PrintLog printLog);
/**
*
*
* @param site
* @param user
* @param printList
*/
void labelPrint(String site, String user, List<PrintLog> printList);
}

@ -1,13 +0,0 @@
package com.foreverwin.mesnac.common.service;
import com.foreverwin.mesnac.common.model.PrintRequest;
/**
* @author Ervin Chen
* @date 2020/3/6 13:37
*/
public interface PrintService {
void print(PrintRequest printRequest);
}

@ -1,16 +1,21 @@
package com.foreverwin.mesnac.common.service.impl;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.foreverwin.mesnac.common.model.PrintLog;
import com.foreverwin.mesnac.common.mapper.PrintLogMapper;
import com.foreverwin.mesnac.common.service.PrintLogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.List;
/**
* <p>
@ -24,6 +29,8 @@ import java.time.LocalDateTime;
@Transactional(rollbackFor = Exception.class)
public class PrintLogServiceImpl extends ServiceImpl<PrintLogMapper, PrintLog> implements PrintLogService {
@Value("${print.server}")
private String printServer;
@Autowired
private PrintLogMapper printLogMapper;
@ -40,4 +47,23 @@ public class PrintLogServiceImpl extends ServiceImpl<PrintLogMapper, PrintLog> i
printLog.setModifiedDateTime(dateTime);
this.save(printLog);
}
@Override
public void labelPrint(String site, String user, List<PrintLog> printList) {
if (printList == null || printList.size() <= 0) {
return;
}
JSONArray jsonArray = new JSONArray();
for (PrintLog printLog : printList) {
JSONObject _json = new JSONObject();
_json.put("PRINTER", printLog.getPrintName());
_json.put("PRINT_TEMPLATE", printLog.getPrintTemplate());
_json.put("PRINT_PARAM", printLog.getPrintParam());
jsonArray.add(_json);
}
HttpUtil.post(printServer, jsonArray.toJSONString(), 30000);
}
}

@ -1,39 +0,0 @@
package com.foreverwin.mesnac.common.service.impl;
import com.foreverwin.mesnac.common.model.PrintRequest;
import com.foreverwin.mesnac.common.service.PrintService;
import com.foreverwin.mesnac.common.util.HttpUtils;
import com.foreverwin.mesnac.meapi.util.StringUtils;
import com.foreverwin.modular.core.exception.BusinessException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
/**
* @author Ervin Chen
* @date 2020/3/6 13:38
*/
@Service
public class PrintServiceImpl implements PrintService {
@Value("${print.server}")
private String printServer;
@Override
public void print(PrintRequest printRequest) {
String printer = printRequest.getPrinter();
String printTemplate = printRequest.getTemplate();
if (StringUtils.isBlank(printer)) {
throw BusinessException.build("打印机未维护");
}
if (StringUtils.isBlank(printTemplate)) {
throw BusinessException.build("打印模板未维护");
}
//发送打印请求
ResponseEntity responseEntity = HttpUtils.callPost(printServer, "REQUEST_DATA=" + printRequest.toString());
}
}

@ -15,7 +15,12 @@
<result column="STEP_ID" property="stepId" />
<result column="OPERATION" property="operation" />
<result column="INVENTORY" property="inventory" />
<result column="ITEM_BO" property="itemBo" />
<result column="ITEM" property="item" />
<result column="ITEM_DESCRIPTION" property="itemDescription" />
<result column="COMMENTS" property="comments" />
<result column="IS_PRINT" property="isPrint" />
<result column="PRINT_NUM" property="printNum" />
<result column="OTHER_1" property="other1" />
<result column="OTHER_2" property="other2" />
<result column="OTHER_3" property="other3" />
@ -29,7 +34,7 @@
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
HANDLE, SITE, CATEGORY, PRINT_NAME, PRINT_TEMPLATE, PRINT_PARAM, SFC, RESRCE, STEP_ID, OPERATION, INVENTORY, COMMENTS, OTHER_1, OTHER_2, OTHER_3, OTHER_4, OTHER_5, CREATE_USER, CREATED_DATE_TIME, MODIFY_USER, MODIFIED_DATE_TIME
HANDLE, SITE, CATEGORY, PRINT_NAME, PRINT_TEMPLATE, PRINT_PARAM, SFC, RESRCE, STEP_ID, OPERATION, INVENTORY, ITEM_BO, COMMENTS, IS_PRINT, PRINT_NUM, OTHER_1, OTHER_2, OTHER_3, OTHER_4, OTHER_5, CREATE_USER, CREATED_DATE_TIME, MODIFY_USER, MODIFIED_DATE_TIME
</sql>
<!-- BaseMapper标准查询/修改/删除 -->
@ -51,117 +56,38 @@
</if>
</select>
<select id="selectBatchIds" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include>
FROM Z_PRINT_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_PRINT_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.category!=null"> AND CATEGORY=#{ew.entity.category}</if>
<if test="ew.entity.printName!=null"> AND PRINT_NAME=#{ew.entity.printName}</if>
<if test="ew.entity.printTemplate!=null"> AND PRINT_TEMPLATE=#{ew.entity.printTemplate}</if>
<if test="ew.entity.printParam!=null"> AND PRINT_PARAM=#{ew.entity.printParam}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</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.inventory!=null"> AND INVENTORY=#{ew.entity.inventory}</if>
<if test="ew.entity.comments!=null"> AND COMMENTS=#{ew.entity.comments}</if>
<if test="ew.entity.other1!=null"> AND OTHER_1=#{ew.entity.other1}</if>
<if test="ew.entity.other2!=null"> AND OTHER_2=#{ew.entity.other2}</if>
<if test="ew.entity.other3!=null"> AND OTHER_3=#{ew.entity.other3}</if>
<if test="ew.entity.other4!=null"> AND OTHER_4=#{ew.entity.other4}</if>
<if test="ew.entity.other5!=null"> AND OTHER_5=#{ew.entity.other5}</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 test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</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_PRINT_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.category!=null"> AND CATEGORY=#{ew.entity.category}</if>
<if test="ew.entity.printName!=null"> AND PRINT_NAME=#{ew.entity.printName}</if>
<if test="ew.entity.printTemplate!=null"> AND PRINT_TEMPLATE=#{ew.entity.printTemplate}</if>
<if test="ew.entity.printParam!=null"> AND PRINT_PARAM=#{ew.entity.printParam}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</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.inventory!=null"> AND INVENTORY=#{ew.entity.inventory}</if>
<if test="ew.entity.comments!=null"> AND COMMENTS=#{ew.entity.comments}</if>
<if test="ew.entity.other1!=null"> AND OTHER_1=#{ew.entity.other1}</if>
<if test="ew.entity.other2!=null"> AND OTHER_2=#{ew.entity.other2}</if>
<if test="ew.entity.other3!=null"> AND OTHER_3=#{ew.entity.other3}</if>
<if test="ew.entity.other4!=null"> AND OTHER_4=#{ew.entity.other4}</if>
<if test="ew.entity.other5!=null"> AND OTHER_5=#{ew.entity.other5}</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 test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</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_PRINT_LOG
SELECT ZL.HANDLE, ZL.SITE, ZL.CATEGORY, ZL.PRINT_NAME, ZL.PRINT_TEMPLATE, ZL.PRINT_PARAM, ZL.SFC, ZL.RESRCE, ZL.STEP_ID, ZL.OPERATION, ZL.INVENTORY, ZL.ITEM_BO, IM.ITEM, IT.DESCRIPTION ITEM_DESCRIPTION, ZL.COMMENTS, ZL.IS_PRINT, ZL.PRINT_NUM, ZL.CREATE_USER, ZL.CREATED_DATE_TIME, ZL.MODIFY_USER, ZL.MODIFIED_DATE_TIME
FROM Z_PRINT_LOG ZL
LEFT JOIN ITEM IM ON ZL.ITEM_BO = IM.HANDLE
LEFT JOIN ITEM_T IT ON IT.ITEM_BO = IM.HANDLE AND IT.LOCALE = 'zh'
<where>
<if test="ew!=null">
<if test="ew.entity!=null">
<if test="ew.entity.handle!=null">
HANDLE=#{ew.entity.handle}
ZL.HANDLE=#{ew.entity.handle}
</if>
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
<if test="ew.entity.category!=null"> AND CATEGORY=#{ew.entity.category}</if>
<if test="ew.entity.printName!=null"> AND PRINT_NAME=#{ew.entity.printName}</if>
<if test="ew.entity.printTemplate!=null"> AND PRINT_TEMPLATE=#{ew.entity.printTemplate}</if>
<if test="ew.entity.printParam!=null"> AND PRINT_PARAM=#{ew.entity.printParam}</if>
<if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</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.inventory!=null"> AND INVENTORY=#{ew.entity.inventory}</if>
<if test="ew.entity.comments!=null"> AND COMMENTS=#{ew.entity.comments}</if>
<if test="ew.entity.other1!=null"> AND OTHER_1=#{ew.entity.other1}</if>
<if test="ew.entity.other2!=null"> AND OTHER_2=#{ew.entity.other2}</if>
<if test="ew.entity.other3!=null"> AND OTHER_3=#{ew.entity.other3}</if>
<if test="ew.entity.other4!=null"> AND OTHER_4=#{ew.entity.other4}</if>
<if test="ew.entity.other5!=null"> AND OTHER_5=#{ew.entity.other5}</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 test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
<if test="ew.entity.site!=null"> AND ZL.SITE=#{ew.entity.site}</if>
<if test="ew.entity.category!=null"> AND ZL.CATEGORY=#{ew.entity.category}</if>
<if test="ew.entity.printName!=null"> AND ZL.PRINT_NAME=#{ew.entity.printName}</if>
<if test="ew.entity.printTemplate!=null"> AND ZL.PRINT_TEMPLATE=#{ew.entity.printTemplate}</if>
<if test="ew.entity.sfc!=null"> AND ZL.SFC=#{ew.entity.sfc}</if>
<if test="ew.entity.resrce!=null"> AND ZL.RESRCE=#{ew.entity.resrce}</if>
<if test="ew.entity.stepId!=null"> AND ZL.STEP_ID=#{ew.entity.stepId}</if>
<if test="ew.entity.operation!=null"> AND ZL.OPERATION=#{ew.entity.operation}</if>
<if test="ew.entity.inventory!=null"> AND ZL.INVENTORY=#{ew.entity.inventory}</if>
<if test="ew.entity.itemBo!=null"> AND ZL.ITEM_BO=#{ew.entity.itemBo}</if>
<if test="ew.entity.comments!=null"> AND ZL.COMMENTS=#{ew.entity.comments}</if>
<if test="ew.entity.isPrint!=null"> AND ZL.IS_PRINT=#{ew.entity.isPrint}</if>
<if test="ew.entity.printNum!=null"> AND ZL.PRINT_NUM=#{ew.entity.printNum}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
AND ${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
AND ${ew.sqlSegment}
</if>
</select>
@ -183,7 +109,10 @@
<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.inventory!=null"> AND INVENTORY=#{ew.entity.inventory}</if>
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
<if test="ew.entity.comments!=null"> AND COMMENTS=#{ew.entity.comments}</if>
<if test="ew.entity.isPrint!=null"> AND IS_PRINT=#{ew.entity.isPrint}</if>
<if test="ew.entity.printNum!=null"> AND PRINT_NUM=#{ew.entity.printNum}</if>
<if test="ew.entity.other1!=null"> AND OTHER_1=#{ew.entity.other1}</if>
<if test="ew.entity.other2!=null"> AND OTHER_2=#{ew.entity.other2}</if>
<if test="ew.entity.other3!=null"> AND OTHER_3=#{ew.entity.other3}</if>
@ -222,7 +151,10 @@
<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.inventory!=null"> AND INVENTORY=#{ew.entity.inventory}</if>
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
<if test="ew.entity.comments!=null"> AND COMMENTS=#{ew.entity.comments}</if>
<if test="ew.entity.isPrint!=null"> AND IS_PRINT=#{ew.entity.isPrint}</if>
<if test="ew.entity.printNum!=null"> AND PRINT_NUM=#{ew.entity.printNum}</if>
<if test="ew.entity.other1!=null"> AND OTHER_1=#{ew.entity.other1}</if>
<if test="ew.entity.other2!=null"> AND OTHER_2=#{ew.entity.other2}</if>
<if test="ew.entity.other3!=null"> AND OTHER_3=#{ew.entity.other3}</if>
@ -261,7 +193,10 @@
<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.inventory!=null"> AND INVENTORY=#{ew.entity.inventory}</if>
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
<if test="ew.entity.comments!=null"> AND COMMENTS=#{ew.entity.comments}</if>
<if test="ew.entity.isPrint!=null"> AND IS_PRINT=#{ew.entity.isPrint}</if>
<if test="ew.entity.printNum!=null"> AND PRINT_NUM=#{ew.entity.printNum}</if>
<if test="ew.entity.other1!=null"> AND OTHER_1=#{ew.entity.other1}</if>
<if test="ew.entity.other2!=null"> AND OTHER_2=#{ew.entity.other2}</if>
<if test="ew.entity.other3!=null"> AND OTHER_3=#{ew.entity.other3}</if>
@ -300,7 +235,10 @@
<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.inventory!=null"> AND INVENTORY=#{ew.entity.inventory}</if>
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
<if test="ew.entity.comments!=null"> AND COMMENTS=#{ew.entity.comments}</if>
<if test="ew.entity.isPrint!=null"> AND IS_PRINT=#{ew.entity.isPrint}</if>
<if test="ew.entity.printNum!=null"> AND PRINT_NUM=#{ew.entity.printNum}</if>
<if test="ew.entity.other1!=null"> AND OTHER_1=#{ew.entity.other1}</if>
<if test="ew.entity.other2!=null"> AND OTHER_2=#{ew.entity.other2}</if>
<if test="ew.entity.other3!=null"> AND OTHER_3=#{ew.entity.other3}</if>
@ -335,7 +273,10 @@
<if test="stepId!=null">STEP_ID,</if>
<if test="operation!=null">OPERATION,</if>
<if test="inventory!=null">INVENTORY,</if>
<if test="itemBo!=null">ITEM_BO,</if>
<if test="comments!=null">COMMENTS,</if>
<if test="isPrint!=null">IS_PRINT,</if>
<if test="printNum!=null">PRINT_NUM,</if>
<if test="other1!=null">OTHER_1,</if>
<if test="other2!=null">OTHER_2,</if>
<if test="other3!=null">OTHER_3,</if>
@ -358,7 +299,10 @@
<if test="stepId!=null">#{stepId},</if>
<if test="operation!=null">#{operation},</if>
<if test="inventory!=null">#{inventory},</if>
<if test="itemBo!=null">#{itemBo},</if>
<if test="comments!=null">#{comments},</if>
<if test="isPrint!=null">#{isPrint},</if>
<if test="printNum!=null">#{printNum},</if>
<if test="other1!=null">#{other1},</if>
<if test="other2!=null">#{other2},</if>
<if test="other3!=null">#{other3},</if>
@ -388,7 +332,10 @@
#{stepId},
#{operation},
#{inventory},
#{itemBo},
#{comments},
#{isPrint},
#{printNum},
#{other1},
#{other2},
#{other3},
@ -414,7 +361,10 @@
<if test="et.stepId!=null">STEP_ID=#{et.stepId},</if>
<if test="et.operation!=null">OPERATION=#{et.operation},</if>
<if test="et.inventory!=null">INVENTORY=#{et.inventory},</if>
<if test="et.itemBo!=null">ITEM_BO=#{et.itemBo},</if>
<if test="et.comments!=null">COMMENTS=#{et.comments},</if>
<if test="et.isPrint!=null">IS_PRINT=#{et.isPrint},</if>
<if test="et.printNum!=null">PRINT_NUM=#{et.printNum},</if>
<if test="et.other1!=null">OTHER_1=#{et.other1},</if>
<if test="et.other2!=null">OTHER_2=#{et.other2},</if>
<if test="et.other3!=null">OTHER_3=#{et.other3},</if>
@ -440,7 +390,10 @@
STEP_ID=#{et.stepId},
OPERATION=#{et.operation},
INVENTORY=#{et.inventory},
ITEM_BO=#{et.itemBo},
COMMENTS=#{et.comments},
IS_PRINT=#{et.isPrint},
PRINT_NUM=#{et.printNum},
OTHER_1=#{et.other1},
OTHER_2=#{et.other2},
OTHER_3=#{et.other3},
@ -466,7 +419,10 @@
<if test="et.stepId!=null">STEP_ID=#{et.stepId},</if>
<if test="et.operation!=null">OPERATION=#{et.operation},</if>
<if test="et.inventory!=null">INVENTORY=#{et.inventory},</if>
<if test="et.itemBo!=null">ITEM_BO=#{et.itemBo},</if>
<if test="et.comments!=null">COMMENTS=#{et.comments},</if>
<if test="et.isPrint!=null">IS_PRINT=#{et.isPrint},</if>
<if test="et.printNum!=null">PRINT_NUM=#{et.printNum},</if>
<if test="et.other1!=null">OTHER_1=#{et.other1},</if>
<if test="et.other2!=null">OTHER_2=#{et.other2},</if>
<if test="et.other3!=null">OTHER_3=#{et.other3},</if>
@ -491,7 +447,10 @@
<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.inventory!=null"> AND INVENTORY=#{ew.entity.inventory}</if>
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
<if test="ew.entity.comments!=null"> AND COMMENTS=#{ew.entity.comments}</if>
<if test="ew.entity.isPrint!=null"> AND IS_PRINT=#{ew.entity.isPrint}</if>
<if test="ew.entity.printNum!=null"> AND PRINT_NUM=#{ew.entity.printNum}</if>
<if test="ew.entity.other1!=null"> AND OTHER_1=#{ew.entity.other1}</if>
<if test="ew.entity.other2!=null"> AND OTHER_2=#{ew.entity.other2}</if>
<if test="ew.entity.other3!=null"> AND OTHER_3=#{ew.entity.other3}</if>
@ -547,7 +506,10 @@
<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.inventory!=null"> AND INVENTORY=#{ew.entity.inventory}</if>
<if test="ew.entity.itemBo!=null"> AND ITEM_BO=#{ew.entity.itemBo}</if>
<if test="ew.entity.comments!=null"> AND COMMENTS=#{ew.entity.comments}</if>
<if test="ew.entity.isPrint!=null"> AND IS_PRINT=#{ew.entity.isPrint}</if>
<if test="ew.entity.printNum!=null"> AND PRINT_NUM=#{ew.entity.printNum}</if>
<if test="ew.entity.other1!=null"> AND OTHER_1=#{ew.entity.other1}</if>
<if test="ew.entity.other2!=null"> AND OTHER_2=#{ew.entity.other2}</if>
<if test="ew.entity.other3!=null"> AND OTHER_3=#{ew.entity.other3}</if>

@ -1,3 +1,4 @@
#Spring
spring:
datasource:
dynamic:
@ -5,4 +6,31 @@ spring:
datasource:
wip:
driver-class-name: com.sap.db.jdbc.Driver
jndi-name: jdbc/jts/wipPool
jndi-name: jdbc/jts/wipPool
activemq:
enabled: false
brokerUrl: tcp://121.36.58.109:61616?wireFormat.maxInactivityDuration=0
password: admin
user: admin
pool:
enabled: true
max-connections: 10
#WebService
ws:
erp:
server: 172.16.251.223
port: 8000
user: mesd001
pwd: a123456
valid: N
ftp:
host:
port: 21
username:
password:
#打印服务器配置
print:
server: http://localhost:8080/CodeSoftPrintWeb/printService

@ -32,6 +32,38 @@ public class ItemBatchController {
@Autowired
public ItemBatchService itemBatchService;
/**
*
*
* @param frontPage
* @return
*/
@ResponseBody
@GetMapping("/getItemBatchPageList")
public R getItemBatchPageList(FrontPage<ItemBatch> frontPage, ItemBatch itemBatch){
IPage result;
try {
String site = CommonMethods.getSite();
itemBatch.setSite(site);
QueryWrapper<ItemBatch> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(itemBatch);
if (frontPage.getGlobalQuery() != null && !"".equals(frontPage.getGlobalQuery().trim())) {
queryWrapper
.like(ItemBatch.ITEM, frontPage.getGlobalQuery())
.or().like(ItemBatch.BATCH, frontPage.getGlobalQuery())
.or().like(ItemBatch.LABEL, frontPage.getGlobalQuery())
.or().like(ItemBatch.SUPPLIER, frontPage.getGlobalQuery());
}
result = itemBatchService.page(frontPage.getPagePlus(), queryWrapper);
} catch (Exception e) {
return R.failed(e.getMessage());
}
return R.ok(result);
}
@GetMapping("/testErpJK")
public R testErpJK (String shopOrder, String stepId) {

@ -1,6 +1,9 @@
package com.foreverwin.mesnac.dispatch.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.foreverwin.mesnac.dispatch.model.ItemBatch;
import com.baomidou.mybatisplus.extension.service.IService;

@ -1,6 +1,9 @@
package com.foreverwin.mesnac.dispatch.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.dispatch.model.ItemBatch;
import com.foreverwin.mesnac.dispatch.mapper.ItemBatchMapper;

@ -224,12 +224,12 @@
<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}
AND ${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
AND ${ew.sqlSegment}
</if>
</select>

@ -1,8 +1,11 @@
package com.foreverwin.mesnac.integration.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.foreverwin.mesnac.common.constant.Constants;
import com.foreverwin.mesnac.common.constant.CustomFieldConstant;
import com.foreverwin.mesnac.common.enums.HandleEnum;
import com.foreverwin.mesnac.common.model.PrintLog;
import com.foreverwin.mesnac.common.service.PrintLogService;
import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.dispatch.model.ItemBatch;
import com.foreverwin.mesnac.dispatch.service.ItemBatchService;
@ -53,6 +56,8 @@ public class InterfaceServiceImpl implements InterfaceService {
@Autowired
private ResrceService resrceService;
@Autowired
private PrintLogService printLogService;
@Autowired
private ShopOrderService shopOrderService;
@Autowired
private ItemBatchService itemBatchService;
@ -62,6 +67,7 @@ public class InterfaceServiceImpl implements InterfaceService {
private CustomFieldsService customFieldsService;
@Override
public void itemSync(String site, ItemSyncRequest itemSyncRequest) throws Exception{
//物料
@ -772,13 +778,21 @@ public class InterfaceServiceImpl implements InterfaceService {
String supplier = itemBatchReceiveRequest.getSUPPLIER();
LocalDateTime now = LocalDateTime.now();
List<PrintLog> printLogList = new ArrayList<>();
//循环处理 物料批次
for (int i = 0; i < itemBatchDtoList.size(); i++) {
ItemBatchDto itemBatchDto = itemBatchDtoList.get(i);
String item = itemBatchDto.getITEM();
if (StringUtil.isBlank(item)) {
throw BusinessException.build("物料参数不能为空");
throw BusinessException.build("物料参数不能为空");
}
Item itemModel = itemService.selectCurrent(site, item);
if (itemModel == null) {
throw BusinessException.build("物料【" +item+ "】没有维护当前版本!");
}
String spec = itemBatchDto.getSPEC();
String texture = itemBatchDto.getTEXTURE();
String batch = itemBatchDto.getBATCH();
@ -787,6 +801,7 @@ public class InterfaceServiceImpl implements InterfaceService {
}
String factory = itemBatchDto.getFACTORY();
String inventory = item + "*" + batch;
//查询物料和批次是否已经存在记录
List<ItemBatch> itemBatchList = itemBatchService.findItemBatch(site, item, batch);
if (itemBatchList != null && itemBatchList.size() > 0) {
@ -808,12 +823,40 @@ public class InterfaceServiceImpl implements InterfaceService {
itemBatch.setSpec(spec);
itemBatch.setTexture(texture);
itemBatch.setSupplier(supplier);
itemBatch.setLabel(item + "*" + batch);
itemBatch.setLabel(inventory);
itemBatch.setIsPrint("false");
itemBatch.setCreateUser(Constants.SITE_ADMIN);
itemBatch.setCreatedDateTime(now);
itemBatchService.save(itemBatch);
}
//打印模板参数
JSONObject jsonObject = new JSONObject();
jsonObject.put("ITEM", item);
jsonObject.put("ITEM_DESC", itemModel.getDescription());
jsonObject.put("SUPPLIER", supplier);
jsonObject.put("INVENTORY", inventory);
//记录打印数据
PrintLog printLog = new PrintLog();
printLog.setHandle(UUID.randomUUID().toString());
printLog.setSite(site);
printLog.setCategory("INV");
printLog.setPrintName("");
printLog.setPrintTemplate("INV_LABEL");
printLog.setPrintParam(jsonObject.toJSONString());
printLog.setInventory(inventory);
printLog.setItemBo(itemModel.getHandle());
printLog.setIsPrint("false");
printLog.setPrintNum(0);
printLog.setCreateUser("SITE_ADMIN");
printLog.setCreatedDateTime(LocalDateTime.now());
printLogList.add(printLog);
}
if (printLogList != null && printLogList.size() > 0) {
printLogService.saveBatch(printLogList);
}
}

@ -0,0 +1,130 @@
package com.foreverwin.mesnac.meapi.controller;
import com.foreverwin.modular.core.util.R;
import com.foreverwin.modular.core.util.FrontPage;
import com.foreverwin.modular.core.util.CommonMethods;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.foreverwin.mesnac.meapi.service.PrinterService;
import com.foreverwin.mesnac.meapi.model.Printer;
import java.util.List;
/**
*
* @author Leon.L
* @since 2021-07-22
*/
@RestController
@RequestMapping("/PRINTER")
public class PrinterController {
@Autowired
public PrinterService printerService;
/**
* id
*
* @param id
* @return
*/
@ResponseBody
@GetMapping("/{id:.+}")
public R getPrinterById(@PathVariable String id) {
return R.ok( printerService.getById(id));
}
/**
*
*
* @return
*/
@ResponseBody
@GetMapping("")
public R getPrinterList(Printer printer){
List<Printer> result;
try {
String site = CommonMethods.getSite();
printer.setSite(site);
QueryWrapper<Printer> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(printer);
result = printerService.list(queryWrapper);
} catch (Exception e) {
return R.failed(e.getMessage());
}
return R.ok(result);
}
/**
*
*
* @param frontPage
* @return
*/
@ResponseBody
@GetMapping("/page")
public R page(FrontPage<Printer> frontPage, Printer printer){
IPage result;
QueryWrapper<Printer> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(printer);
if (frontPage.getGlobalQuery() != null && !"".equals(frontPage.getGlobalQuery().trim())) {
//TODO modify global query
queryWrapper.lambda().and(wrapper -> wrapper
.like(Printer::getHandle, frontPage.getGlobalQuery())
.or().like(Printer::getSite, frontPage.getGlobalQuery())
.or().like(Printer::getPrinter, frontPage.getGlobalQuery())
.or().like(Printer::getDescription, frontPage.getGlobalQuery())
.or().like(Printer::getEnabled, frontPage.getGlobalQuery())
);
}
result = printerService.page(frontPage.getPagePlus(), queryWrapper);
return R.ok(result);
}
/**
*
* @param printer
* @return null
*/
@PostMapping
public R save(@RequestBody Printer printer) {
return R.ok(printerService.save(printer));
}
/**
*
* @param printer
* @return null
*/
@PutMapping
public R updateById(@RequestBody Printer printer) {
return R.ok(printerService.updateById(printer));
}
/**
* id
* @param id ID
* @return 0 1
*/
@ResponseBody
@RequestMapping(method = RequestMethod.DELETE, value = "/{id:.+}")
public R removeById(@PathVariable("id") String id){
return R.ok(printerService.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(printerService.removeByIds(ids));
}
}

@ -26,6 +26,8 @@ public interface ItemMapper extends BaseMapper<Item> {
List<Item> selectPage(@Param("locale") String locale, IPage<Item> page, @Param("ew") Wrapper<Item> wrapper);
Item selectCurrentRevision(@Param("site") String site, @Param("item") String item);
Item selectById(@Param("locale") String locale, @Param("handle") String handle);
List<Item> selectListByCriteria(@Param("locale") String locale, @Param("ew") Wrapper<Item> wrapper);

@ -0,0 +1,18 @@
package com.foreverwin.mesnac.meapi.mapper;
import com.foreverwin.mesnac.meapi.model.Printer;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* Mapper
* </p>
*
* @author Leon.L
* @since 2021-07-22
*/
@Repository
public interface PrinterMapper extends BaseMapper<Printer> {
}

@ -0,0 +1,130 @@
package com.foreverwin.mesnac.meapi.model;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.IdType;
/**
* <p>
*
* </p>
*
* @author Leon.L
* @since 2021-07-22
*/
@TableName("PRINTER")
public class Printer extends Model<Printer> {
private static final long serialVersionUID = 1L;
@TableField("HANDLE")
private String handle;
@TableField("SITE")
private String site;
@TableField("PRINTER")
private String printer;
@TableField("DESCRIPTION")
private String description;
@TableField("ENABLED")
private String enabled;
@TableField("CREATED_DATE_TIME")
private LocalDateTime createdDateTime;
@TableField("MODIFIED_DATE_TIME")
private LocalDateTime modifiedDateTime;
public String getHandle() {
return handle;
}
public void setHandle(String handle) {
this.handle = handle;
}
public String getSite() {
return site;
}
public void setSite(String site) {
this.site = site;
}
public String getPrinter() {
return printer;
}
public void setPrinter(String printer) {
this.printer = printer;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getEnabled() {
return enabled;
}
public void setEnabled(String enabled) {
this.enabled = enabled;
}
public LocalDateTime getCreatedDateTime() {
return createdDateTime;
}
public void setCreatedDateTime(LocalDateTime createdDateTime) {
this.createdDateTime = createdDateTime;
}
public LocalDateTime getModifiedDateTime() {
return modifiedDateTime;
}
public void setModifiedDateTime(LocalDateTime modifiedDateTime) {
this.modifiedDateTime = modifiedDateTime;
}
public static final String HANDLE = "HANDLE";
public static final String SITE = "SITE";
public static final String PRINTER = "PRINTER";
public static final String DESCRIPTION = "DESCRIPTION";
public static final String ENABLED = "ENABLED";
public static final String CREATED_DATE_TIME = "CREATED_DATE_TIME";
public static final String MODIFIED_DATE_TIME = "MODIFIED_DATE_TIME";
@Override
protected Serializable pkVal() {
return this.handle;
}
@Override
public String toString() {
return "Printer{" +
"handle = " + handle +
", site = " + site +
", printer = " + printer +
", description = " + description +
", enabled = " + enabled +
", createdDateTime = " + createdDateTime +
", modifiedDateTime = " + modifiedDateTime +
"}";
}
}

@ -0,0 +1,28 @@
package com.foreverwin.mesnac.meapi.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.meapi.model.Printer;
import com.baomidou.mybatisplus.extension.service.IService;
import com.foreverwin.modular.core.util.FrontPage;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author Leon.L
* @since 2021-07-22
*/
public interface PrinterService extends IService<Printer> {
/**
*
* @param frontPage
* @return
*/
IPage<Printer> selectPage(FrontPage<Printer> frontPage, Printer printer);
List<Printer> selectList(Printer printer);
}

@ -84,15 +84,6 @@ public class ItemServiceImpl extends ServiceImpl<ItemMapper, Item> implements It
}
@Override
public Item selectCurrent(String site, String item) {
Locale locale = LocaleContextHolder.getLocale();
//----------------------------------------------------------------------------------
LambdaQueryWrapper<Item> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(Item::getSite, site);
queryWrapper.eq(Item::getItem, item);
queryWrapper.orderByDesc(Item::getCurrentRevision);
//----------------------------------------------------------------------------------
List<Item> resultLit = itemMapper.selectList(locale.getLanguage(), queryWrapper);
//----------------------------------------------------------------------------------
return resultLit != null && resultLit.size() > 0 ? resultLit.get(0) : null;
return itemMapper.selectCurrentRevision(site, item);
}
}

@ -0,0 +1,46 @@
package com.foreverwin.mesnac.meapi.service.impl;
import com.foreverwin.modular.core.util.FrontPage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.meapi.model.Printer;
import com.foreverwin.mesnac.meapi.mapper.PrinterMapper;
import com.foreverwin.mesnac.meapi.service.PrinterService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author Leon.L
* @since 2021-07-22
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class PrinterServiceImpl extends ServiceImpl<PrinterMapper, Printer> implements PrinterService {
@Autowired
private PrinterMapper printerMapper;
@Override
public IPage<Printer> selectPage(FrontPage<Printer> frontPage, Printer printer) {
QueryWrapper<Printer> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(printer);
return super.page(frontPage.getPagePlus(), queryWrapper);
}
@Override
public List<Printer> selectList(Printer printer) {
QueryWrapper<Printer> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(printer);
return super.list(queryWrapper);
}
}

@ -85,6 +85,13 @@
WHERE I.HANDLE=#{handle}
</select>
<select id="selectCurrentRevision" resultMap="BaseResultMap">
SELECT I.*, IT.DESCRIPTION
FROM ITEM I
LEFT JOIN ITEM_T IT ON I.HANDLE = IT.ITEM_BO AND IT.LOCALE = 'zh'
WHERE I.SITE = #{site} AND I.ITEM = #{item} AND I.CURRENT_REVISION = 'true'
</select>
<select id="selectByMap" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include>
FROM ITEM

@ -0,0 +1,318 @@
<?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.meapi.mapper.PrinterMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.foreverwin.mesnac.meapi.model.Printer">
<result column="HANDLE" property="handle" />
<result column="SITE" property="site" />
<result column="PRINTER" property="printer" />
<result column="DESCRIPTION" property="description" />
<result column="ENABLED" property="enabled" />
<result column="CREATED_DATE_TIME" property="createdDateTime" />
<result column="MODIFIED_DATE_TIME" property="modifiedDateTime" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
HANDLE, SITE, PRINTER, DESCRIPTION, ENABLED, CREATED_DATE_TIME, MODIFIED_DATE_TIME
</sql>
<!-- BaseMapper标准查询/修改/删除 -->
<select id="selectByMap" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include>
FROM PRINTER
<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="selectOne" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include> FROM PRINTER
<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.printer!=null"> AND PRINTER=#{ew.entity.printer}</if>
<if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
<if test="ew.entity.enabled!=null"> AND ENABLED=#{ew.entity.enabled}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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 PRINTER
<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.printer!=null"> AND PRINTER=#{ew.entity.printer}</if>
<if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
<if test="ew.entity.enabled!=null"> AND ENABLED=#{ew.entity.enabled}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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 PRINTER
<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.printer!=null"> AND PRINTER=#{ew.entity.printer}</if>
<if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
<if test="ew.entity.enabled!=null"> AND ENABLED=#{ew.entity.enabled}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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 PRINTER
<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.printer!=null"> AND PRINTER=#{ew.entity.printer}</if>
<if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
<if test="ew.entity.enabled!=null"> AND ENABLED=#{ew.entity.enabled}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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 PRINTER
<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.printer!=null"> AND PRINTER=#{ew.entity.printer}</if>
<if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
<if test="ew.entity.enabled!=null"> AND ENABLED=#{ew.entity.enabled}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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 PRINTER
<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.printer!=null"> AND PRINTER=#{ew.entity.printer}</if>
<if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
<if test="ew.entity.enabled!=null"> AND ENABLED=#{ew.entity.enabled}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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 PRINTER
<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.printer!=null"> AND PRINTER=#{ew.entity.printer}</if>
<if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
<if test="ew.entity.enabled!=null"> AND ENABLED=#{ew.entity.enabled}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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.meapi.model.Printer">
INSERT INTO PRINTER
<trim prefix="(" suffix=")" suffixOverrides=",">
HANDLE,
<if test="site!=null">SITE,</if>
<if test="printer!=null">PRINTER,</if>
<if test="description!=null">DESCRIPTION,</if>
<if test="enabled!=null">ENABLED,</if>
<if test="createdDateTime!=null">CREATED_DATE_TIME,</if>
<if test="modifiedDateTime!=null">MODIFIED_DATE_TIME,</if>
</trim> VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{handle},
<if test="site!=null">#{site},</if>
<if test="printer!=null">#{printer},</if>
<if test="description!=null">#{description},</if>
<if test="enabled!=null">#{enabled},</if>
<if test="createdDateTime!=null">#{createdDateTime},</if>
<if test="modifiedDateTime!=null">#{modifiedDateTime},</if>
</trim>
</insert>
<insert id="insertAllColumn" parameterType="com.foreverwin.mesnac.meapi.model.Printer">
INSERT INTO PRINTER
<trim prefix="(" suffix=")" suffixOverrides=",">
<include refid="Base_Column_List"></include>
</trim> VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{handle},
#{site},
#{printer},
#{description},
#{enabled},
#{createdDateTime},
#{modifiedDateTime},
</trim>
</insert>
<update id="update">
UPDATE PRINTER <trim prefix="SET" suffixOverrides=",">
<if test="et.handle!=null">HANDLE=#{et.handle},</if>
<if test="et.site!=null">SITE=#{et.site},</if>
<if test="et.printer!=null">PRINTER=#{et.printer},</if>
<if test="et.description!=null">DESCRIPTION=#{et.description},</if>
<if test="et.enabled!=null">ENABLED=#{et.enabled},</if>
<if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</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.printer!=null"> AND PRINTER=#{ew.entity.printer}</if>
<if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
<if test="ew.entity.enabled!=null"> AND ENABLED=#{ew.entity.enabled}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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="deleteByMap">
DELETE FROM PRINTER
<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 PRINTER
<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.printer!=null"> AND PRINTER=#{ew.entity.printer}</if>
<if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
<if test="ew.entity.enabled!=null"> AND ENABLED=#{ew.entity.enabled}</if>
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</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>
<!-- BaseMapper标准查询/修改/删除 -->
</mapper>
Loading…
Cancel
Save