diff --git a/demo/pom.xml b/demo/pom.xml
index 3bc2f42..b65b330 100644
--- a/demo/pom.xml
+++ b/demo/pom.xml
@@ -103,6 +103,12 @@
tomcat-embed-jasper
provided
+
+ org.springframework.boot
+ spring-boot-starter-web
+ RELEASE
+ compile
+
diff --git a/demo/src/main/java/com/example/demo/Dao/usageDateMapper.java b/demo/src/main/java/com/example/demo/Dao/usageDateMapper.java
index 7bc503e..1b8b02c 100644
--- a/demo/src/main/java/com/example/demo/Dao/usageDateMapper.java
+++ b/demo/src/main/java/com/example/demo/Dao/usageDateMapper.java
@@ -16,7 +16,7 @@ public interface usageDateMapper {
@Select("select productNum from usageDate group by productNum order by count(productNum) DESC")
- public List selectByCount();
+ public List selectByCount();
@Insert("insert into usagedate(checkNum, productNum, userNum," +
" bankAccount, bankNum, year, amount, startTime)" +
diff --git a/demo/src/main/java/com/example/demo/searchService/controller/SearchServiceController.java b/demo/src/main/java/com/example/demo/searchService/controller/SearchServiceController.java
index f8ba075..4d9fdef 100644
--- a/demo/src/main/java/com/example/demo/searchService/controller/SearchServiceController.java
+++ b/demo/src/main/java/com/example/demo/searchService/controller/SearchServiceController.java
@@ -22,7 +22,7 @@ import java.util.List;
//@Controller
@RestController
@RequestMapping("/search")
-public class SearchServiceController extends HttpServlet {
+public class SearchServiceController{
@Autowired
private ProductSearchService productSearchService;
@@ -32,7 +32,7 @@ public class SearchServiceController extends HttpServlet {
List list = new ArrayList();
String productName = request.getParameter("productName");
String category = request.getParameter("category");
- float intrate = Float.parseFloat(request.getParameter("intrate"));
+ //float intrate = Float.parseFloat(request.getParameter("intrate"));
if(productName!=null){
list = productSearchService.findByNameLike(productName);
@@ -40,24 +40,22 @@ public class SearchServiceController extends HttpServlet {
}else if(category!=null){
list = productSearchService.findByCategory(category);
//按产品类别搜索
- }else if(intrate!=0){
- list = productSearchService.findByIntrate(intrate);
- //按利率排序由低到高
+// }else if(intrate!=0){
+// list = productSearchService.findByIntrate(intrate);
+// //按利率排序由低到高
}else{
list = productSearchService.findByCount();
//默认按产品使用的产品的数量由高到低排序
}
-// String json = JSONObject.toJSONString(list);
-// response.getWriter().print(json);
return list;
}
- @PostMapping("/showIndex")
- public void showPro(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException{
+ @RequestMapping(value = "/showIndex",method = RequestMethod.POST)
+ public List showPro(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException{
List products = productSearchService.findByCount();
- String json = JSONObject.toJSONString(products);
- System.out.println(json);
response.setCharacterEncoding("utf-8");
- response.getWriter().print(json);
+ return products;
+ //String json = JSONObject.toJSONString(list);
+ // response.getWriter().print(json);
}
}
diff --git a/demo/src/main/java/com/example/demo/searchService/service/impl/ProductSearchServiceImpl.java b/demo/src/main/java/com/example/demo/searchService/service/impl/ProductSearchServiceImpl.java
index 054c52f..ce1d895 100644
--- a/demo/src/main/java/com/example/demo/searchService/service/impl/ProductSearchServiceImpl.java
+++ b/demo/src/main/java/com/example/demo/searchService/service/impl/ProductSearchServiceImpl.java
@@ -36,8 +36,8 @@ public class ProductSearchServiceImpl implements ProductSearchService {
public List findByCount(){
Product product = new Product();
List productList = new ArrayList();
- List listusage = usageDateMapper.selectByCount();
- int[] arr = listusage.stream().mapToInt(Integer::valueOf).toArray();
+ List listusage = usageDateMapper.selectByCount();
+ long [] arr = listusage.stream().mapToLong(t->t.longValue()).toArray();
for(int i=0;i