|
@@ -1,25 +1,29 @@
|
|
package com.ruoyi.web.work.controller;
|
|
package com.ruoyi.web.work.controller;
|
|
|
|
|
|
-import java.util.Arrays;
|
|
|
|
-import java.util.List;
|
|
|
|
-import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
-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.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.annotation.Log;
|
|
import com.ruoyi.common.annotation.Log;
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
|
+import com.ruoyi.common.core.page.TableDataInfo;
|
|
import com.ruoyi.common.enums.BusinessType;
|
|
import com.ruoyi.common.enums.BusinessType;
|
|
import com.ruoyi.web.work.domain.Banner;
|
|
import com.ruoyi.web.work.domain.Banner;
|
|
|
|
+import com.ruoyi.web.work.domain.News;
|
|
|
|
+import com.ruoyi.web.work.domain.Notice;
|
|
|
|
+import com.ruoyi.web.work.domain.Position;
|
|
import com.ruoyi.web.work.service.IBannerService;
|
|
import com.ruoyi.web.work.service.IBannerService;
|
|
-import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
|
|
|
+import com.ruoyi.web.work.service.INewsService;
|
|
|
|
+import com.ruoyi.web.work.service.INoticeService;
|
|
|
|
+import com.ruoyi.web.work.service.IPositionService;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
+
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.Arrays;
|
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 轮播图
|
|
* 轮播图
|
|
|
|
+ *
|
|
* @author lsw
|
|
* @author lsw
|
|
* @date 2024-04-15
|
|
* @date 2024-04-15
|
|
*/
|
|
*/
|
|
@@ -29,38 +33,69 @@ public class BannerController extends BaseController {
|
|
@Autowired
|
|
@Autowired
|
|
private IBannerService bannerService;
|
|
private IBannerService bannerService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private INewsService newsService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private INoticeService noticeService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IPositionService positionService;
|
|
|
|
+
|
|
|
|
+
|
|
@PreAuthorize("@ss.hasPermi('work:banner:list')")
|
|
@PreAuthorize("@ss.hasPermi('work:banner:list')")
|
|
@GetMapping("/list")
|
|
@GetMapping("/list")
|
|
- public TableDataInfo list(Banner banner){
|
|
|
|
|
|
+ public TableDataInfo list(Banner banner) {
|
|
startPage();
|
|
startPage();
|
|
List<Banner> list = bannerService.selectList(banner);
|
|
List<Banner> list = bannerService.selectList(banner);
|
|
return getDataTable(list);
|
|
return getDataTable(list);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermi('work:banner:edit')")
|
|
|
|
+ @GetMapping("/selectUrl")
|
|
|
|
+ public TableDataInfo selectUrl(String type, String title) {
|
|
|
|
+ if (type.equals("新闻资讯")) {
|
|
|
|
+ startPage();
|
|
|
|
+ List<News> list = newsService.selectList(new News().setTitle(title).setState(0));
|
|
|
|
+ return getDataTable(list);
|
|
|
|
+ }
|
|
|
|
+ if (type.equals("通知公告")) {
|
|
|
|
+ startPage();
|
|
|
|
+ List<Notice> list = noticeService.selectList(new Notice().setTitle(title).setState(0));
|
|
|
|
+ return getDataTable(list);
|
|
|
|
+ }
|
|
|
|
+ if (type.equals("工作职位")) {
|
|
|
|
+ startPage();
|
|
|
|
+ List<Position> list = positionService.selectList(new Position().setTitle(title).setAudit(1).setState(0));
|
|
|
|
+ return getDataTable(list);
|
|
|
|
+ }
|
|
|
|
+ return getDataTable(new ArrayList());
|
|
|
|
+ }
|
|
|
|
+
|
|
@PreAuthorize("@ss.hasPermi('work:banner:query')")
|
|
@PreAuthorize("@ss.hasPermi('work:banner:query')")
|
|
@GetMapping(value = "/detail/{id}")
|
|
@GetMapping(value = "/detail/{id}")
|
|
- public AjaxResult detail(@PathVariable("id") Long id){
|
|
|
|
|
|
+ public AjaxResult detail(@PathVariable("id") Long id) {
|
|
return AjaxResult.success(bannerService.getById(id));
|
|
return AjaxResult.success(bannerService.getById(id));
|
|
}
|
|
}
|
|
|
|
|
|
@PreAuthorize("@ss.hasPermi('work:banner:add')")
|
|
@PreAuthorize("@ss.hasPermi('work:banner:add')")
|
|
@Log(title = "轮播图", businessType = BusinessType.INSERT)
|
|
@Log(title = "轮播图", businessType = BusinessType.INSERT)
|
|
@PostMapping("/add")
|
|
@PostMapping("/add")
|
|
- public AjaxResult add(@RequestBody Banner banner){
|
|
|
|
|
|
+ public AjaxResult add(@RequestBody Banner banner) {
|
|
return toAjax(bannerService.save(banner));
|
|
return toAjax(bannerService.save(banner));
|
|
}
|
|
}
|
|
|
|
|
|
@PreAuthorize("@ss.hasPermi('work:banner:edit')")
|
|
@PreAuthorize("@ss.hasPermi('work:banner:edit')")
|
|
@Log(title = "轮播图", businessType = BusinessType.UPDATE)
|
|
@Log(title = "轮播图", businessType = BusinessType.UPDATE)
|
|
@PostMapping("/edit")
|
|
@PostMapping("/edit")
|
|
- public AjaxResult edit(@RequestBody Banner banner){
|
|
|
|
|
|
+ public AjaxResult edit(@RequestBody Banner banner) {
|
|
return toAjax(bannerService.updateById(banner));
|
|
return toAjax(bannerService.updateById(banner));
|
|
}
|
|
}
|
|
|
|
|
|
@PreAuthorize("@ss.hasPermi('work:banner:remove')")
|
|
@PreAuthorize("@ss.hasPermi('work:banner:remove')")
|
|
@Log(title = "轮播图", businessType = BusinessType.DELETE)
|
|
@Log(title = "轮播图", businessType = BusinessType.DELETE)
|
|
@GetMapping("/remove/{ids}")
|
|
@GetMapping("/remove/{ids}")
|
|
- public AjaxResult remove(@PathVariable Long[] ids){
|
|
|
|
|
|
+ public AjaxResult remove(@PathVariable Long[] ids) {
|
|
return toAjax(bannerService.removeByIds(Arrays.asList(ids)));
|
|
return toAjax(bannerService.removeByIds(Arrays.asList(ids)));
|
|
}
|
|
}
|
|
}
|
|
}
|