package com.prolog.rdc.tms.controller;

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 com.prolog.framework.common.message.RestMessage;
import com.prolog.framework.log.aop.annotation.UserLog;
import com.prolog.rdc.tms.model.vo.ClearFieldByExtendedObjectVO;
import com.prolog.rdc.tms.service.ExtendedFieldService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 
 *
 * 公共服务-扩展字段处理控制层
 *
 * @className :ExtendedFieldController
 * @author :fanzw
 * @creationTime :2022/04/01
 * @description :
 *
 * @modifier :fanzw
 * @modifyTime :2022/04/01
 * @reviseRemarks:
 *
 * @version :1.0.0
 *
 */
@Api(tags = "公共服务-扩展字段处理控制层")
@RestController
@RequestMapping("/common")
public class ExtendedFieldController {

	@Autowired
	private ExtendedFieldService extendedFieldService;

	@UserLog("扩展字段置空")
	@ApiOperation(value = "扩展字段置空", notes = "扩展字段置空")
	@PostMapping("/clear")
	public RestMessage<String> clearFieldExecute(@RequestBody ClearFieldByExtendedObjectVO clearFieldByExtendedObjectVO) {
		try {
			extendedFieldService.clearFieldData(clearFieldByExtendedObjectVO);
			return RestMessage.newInstance(true, "处理成功", null);
		} catch (Exception e) {
			e.printStackTrace();
			return RestMessage.newInstance(false, e.getMessage(), null);
		}
	}

}
