package com.cim.idm.controller;

import com.cim.idm.model.dto.EditMaterialDto;
import com.cim.idm.service.IMaterialSpecService;
import com.cim.idm.utils.AjaxResult;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@EnableAutoConfiguration
@RequestMapping("/api/materialSpec")
public class MaterialSpecController {

	@Resource
	private IMaterialSpecService msService;

	@RequestMapping(value = "/edit", method = RequestMethod.POST)
	public AjaxResult editMaterialSpec(@RequestBody EditMaterialDto editMaterialDto){
		if (msService.editMaterialSpec(editMaterialDto) > 0) {
			return AjaxResult.me().setSuccess(true).setMessage("编辑成功");
		}
		return AjaxResult.me().setErrorCode(-1).setMessage("编辑失败");
	}

}