| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.system.dto.KnowledgeDTO; |
| | | import com.ruoyi.system.dto.SystemBulletinDTO; |
| | | import com.ruoyi.system.model.TKnowledge; |
| | | import com.ruoyi.system.model.TSystemBulletin; |
| | | import com.ruoyi.system.query.KnowledgeListQuery; |
| | | import com.ruoyi.system.query.SystemBulletinQuery; |
| | | import com.ruoyi.system.service.TKnowledgeService; |
| | | import com.ruoyi.system.service.TSystemBulletinService; |
| | | import com.ruoyi.system.vo.system.KnowledgeListVO; |
| | | import com.ruoyi.system.vo.system.SystemBulletinListVO; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RestController |
| | | @RequestMapping("/t-knowledge") |
| | | public class TKnowledgeController { |
| | | @Resource |
| | | private TKnowledgeService knowledgeService; |
| | | |
| | | /** |
| | | * 获取谱系图详情待入库菌种分页列表 |
| | | */ |
| | | @ApiOperation(value = "环卫知识分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<KnowledgeListVO>> pageList(@RequestBody KnowledgeListQuery query) { |
| | | return R.ok(knowledgeService.pageList(query)); |
| | | } |
| | | @Log(title = "新增环卫知识", businessType = BusinessType.INSERT) |
| | | @ApiOperation(value = "新增环卫知识") |
| | | @PostMapping(value = "/add") |
| | | public R<Boolean> add(@RequestBody KnowledgeDTO dto) { |
| | | knowledgeService.save(dto); |
| | | return R.ok(); |
| | | } |
| | | @Log(title = "编辑环卫知识", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "编辑环卫知识") |
| | | @PostMapping(value = "/edit") |
| | | public R<Boolean> edit(@RequestBody KnowledgeDTO dto) { |
| | | knowledgeService.updateById(dto); |
| | | return R.ok(); |
| | | } |
| | | @Log(title = "批量删除环卫知识", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "批量环卫知识") |
| | | @DeleteMapping(value = "/delete") |
| | | public R<Boolean> edit(@RequestParam String ids) { |
| | | String[] split = ids.split(","); |
| | | knowledgeService.removeBatchByIds(Arrays.asList(split)); |
| | | return R.ok(); |
| | | } |
| | | @Log(title = "启用/禁用环卫知识", businessType = BusinessType.OTHER) |
| | | @ApiOperation(value = "启用/禁用环卫知识") |
| | | @DeleteMapping(value = "/editStatus") |
| | | public R<Boolean> editStatus(@RequestParam String id) { |
| | | TKnowledge byId = knowledgeService.getById(id); |
| | | if (byId.getStatus()==1){ |
| | | byId.setStatus(2); |
| | | }else{ |
| | | byId.setStatus(1); |
| | | } |
| | | knowledgeService.updateById(byId); |
| | | return R.ok(); |
| | | } |
| | | } |
| | | |