Commit ab541bd9 by 丁伟峰

DAO修订

1 parent c3f78348
......@@ -6,6 +6,6 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface EngineerInfoDao extends JpaRepository {
public interface EngineerInfoDao extends JpaRepository<EngineerInfoEntity, Integer> {
EngineerInfoEntity getByEngineerCode(String engineerCode);
}
......@@ -2,14 +2,16 @@ package com.alibaba.cloud.integration.order.dao;
import com.alibaba.cloud.integration.order.entity.OrgTeamEngineerEntity;
import org.hibernate.annotations.Where;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.Collection;
import java.util.List;
@Repository
@Where(clause = "status = 1")
public interface OrgTeamEngineerDao {
public interface OrgTeamEngineerDao extends JpaRepository<OrgTeamEngineerEntity, Integer> {
List<OrgTeamEngineerEntity> findAllByTeamidIn(String[] teamIds);
List<OrgTeamEngineerEntity> findAllByTeamIdIn(Collection<String> teamIds);
}
......@@ -3,7 +3,9 @@ package com.alibaba.cloud.integration.order.dao;
import com.alibaba.cloud.integration.order.entity.ProductCategoryEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
@Repository
public interface ProductCategoryDao extends JpaRepository<ProductCategoryEntity, Long> {
ProductCategoryEntity getProductCategoryEntityByBrandAndTypeAndSkill(String brand, String type, String skill);
......
......@@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
......@@ -76,10 +77,10 @@ public class OrganizationServiceImpl implements OrganizationService {
@Override
public Result<?> getEngineersByTeams(String[] teamIds) {
List<OrganizationEngineersRespDTO.Engineer> engineers = new ArrayList<>();
for (OrgTeamEngineerEntity e : orgTeamEngineerDao.findAllByTeamidIn(teamIds)) {
for (OrgTeamEngineerEntity e : orgTeamEngineerDao.findAllByTeamIdIn(Arrays.asList(teamIds))) {
EngineerInfoEntity engineerInfoEntity = engineerInfoDao.getByEngineerCode(e.getEngineerCode());
if (engineerInfoEntity == null) {
log.error("技术员信息不存在!engineer_code[%s]", e.getEngineerCode());
log.error("技术员信息不存在!engineer_code: {}", e.getEngineerCode());
continue;
}
engineers.add(new OrganizationEngineersRespDTO.Engineer(e.getTeamId(), e.getEngineerCode(), engineerInfoEntity.getName()));
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!