Browse Source

设置主房

qh 2 years ago
parent
commit
92c7acc693

+ 14 - 14
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/controller/BusBookingRoomsController.java

@@ -102,20 +102,20 @@ public class BusBookingRoomsController extends JeecgController<BusBookingRooms,
 		busBookingRoomsService.updateById(busBookingRooms);
 		busBookingRoomsService.updateById(busBookingRooms);
 		return Result.OK("编辑成功!");
 		return Result.OK("编辑成功!");
 	}
 	}
-//	 /**
-//	  *  设置为主房
-//	  *
-//	  * @param busBookingRooms
-//	  * @return
-//	  */
-//	 @AutoLog(value = "预定关联房间-设置为主房")
-//	 @ApiOperation(value="预定关联房间-设置为主房", notes="预定关联房间-设置为主房")
-//	 //@RequiresPermissions("business:bus_booking_rooms:edit")
-//	 @RequestMapping(value = "/set", method = {RequestMethod.PUT,RequestMethod.POST})
-//	 public Result<String> edit(@RequestBody BusBookingRooms busBookingRooms) {
-//		 busBookingRoomsService.updateById(busBookingRooms);
-//		 return Result.OK("编辑成功!");
-//	 }
+	 /**
+	  *  设置为主房
+	  *
+	  * @param busBookingRooms
+	  * @return
+	  */
+	 @AutoLog(value = "预定关联房间-设置为主房")
+	 @ApiOperation(value="预定关联房间-设置为主房", notes="预定关联房间-设置为主房")
+	 //@RequiresPermissions("business:bus_booking_rooms:edit")
+	 @RequestMapping(value = "/set-main", method = {RequestMethod.PUT,RequestMethod.POST})
+	 public Result<String> setMain(@RequestBody BusBookingRooms busBookingRooms) {
+		 busBookingRoomsService.setMain(busBookingRooms.getId());
+		 return Result.OK("编辑成功!");
+	 }
 
 
 	 /**
 	 /**
 	 *   通过id删除
 	 *   通过id删除

+ 0 - 1
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/entity/BusBookingRooms.java

@@ -65,5 +65,4 @@ public class BusBookingRooms implements Serializable {
     @ApiModelProperty(value = "是否主房")
     @ApiModelProperty(value = "是否主房")
     private Boolean isMain;
     private Boolean isMain;
 
 
-
 }
 }

+ 4 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/mapper/BusBookingRoomsMapper.java

@@ -4,6 +4,7 @@ import java.util.List;
 
 
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
 import org.jeecg.modules.business.entity.BusBookingRooms;
 import org.jeecg.modules.business.entity.BusBookingRooms;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.jeecg.modules.business.vo.ExtendBusBookingRoomsVo;
 import org.jeecg.modules.business.vo.ExtendBusBookingRoomsVo;
@@ -27,4 +28,7 @@ public interface BusBookingRoomsMapper extends BaseMapper<BusBookingRooms> {
             "\tr.booking_orders_id = #{bookingId} and\n" +
             "\tr.booking_orders_id = #{bookingId} and\n" +
             "\tr.booking_type=#{sType}")
             "\tr.booking_type=#{sType}")
     List<ExtendBusBookingRoomsVo> bookingRooms(String bookingId, Integer sType);
     List<ExtendBusBookingRoomsVo> bookingRooms(String bookingId, Integer sType);
+
+    @Update("update bus_booking_rooms set is_main = 0 where booking_orders_id = #{orderId}")
+    Boolean setNotMain(String orderId);
 }
 }

+ 4 - 2
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/business/service/impl/BusBookingRoomsServiceImpl.java

@@ -30,7 +30,9 @@ public class BusBookingRoomsServiceImpl extends ServiceImpl<BusBookingRoomsMappe
     public Boolean setMain(String relationRoomId) {
     public Boolean setMain(String relationRoomId) {
         BusBookingRooms roomR =  getById(relationRoomId);
         BusBookingRooms roomR =  getById(relationRoomId);
         if(roomR==null) throw new JeecgBootException("未找到房间");
         if(roomR==null) throw new JeecgBootException("未找到房间");
-//        update(Wrappers.<BusBookingRooms>query())
-        return null;
+        baseMapper.setNotMain(roomR.getBookingOrdersId());
+        roomR.setIsMain(true);
+        updateById(roomR);
+        return true;
     }
     }
 }
 }