Commit 893853a2 authored by 温志超's avatar 温志超

更新查询

parent 580d9e16
...@@ -114,14 +114,19 @@ public class MdWorkunitWorkerController extends BaseController { ...@@ -114,14 +114,19 @@ public class MdWorkunitWorkerController extends BaseController {
@Log(title = "岗位资源", businessType = BusinessType.INSERT) @Log(title = "岗位资源", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody List<MdWorkunitWorker> mdWorkunitWorkerData) { public AjaxResult add(@RequestBody List<MdWorkunitWorker> mdWorkunitWorkerData) {
StringBuilder stringBuilder = new StringBuilder();
for (MdWorkunitWorker mdWorkunitWorker : mdWorkunitWorkerData){ for (MdWorkunitWorker mdWorkunitWorker : mdWorkunitWorkerData){
QueryWrapper<MdWorkunitWorker> proWorkorderQueryWrapper = new QueryWrapper<>(); QueryWrapper<MdWorkunitWorker> proWorkorderQueryWrapper = new QueryWrapper<>();
proWorkorderQueryWrapper.eq("t1.user_id", mdWorkunitWorker.getUserId()); proWorkorderQueryWrapper.eq("t1.user_id", mdWorkunitWorker.getUserId());
proWorkorderQueryWrapper.eq("t1.workunit_id", mdWorkunitWorker.getWorkunitId()); proWorkorderQueryWrapper.eq("t1.workunit_id", mdWorkunitWorker.getWorkunitId());
List<MdWorkunitWorker> mdWorkunitWorkers = mdWorkunitWorkerMapper.selectListByQw(proWorkorderQueryWrapper); List<MdWorkunitWorker> mdWorkunitWorkers = mdWorkunitWorkerMapper.selectListByQw(proWorkorderQueryWrapper);
ExceptionUtil.checkTrueThrowException(CollectionUtil.isNotEmpty(mdWorkunitWorkers), MessageUtils.message("md.workUnit.error.repeat.bind")); if(CollectionUtil.isNotEmpty(mdWorkunitWorkers)){
stringBuilder.append(mdWorkunitWorker.getWorkunitName()+",");
break;
}
int rows = mdWorkunitWorkerService.insertObj(mdWorkunitWorker); int rows = mdWorkunitWorkerService.insertObj(mdWorkunitWorker);
} }
ExceptionUtil.checkTrueThrowException(StringUtils.isNotEmpty(stringBuilder), MessageUtils.message("md.workUnit.error.repeat.bind") + stringBuilder);
return toAjax(mdWorkunitWorkerData.size()); return toAjax(mdWorkunitWorkerData.size());
} }
......
...@@ -13,8 +13,10 @@ import com.ximai.system.service.ISysUserService; ...@@ -13,8 +13,10 @@ import com.ximai.system.service.ISysUserService;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.annotation.Tainted;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
...@@ -108,6 +110,7 @@ public class MdWorkunitWorkerServiceImpl implements IMdWorkunitWorkerService { ...@@ -108,6 +110,7 @@ public class MdWorkunitWorkerServiceImpl implements IMdWorkunitWorkerService {
} }
@Override @Override
@Transactional
public int insertObj(MdWorkunitWorker mdWorkunitWorker) { public int insertObj(MdWorkunitWorker mdWorkunitWorker) {
SysUser sysUser = sysUserService.selectUserById(mdWorkunitWorker.getUserId()); SysUser sysUser = sysUserService.selectUserById(mdWorkunitWorker.getUserId());
ExceptionUtil.checkTrueThrowException(sysUser == null, MessageUtils.message("md.workUnit.error.bind.not.user")); ExceptionUtil.checkTrueThrowException(sysUser == null, MessageUtils.message("md.workUnit.error.bind.not.user"));
......
...@@ -454,12 +454,12 @@ public class ProTaskWorkunitServiceImpl implements IProTaskWorkunitService { ...@@ -454,12 +454,12 @@ public class ProTaskWorkunitServiceImpl implements IProTaskWorkunitService {
query.like(StringUtils.isNotEmpty(proTaskWorkunit.getProductCode()), "wo.product_code", query.like(StringUtils.isNotEmpty(proTaskWorkunit.getProductCode()), "wo.product_code",
proTaskWorkunit.getProductCode()); proTaskWorkunit.getProductCode());
query.like(StringUtils.isNotEmpty(proTaskWorkunit.getOrderCode()), "wo.order_code", // query.like(StringUtils.isNotEmpty(proTaskWorkunit.getOrderCode()), "wo.order_code",
proTaskWorkunit.getOrderCode()); // proTaskWorkunit.getOrderCode());
query.like(StringUtils.isNotEmpty(proTaskWorkunit.getOrderSerial()), "wo.order_serial", query.like(StringUtils.isNotEmpty(proTaskWorkunit.getOrderSerial()), "wo.order_serial",
proTaskWorkunit.getOrderSerial()); proTaskWorkunit.getOrderSerial());
query.like(StringUtils.isNotEmpty(proTaskWorkunit.getCustomerProjectNo()), "wo.customer_drawing_no", query.like(StringUtils.isNotEmpty(proTaskWorkunit.getCustomerDrawingNo()), "wo.customer_drawing_no",
proTaskWorkunit.getCustomerProjectNo()); proTaskWorkunit.getCustomerDrawingNo());
query.gt("ptw.quantity",0); query.gt("ptw.quantity",0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment