package com.diagbot.web;


import com.diagbot.annotation.SysLogger;
import com.diagbot.dto.RespDTO;
import com.diagbot.facade.IntroduceMapFacade;
import com.diagbot.vo.IntroduceMapVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
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;

/**
 * <p>
 * 标签与提示信息映射表 前端控制器
 * </p>
 *
 * @author zhaops
 * @since 2018-11-16
 */
@RestController
@RequestMapping("/introduceMap")
@SuppressWarnings("unchecked")
@Api(value = "提示信息与标签映射关系维护相关API", tags = { "提示信息与标签映射关系维护相关API" })
public class IntroduceMapController {

    @Autowired
    IntroduceMapFacade introduceMapFacade;

    @ApiOperation(value = "保存标签提示信息映射关系[by:zhaops]",
            notes = "questionId: 标签id,必填" +
                    "introduceId: 提示信息id,必填" +
                    "type: 标签类型,必填")
    @PostMapping("/saveIntroduceMap")
    @SysLogger("saveIntroduceMap")
    @Transactional
    public RespDTO<Boolean> saveIntroduceMap(@RequestBody IntroduceMapVO introduceMapVO) {
        Boolean data = introduceMapFacade.saveIntroduceMap(introduceMapVO);
        return RespDTO.onSuc(data);
    }

    @ApiOperation(value = "删除标签提示信息映射关系[by:zhaops]",
            notes = "questionId: 标签id,必填" +
                    "introduceId: 提示信息id,必填" +
                    "type: 标签类型,必填")
    @PostMapping("/delIntroduceMap")
    @SysLogger("delIntroduceMap")
    @Transactional
    public RespDTO<Boolean> delIntroduceMap(@RequestBody IntroduceMapVO introduceMapVO) {
        Boolean data = introduceMapFacade.delIntroduceMap(introduceMapVO);
        return RespDTO.onSuc(data);
    }
}