/*
 * @Author: Kane
 * @Date: 2023-02-28 23:13:51
 * @LastEditors: Kane
 * @FilePath: /desktop_archievement_backend/src/main/java/com/cpic/xim/web/controllers/account/StaffInfoQueryController.java
 * @Description: 员工信息查询controller
 * 
 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 */
package com.cpic.xim.web.controllers.account;

import java.sql.SQLException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.cpic.xim.utils.account.CpicXIMStaffInfo;

@Controller
@RequestMapping( "/account" )
public class StaffInfoQueryController
{
    @RequestMapping( "/query_staff_info.do" )
    @ResponseBody
    public StaffInfoQueryResult queryStaffInfo( @RequestParam( "account" ) String account )
    {
        StaffInfoQueryResult result = new StaffInfoQueryResult();
        CpicXIMStaffInfo staffInfo = null;

        try
        {
            staffInfo = CpicXIMStaffInfo.getStaffInfo( account );

            result.setStaffInfo( staffInfo );
            result.setSuccess( true );
            result.setMessage( "查询成功" );
        }
        catch ( SQLException error )
        {
            result.setSuccess( false );
            result.setMessage( error.getMessage() );
        }
        catch ( ClassNotFoundException error )
        {
            result.setSuccess( false );
            result.setMessage( error.getMessage() );
        }

        return result;
    }
}

