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

import com.bsth.entity.Personnel;
import com.bsth.service.schedule.utils.DataToolsProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

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

    @Autowired
    private DataToolsProperties dataToolsProperties;

    /**
     * 覆写方法,因为form提交的方式参数不全,改用 json形式提交 @RequestBody
     * @Title: save
     * @Description: TODO(持久化对象)
     * @param @param t
     * @param @return    设定文件
     * @return Map<String,Object>  {status: 1(成功),-1(失败)}
     * @throws
     */
    @RequestMapping(method = RequestMethod.POST)
    public Map<String, Object> save(@RequestBody Personnel t){
        return baseService.save(t);
    }

    /**
     * 验证。
     * @param map
     * @return
     */
    @RequestMapping(value = "/validate/equale", method = RequestMethod.GET)
    public Map<String, Object> validateData(@RequestParam Map<String, Object> map) {
        // 一般比较相同公司下工号是否相同
        return baseService.validateEquale(map);
    }

    @Override
    protected String getDataImportKtrClasspath() {
        return dataToolsProperties.getEmployeesDatainputktr();
    }

    @Override
    protected String getDataExportKtrClasspath() {
        return dataToolsProperties.getEmployeesDataoutputktr();
    }

    @Override
    protected String getDataExportFilename() {
        return "人员基础信息";
    }
}