package com.ruoyi.mall.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; 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.PutMapping; import org.springframework.web.bind.annotation.DeleteMapping; 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.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.mall.domain.OfflineServices; import com.ruoyi.mall.service.IOfflineServicesService; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; /** * 线下服务Controller * * @author ruoyi * @date 2023-10-16 */ @RestController @RequestMapping("/mall/OfflineServices") public class OfflineServicesController extends BaseController { @Autowired private IOfflineServicesService offlineServicesService; /** * 查询线下服务列表 */ @PreAuthorize("@ss.hasPermi('mall:OfflineServices:list')") @GetMapping("/list") public TableDataInfo list(OfflineServices offlineServices) { startPage(); List list = offlineServicesService.selectOfflineServicesList(offlineServices); return getDataTable(list); } /** * 导出线下服务列表 */ @PreAuthorize("@ss.hasPermi('mall:OfflineServices:export')") @Log(title = "线下服务", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, OfflineServices offlineServices) { List list = offlineServicesService.selectOfflineServicesList(offlineServices); ExcelUtil util = new ExcelUtil(OfflineServices.class); util.exportExcel(response, list, "线下服务数据"); } /** * 获取线下服务详细信息 */ @PreAuthorize("@ss.hasPermi('mall:OfflineServices:query')") @GetMapping(value = "/{serviceId}") public AjaxResult getInfo(@PathVariable("serviceId") Long serviceId) { return AjaxResult.success(offlineServicesService.selectOfflineServicesByServiceId(serviceId)); } /** * 新增线下服务 */ @PreAuthorize("@ss.hasPermi('mall:OfflineServices:add')") @Log(title = "线下服务", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody OfflineServices offlineServices) { return toAjax(offlineServicesService.insertOfflineServices(offlineServices)); } /** * 修改线下服务 */ @PreAuthorize("@ss.hasPermi('mall:OfflineServices:edit')") @Log(title = "线下服务", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody OfflineServices offlineServices) { return toAjax(offlineServicesService.updateOfflineServices(offlineServices)); } /** * 逻辑删除线下服务 */ @PreAuthorize("@ss.hasPermi('mall:OfflineServices:remove')") @Log(title = "线下服务", businessType = BusinessType.DELETE) @DeleteMapping("/{serviceIds}") public AjaxResult logicDel(@PathVariable Long[] serviceIds) { System.out.println("进入逻辑删除"+serviceIds.length); return toAjax(offlineServicesService.logicDelOfflineServicesByServiceIds(serviceIds)); } }