Newer
Older
huludao / src / main / java / com / newfiber / modules / inspection / controller / EquTechnologicalProcessInfoController.java
package com.newfiber.modules.inspection.controller;

import com.newfiber.common.utils.PageUtils;
import com.newfiber.common.utils.R;
import com.newfiber.modules.inspection.entity.EquTechnologicalProcessInfoEntity;
import com.newfiber.modules.inspection.service.EquTechnologicalProcessInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;
import java.util.UUID;


/**
 * 设备工单流程信息表
 *
 * @author xiey
 * @email sunlightcs@gmail.com
 * @date 2020-09-10 19:16:42
 */
@RestController
@RequestMapping("equtechnologicalprocessinfo")
@Api(tags = "设备工单流程信息")
public class EquTechnologicalProcessInfoController {

    @Autowired
    private EquTechnologicalProcessInfoService equTechnologicalProcessInfoService;

    /**
     * 查询当前用户需审批的流程
     */
    @PostMapping("/list")
    @ApiOperation("查询当前用户需审批的流程")
    //@RequiresPermissions("business:equtechnologicalprocessinfo:list")
    public R list(@RequestBody Map<String, Object> params) {
        PageUtils list = equTechnologicalProcessInfoService.queryInfo(params);

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

    /**
     * 保存
     */
    @PostMapping("/save")
    @ApiOperation("新增审批流程")
    //@RequiresPermissions("business:equtechnologicalprocessinfo:save")
    public R save(@RequestBody List<EquTechnologicalProcessInfoEntity> entityList) {
        entityList.get(0).setPointer(1);
        String uuid = UUID.randomUUID().toString().replace("-", "");
        for (EquTechnologicalProcessInfoEntity infoEntity : entityList) {
            infoEntity.setApprovalNo(uuid);
        }
        equTechnologicalProcessInfoService.saveBatch(entityList);

        return R.ok();
    }

    /**
     * 修改
     */
    @PostMapping("/update")
    @ApiOperation("修改审批流程")
    //@RequiresPermissions("business:equtechnologicalprocessinfo:update")
    public R update(@RequestBody EquTechnologicalProcessInfoEntity equTechnologicalProcessInfo) {
        equTechnologicalProcessInfoService.updateInfo(equTechnologicalProcessInfo);

        return R.ok();
    }

}