Commit f87ac4c7 by wangli

mp2jpa

1 parent 9a09a738
...@@ -20,7 +20,11 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -20,7 +20,11 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaUpdate;
import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -45,10 +49,10 @@ public class EngineerServiceImpl implements EngineerService { ...@@ -45,10 +49,10 @@ public class EngineerServiceImpl implements EngineerService {
private OrgGroupDao orgGroupDao; private OrgGroupDao orgGroupDao;
@Autowired @Autowired
private EngineerBusinessMPDao engineerBusinessMPDao; private EngineerBusinessDao engineerBusinessDao;
@Autowired @Autowired
private EngineerBusinessDao engineerBusinessDao; private EntityManager entityManager;
@Transactional @Transactional
@Override @Override
...@@ -209,17 +213,18 @@ public class EngineerServiceImpl implements EngineerService { ...@@ -209,17 +213,18 @@ public class EngineerServiceImpl implements EngineerService {
int minute = this.getMinuteDiff(TimeUtils.time2LocalTime(workOn), TimeUtils.time2LocalTime(workOff)); int minute = this.getMinuteDiff(TimeUtils.time2LocalTime(workOn), TimeUtils.time2LocalTime(workOff));
// 技术员业务属性配置修改 // 技术员业务属性配置修改
LambdaUpdateWrapper<EngineerBusiness> wrapper = new LambdaUpdateWrapper<>(); CriteriaBuilder cb = entityManager.getCriteriaBuilder();
wrapper.eq(EngineerBusiness::getEngineerCode, engineerCode); CriteriaUpdate<EngineerBusiness> update = cb.createCriteriaUpdate(EngineerBusiness.class);
wrapper.set(EngineerBusiness::getMaxNum, maxNum); Root<EngineerBusiness> root = update.from(EngineerBusiness.class);
wrapper.set(EngineerBusiness::getDeparture, departure); update.set(root.get("maxNum"), maxNum);
wrapper.set(EngineerBusiness::getPriority, priority); update.set(root.get("departure"), departure);
wrapper.set(EngineerBusiness::getWorkOn, workOn); update.set(root.get("priority"), priority);
wrapper.set(EngineerBusiness::getWorkOff, workOff); update.set(root.get("workOn"), workOn);
wrapper.set(EngineerBusiness::getMaxMinute, minute); update.set(root.get("workOff"), workOff);
wrapper.set(EngineerBusiness::getVehicle, transportMode); update.set(root.get("maxMinute"), minute);
// 更新字段 update.set(root.get("vehicle"), transportMode);
engineerBusinessMPDao.update(null, wrapper); update.where(cb.equal(root.get("engineerCode"), engineerCode));
entityManager.createQuery(update).executeUpdate();
return Result.success(null); return Result.success(null);
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!