地质所 沉降监测网建设项目
suerwei
2024-05-16 560e679c239af089e2ba79bdbec4bac331c01b4f
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
package com.javaweb.cms.controller;
 
import java.util.List;
import java.util.Map;
 
import com.javaweb.cms.domain.AlbumMaterial;
import com.javaweb.cms.domain.Material;
import com.javaweb.common.utils.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.javaweb.common.annotation.Log;
import com.javaweb.common.enums.BusinessType;
import com.javaweb.cms.domain.Album;
import com.javaweb.cms.service.IAlbumService;
import com.javaweb.common.core.controller.BaseController;
import com.javaweb.common.core.domain.AjaxResult;
import com.javaweb.common.utils.poi.ExcelUtil;
import com.javaweb.common.core.page.TableDataInfo;
 
/**
 * 素材相册Controller
 * 
 * @author wujiyue
 * @date 2019-11-08
 */
@Controller
@RequestMapping("/cms/album")
public class AlbumController extends BaseController
{
    private String prefix = "cms/album";
 
    @Autowired
    private IAlbumService albumService;
 
    @RequiresPermissions("cms:album:view")
    @GetMapping()
    public String album()
    {
        return prefix + "/album";
    }
 
    /**
     * 查询素材专辑列表
     */
    @RequiresPermissions("cms:album:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(Album album)
    {
        startPage();
        List<Album> list = albumService.selectAlbumList(album);
        return getDataTable(list);
    }
 
    /**
     * 新增素材专辑
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }
 
    /**
     * 新增保存素材专辑
     */
    @RequiresPermissions("cms:album:add")
    @Log(title = "素材专辑", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(Album album)
    {
        return toAjax(albumService.insertAlbum(album));
    }
 
    /**
     * 修改素材专辑
     */
    @GetMapping("/edit/{albumId}")
    public String edit(@PathVariable("albumId") String albumId, ModelMap mmap)
    {
        Album album = albumService.selectAlbumById(albumId);
        mmap.put("album", album);
        return prefix + "/edit";
    }
 
    /**
     * 修改保存素材专辑
     */
    @RequiresPermissions("cms:album:edit")
    @Log(title = "素材专辑", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(Album album)
    {
        return toAjax(albumService.updateAlbum(album));
    }
 
    /**
     * 删除素材专辑
     */
    @RequiresPermissions("cms:album:remove")
    @Log(title = "素材专辑", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(albumService.deleteAlbumByIds(ids));
    }
 
 
    /**
     * 跳转分配素材页面
     */
    @RequiresPermissions("cms:album:addMaterial")
    @GetMapping("/toAddMaterial/{albumId}")
    public String toAddMaterial(@PathVariable("albumId") String albumId, ModelMap mmap)
    {
        mmap.put("albumId", albumId);
        return prefix + "/addMaterial";
    }
 
    /**
     * 查询相册绑定的素材图片列表
     */
    @PostMapping("/materialList")
    @ResponseBody
    public TableDataInfo materialList(Material material)
    {
        List<AlbumMaterial> list = albumService.selectAlbumMaterialList(material);
        return getDataTable(list);
    }
 
 
    /**
     * 跳转选择未分配素材页面
     */
    @GetMapping("/selectMaterial/{albumId}")
    public String selectMaterial(@PathVariable("albumId") String albumId, ModelMap mmap)
    {
        mmap.put("albumId", albumId);
        return prefix + "/selectMaterial";
    }
 
 
    /**
     * 查询未配置的素材
     * @param material
     * @return
     */
    @PostMapping("/unMaterialList")
    @ResponseBody
    public TableDataInfo unMaterialList(Material material)
    {
        startPage();
        List<Material> list = albumService.selectAlbumUnMaterialList(material);
        return getDataTable(list);
    }
    /**
     * 保存素材
     */
    @PostMapping( "/saveMaterial")
    @ResponseBody
    public AjaxResult saveMaterial(String albumId,String materialIds)
    {
        if(StringUtils.isEmpty(albumId)||StringUtils.isEmpty(materialIds)){
            return AjaxResult.error("参数传递错误!");
        }
        albumService.saveMaterial(albumId,materialIds);
        return success();
    }
    /**
     * 删除专辑关联的素材
     */
    @PostMapping( "/deleteMaterialBatch")
    @ResponseBody
    public AjaxResult deleteMaterialBatch(String ids)
    {
        if(StringUtils.isEmpty(ids)){
            return AjaxResult.error("参数传递错误!");
        }
        albumService.deleteMaterialBatch(ids);
        return success();
    }
 
    /**
     * 获取一个专辑以及其关联的素材
     */
    @PostMapping( "/getAlbum")
    @ResponseBody
    public AjaxResult getAlbum(String code)
    {
        if(StringUtils.isEmpty(code)){
            return AjaxResult.error("参数code不能为空!");
        }
        Map data= albumService.getAlbum(code);
        return AjaxResult.success(data);
    }
 
 
}