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.StaffProjectExperienceEntity;
import com.lz.modules.app.service.StaffProjectExperienceService;
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/staffprojectexperience")
public class StaffProjectExperienceController {
    @Autowired
    private StaffProjectExperienceService staffProjectExperienceService;

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

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


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("generator:staffprojectexperience:info")
    public R info(@PathVariable("id") Long id){
		StaffProjectExperienceEntity staffProjectExperience = staffProjectExperienceService.getById(id);

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

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("generator:staffprojectexperience:save")
    public R save(@RequestBody StaffProjectExperienceEntity staffProjectExperience){
		staffProjectExperienceService.save(staffProjectExperience);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("generator:staffprojectexperience:update")
    public R update(@RequestBody StaffProjectExperienceEntity staffProjectExperience){
		staffProjectExperienceService.updateById(staffProjectExperience);

        return R.ok();
    }

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

        return R.ok();
    }

}
