package com.lz.modules.app.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.lz.modules.app.entity.StaffEducationEntity;
import com.lz.modules.app.service.StaffEducationService;
import com.lz.common.utils.PageUtils;
import com.lz.common.utils.R;



/**
 * 员工教育背景
 *
 * @author fumeiai
 * @email fumeiai@linzikg.com
 * @date 2020-04-29 20:59:20
 */
@RestController
@RequestMapping("generator/staffeducation")
public class StaffEducationController {
    @Autowired
    private StaffEducationService staffEducationService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("generator:staffeducation:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = staffEducationService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("generator:staffeducation:info")
    public R info(@PathVariable("id") Long id){
		StaffEducationEntity staffEducation = staffEducationService.getById(id);

        return R.ok().put("staffEducation", staffEducation);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("generator:staffeducation:save")
    public R save(@RequestBody StaffEducationEntity staffEducation){
		staffEducationService.save(staffEducation);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("generator:staffeducation:update")
    public R update(@RequestBody StaffEducationEntity staffEducation){
		staffEducationService.updateById(staffEducation);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("generator:staffeducation:delete")
    public R delete(@RequestBody Long[] ids){
		staffEducationService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
