# TaCompareOtaRateCodeConfigController.java

    package cloud.wconnect.finance.controller.ta;

    import cloud.wconnect.commonlib.annotation.ApiId;
    import cloud.wconnect.commonlib.component.SessionContext;
    import cloud.wconnect.finance.pojo.dto.ta.compare.TaCompareOtaRateCodeDTO;
    import cloud.wconnect.finance.service.ta.ITaCompareOtaRateCodeConfigService;
    import org.springframework.validation.annotation.Validated;
    import org.springframework.web.bind.annotation.*;

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

    /**
     * <p>
     * TA 用于过滤 OTA 数据 前端控制器
     * </p>
     *
     * @author zc
     * @since 2023-07-27
     */
    @Validated
    @RestController
    @RequestMapping("/ta/report-compare/ota-rate-code/config")
    public class TaCompareOtaRateCodeConfigController {
        @Resource
        private ITaCompareOtaRateCodeConfigService taCompareOtaRateCodeConfigService;
        @Resource
        private SessionContext sessionContext;

        /**
         * 获取 OTA Rate Code
         *
         * @param property 资产标识
         * @return TaCompareOtaRateCodeDTO 集合
         * @author zc
         * @date 2023/7/27
         */
        @ApiId(502)
        @GetMapping
        public List<TaCompareOtaRateCodeDTO> list(String property) {
            int propertyId = sessionContext.getPropertyId(property);

            return taCompareOtaRateCodeConfigService.list(propertyId);
        }

        /**
         * 保存 OTA Rate Code
         *
         * @param property 资产标识
         * @param list     资产标识
         * @return TaCompareOtaRateCodeDTO 集合
         * @author zc
         * @date 2023/7/27
         */
        @ApiId(503)
        @PostMapping
        public Map<Object, Object> save(String property, @RequestBody List<@Valid TaCompareOtaRateCodeDTO> list) {
            int tenantId = sessionContext.getTenantSymbolBO().getId();
            int propertyId = sessionContext.getPropertyId(property);

            taCompareOtaRateCodeConfigService.save(tenantId, propertyId, list, sessionContext.getLoginUserId());

            return Collections.emptyMap();
        }
    }