liliang4869 7 년 전
부모
커밋
f7f3052bdd

+ 9 - 14
src/main/java/com/goafanti/common/controller/WebpageController.java

@@ -449,9 +449,7 @@ public class WebpageController extends BaseController {
 		
 		
 		//企业技术需求
-		List<DemandListBo> companyDemand=demandService.companyDemand();
-		int minSize=companyDemand.size()>8?8:companyDemand.size();
-		List <DemandListBo>eightMaxCompanyDemand=companyDemand.subList(0,minSize);
+		List<DemandListBo> eightMaxCompanyDemand=demandService.companyDemand(8);
 		for(DemandListBo demandListBo:eightMaxCompanyDemand) {
 			if(demandListBo.getPictureUrl()==null || !demandListBo.getPictureUrl().contains("."))demandListBo.setPictureUrl(null);
 			else demandListBo.setPictureUrl(demandListBo.getPictureUrl().split(",")[0]);
@@ -459,8 +457,7 @@ public class WebpageController extends BaseController {
 		modelview.addObject("companyDemandList",eightMaxCompanyDemand);
 		
 		//地区产业需求  最多4个
-		List<DemandListBo> areaDemand=demandService.areaDemand();
-		List <DemandListBo>fourMaxareaDemand=areaDemand.subList(0,Math.min(4, areaDemand.size()));
+		List<DemandListBo> fourMaxareaDemand=demandService.areaDemand(4);
 		for(DemandListBo demandListBo:fourMaxareaDemand) {
 			if(demandListBo.getPictureUrl()==null || !demandListBo.getPictureUrl().contains("."))demandListBo.setPictureUrl(null);
 			else demandListBo.setPictureUrl(demandListBo.getPictureUrl().split(",")[0]);
@@ -469,8 +466,7 @@ public class WebpageController extends BaseController {
 		modelview.addObject("areaDemandList",fourMaxareaDemand);
 		
 		//产学研需求 最多9个
-		List<DemandListBo> proLearnStudyDemand=demandService.proLearnStudyDemand();
-		List <DemandListBo>nightMaxProLearnStudyDemand=proLearnStudyDemand.subList(0,Math.min(9, proLearnStudyDemand.size()));
+		List<DemandListBo> nightMaxProLearnStudyDemand=demandService.proLearnStudyDemand(9);
 		for(DemandListBo demandListBo:nightMaxProLearnStudyDemand) {
 			if(demandListBo.getPictureUrl()==null || !demandListBo.getPictureUrl().contains("."))demandListBo.setPictureUrl(null);
 			else demandListBo.setPictureUrl(demandListBo.getPictureUrl().split(",")[0]);
@@ -480,8 +476,7 @@ public class WebpageController extends BaseController {
 		modelview.addObject("proLearnStudyDemandList",nightMaxProLearnStudyDemand);
 		
 		//研产资金需求 最多4个
-		List<DemandListBo> fundDemand=demandService.getFundCrowdDemand();
-		List <DemandListBo>fourMaxFundDemand=fundDemand.subList(0,Math.min(4, fundDemand.size()));
+		List<DemandListBo> fourMaxFundDemand=demandService.getFundCrowdDemand(4);
 		for(DemandListBo demandListBo:fourMaxFundDemand) {
 			if(demandListBo.getPictureUrl()==null || !demandListBo.getPictureUrl().contains("."))demandListBo.setPictureUrl(null);
 			else demandListBo.setPictureUrl(demandListBo.getPictureUrl().split(",")[0]);
@@ -490,14 +485,14 @@ public class WebpageController extends BaseController {
 		modelview.addObject("fundDemandList",fourMaxFundDemand);
 		
 		//技术人才需求
-		List<DemandListBo> personnelDemand=demandService.getPersonnelDemand();
-		List <DemandListBo>fourMaxPersonnelDemand=personnelDemand.subList(0,Math.min(6, personnelDemand.size()));
-		for(DemandListBo demandListBo:fourMaxPersonnelDemand) {
+		List<DemandListBo> sixMaxPersonnelDemand=demandService.getPersonnelDemand(6);
+//		List <DemandListBo>fourMaxPersonnelDemand=personnelDemand.subList(0,Math.min(6, personnelDemand.size()));
+		for(DemandListBo demandListBo:sixMaxPersonnelDemand) {
 			if(demandListBo.getPictureUrl()==null || !demandListBo.getPictureUrl().contains("."))demandListBo.setPictureUrl(null);
 			else demandListBo.setPictureUrl(demandListBo.getPictureUrl().split(",")[0]);
 		}
-		LimitLengthUtil.limiteDemandLength(fourMaxPersonnelDemand,7,30);
-		modelview.addObject("personnelDemandList",fourMaxPersonnelDemand);
+		LimitLengthUtil.limiteDemandLength(sixMaxPersonnelDemand,7,30);
+		modelview.addObject("personnelDemandList",sixMaxPersonnelDemand);
 		return modelview;
 	}
 	

+ 5 - 5
src/main/java/com/goafanti/common/dao/DemandMapper.java

@@ -68,18 +68,18 @@ public interface DemandMapper {
 	
 	List<DemandListBo> selectRecentDemand();
 	
-	List<DemandListBo> selectCompanyDemand();
+	List<DemandListBo> selectCompanyDemand(int size);
 	
 	List<DemandListBo> getUrgentDemand();
 	
 	List<DemandListBo> getHotDemand();
 	
-	List<DemandListBo> getAreaDemand();
+	List<DemandListBo> getAreaDemand(int size);
 	
-	List<DemandListBo> 	getProLearnStudyDemand();
+	List<DemandListBo> 	getProLearnStudyDemand(int size);
 	
-	List<DemandListBo> getFundCrowdDemand();
+	List<DemandListBo> getFundCrowdDemand(int size);
 	
-	List<DemandListBo> getPersonnelDemand();
+	List<DemandListBo> getPersonnelDemand(int size);
 
 }

+ 6 - 5
src/main/java/com/goafanti/common/mapper/DemandMapper.xml

@@ -2134,7 +2134,7 @@ select
   </select>
   
     <select id="selectCompanyDemand" resultType="com.goafanti.demand.bo.DemandListBo">
- select name,picture_url as pictureUrl,id from demand d  where d.data_category=1 and d.audit_status=2  order by  release_date  desc
+ select name,picture_url as pictureUrl,id from demand d  where d.data_category=1 and d.audit_status=2  order by  release_date  desc limit #{size}
   </select>
    <select id="getUrgentDemand" resultType="com.goafanti.demand.bo.DemandListBo">
  select name,release_date as releaseDate,id,problem_des as problemDes,research_type as researchType,budget_cost as fundForPersonnel,crowd_cost as fundForCrowd,demand_type as demandType,
@@ -2149,21 +2149,22 @@ select
   </select>
   
    <select id="getAreaDemand" resultType="com.goafanti.demand.bo.DemandListBo">
- select name,picture_url as pictureUrl ,problem_des as problemDes ,id from demand d  where d.demand_type=4 and d.audit_status=2 order by  release_date  desc
+ select name,picture_url as pictureUrl ,problem_des as problemDes ,id from demand d  where d.demand_type=4 and d.audit_status=2 order by  release_date  desc limit #{size}
   </select>
   
      <select id="getProLearnStudyDemand" resultType="com.goafanti.demand.bo.DemandListBo">
     select d.name as name,picture_url as pictureUrl ,problem_des as problemDes,employer_name as employerName,d.id,fg.name as industryCategory1,fgg.name as industryCategory2 from demand d  
     left join aft.field_glossory  fg  on fg.id=d.industry_category_a
     left join aft.field_glossory fgg  on fgg.id=d.industry_category_b
- where d.demand_type=2 and d.audit_status=2 order by  release_date  desc
+ where d.demand_type=2 and d.audit_status=2 order by  release_date  desc limit #{size}
   </select>
    <select id="getFundCrowdDemand" resultType="com.goafanti.demand.bo.DemandListBo">
-  select name,picture_url as pictureUrl ,problem_des as problemDes ,id,crowd_cost as fundForCrowd,research_type as researchType from demand d  where d.demand_type=3 and d.audit_status=2  order by  release_date  desc
+  select name,picture_url as pictureUrl ,problem_des as problemDes ,id,crowd_cost as fundForCrowd,research_type as researchType from demand d  where d.demand_type=3 and d.audit_status=2  order by  release_date 
+   desc limit #{size}
   </select>
   
    <select id="getPersonnelDemand" resultType="com.goafanti.demand.bo.DemandListBo">
-  select name,picture_url as pictureUrl ,problem_des as problemDes ,id,budget_cost as fundForPersonnel from demand d  where d.demand_type=5 and d.audit_status=2 order by  release_date  desc
+  select name,picture_url as pictureUrl ,problem_des as problemDes ,id,budget_cost as fundForPersonnel from demand d  where d.demand_type=5 and d.audit_status=2 order by  release_date  desc limit #{size}
   </select>
   
 </mapper>

+ 5 - 5
src/main/java/com/goafanti/demand/service/DemandService.java

@@ -113,19 +113,19 @@ public interface DemandService {
 	//科技需求首页列表
 	List<DemandListBo> recentDemand();
 	
-	List<DemandListBo> companyDemand();
+	List<DemandListBo> companyDemand(int size);
 	
 	List<DemandListBo> getUrgentDemand();
 	
 	List<DemandListBo> getHotDemand();
 	
 
-	List<DemandListBo> areaDemand();
+	List<DemandListBo> areaDemand(int size);
 	
-	List<DemandListBo> proLearnStudyDemand();
+	List<DemandListBo> proLearnStudyDemand(int size);
 	
-	List<DemandListBo> getFundCrowdDemand();
+	List<DemandListBo> getFundCrowdDemand(int size);
 	
-	List<DemandListBo> getPersonnelDemand();
+	List<DemandListBo> getPersonnelDemand(int size);
 	
 }

+ 10 - 10
src/main/java/com/goafanti/demand/service/impl/DemandServiceImpl.java

@@ -1118,9 +1118,9 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 	
 
 	@Override
-	public List<DemandListBo> companyDemand() {
+	public List<DemandListBo> companyDemand(int size) {
 		// TODO Auto-generated method stub
-		return demandMapper.selectCompanyDemand();
+		return demandMapper.selectCompanyDemand(size);
 	}
 
 	@Override
@@ -1136,27 +1136,27 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 	}
 
 	@Override
-	public List<DemandListBo> areaDemand() {
+	public List<DemandListBo> areaDemand(int size) {
 		// TODO Auto-generated method stub
-		return demandMapper.getAreaDemand();
+		return demandMapper.getAreaDemand(size);
 	}
 
 	@Override
-	public List<DemandListBo> proLearnStudyDemand() {
+	public List<DemandListBo> proLearnStudyDemand(int size) {
 		// TODO Auto-generated method stub
-		return demandMapper.getProLearnStudyDemand();
+		return demandMapper.getProLearnStudyDemand(size);
 	}
 
 	@Override
-	public List<DemandListBo> getFundCrowdDemand() {
+	public List<DemandListBo> getFundCrowdDemand(int size) {
 		// TODO Auto-generated method stub
-		return demandMapper.getFundCrowdDemand();
+		return demandMapper.getFundCrowdDemand(size);
 	}
 
 	@Override
-	public List<DemandListBo> getPersonnelDemand() {
+	public List<DemandListBo> getPersonnelDemand(int size) {
 		// TODO Auto-generated method stub
-		return demandMapper.getPersonnelDemand();
+		return demandMapper.getPersonnelDemand(size);
 	}