package ${packageName}.controller;

/**
 * ${ClassName} ${functionName}
 *
 * Author ${author}
 * Email ${emali}
 * Date ${time}
*/
import com.hchyun.common.annotation.Log;
import com.hchyun.common.constant.ReturnConstants;
import com.hchyun.common.core.controller.BaseController;
import com.hchyun.common.core.entity.AjaxResult;
import com.hchyun.common.enums.BusinessType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;



#if($Permission)
@Api(value = "${functionName}",tags = "${functionName}")
#end
@RestController
@RequestMapping("${reqMapping}")
public class ${ClassName}Controller extends BaseController{
    private final Logger logger = LoggerFactory.getLogger(${ClassName}Controller.class);

#foreach($column in $columns)
#if($column.isGenerate.equals("1"))
#set($InterName = $column.itName.substring(0,1).toUpperCase() + ${column.itName.substring(1)})
    /**
    * ${column.itDescribe}
    */
    @ApiOperation("${column.itDescribe}")
#if($column.isPermission.equals("1"))
    @PreAuthorize("@hchyun.hasPermi('${prefix}:${column.requrl}')")
    @Log(title = "${column.itDescribe}", businessType = BusinessType.INSERT)
#end
    @${column.method}Mapping("/${column.requrl}")
#if($column.method.equals("Get"))
    public AjaxResult ${InterName} ( Map<String,String> parms){
#else
    public AjaxResult ${InterName} (@RequestBody Map<String,String> parms){
#end
        try {
            return AjaxResult.success("${column.itDescribe}测试!");
        }catch (RuntimeException e){
            logger.error(e.getMessage());
            return AjaxResult.error(ReturnConstants.DB_EX);
        }
    }
#end
#end
}



