Преглед изворни кода

首页数据接口开发、成果需求新增按名字搜索

anderx пре 7 година
родитељ
комит
c41807c673

+ 25 - 1
src/main/java/com/goafanti/app/controller/OpenAppHomeController.java

@@ -115,6 +115,17 @@ public class OpenAppHomeController extends BaseApiController{
 		result.setData(jtBusinessService.makeMoneyCategoryList());
 		return result;
 	}
+	
+	/**
+	 * 知识产权更多分类
+	 * @return
+	 */
+	@RequestMapping(value = "/getCategoryList" , method = RequestMethod.GET)
+	public Result getCategoryList(Integer module) {
+		Result result=new Result();
+		result.setData(jtBusinessService.getCategoryBoList(module));
+		return result;
+	}
 	/**
 	 * 赚钱首页推荐运用
 	 * @return
@@ -124,7 +135,20 @@ public class OpenAppHomeController extends BaseApiController{
 		Result result=new Result();
 		if (null==pageNo)pageNo=1;
 		if (null==pageSize)pageSize=3;
-		result.setData(jtBusinessService.recommendedApplication(pageNo,pageSize));
+		//1 赚钱数据    2首页数据
+		result.setData(jtBusinessService.recommendedApplication(1,pageNo,pageSize));
+		return result;
+	}
+	/**
+	 * 首页数据
+	 * @return
+	 */
+	@RequestMapping(value = "/getHomeData" , method = RequestMethod.GET)
+	public Result getHomeData(Integer pageNo,Integer pageSize) {
+		Result result=new Result();
+		if (null==pageNo)pageNo=1;
+		if (null==pageSize)pageSize=3;
+		result.setData(jtBusinessService.recommendedApplication(2,pageNo,pageSize));
 		return result;
 	}
 	

+ 1 - 1
src/main/java/com/goafanti/business/service/JtBusinessService.java

@@ -32,6 +32,6 @@ public interface JtBusinessService {
 	Pagination<JtBusinessProject>listProjectIInterestedIn(Integer pageNo,Integer pageSize);
 	Pagination<MyCollection> myCollectionProject(Integer pageNo, Integer pageSize);
 	List<makeMoneyCategoryListBo> makeMoneyCategoryList();
-	Pagination<MyCollection> recommendedApplication(Integer pageNo, Integer pageSize);
+	Pagination<MyCollection> recommendedApplication( Integer type,Integer pageNo, Integer pageSize);
 	
 }

+ 2 - 1
src/main/java/com/goafanti/business/service/impl/JtBusinessServiceImpl.java

@@ -346,8 +346,9 @@ public class JtBusinessServiceImpl  extends BaseMybatisDao<JtBusinessProjectMapp
 
 	@SuppressWarnings("unchecked")
 	@Override
-	public Pagination<MyCollection> recommendedApplication(Integer pageNo, Integer pageSize) {
+	public Pagination<MyCollection> recommendedApplication(Integer type,Integer pageNo, Integer pageSize) {
 		Map<String,Object> params=new HashMap<String,Object>();
+		if (null!=type)params.put("type", type); 
 		return (Pagination<MyCollection>) findPage("recommendedApplicationList", "recommendedApplicationCount", params, pageNo, pageSize);
 	}
 	

+ 2 - 6
src/main/java/com/goafanti/common/mapper/AchievementMapper.xml

@@ -656,14 +656,10 @@
 		and  a.audit_status = #{auditStatus,jdbcType=INTEGER}
 	</if>
 	<if test="name != null">
-
-		and  a.name = #{name,jdbcType=VARCHAR}
-
+		and  a.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
 	</if>
 	<if test="keyword != null">
-
-		and  a.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
-
+		and  a.keyword like CONCAT('%',#{keyword,jdbcType=VARCHAR},'%')
 	</if>
 	<if test="dataCategory != null and dataCategory != ''">
   		and a.data_category = #{dataCategory,jdbcType=INTEGER}

+ 18 - 3
src/main/java/com/goafanti/common/mapper/JtBusinessProjectMapper.xml

@@ -777,11 +777,20 @@
   </select>
   
    <select id="recommendedApplicationList" resultType="com.goafanti.common.bo.MyCollection">
-  select a.id,a.name,a.introduce as introduction,a.price as textA,c.nickname as ownerName
+  select a.id,a.name,a.introduce as introduction,a.price as textA,
+  		c.nickname as ownerName,ifnull(d.count,0) as interestCount
   	from jt_business_project a
   	left join jt_business_category b on  a.category_id=b.id
   	left join user c on a.owner_id=c.id
-  	where b.module != 1 and a.is_hot=1
+  	left join (select project_id as id,count(*) as count  from project_interest group by project_id) d 
+  	on a.id=d.id
+  	where  a.is_hot=1
+   <if test="type==1">
+  	and b.module != 1 
+  	</if>
+  	<if test="type==2">
+  	and b.module = 5 
+  	</if>
   <if test="page_sql!=null">
 		${page_sql}
 	</if>
@@ -790,6 +799,12 @@
   select count(*)
   	from jt_business_project a
   	left join jt_business_category b on  a.category_id=b.id
-  	where b.module != 1 and a.is_hot=1
+  	where a.is_hot=1
+  	<if test="type==1">
+  	and b.module != 1 
+  	</if>
+  	<if test="type==2">
+  	and b.module = 5 
+  	</if>
   </select>
 </mapper>