package com.ym.mec.web.controller;

import com.ym.mec.biz.dal.enums.MessageTypeEnum;
import com.ym.mec.biz.service.SysMessageConfigService;
import com.ym.mec.common.controller.BaseController;
import com.ym.mec.common.entity.HttpResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author Joburgess
 * @Date 2021/10/14 0014
 */
@Api(tags = "消息模板")
@RequestMapping("sysMessageConfig")
@RestController
public class SysMessageConfigController extends BaseController {

    @Autowired
    private SysMessageConfigService sysMessageConfigService;

    @ApiOperation(value = "获取指定类型的消息模板")
    @GetMapping("getWithType")
    @PreAuthorize("@pcs.hasPermissions('sysMessageConfig/getWithType')")
    public HttpResponseResult getWithType(MessageTypeEnum type){
        return succeed(sysMessageConfigService.queryByType(type));
    }
}
