/**
 * 2022-02-23  mzy 
 * 共通平台 - 首页提醒
 * 智慧医疗 - 首页提醒
 * 汇总一下我的待跟进的咨询单数量
 */
public with sharing class InquiryFormManageController {
    public InquiryFormManageController() {
        
    }
    
    //查询当前登录人所能查看到的符合要求的咨询单
    public static InquiryFormView getCurrentInquiryInform(){

        List<Inquiry_form__c> AllInquiryForm =  goSelectByCurrentUser();

        InquiryFormView MyInquiryForm = new  InquiryFormView();
        if(AllInquiryForm.size()>0){
            MyInquiryForm.InquiryFormList = AllInquiryForm;
            MyInquiryForm.isShow = true;
        }
        return MyInquiryForm;
    }

    //根据当前用户查找咨询单
    public static List<Inquiry_form__c> goSelectByCurrentUser(){
    	//定义List封装查询结果
    	List<Inquiry_form__c> AllInquiryForm = new List<Inquiry_form__c>();
    	//查询
    	String query = 'SELECT id ';
    	       query += 'FROM Inquiry_form__c ';
               //状态 为 未跟进
               query += 'WHERE Status__c = \'01.未跟进\' ';
               //所有人 为 当前登录人
               query += 'AND OwnerId = \''+UserInfo.getUserId()+'\'';

        AllInquiryForm = Database.query(query);

    	return AllInquiryForm;
    }

    public class InquiryFormView {
        //是否显示
        @AuraEnabled
        public Boolean isShow;
        //查询结果
        @AuraEnabled
        public List<Inquiry_form__c> InquiryFormList;

        public InquiryFormView(){
            this.isShow = false;
            this.InquiryFormList = new List<Inquiry_form__c>();
        }
    }
}