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.StaffWorkTransferRecordEntity;
import com.lz.modules.app.service.StaffWorkTransferRecordService;
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/staffworktransferrecord")
public class StaffWorkTransferRecordController {
    @Autowired
    private StaffWorkTransferRecordService staffWorkTransferRecordService;

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

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


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("generator:staffworktransferrecord:info")
    public R info(@PathVariable("id") Long id){
		StaffWorkTransferRecordEntity staffWorkTransferRecord = staffWorkTransferRecordService.getById(id);

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

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("generator:staffworktransferrecord:save")
    public R save(@RequestBody StaffWorkTransferRecordEntity staffWorkTransferRecord){
		staffWorkTransferRecordService.save(staffWorkTransferRecord);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("generator:staffworktransferrecord:update")
    public R update(@RequestBody StaffWorkTransferRecordEntity staffWorkTransferRecord){
		staffWorkTransferRecordService.updateById(staffWorkTransferRecord);

        return R.ok();
    }

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

        return R.ok();
    }

}
