前提
开发目的:解决常用的代码crud重复工作。
采取方案:利用mybatisPlus生成crud代码(包含controller,service,serviceImpl,mapper,mapperxml代码)。
采用技术:springboot2.1.1+mybatisPlus3.0.6+swagger2.5.0+Lombok1.18.4+postgresql等。
具体细节:
第一步:
首先利用idea开发工具搭建springboot的maven项目,并配置好数据库连接等配置文件包(config)和comm包(常用代码工具类)。
第二步:
编辑常用的代码vm模板(可以根据自己的需求修改)
controller.java.vm
package ${package.Controller};
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import com.plus.generate.common.ResponseObject;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import com.plus.generate.common.ResponsePageEntity;
import lombok.extern.java.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springf