package com.propertyManagement.web.controller.business.api;

import com.propertyManagement.business.domain.bo.WxCommonPhoneBo;
import com.propertyManagement.business.domain.vo.LoginWxUser;
import com.propertyManagement.business.domain.vo.WxCommonPhoneVo;
import com.propertyManagement.business.service.IWxCommonPhoneService;
import com.propertyManagement.business.support.util.AuthUtil;
import com.propertyManagement.common.core.controller.BaseController;
import com.propertyManagement.common.core.domain.R;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 常用电话
 *
 * @author liushuai
 * @date 2025-05-14
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/api/commonPhone")
public class ApiWxCommonPhoneController extends BaseController {

    private final IWxCommonPhoneService iWxCommonPhoneService;

    /**
     * 查询常用电话列表
     */
    @GetMapping("/listAll")
    public R<List<WxCommonPhoneVo>> list(WxCommonPhoneBo bo) {
        LoginWxUser wxUser = AuthUtil.getWxUser();
        bo.setCommunityId(wxUser.getCommunityId());
        return R.ok(iWxCommonPhoneService.queryList(bo));
    }
}
