# HkInventoryTaxRateController.java

    package cloud.wconnect.workperformance.controller.hkinventory;

    import cloud.wconnect.commonlib.annotation.ApiId;
    import cloud.wconnect.commonlib.component.SessionContext;
    import cloud.wconnect.workperformance.pojo.dto.hkinventory.HkInventoryTaxRateDTO;
    import cloud.wconnect.workperformance.service.hkinventory.IHkInventoryTaxRateService;
    import jakarta.validation.Valid;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.web.bind.annotation.*;

    import java.util.Collections;
    import java.util.Map;

    /**
     * <p>
     * 税率表 前端控制器
     * </p>
     *
     * @author lichen
     * @since 2025-07-15
     */
    @RestController
    @RequestMapping("/hk-inventory/tax-rate")
    public class HkInventoryTaxRateController {

        @Autowired
        private SessionContext sessionContext;
        @Autowired
        private IHkInventoryTaxRateService hkInventoryTaxRateService;

        /**
         * 查询税率
         *
         * @param property 资产标识
         * @return cloud.wconnect.workperformance.pojo.dto.hkinventory.HkInventoryTaxRateDTO
         * @author lichen
         * @date 2025/7/15
         */
        @ApiId(1537)
        @GetMapping
        public HkInventoryTaxRateDTO get(String property) {
            int propertyId = sessionContext.getPropertyId(property);
            return hkInventoryTaxRateService.getByPropertyId(propertyId);
        }

        /**
         * 保存资产的税率
         *
         * @param property   资产
         * @param taxRateDTO 税率DTO
         * @return java.util.Map<java.lang.String, java.lang.String>
         * @author lichen
         * @date 2025/7/15
         */
        @ApiId(1538)
        @PostMapping
        public Map<String, String> save(String property, @RequestBody @Valid HkInventoryTaxRateDTO taxRateDTO) {
            int propertyId = sessionContext.getPropertyId(property);
            Integer tenantId = sessionContext.getTenantSymbolBO().getId();

            //保存或修改
            hkInventoryTaxRateService.saveOrUpdate(tenantId, propertyId, taxRateDTO);

            return Collections.emptyMap();
        }

    }