package com.activiti6.controller.activiti;


import com.activiti6.domain.AjaxResult;
import com.activiti6.domain.DbTableHis;
import com.activiti6.domain.TableDataInfo;
import com.activiti6.service.activiti.IDbTableHisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 流程历史单Controller
 *
 * @author xtd
 * @date 2020-04-14
 */
@RestController
@RequestMapping("/his")
public class DbTableHisController extends BaseController
{
    @Autowired
    private IDbTableHisService dbTableHisService;

    /**
     * 查询流程历史单列表
     */
    @GetMapping("/list")
    public TableDataInfo list(DbTableHis dbTableHis)
    {
        startPage();
        List<DbTableHis> list = dbTableHisService.selectDbTableHisList(dbTableHis);
        return getDataTable(list);
    }


    /**
     * 获取流程历史单详细信息
     */
    @GetMapping(value = "/{instanceId}")
    public AjaxResult getInfo(@PathVariable("instanceId") String instanceId)
    {
        return AjaxResult.success(dbTableHisService.selectDbTableHisById(instanceId));
    }

    /**
     * 新增流程历史单
     */
    @PostMapping
    public AjaxResult add(@RequestBody DbTableHis dbTableHis)
    {
        return toAjax(dbTableHisService.insertDbTableHis(dbTableHis));
    }

    /**
     * 修改流程历史单
     */
    @PutMapping
    public AjaxResult edit(@RequestBody DbTableHis dbTableHis)
    {
        return toAjax(dbTableHisService.updateDbTableHis(dbTableHis));
    }

    /**
     * 删除流程历史单
     */
	@DeleteMapping("/{instanceIds}")
    public AjaxResult remove(@PathVariable String[] instanceIds)
    {
        return toAjax(dbTableHisService.deleteDbTableHisByIds(instanceIds));
    }
}
