ソースを参照

fix fetch 餐券

shenzhongzheng 2 年 前
コミット
aea35c03bd

+ 51 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/controller/CesMealCouponController.java

@@ -0,0 +1,51 @@
+package org.jeecg.modules.rooms.controller;
+
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.jeecg.common.Enum.ResultCode;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.modules.rooms.entity.CesMealCoupon;
+import org.jeecg.modules.rooms.service.CesMealCouponServiceImpl;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+/**
+ * <p>
+ * 餐卷设置 前端控制器
+ * </p>
+ *
+ * @author fendo
+ * @since 2023-03-14
+ */
+@RestController
+@RequestMapping("/rooms/cesMealCoupon")
+@Api(tags = "ces_all_day_price_rule")
+@Slf4j
+public class CesMealCouponController {
+
+    @Resource
+    private CesMealCouponServiceImpl mealCouponService;
+
+    @ApiOperation(value="餐券查询", notes="餐券查询")
+    @GetMapping("/fetch")
+    public Result fetch(@RequestParam  String hotelId){
+        if(StringUtils.isBlank(hotelId)){
+            return Result.error(ResultCode.PARAM_MISS);
+        }
+        try{
+            return mealCouponService.fetch(hotelId);
+        }catch (Exception e){
+            return Result.error(e.getMessage());
+        }
+    }
+}
+

+ 3 - 3
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/rooms/service/CesMealCouponServiceImpl.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.apache.commons.lang3.StringUtils;
+import org.jeecg.common.api.vo.Result;
 import org.jeecg.modules.rooms.Vo.SelectVo;
 import org.jeecg.modules.rooms.entity.CesMealCoupon;
 import org.jeecg.modules.rooms.mapper.CesMealCouponMapper;
@@ -31,8 +32,7 @@ public class CesMealCouponServiceImpl extends ServiceImpl<CesMealCouponMapper, C
      * @param hotelId
      * @return
      */
-    public List<SelectVo> fetch(String hotelId){
-        if(StringUtils.isBlank(hotelId)) return new ArrayList<>();
+    public Result fetch(String hotelId){
         List<SelectVo> vos = new ArrayList<>();
         List<CesMealCoupon> list = cesMealCouponMapper.selectList(Wrappers.<CesMealCoupon>lambdaQuery().eq(CesMealCoupon::getHotelId,hotelId));
         list.forEach(v -> {
@@ -41,6 +41,6 @@ public class CesMealCouponServiceImpl extends ServiceImpl<CesMealCouponMapper, C
             vo.setValue(v.getId());
             vos.add(vo);
         });
-        return vos;
+        return Result.ok(vos);
     }
 }