| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | 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.model.TAppUser; |
| | | import com.ruoyi.system.model.THelpNeeds; |
| | | import com.ruoyi.system.model.THelpNeeds; |
| | | import com.ruoyi.system.query.AssistedDiningListQuery; |
| | | import com.ruoyi.system.query.HelpNeedsListQuery; |
| | | import com.ruoyi.system.service.THelpNeedsService; |
| | | import com.ruoyi.system.service.THelpNeedsService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/t-help-needs") |
| | | @Api(tags = "助需管理") |
| | | public class THelpNeedsController { |
| | | @Autowired |
| | | private THelpNeedsService helpNeedsService; |
| | | @ApiOperation(value = "助需管理分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<THelpNeeds>> pageList(@RequestBody HelpNeedsListQuery query) { |
| | | return R.ok(helpNeedsService.pageList(query)); |
| | | } |
| | | |
| | | @ApiOperation(value = "添加") |
| | | @Transactional |
| | | @Log(title = "助需管理-添加", businessType = BusinessType.INSERT) |
| | | @PostMapping(value = "/add") |
| | | public R<Boolean> save(@RequestBody THelpNeeds entity) { |
| | | helpNeedsService.save(entity); |
| | | return R.ok(); |
| | | } |
| | | @ApiOperation(value = "修改") |
| | | @Log(title = "助需管理-修改", businessType = BusinessType.UPDATE) |
| | | @PostMapping(value = "/edit") |
| | | public R<Boolean> edit(@RequestBody THelpNeeds entity) { |
| | | helpNeedsService.updateById(entity); |
| | | return R.ok(); |
| | | } |
| | | @Log(title = "助需管理-删除", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "助需管理-删除") |
| | | @DeleteMapping(value = "/delete") |
| | | public R delete(@RequestParam String ids) { |
| | | List<Integer> res = Arrays.stream(ids.split(",")).map(Integer::parseInt).collect(Collectors.toList()); |
| | | // 转换成Integer |
| | | helpNeedsService.removeBatchByIds(res); |
| | | return R.ok(); |
| | | } |
| | | @ApiOperation(value = "查看详情") |
| | | @GetMapping(value = "/detail") |
| | | public R<THelpNeeds> detail(Integer id) { |
| | | return R.ok(helpNeedsService.getById( id)); |
| | | } |
| | | } |
| | | |