Skip to content

Commit

Permalink
InvController 添加处理通过回答查找问卷请求的方法
Browse files Browse the repository at this point in the history
  • Loading branch information
suvvm committed Dec 2, 2019
1 parent e364215 commit f1afe5b
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package qdu.suvvm.onlinesurvey.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
Expand All @@ -9,11 +10,13 @@
import org.springframework.web.bind.annotation.RestController;
import qdu.suvvm.onlinesurvey.mapper.InvMapper;
import qdu.suvvm.onlinesurvey.pojo.Investigate;
import qdu.suvvm.onlinesurvey.pojo.Result;
import qdu.suvvm.onlinesurvey.pojo.Tag;
import qdu.suvvm.onlinesurvey.pojo.User;
import qdu.suvvm.onlinesurvey.utils.EmailUtil;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

Expand Down Expand Up @@ -151,4 +154,19 @@ public String getVisibleInv() {
return JSONArray.toJSONString(invList);
// System.out.println("res!!!" + res);
}

@PostMapping("/getInvsByResults")
public String getHistoryByUId(@RequestParam("results") String reqResults) {
List<Result> results = JSONArray.parseArray(reqResults, Result.class);
List<Investigate> investigates = new ArrayList<>();
for(Result result : results) {
Investigate investigate = new Investigate();
investigate.setId(result.getIid());
investigates.addAll(invMapper.getInvestigate(investigate));
}
if(investigates.isEmpty()) {
return "null";
}
return JSONArray.toJSONString(investigates);
}
}

0 comments on commit f1afe5b

Please sign in to comment.