123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- package com.sooka.sponest.event.centereventteventcollect.controller;
- import java.util.List;
- import java.io.IOException;
- import javax.servlet.http.HttpServletResponse;
- import com.ruoyi.common.core.utils.StringUtils;
- import com.ruoyi.common.core.utils.uuid.IdUtils;
- import com.ruoyi.common.security.utils.SecurityUtils;
- import com.sooka.sponest.event.centereventteventcollect.domain.CentereventTEventCollect;
- import com.sooka.sponest.event.centereventteventcollect.service.ICentereventTEventCollectService;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.PutMapping;
- import org.springframework.web.bind.annotation.DeleteMapping;
- import org.springframework.web.bind.annotation.PathVariable;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- import com.ruoyi.common.log.annotation.Log;
- import com.ruoyi.common.log.enums.BusinessType;
- import com.ruoyi.common.security.annotation.RequiresPermissions;
- import com.ruoyi.common.core.web.controller.BaseController;
- import com.ruoyi.common.core.web.domain.AjaxResult;
- import com.ruoyi.common.core.utils.poi.ExcelUtil;
- import com.ruoyi.common.core.web.page.TableDataInfo;
- /**
- * 事件收藏Controller
- *
- * @author ruoyi
- * @date 2025-06-24
- */
- @RestController
- @RequestMapping("/collect")
- public class CentereventTEventCollectController extends BaseController {
- @Autowired
- private ICentereventTEventCollectService centereventTEventCollectService;
- /**
- * 查询事件收藏列表
- */
- @RequiresPermissions("system:collect:list")
- @GetMapping("/list")
- public TableDataInfo list(CentereventTEventCollect centereventTEventCollect) {
- startPage();
- List<CentereventTEventCollect> list = centereventTEventCollectService.selectCentereventTEventCollectList(centereventTEventCollect);
- return getDataTable(list);
- }
- /**
- * 导出事件收藏列表
- */
- @RequiresPermissions("system:collect:export")
- @Log(title = "事件收藏", businessType = BusinessType.EXPORT)
- @PostMapping("/export")
- public void export(HttpServletResponse response, CentereventTEventCollect centereventTEventCollect) {
- List<CentereventTEventCollect> list = centereventTEventCollectService.selectCentereventTEventCollectList(centereventTEventCollect);
- ExcelUtil<CentereventTEventCollect> util = new ExcelUtil<CentereventTEventCollect>(CentereventTEventCollect.class);
- util.exportExcel(response, list, "事件收藏数据");
- }
- /**
- * 获取事件收藏详细信息
- */
- @RequiresPermissions("system:collect:query")
- @GetMapping(value = "/{id}")
- public AjaxResult getInfo(@PathVariable("id") String id) {
- return AjaxResult.success(centereventTEventCollectService.selectCentereventTEventCollectById(id));
- }
- /**
- * 新增事件收藏
- */
- @RequiresPermissions("system:collect:add")
- @Log(title = "事件收藏", businessType = BusinessType.INSERT)
- @PostMapping
- public AjaxResult add(@RequestBody CentereventTEventCollect centereventTEventCollect) {
- String uuid = IdUtils.simpleUUID();
- centereventTEventCollect.setId(uuid);
- centereventTEventCollect.setSort("0");
- if(StringUtils.isBlank(centereventTEventCollect.getUserId())){
- centereventTEventCollect.setUserId(SecurityUtils.getUserId().toString());
- }
- if(centereventTEventCollectService.isCollect(centereventTEventCollect)){
- return AjaxResult.error("您已收藏该事件");
- }
- int i = centereventTEventCollectService.insertCentereventTEventCollect(centereventTEventCollect);
- if(i>0){
- return AjaxResult.success("收藏成功", uuid);
- }else{
- return AjaxResult.error("收藏失败");
- }
- }
- /**
- * 修改事件收藏
- */
- @RequiresPermissions("system:collect:edit")
- @Log(title = "事件收藏", businessType = BusinessType.UPDATE)
- @PutMapping
- public AjaxResult edit(@RequestBody CentereventTEventCollect centereventTEventCollect) {
- return toAjax(centereventTEventCollectService.updateCentereventTEventCollect(centereventTEventCollect));
- }
- /**
- * 删除事件收藏
- */
- @RequiresPermissions("system:collect:remove")
- @Log(title = "事件收藏", businessType = BusinessType.DELETE)
- @DeleteMapping("/{ids}")
- public AjaxResult remove(@PathVariable String[] ids) {
- return toAjax(centereventTEventCollectService.deleteCentereventTEventCollectByIds(ids));
- }
- }
|