多单位版国产化地质资料管理系统
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
package com.zbooksoft.gdmis.controller;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruili.wcp.web.model.AjaxResponse;
import com.ruili.wcp.web.model.ErrorInfo;
import com.zbooksoft.gdmis.data.entity.CatAjjxx;
import com.zbooksoft.gdmis.data.entity.StudyMaterial;
import com.zbooksoft.gdmis.data.entity.StudyType;
import com.zbooksoft.gdmis.service.CatAjjxxService;
import com.zbooksoft.gdmis.service.StudyMaterialService;
import com.zbooksoft.gdmis.service.StudyTypeService;
import org.apache.shiro.authz.annotation.RequiresUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
 
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
 
/**
 * @Description:专题
 * @Author: zhai
 * @Date: 2024/9/24
 **/
@Controller
@RequestMapping("/study")
public class StudyController {
 
    @Autowired
    StudyMaterialService studyMaterialService;
 
    @Autowired
    StudyTypeService studyTypeService;
 
    @Autowired
    CatAjjxxService catAjjxxService;
 
    /**
     * 处理选择的数据(加入专题)
     *
     * @param idList 选中的文件主键列表
     * @return
     */
    @RequestMapping(value = "/addStudyData")
    @ResponseBody
    @RequiresUser
    public Object dealSelectedDataList(Long studyId, @RequestBody List<Long> idList) {
        String message = studyMaterialService.addByIdList(studyId, idList);
        return new AjaxResponse(message);
    }
 
    @RequestMapping("studyList")
    @RequiresUser
    public ModelAndView studyList() {
        ModelAndView mav = new ModelAndView("gh/study/studyList");
        return mav;
    }
 
    @RequestMapping(value = "getStudyList", produces = "application/json; charset=utf-8", method = RequestMethod.POST)
    @ResponseBody
    @RequiresUser
    public Object getStudyList(String searchText) {
        QueryWrapper<StudyType> query = new QueryWrapper<>();
 
        if (searchText != null && searchText != "") {
            query.like("type_name", searchText);
        }
        query.orderByAsc("id");
        List<StudyType> list = studyTypeService.list(query);
        return list;
    }
 
 
    @RequestMapping("/getStudyData")
    @ResponseBody
    @RequiresUser
    public Object getStudyData(HttpServletRequest request, HttpServletResponse response, Long id) {
        try {
            QueryWrapper<StudyMaterial> studyMaterialQueryWrapper = new QueryWrapper<>();
            studyMaterialQueryWrapper.eq("type_id", id);
            studyMaterialQueryWrapper.select("KEY_ID");
            List<Object> idList = studyMaterialService.listObjs(studyMaterialQueryWrapper);
            List<CatAjjxx> list = new ArrayList<>();
            if (idList.size() > 0) {
                QueryWrapper<CatAjjxx> catAjjxxQueryWrapper = new QueryWrapper<>();
                catAjjxxQueryWrapper.in("id", idList);
                list = catAjjxxService.list(catAjjxxQueryWrapper);
                return new AjaxResponse(list);
            }
            return new AjaxResponse(list);
 
        } catch (Exception e) {
            return new AjaxResponse(new ErrorInfo(e.getMessage()), false);
        }
    }
 
}