Commit 334cfa07 by Water Wang

optimize

parent 3f2a1280
...@@ -7,7 +7,9 @@ import com.yd.dal.service.customer.AclPractitionerPotentialDALService; ...@@ -7,7 +7,9 @@ import com.yd.dal.service.customer.AclPractitionerPotentialDALService;
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 java.util.List; import java.util.*;
import java.util.stream.Collectors;
@Service("aclPractitionerPotentialDALService") @Service("aclPractitionerPotentialDALService")
public class AclPractitionerPotentialDALServiceImpl implements AclPractitionerPotentialDALService { public class AclPractitionerPotentialDALServiceImpl implements AclPractitionerPotentialDALService {
...@@ -25,7 +27,25 @@ public class AclPractitionerPotentialDALServiceImpl implements AclPractitionerPo ...@@ -25,7 +27,25 @@ public class AclPractitionerPotentialDALServiceImpl implements AclPractitionerPo
@Override @Override
public List<PractitionerPotentialInfo> findByPractitionerIdAndLasted(Long practitionerId) { public List<PractitionerPotentialInfo> findByPractitionerIdAndLasted(Long practitionerId) {
return aclPractitionerPotentialMapper.findByPractitionerIdAndLasted(practitionerId) ; List<PractitionerPotentialInfo> temp = aclPractitionerPotentialMapper.findByPractitionerIdAndLasted(practitionerId);
Map<Long,PractitionerPotentialInfo> potentialInfoMap = new HashMap<>();
Long potentialId;
Long trackId,trackMaxId;
for(PractitionerPotentialInfo item :temp){
potentialId = item.getPotentialId();
trackId = item.getTrackId();
if(potentialInfoMap.containsKey(potentialId)){
trackMaxId = potentialInfoMap.get(potentialId).getTrackId();
if(trackMaxId < trackId){
potentialInfoMap.put(potentialId,item);
}
}else{
potentialInfoMap.put(potentialId,item);
}
}
List<PractitionerPotentialInfo> result = new ArrayList<>(potentialInfoMap.values());
result.sort((o1, o2) -> o2.getPotentialId().compareTo(o1.getPotentialId()));
return result;
} }
@Override @Override
......
...@@ -310,15 +310,12 @@ ...@@ -310,15 +310,12 @@
p.oss_path_resume ossPathResume, p.oss_path_resume ossPathResume,
t.track_status_id trackStatusId, t.track_status_id trackStatusId,
t.id trackId, t.id trackId,
date_format(p.created_at,'%Y-%m-%d') createdAt, date_format(p.created_at,'%Y-%m-%d') createdAt
MAX(t.created_at) LastedUpdateDate
FROM FROM
ag_acl_practitioner_potential p ag_acl_practitioner_potential p
INNER JOIN ag_acl_practitioner_potential_assigned_track t ON p.id = t.practitioner_potential_id INNER JOIN ag_acl_practitioner_potential_assigned_track t ON p.id = t.practitioner_potential_id
WHERE WHERE
t.practitioner_assigned_id = #{practitionerId,jdbcType=BIGINT} t.practitioner_assigned_id = #{practitionerId,jdbcType=BIGINT}
GROUP BY
p.id
order by p.id desc; order by p.id desc;
</select> </select>
</mapper> </mapper>
\ No newline at end of file
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