diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/controller/goodsInfo/GoodsInfoController.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/controller/goodsInfo/GoodsInfoController.java new file mode 100644 index 0000000..cf4fb4b --- /dev/null +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/controller/goodsInfo/GoodsInfoController.java @@ -0,0 +1,138 @@ +package com.xinelu.manage.controller.goodsInfo; + +import com.xinelu.common.annotation.Log; +import com.xinelu.common.core.controller.BaseController; +import com.xinelu.common.core.domain.AjaxResult; +import com.xinelu.common.core.page.TableDataInfo; +import com.xinelu.common.custominterface.Insert; +import com.xinelu.common.custominterface.Update; +import com.xinelu.common.enums.BusinessType; +import com.xinelu.common.utils.poi.ExcelUtil; +import com.xinelu.manage.domain.goodsInfo.GoodsInfo; +import com.xinelu.manage.dto.goodsInfo.GoodsInfoDTO; +import com.xinelu.manage.service.goodsInfo.IGoodsInfoService; +import com.xinelu.manage.vo.goodsInfo.GetGoodDetails; +import com.xinelu.manage.vo.goodsInfo.GoodsInfoVO; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Objects; + +/** + * 护理站商品基本信息Controller + * + * @author xinyilu + * @date 2022-10-17 + */ +@RestController +@RequestMapping("/system/goodsInfo") +public class GoodsInfoController extends BaseController { + @Resource + private IGoodsInfoService goodsInfoService; + + /** + * 查询商品基本信息列表 + */ + @PreAuthorize("@ss.hasPermi('system:goodsInfo:list')") + @GetMapping("/list") + public TableDataInfo list(GoodsInfo goodsInfo) { + startPage(); + List list = goodsInfoService.selectGoodsInfoList(goodsInfo); + return getDataTable(list); + } + + /** + * 导出商品基本信息列表 + */ + @PreAuthorize("@ss.hasPermi('system:goodsInfo:export')") + @Log(title = "商品基本信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, GoodsInfo goodsInfo) { + List list = goodsInfoService.selectGoodsInfoList(goodsInfo); + ExcelUtil util = new ExcelUtil<>(GoodsInfo.class); + util.exportExcel(response, list, "商品基本信息数据"); + } + + /** + * 获取商品基本信息详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:goodsInfo:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) { + return AjaxResult.success(goodsInfoService.selectGoodsInfoById(id)); + } + + /** + * 新增商品基本信息 + */ + @PreAuthorize("@ss.hasPermi('system:goodsInfo:add')") + @Log(title = "商品基本信息", businessType = BusinessType.INSERT) + @PostMapping("/add") + public AjaxResult add(@Validated(Insert.class) @RequestBody GoodsInfoDTO goodsInfo) { + return goodsInfoService.insertGoodsInfo(goodsInfo); + } + + /** + * 修改商品基本信息 + */ + @PreAuthorize("@ss.hasPermi('system:goodsInfo:edit')") + @Log(title = "商品基本信息", businessType = BusinessType.UPDATE) + @PostMapping("/edit") + public AjaxResult edit(@Validated(Update.class) @RequestBody GoodsInfoDTO goodsInfo) { + if (Objects.isNull(goodsInfo) || Objects.isNull(goodsInfo.getId())) { + return AjaxResult.error("商品信息为空,请联系管理员!"); + } + return goodsInfoService.updateGoodsInfo(goodsInfo); + } + + /** + * 删除商品基本信息 + */ + @PreAuthorize("@ss.hasPermi('system:goodsInfo:remove')") + @Log(title = "商品基本信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + return goodsInfoService.deleteGoodsInfoByIds(ids); + } + + /** + * 查询商品基本信息列表 + */ + @PreAuthorize("@ss.hasPermi('system:goodsInfo:goodsInfoList')") + @GetMapping("/goodsInfoList") + public TableDataInfo goodsInfoList(GoodsInfoVO goodsInfo) { + startPage(); + List goodsInfoList = goodsInfoService.getGoodsInfoList(goodsInfo); + return getDataTable(goodsInfoList); + } + + /** + * 根据商品id查询商品详细信息 + * + * @param goodsInfoId 商品详细id + * @return com.xinyilu.nurseapplet.domain.nearbynursingstation.NearbyNursingStationVO + **/ + @PreAuthorize("@ss.hasPermi('system:goodsInfo:goodsDetails')") + @GetMapping("/goodsDetails") + public AjaxResult goodsDetails(Long goodsInfoId) { + if (Objects.isNull(goodsInfoId)) { + return AjaxResult.error("商品详细id不能为空!"); + } + GetGoodDetails goodsDetails = goodsInfoService.getGoodsDetails(goodsInfoId); + return AjaxResult.success(goodsDetails); + } + + /** + * 修改商品上架状态基本信息 + */ + @PreAuthorize("@ss.hasPermi('system:goodsInfo:editGoodsWhetherShelf')") + @Log(title = "商品基本信息", businessType = BusinessType.UPDATE) + @PostMapping("/editGoodsWhetherShelf") + public AjaxResult editGoodsWhetherShelf(@RequestBody GoodsInfo goodsInfo) { + return AjaxResult.success(goodsInfoService.updateGoodsWhetherShelf(goodsInfo)); + } +} diff --git a/xinelu-nurse-manage/src/main/java/com/xinelu/manage/controller/goodsInfo/OperateGoodInfoController.java b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/controller/goodsInfo/OperateGoodInfoController.java new file mode 100644 index 0000000..2e66615 --- /dev/null +++ b/xinelu-nurse-manage/src/main/java/com/xinelu/manage/controller/goodsInfo/OperateGoodInfoController.java @@ -0,0 +1,120 @@ +package com.xinelu.manage.controller.goodsInfo; + +import com.xinelu.common.annotation.Log; +import com.xinelu.common.core.controller.BaseController; +import com.xinelu.common.core.domain.AjaxResult; +import com.xinelu.common.core.page.TableDataInfo; +import com.xinelu.common.custominterface.Insert; +import com.xinelu.common.custominterface.Update; +import com.xinelu.common.enums.BusinessType; +import com.xinelu.manage.domain.goodsInfo.GoodsInfo; +import com.xinelu.manage.dto.goodsInfo.GoodsInfoDTO; +import com.xinelu.manage.service.goodsInfo.GoodsOperateInfoService; +import com.xinelu.manage.service.goodsInfo.IGoodsInfoService; +import com.xinelu.manage.vo.goodsInfo.GetGoodDetails; +import com.xinelu.manage.vo.goodsInfo.GoodsInfoVO; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Objects; + +/** + * @Description 运营商品管理控制器 + * @Author 纪寒 + * @Date 2022-11-08 11:04:25 + * @Version 1.0 + */ +@RestController +@RequestMapping("/system/operateGoodInfo") +public class OperateGoodInfoController extends BaseController { + + @Resource + private IGoodsInfoService goodsInfoService; + @Resource + private GoodsOperateInfoService goodsOperateInfoService; + + /** + * 运营PC-查询商品基本信息列表 + * + * @param goodsInfo 查询条件 + * @return 列表信息 + */ + @PreAuthorize("@ss.hasPermi('system:operateGoodInfo:goodsInfoList')") + @GetMapping("/goodsInfoList") + public TableDataInfo goodsInfoList(GoodsInfoVO goodsInfo) { + startPage(); + List goodsInfoList = goodsInfoService.getGoodsInfoList(goodsInfo); + return getDataTable(goodsInfoList); + } + + /** + * 运营PC-根据商品id查询商品详细信息 + * + * @param goodsInfoId 商品详细id + * @return 商品详情信息 + **/ + @PreAuthorize("@ss.hasPermi('system:operateGoodInfo:goodsDetails')") + @GetMapping("/goodsDetails") + public AjaxResult goodsDetails(Long goodsInfoId) { + if (Objects.isNull(goodsInfoId)) { + return AjaxResult.error("商品详细id不能为空!"); + } + GetGoodDetails goodsDetails = goodsInfoService.getGoodsDetails(goodsInfoId); + return AjaxResult.success(goodsDetails); + } + + /** + * 运营PC端-新增商品基本信息 + * + * @param goodsInfo 商品信息 + * @return 添加结果 + */ + @PreAuthorize("@ss.hasPermi('system:operateGoodInfo:add')") + @Log(title = "运营PC端商品基本信息", businessType = BusinessType.INSERT) + @PostMapping("/add") + public AjaxResult add(@Validated(Insert.class) @RequestBody GoodsInfoDTO goodsInfo) { + return goodsOperateInfoService.insertGoodsOperateInfo(goodsInfo); + } + + /** + * 运营PC-修改商品基本信息 + * + * @param goodsInfo 商品信息 + * @return 修改结果 + */ + @PreAuthorize("@ss.hasPermi('system:operateGoodInfo:edit')") + @Log(title = "运营PC端商品基本信息", businessType = BusinessType.UPDATE) + @PostMapping("/edit") + public AjaxResult edit(@Validated(Update.class) @RequestBody GoodsInfoDTO goodsInfo) { + return goodsOperateInfoService.updateGoodsOperateInfo(goodsInfo); + } + + /** + * 运营PC-删除商品基本信息 + * + * @param ids 商品id集合 + * @return 删除信息 + */ + @PreAuthorize("@ss.hasPermi('system:operateGoodInfo:remove')") + @Log(title = "运营PC端商品基本信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + return goodsInfoService.deleteGoodsInfoByIds(ids); + } + + /** + * 运营PC-修改商品上架状态基本信息 + * + * @param goodsInfo 商品信息 + * @return 上架结果 + */ + @PreAuthorize("@ss.hasPermi('system:operateGoodInfo:editGoodsWhetherShelf')") + @Log(title = "运营PC端商品基本信息", businessType = BusinessType.UPDATE) + @PostMapping("/editGoodsWhetherShelf") + public AjaxResult editGoodsWhetherShelf(@RequestBody GoodsInfo goodsInfo) { + return AjaxResult.success(goodsInfoService.updateGoodsWhetherShelf(goodsInfo)); + } +}