controller.java.ftl 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package ${package.Controller};
  2. import org.springframework.beans.factory.annotation.Autowired;
  3. import org.springframework.web.bind.annotation.RequestMapping;
  4. import ${package.Service}.${table.serviceName};
  5. <#if restControllerStyle>
  6. import org.springframework.web.bind.annotation.RestController;
  7. <#else>
  8. import org.springframework.stereotype.Controller;
  9. </#if>
  10. <#if superControllerClassPackage??>
  11. import ${superControllerClassPackage};
  12. </#if>
  13. /**
  14. * <p>
  15. * ${table.comment!} 前端控制器
  16. * </p>
  17. *
  18. * @author ${author}
  19. * @since ${date}
  20. */
  21. <#if restControllerStyle>
  22. @RestController
  23. <#else>
  24. @Controller
  25. </#if>
  26. @RequestMapping("/<#if controllerMappingHyphenStyle??>${controllerMappingHyphen}<#else>${table.entityPath}</#if>")
  27. <#if kotlin>
  28. class ${table.controllerName}<#if superControllerClass??> : ${superControllerClass}()</#if>
  29. <#else>
  30. <#if superControllerClass??>
  31. public class ${table.controllerName} extends ${superControllerClass} {
  32. <#else>
  33. public class ${table.controllerName} {
  34. </#if>
  35. @Autowired
  36. private ${table.serviceName} <#if controllerMappingHyphenStyle??>${controllerMappingHyphen}<#else>${table.entityPath}</#if>Service;
  37. }
  38. </#if>