package com.diagbot.web;


import com.diagbot.annotation.SysLogger;
import com.diagbot.dto.RespDTO;
import com.diagbot.entity.IntroduceDetail;
import com.diagbot.facade.IntroduceDetailFacade;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 提示信息明细 前端控制器
 * </p>
 *
 * @author zhaops
 * @since 2018-11-16
 */
@RestController
@RequestMapping("/introduceDetail")
@SuppressWarnings("unchecked")
@Api(value = "提示信息明细维护相关API", tags = { "提示信息明细维护相关API" })
public class IntroduceDetailController {
    @Autowired
    IntroduceDetailFacade introduceDetailFacade;

    @ApiOperation(value = "获取提示信息明细信息[by:zhaops]",
            notes = "introduceId: 提示信息id,必填")
    @PostMapping("/getByIntroduceId")
    @SysLogger("getByIntroduceId")
    public RespDTO<List<IntroduceDetail>> getByIntroduceId(@RequestParam Long introduceId) {
        List<IntroduceDetail> data = introduceDetailFacade.getByIntroduceId(introduceId);
        return RespDTO.onSuc(data);
    }

    @ApiOperation(value = "删除单条提示信息明细[by:zhaops]",
            notes = "id: id,必填")
    @PostMapping("/deleteRecord")
    @SysLogger("deleteRecord")
    @Transactional
    public RespDTO<Boolean> deleteRecord(@RequestParam Long id) {
        Boolean data = introduceDetailFacade.deleteRecord(id);
        return RespDTO.onSuc(data);
    }

    @ApiOperation(value = "批量删除提示信息明细[by:zhaops]",
            notes = "ids: ids,必填")
    @PostMapping("/deleteRecords")
    @SysLogger("deleteRecords")
    @Transactional
    public RespDTO<Boolean> deleteRecords(@RequestParam Long[] ids) {
        Boolean data = introduceDetailFacade.deleteRecords(ids);
        return RespDTO.onSuc(data);
    }
}