
一、IDEA File and Code Templatesjava类、接口、枚举等文件创建模板的修改,修改后可以根据公司的代码规范,自定义创建相关文件时生成的文件初始代码,提高开发效率的同时保障代码的规范性。1. Class#if (${PACKAGE_NAME} ${PACKAGE_NAME} != "")package ${PACKAGE_NAME}; #end #parse("File Header.java") #if (${PACKAGE_NAME} ${PACKAGE_NAME} != "" ${PACKAGE_NAME.contains(".controller")}) import com.github.pagehelper.PageInfo; import io.swagger.annotations.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; /** * $Description * @author xxx * @date ${YEAR}-${MONTH}-${DAY} ${HOUR}:${MINUTE} */ @Api(tags = "$Description") @RestController @RequestMapping("$URI") public class ${NAME} { /** * 示例方法 * @return */ @ApiOperation(value = "示例方法", notes = "示例方法") @ApiResponses({ @ApiResponse(code = 0, message = "操作成功", response = JSONObject.class), @ApiResponse(code = 1000, message = "操作失败") }) @ApiImplicitParams({ @ApiImplicitParam(name = "exampleParam", required = true, value = "示例参数"), }) @GetMapping("/exampleUri") public JSONObject exampleMethod(@RequestParam(value = "exampleParam") String exampleParam){ return new JSONObject(); } } #elseif (${PACKAGE_NAME} ${PACKAGE_NAME} != "" ${PACKAGE_NAME.contains(".service.impl")}) import ${PACKAGE_NAME.replace(".impl","")}.${NAME.replace("Impl","")}; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; /** * $Description * @author xxx * @date ${YEAR}-${MONTH}-${DAY} ${HOUR}:${MINUTE} */ @Service public class ${NAME} implements ${NAME.replace("Impl","")} { } #elseif (${PACKAGE_NAME} ${PACKAGE_NAME} != "" ${PACKAGE_NAME.contains(".response")}) import io.swagger.annotations.Api; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.ToString; import java.io.Serializable; /** * $Description * @author xxx * @date ${YEAR}-${MONTH}-${DAY} ${HOUR}:${MINUTE} */ @Api(tags = "$Description响应") @Data @ToString public class ${NAME} implements Serializable { private static final long serialVersionUID = 5952689219413916553L; /** * 示例字段 */ @ApiModelProperty(value = "示例字段") private String exampleField; } #elseif(${PACKAGE_NAME} ${PACKAGE_NAME} != "" ${PACKAGE_NAME.contains(".request")}) import io.swagger.annotations.Api; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.ToString; import java.io.Serializable; /** * $Description * @