package com.ruoyi.mall.controller; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.RepeatSubmit; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.mall.domain.MallSchool; import com.ruoyi.mall.service.IMallSchoolService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.util.List; /** * 学校Controller * * @author lsm * @date 2023-10-18 */ @RestController @RequestMapping("/mall/mallSchool") public class MallSchoolController extends BaseController { @Autowired private IMallSchoolService mallSchoolService; /** * 查询学校列表 */ @PreAuthorize("@ss.hasPermi('mall:mallSchool:list')") @GetMapping("/list") public TableDataInfo list(MallSchool mallSchool) { startPage(); List list = mallSchoolService.selectMallSchoolList(mallSchool); return getDataTable(list); } /** * 导出学校列表 */ @PreAuthorize("@ss.hasPermi('mall:mallSchool:export')") @Log(title = "学校", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, MallSchool mallSchool) { List list = mallSchoolService.selectMallSchoolListForExcel(mallSchool); ExcelUtil util = new ExcelUtil(MallSchool.class); util.exportExcel(response, list, "学校数据"); } /** * 获取学校详细信息 */ @PreAuthorize("@ss.hasPermi('mall:mallSchool:query')") @GetMapping(value = "/{schoolId}") public AjaxResult getInfo(@PathVariable("schoolId") Long schoolId) { return AjaxResult.success(mallSchoolService.selectMallSchoolBySchoolId(schoolId)); } /** * 新增学校 */ @PreAuthorize("@ss.hasPermi('mall:mallSchool:add')") @Log(title = "学校", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody MallSchool mallSchool) { return toAjax(mallSchoolService.insertMallSchool(mallSchool)); } /** * 修改学校 */ @PreAuthorize("@ss.hasPermi('mall:mallSchool:edit')") @Log(title = "学校", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody MallSchool mallSchool) { return toAjax(mallSchoolService.updateMallSchool(mallSchool)); } /** * 删除学校 */ @PreAuthorize("@ss.hasPermi('mall:mallSchool:remove')") @Log(title = "学校", businessType = BusinessType.DELETE) @DeleteMapping("/{schoolIds}") public AjaxResult remove(@PathVariable Long[] schoolIds) { return toAjax(mallSchoolService.deleteMallSchoolBySchoolIds(schoolIds)); } /** * 新增学校登录用户 */ @RepeatSubmit @PreAuthorize("@ss.hasPermi('mall:mallSchool:addSchoolUser')") @Log(title = "新增学校登录用户", businessType = BusinessType.UPDATE) @PutMapping("/submitSchoolUser") public AjaxResult submitSchoolUser(@RequestBody MallSchool mallSchool) { return mallSchoolService.submitSchoolUser(mallSchool); } }