ソースを参照

获取技淘品类分类接口

liliang4869 7 年 前
コミット
8f8802b23c

+ 30 - 0
src/main/java/com/goafanti/business/bo/JtBusinessCategoryBo.java

@@ -0,0 +1,30 @@
+package com.goafanti.business.bo;
+
+import java.util.List;
+
+import com.goafanti.common.model.JtBusinessCategory;
+
+public class JtBusinessCategoryBo {
+String topLevel;
+String topLevelId;
+List<JtBusinessCategory>children;
+public String getTopLevel() {
+	return topLevel;
+}
+public void setTopLevel(String topLevel) {
+	this.topLevel = topLevel;
+}
+public List<JtBusinessCategory> getChildren() {
+	return children;
+}
+public void setChildren(List<JtBusinessCategory> children) {
+	this.children = children;
+}
+public String getTopLevelId() {
+	return topLevelId;
+}
+public void setTopLevelId(String topLevelId) {
+	this.topLevelId = topLevelId;
+}
+
+}

+ 27 - 0
src/main/java/com/goafanti/business/controller/JtBusinessController.java

@@ -0,0 +1,27 @@
+package com.goafanti.business.controller;
+
+import java.util.List;
+
+import javax.annotation.Resource;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.goafanti.business.service.JtBusinessService;
+import com.goafanti.common.bo.Result;
+import com.goafanti.common.controller.CertifyApiController;
+
+@RestController
+@RequestMapping(value = "/open")
+public class JtBusinessController extends CertifyApiController {
+	@Resource 
+	private JtBusinessService jtBusinessService;
+	
+	@RequestMapping(value = "/jtBusiness/getCategoryList" , method = RequestMethod.GET)
+	public Result getList() {
+		Result result=new Result();
+result.setData(jtBusinessService.getCategoryBoList());
+		return result;
+	}
+}

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

@@ -2,6 +2,7 @@ package com.goafanti.business.service;
 
 import java.util.List;
 
+import com.goafanti.business.bo.JtBusinessCategoryBo;
 import com.goafanti.business.bo.JtBusinessCategoryTree;
 import com.goafanti.common.model.JtBusinessCategory;
 import com.goafanti.common.model.JtBusinessProject;
@@ -12,4 +13,5 @@ List<JtBusinessCategory> getBusinessCategoryBySuperId(String id,Integer size);
 List<JtBusinessProject>getBusinessProjectByCategoryId(String id,Integer size);
 JtBusinessProject getBusinessProjectDetail(String id);
 JtBusinessCategoryTree getCategoryTree(String id);
+public List<JtBusinessCategoryBo>getCategoryBoList();
 }

+ 4 - 0
src/main/java/com/goafanti/business/service/impl/JtBusinessServiceImpl.java

@@ -5,6 +5,7 @@ import java.util.List;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import com.goafanti.business.bo.JtBusinessCategoryBo;
 import com.goafanti.business.bo.JtBusinessCategoryTree;
 import com.goafanti.business.service.JtBusinessService;
 import com.goafanti.common.dao.JtBusinessCategoryMapper;
@@ -48,5 +49,8 @@ public class JtBusinessServiceImpl implements JtBusinessService{
 		return jtBusinessCategoryMapper.getCategoryTree(id);
 	}
 	
+	public List<JtBusinessCategoryBo>getCategoryBoList(){
+		return jtBusinessCategoryMapper.getCategoryBoList();
+	}
 
 }

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

@@ -60,7 +60,7 @@ public class WebpageController extends BaseController {
 	private NewsService newsService; 
 	
 	@Resource 
-	private JtBusinessService jtBusinessService;
+	private JtBusinessService jtBusinessService; 
 
 	@RequestMapping(value = "/user/account/index", method = RequestMethod.GET)
 	public ModelAndView index(HttpServletRequest request, ModelAndView modelview) {

+ 3 - 0
src/main/java/com/goafanti/common/dao/JtBusinessCategoryMapper.java

@@ -1,5 +1,6 @@
 package com.goafanti.common.dao;
 
+import com.goafanti.business.bo.JtBusinessCategoryBo;
 import com.goafanti.business.bo.JtBusinessCategoryTree;
 import com.goafanti.common.model.JtBusinessCategory;
 import com.goafanti.common.model.JtBusinessCategoryExample;
@@ -103,4 +104,6 @@ public interface JtBusinessCategoryMapper {
     
     JtBusinessCategoryTree getCategoryTree(String id);
     
+    List<JtBusinessCategoryBo>getCategoryBoList();
+    
 }

+ 25 - 0
src/main/java/com/goafanti/common/mapper/JtBusinessCategoryMapper.xml

@@ -386,4 +386,29 @@ where
 	and jt1.layer = 1
 	and jt2.id = #{0}
  </select>
+ <select id="getCategoryBySuperId" resultType="com.goafanti.common.model.JtBusinessCategory">
+  select
+	id,
+	name,
+	super_id as superId
+from
+	jt_business_category
+where
+	super_id = #{0}
+	order by create_time
+  </select>
+  <resultMap type="com.goafanti.business.bo.JtBusinessCategoryBo" id="JtBusinessCategoryBoResult">  
+        <id column="name" property="topLevel"/>  
+        <id column="topLevelId"   property="topLevelId"/>
+        <collection property="children" select="getCategoryBySuperId" column="topLevelId" ofType="com.goafanti.common.model.JtBusinessCategory">
+        </collection>  
+    </resultMap>  
+    
+    <select id="getCategoryBoList" resultMap="JtBusinessCategoryBoResult">
+    select 
+    name as topLevel,
+    id as topLevelId
+    from jt_business_category
+    where layer=1
+    </select>
 </mapper>

File diff suppressed because it is too large
+ 1 - 1
src/main/webapp/WEB-INF/views/portal/service/serviceIndex.html