# RevenueRoomTypeRoomsController.java

    package cloud.wconnect.rateshop.controller.revenue;

    import cloud.wconnect.commonlib.annotation.ApiId;
    import cloud.wconnect.commonlib.component.SessionContext;
    import cloud.wconnect.rateshop.pojo.dto.revenue.RoomTypeRoomsDTO;
    import cloud.wconnect.rateshop.service.revenue.IRevenueRoomTypeRoomsService;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.validation.annotation.Validated;
    import org.springframework.web.bind.annotation.*;

    import jakarta.validation.Valid;
    import java.util.Collections;
    import java.util.List;
    import java.util.Map;

    /**
     * <p>
     * 不同房型的可用房间数 前端控制器
     * </p>
     *
     * @author yyt
     * @since 2025-02-11
     */
    @Validated
    @RestController
    @RequestMapping("/revenue")
    public class RevenueRoomTypeRoomsController {

        @Autowired
        private SessionContext sessionContext;
        @Autowired
        private IRevenueRoomTypeRoomsService revenueRoomTypeRoomsService;

        /**
         * 1342 - 获取不同房型的房间数
         *
         * @param date 指定日期
         * @param property 资产标识
         * @return 房间数
         * @author yyt
         * @date 2025/2/11
         **/
        @ApiId(1342)
        @GetMapping("/{date:\\d+}/room-type-rooms")
        public List<RoomTypeRoomsDTO> list(@PathVariable long date, String property){
            return revenueRoomTypeRoomsService.listDTO(sessionContext.getPropertyId(property), date);
        }

        /**
         * 1343 - 编辑不同房型的房间数
         *
         * @param date                 指定日期
         * @param property             资产标识
         * @param roomTypeRoomsDTOList 房间数
         * @return {}
         * @author yyt
         * @date 2025/2/11
         **/
        @ApiId(1343)
        @PostMapping("/{date:\\d+}/room-type-rooms")
        public Map edit(@PathVariable long date, String property, @RequestBody List<@Valid RoomTypeRoomsDTO> roomTypeRoomsDTOList) {
            revenueRoomTypeRoomsService.save(sessionContext.getPropertyId(property), date, roomTypeRoomsDTOList, sessionContext.getLoginUserId());
            return Collections.emptyMap();
        }

    }