1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- package thyyxxk.wxservice_server.controller.isolations;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- import thyyxxk.wxservice_server.config.auth.PassToken;
- import thyyxxk.wxservice_server.dao.isolations.HealthEducationDao;
- import thyyxxk.wxservice_server.entity.ResultVo;
- import thyyxxk.wxservice_server.entity.isolations.HealthEducation;
- import thyyxxk.wxservice_server.utils.ResultVoUtil;
- import java.util.*;
- @RestController
- @RequestMapping("/healthEducation")
- public class HealthEducationController {
- private final HealthEducationDao dao;
- @Autowired
- public HealthEducationController(HealthEducationDao dao) {
- this.dao = dao;
- }
- @PassToken
- @GetMapping("/getVideoUrls")
- public ResultVo<LinkedHashMap<String, List<HealthEducation>>> getVideoUrls() {
- List<HealthEducation> urls = dao.selectHealthEducations();
- LinkedHashMap<String, List<HealthEducation>> map = new LinkedHashMap<>();
- for (HealthEducation item : urls) {
- String typeName = item.getTypeName();
- if (map.containsKey(typeName)) {
- map.get(typeName).add(item);
- } else {
- List<HealthEducation> tempList = new ArrayList<>();
- tempList.add(item);
- map.put(typeName, tempList);
- }
- }
- return ResultVoUtil.success(map);
- }
- }
|