PersonnelController.java 1.66 KB
package com.bsth.controller;

import com.bsth.common.Constants;
import com.bsth.data.pinyin.PersionPinYin;
import com.bsth.data.pinyin.PersionPinYinBuffer;
import com.bsth.entity.Personnel;
import com.bsth.entity.sys.CompanyAuthority;
import com.bsth.service.PersonnelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

/**
 * Created by xu on 16/6/15.
 */
@RestController
@RequestMapping("personnel")
public class PersonnelController extends BaseController<Personnel, Integer> {

    @Autowired
    private PersonnelService service;

    @Autowired
    PersionPinYinBuffer persionPinYinBuffer;

    @RequestMapping(value = "/sreachPersonnel", method = RequestMethod.GET)
	public List<Map<String, String>> sreachPersonnel(@RequestParam String jobCode) {
		return service.sreachPersonnel(jobCode);
	}

    @RequestMapping(value = "/all_py", method = RequestMethod.GET)
	public List<PersionPinYin> findAll_PY(){
        return persionPinYinBuffer.getAll();
    }

    @RequestMapping(value = "/list_py", method = RequestMethod.GET)
    public List<PersionPinYin> findByCurrUser_PY(HttpServletRequest request){
        List<CompanyAuthority> auths = (List<CompanyAuthority>) request.getSession().getAttribute(Constants.COMPANY_AUTHORITYS);
        return persionPinYinBuffer.getAll(auths);
    }
}