Commit f87ac4c7 by wangli

mp2jpa

1 parent 9a09a738
......@@ -20,7 +20,11 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
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.Root;
import java.util.ArrayList;
import java.util.List;
......@@ -45,10 +49,10 @@ public class EngineerServiceImpl implements EngineerService {
private OrgGroupDao orgGroupDao;
@Autowired
private EngineerBusinessMPDao engineerBusinessMPDao;
private EngineerBusinessDao engineerBusinessDao;
@Autowired
private EngineerBusinessDao engineerBusinessDao;
private EntityManager entityManager;
@Transactional
@Override
......@@ -209,17 +213,18 @@ public class EngineerServiceImpl implements EngineerService {
int minute = this.getMinuteDiff(TimeUtils.time2LocalTime(workOn), TimeUtils.time2LocalTime(workOff));
// 技术员业务属性配置修改
LambdaUpdateWrapper<EngineerBusiness> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(EngineerBusiness::getEngineerCode, engineerCode);
wrapper.set(EngineerBusiness::getMaxNum, maxNum);
wrapper.set(EngineerBusiness::getDeparture, departure);
wrapper.set(EngineerBusiness::getPriority, priority);
wrapper.set(EngineerBusiness::getWorkOn, workOn);
wrapper.set(EngineerBusiness::getWorkOff, workOff);
wrapper.set(EngineerBusiness::getMaxMinute, minute);
wrapper.set(EngineerBusiness::getVehicle, transportMode);
// 更新字段
engineerBusinessMPDao.update(null, wrapper);
CriteriaBuilder cb = entityManager.getCriteriaBuilder();
CriteriaUpdate<EngineerBusiness> update = cb.createCriteriaUpdate(EngineerBusiness.class);
Root<EngineerBusiness> root = update.from(EngineerBusiness.class);
update.set(root.get("maxNum"), maxNum);
update.set(root.get("departure"), departure);
update.set(root.get("priority"), priority);
update.set(root.get("workOn"), workOn);
update.set(root.get("workOff"), workOff);
update.set(root.get("maxMinute"), minute);
update.set(root.get("vehicle"), transportMode);
update.where(cb.equal(root.get("engineerCode"), engineerCode));
entityManager.createQuery(update).executeUpdate();
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!