| | |
| | | import com.ruoyi.admin.entity.ServeAdvantage; |
| | | import com.ruoyi.admin.service.ServeAdvantageService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @param pageNum 页码 |
| | | * @param pageSize 每页显示条数 |
| | | */ |
| | | @RequiresPermissions("system_advantage") |
| | | @ApiOperation(value = "服务优势分页查询列表", tags = {"后台-系统设置-服务优势管理"}) |
| | | @GetMapping(value = "/page") |
| | | @ApiImplicitParams({ |
| | |
| | | } |
| | | |
| | | /** |
| | | * 新增服务优势 |
| | | * |
| | | * @param serveAdvantage 服务优势信息 |
| | | */ |
| | | @ApiOperation(value = "新增服务优势", tags = {"后台-系统设置-服务优势管理"}) |
| | | @PostMapping(value = "/save") |
| | | public R<String> save(@RequestBody ServeAdvantage serveAdvantage) { |
| | | return serveAdvantageService.save(serveAdvantage) ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | /** |
| | | * 修改服务优势 |
| | | * |
| | | * @param serveAdvantage 服务优势信息 |
| | | */ |
| | | @RequiresPermissions("advantage_update") |
| | | @ApiOperation(value = "修改服务优势", tags = {"后台-系统设置-服务优势管理"}) |
| | | @PostMapping(value = "/update") |
| | | public R<String> update(@RequestBody ServeAdvantage serveAdvantage) { |
| | | return serveAdvantageService.updateById(serveAdvantage) ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | /** |
| | | * 根据id批量删除服务优势 |
| | | * |
| | | * @param ids 服务优势多条id拼接 |
| | | */ |
| | | @ApiOperation(value = "批量删除服务优势", tags = {"后台-系统设置-服务优势管理"}) |
| | | @GetMapping(value = "/batchDelete") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "多个id ',' 拼接", name = "ids", dataType = "String", required = true) |
| | | }) |
| | | public R<String> batchDelete(@RequestParam String ids) { |
| | | List<String> idList = Arrays.stream(ids.split(",")).collect(Collectors.toList()); |
| | | List<ServeAdvantage> list = serveAdvantageService.lambdaQuery().in(ServeAdvantage::getId, idList).list(); |
| | | list.forEach(data -> data.setIsDelete(1)); |
| | | return serveAdvantageService.updateBatchById(list) ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | } |