|
|
@@ -0,0 +1,91 @@
|
|
|
+package org.jeecg.modules.bus.controller;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.jeecg.annotation.ApiLogin;
|
|
|
+import org.jeecg.com.util.ThirdSessionHolder;
|
|
|
+import org.jeecg.common.api.vo.Result;
|
|
|
+import org.jeecg.common.aspect.annotation.AutoLog;
|
|
|
+import org.jeecg.common.system.query.QueryGenerator;
|
|
|
+import org.jeecg.common.util.TenantContextHolder;
|
|
|
+import org.jeecg.config.ApiVersion;
|
|
|
+import org.jeecg.config.ApiVersionConstant;
|
|
|
+import org.jeecg.config.WebConfig;
|
|
|
+import org.jeecg.modules.business.entity.BusHotel;
|
|
|
+import org.jeecg.modules.business.service.IBusHotelService;
|
|
|
+import org.jeecg.modules.order.entity.CesOrderRepair;
|
|
|
+import org.jeecg.modules.order.service.ICesOrderRepairService;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+
|
|
|
+/**
|
|
|
+* @Description: ces_order_repair
|
|
|
+* @Author: jeecg-boot
|
|
|
+* @Date: 2023-03-27
|
|
|
+* @Version: V1.0
|
|
|
+*/
|
|
|
+@Api(tags="服务维修单")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/mall-api/hotel-order-repair")
|
|
|
+@Slf4j
|
|
|
+public class OrderRepairController extends WebConfig {
|
|
|
+ @Resource
|
|
|
+ private ICesOrderRepairService cesOrderRepairService;
|
|
|
+ @Resource
|
|
|
+ private IBusHotelService busHotelService;
|
|
|
+ /**
|
|
|
+ * 服务维修单分页列表查询
|
|
|
+ *
|
|
|
+ * @param cesOrderRepair
|
|
|
+ * @param pageNo
|
|
|
+ * @param pageSize
|
|
|
+ * @param req
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiLogin
|
|
|
+ @ApiVersion(group = ApiVersionConstant.FAP_MALLAPI101)
|
|
|
+ @ApiOperation(value="服务维修单分页列表查询", notes="服务维修单分页列表查询")
|
|
|
+ @GetMapping(value = "/list")
|
|
|
+ public Result<IPage<CesOrderRepair>> queryPageList(CesOrderRepair cesOrderRepair,
|
|
|
+ @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
|
+ @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
|
|
+ @RequestParam(name="startTime",required = false) String startTime,
|
|
|
+ @RequestParam(name="endTime",required = false) String endTime,
|
|
|
+ HttpServletRequest req) {
|
|
|
+ LambdaQueryWrapper<CesOrderRepair> queryWrapper = QueryGenerator.initQueryWrapper(cesOrderRepair, req.getParameterMap()).lambda();
|
|
|
+ String tenantId = TenantContextHolder.getTenantId();
|
|
|
+ String userId = ThirdSessionHolder.getUserId();
|
|
|
+ queryWrapper.eq(CesOrderRepair::getUserId,userId);
|
|
|
+ Page<CesOrderRepair> page = new Page<CesOrderRepair>(pageNo, pageSize);
|
|
|
+ IPage<CesOrderRepair> pageList = cesOrderRepairService.page(page, queryWrapper);
|
|
|
+ pageList.getRecords().forEach(item -> {
|
|
|
+ BusHotel hotel = busHotelService.getById(item.getHotelId());
|
|
|
+ if (hotel != null) {
|
|
|
+ item.setHotelName(hotel.getName());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return Result.OK(pageList);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 服务维修单添加
|
|
|
+ *
|
|
|
+ * @param cesOrderRepair
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "服务维修单添加")
|
|
|
+ @ApiOperation(value="服务维修单添加", notes="服务维修单添加")
|
|
|
+ @ApiLogin
|
|
|
+ @ApiVersion(group = ApiVersionConstant.FAP_MALLAPI101)
|
|
|
+ @PostMapping(value = "/add")
|
|
|
+ public Result<String> add(@RequestBody CesOrderRepair cesOrderRepair) {
|
|
|
+ cesOrderRepairService.save(cesOrderRepair);
|
|
|
+ return Result.OK("添加成功!");
|
|
|
+ }
|
|
|
+}
|