|
@@ -1,81 +0,0 @@
|
|
|
-package com.ruoyi.web.work.controller;
|
|
|
-
|
|
|
-import com.ruoyi.common.annotation.Log;
|
|
|
-import com.ruoyi.common.constant.CacheConstants;
|
|
|
-import com.ruoyi.common.core.controller.BaseController;
|
|
|
-import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
-import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
-import com.ruoyi.common.core.redis.RedisCache;
|
|
|
-import com.ruoyi.common.enums.BusinessType;
|
|
|
-import com.ruoyi.web.work.domain.Links;
|
|
|
-import com.ruoyi.web.work.service.ILinksService;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
-import org.springframework.validation.annotation.Validated;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
-
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
-/**
|
|
|
- * 友情链接
|
|
|
- *
|
|
|
- * @author lishuwen
|
|
|
- * @date 2023-10-29
|
|
|
- */
|
|
|
-@RestController
|
|
|
-@RequestMapping("/work/links")
|
|
|
-public class LinksController extends BaseController {
|
|
|
- @Autowired
|
|
|
- private ILinksService linksService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private RedisCache redisCache;
|
|
|
-
|
|
|
- @PreAuthorize("@ss.hasPermi('work:links:list')")
|
|
|
- @GetMapping("/list")
|
|
|
- public TableDataInfo list(Links links) {
|
|
|
- startPage();
|
|
|
- List<Links> list = linksService.selectList(links);
|
|
|
- return getDataTable(list);
|
|
|
- }
|
|
|
-
|
|
|
- @PreAuthorize("@ss.hasPermi('work:links:query')")
|
|
|
- @GetMapping(value = "/detail/{id}")
|
|
|
- public AjaxResult detail(@PathVariable("id") Long id) {
|
|
|
- return AjaxResult.success(linksService.getById(id));
|
|
|
- }
|
|
|
-
|
|
|
- @PreAuthorize("@ss.hasPermi('work:links:add')")
|
|
|
- @Log(title = "友情链接", businessType = BusinessType.INSERT)
|
|
|
- @PostMapping("/add")
|
|
|
- public AjaxResult add(@Validated @RequestBody Links links) {
|
|
|
- boolean row=linksService.save(links);
|
|
|
- if (row){
|
|
|
- redisCache.deleteObject(CacheConstants.APP_LINKS);
|
|
|
- }
|
|
|
- return toAjax(row);
|
|
|
- }
|
|
|
-
|
|
|
- @PreAuthorize("@ss.hasPermi('work:links:edit')")
|
|
|
- @Log(title = "友情链接", businessType = BusinessType.UPDATE)
|
|
|
- @PostMapping("/edit")
|
|
|
- public AjaxResult edit(@Validated @RequestBody Links links) {
|
|
|
- boolean row=linksService.updateById(links);
|
|
|
- if (row){
|
|
|
- redisCache.deleteObject(CacheConstants.APP_LINKS);
|
|
|
- }
|
|
|
- return toAjax(row);
|
|
|
- }
|
|
|
-
|
|
|
- @PreAuthorize("@ss.hasPermi('work:links:remove')")
|
|
|
- @Log(title = "友情链接", businessType = BusinessType.DELETE)
|
|
|
- @GetMapping("/remove/{ids}")
|
|
|
- public AjaxResult remove(@PathVariable Long[] ids) {
|
|
|
- boolean row=linksService.removeByIds(Arrays.asList(ids));
|
|
|
- if (row){
|
|
|
- redisCache.deleteObject(CacheConstants.APP_LINKS);
|
|
|
- }
|
|
|
- return toAjax(row);
|
|
|
- }
|
|
|
-}
|