您当前的位置:首页 > 时尚 > 内容

如何用vs配置easyx(大众vs5参数配置)

如何用vs配置easyx(大众vs5参数配置)?如果你对这个不了解,来看看!

开发神器EasyCode,下面是知了堂给大家的分享,一起来看看。

如何用vs配置easyx

前言Easy Code介绍

对于java程序员来说,日常工作中就是crud的操作,每次都要搭建MVC三层,还是很繁琐,这里就出现了神器easycode的工具,可以快速生成代码,并且还可以自定义模板,这样来对开发人员来说就减少了很多事情,把更多的时间去用在业务上,大大提高了效率。下面就一步一步搭建easycode,并且使用。

1、打开IntelliJ IDEA 新建一个maven工程

2、选择工程存放目录

3、下载安装EasyCode插件

file->settings->plugins 搜索Easy Code

搜索到后点击Install 我这里安装过了 安装完成会让你重启IDEA。

如何判断是否安装成功 file->settings->Other settings 看是否有Easy Code这个选项

4、引入Easy Code模板 (可以根据个人情况定制 也可以使用默认的)

5、创建数据库,数据表

6、配置数据源(需要指定数据库名称,要生成数据表)

点击IDEA右侧的Datbase->点击上方的加号->选择Data Source.->Mysql

7、配置数据源

注意:连接方式需要采用mysql8的连接方式,不然可能连接失败jdbc:mysql://localhost:3306/table?useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC&useSSL=false

8、连接成功如图所示

9、引入springboot的相关pom.xml依赖

<dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>1.3.2</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.38</version> </dependency> </dependencies>

需要用到mybatis的启动器,所以也一起引用

10、打开Easy Code插件 选要生成的entity,controller,service,serviceimpl,dao

右击表名->Easy Code->Generate Code

Module:当前项目模块

package:生成代码存放包的位置

Template:生成的模板

11、勾选All表示生成所有,勾选禁止提示,防止弹出很多个提示信息,点击OK

12、生成模板

entity.java代码:

##引入宏定义$!define$!init##使用宏定义设置回调(保存位置与文件后缀)#save("/entity", ".java")##使用宏定义设置包后缀#setPackageSuffix("entity")##使用全局变量实现默认包导入$!autoImportimport java.io.Serializable;import lombok.Data;##使用宏定义实现类注释信息#tableComment("实体类")@Datapublic class $!{tableInfo.name} implements Serializable { private static final long serialVersionUID = $!tool.serial();#foreach($column in $tableInfo.fullColumn) #if(${column.comment})/** * ${column.comment} */#end private $!{tool.getClsNameByFullName($column.type)} $!{column.name};#end}

controller接口:controller.java代码如下:

##定义初始变量#set($tableName = $tool.append($tableInfo.name, "Controller"))##设置回调$!callback.setFileName($tool.append($tableName, ".java"))$!callback.setSavePath($tool.append($tableInfo.savePath, "/controller"))##拿到主键#if(!$tableInfo.pkColumn.isEmpty()) #set($pk = $tableInfo.pkColumn.get(0))#end#if($tableInfo.savePackageName)package $!{tableInfo.savePackageName}.#{end}controller;import lombok.extern.slf4j.Slf4j;import com.github.pagehelper.PageInfo;import $!{tableInfo.savePackageName}.response.PageResult;import $!{tableInfo.savePackageName}.response.Result;import $!{tableInfo.savePackageName}.response.StatusCode;import $!{tableInfo.savePackageName}.entity.$!{tableInfo.name};import $!{tableInfo.savePackageName}.service.$!{tableInfo.name}Service;import org.springframework.web.bind.annotation.*;import org.springframework.util.CollectionUtils;import javax.annotation.Resource;import java.util.List;import java.util.Objects;/** * $!{tableInfo.comment}($!{tableInfo.name})控制层 * * @author protagonist * @since $!time.currTime() */@RestController@Slf4j@RequestMapping("/$!tool.firstLowerCase($tableInfo.name)")public class $!{tableName} { /** * 服务对象 */ @Resource private $!{tableInfo.name}Service $!tool.firstLowerCase($tableInfo.name)ServiceImpl; /** * 通过主键查询单条数据 * * @param $!pk.name 主键 * @return 单条数据 */ @GetMapping(value = "/get/{$!pk.name}") public Result selectOne(@PathVariable("$!pk.name") $!pk.shortType $!pk.name) { $tableInfo.name result = $!{tool.firstLowerCase($tableInfo.name)}ServiceImpl.selectById(id); if(Objects.nonNull(result)){ return new Result<>(true,StatusCode.OK,"查询成功",result); } return new Result<>(true,StatusCode.ERROR,"查询失败"); } /** * 新增一条数据 * * @param $!tool.firstLowerCase($tableInfo.name) 实体类 * @return Result对象 */ @PostMapping(value = "/insert") public Result insert(@RequestBody $tableInfo.name $!tool.firstLowerCase($tableInfo.name)) { int result = $!{tool.firstLowerCase($tableInfo.name)}ServiceImpl.insert($!tool.firstLowerCase($tableInfo.name)); if (result > 0) { return new Result<>(true,StatusCode.OK,"新增成功",result); } return new Result<>(true,StatusCode.ERROR,"新增失败"); } /** * 修改一条数据 * * @param $!tool.firstLowerCase($tableInfo.name) 实体类 * @return Result对象 */ @PutMapping(value = "/update") public Result update(@RequestBody $tableInfo.name $!tool.firstLowerCase($tableInfo.name)) { $tableInfo.name result = $!{tool.firstLowerCase($tableInfo.name)}ServiceImpl.update($!tool.firstLowerCase($tableInfo.name)); if (Objects.nonNull(result)) { return new Result<>(true,StatusCode.OK,"修改成功",result); } return new Result<>(true,StatusCode.ERROR,"修改失败"); } /** * 删除一条数据 * * @param $!pk.name 主键 * @return Result对象 */ @DeleteMapping(value = "/delete/{$!pk.name}") public Result delete(@PathVariable("$!pk.name") $!pk.shortType $!pk.name) { int result = $!{tool.firstLowerCase($tableInfo.name)}ServiceImpl.deleteById($!pk.name); if (result > 0) { return new Result<>(true,StatusCode.OK,"删除成功",result); } return new Result<>(true,StatusCode.ERROR,"删除失败"); } /** * 查询全部 * * @return Result对象 */ @GetMapping(value = "/selectAll") public Result<List<$tableInfo.name>> selectAll() { List<$tableInfo.name> $!tool.firstLowerCase($tableInfo.name)s = $!{tool.firstLowerCase($tableInfo.name)}ServiceImpl.selectAll(); if (CollectionUtils.isEmpty($!tool.firstLowerCase($tableInfo.name)s)) { return new Result<>(true,StatusCode.ERROR,"查询全部数据失败"); } return new Result<>(true,StatusCode.OK,"查询全部数据成功",$!tool.firstLowerCase($tableInfo.name)s); } /** * 分页查询 * * @param current 当前页 第零页和第一页的数据是一样 * @param size 每一页的数据条数 * @return Result对象 */ @GetMapping(value = "/selectPage/{current}/{size}") public Result selectPage(@PathVariable("current") Integer current,@PathVariable("size") Integer size) { PageInfo<$tableInfo.name> page = $!{tool.firstLowerCase($tableInfo.name)}ServiceImpl.selectPage(current, size); if (Objects.nonNull(page)) { return new Result<>(true,StatusCode.OK,"分页条件查询成功",new PageResult<>(page.getTotal(),page.getList())); } return new Result<>(true,StatusCode.ERROR,"分页查询数据失败"); } }

service接口:service.java 代码如下:

##定义初始变量#set($tableName = $tool.append($tableInfo.name, "Service"))##设置回调$!callback.setFileName($tool.append($tableName, ".java"))$!callback.setSavePath($tool.append($tableInfo.savePath, "/service"))##拿到主键#if(!$tableInfo.pkColumn.isEmpty()) #set($pk = $tableInfo.pkColumn.get(0))#end#if($tableInfo.savePackageName)package $!{tableInfo.savePackageName}.#{end}service;import $!{tableInfo.savePackageName}.entity.$!{tableInfo.name};import java.util.List;import com.github.pagehelper.PageInfo;/** * $!{tableInfo.comment}($!{tableInfo.name})表服务接口 * * @author protagonist * @since $!time.currTime() */public interface $!{tableName} { /** * 通过ID查询单条数据 * * @param $!pk.name 主键 * @return 实例对象 */ $!{tableInfo.name} selectById($!pk.shortType $!pk.name); /** * 分页查询 * * @param current 当前页 * @param size 每一页数据的条数 * @return 对象列表 */ PageInfo<$!{tableInfo.name}> selectPage(int current, int size); /** * 查询全部 * * @return 对象列表 */ List<$!{tableInfo.name}> selectAll(); /** * 通过实体作为筛选条件查询 * * @param $!tool.firstLowerCase($!{tableInfo.name}) 实例对象 * @return 对象列表 */ List<$!{tableInfo.name}> selectList($!{tableInfo.name} $!tool.firstLowerCase($!{tableInfo.name})); /** * 新增数据 * * @param $!tool.firstLowerCase($!{tableInfo.name}) 实例对象 * @return 影响行数 */ int insert($!{tableInfo.name} $!tool.firstLowerCase($!{tableInfo.name})); /** * 批量新增 * * @param $!tool.firstLowerCase($!{tableInfo.name})s 实例对象的集合 * @return 影响行数 */ int batchInsert(List<$!{tableInfo.name}> $!tool.firstLowerCase($!{tableInfo.name})s); /** * 修改数据 * * @param $!tool.firstLowerCase($!{tableInfo.name}) 实例对象 * @return 修改 */ $!{tableInfo.name} update($!{tableInfo.name} $!tool.firstLowerCase($!{tableInfo.name})); /** * 通过主键删除数据 * * @param $!pk.name 主键 * @return 影响行数 */ int deleteById($!pk.shortType $!pk.name); /** * 查询总数据数 * * @return 数据总数 */ int count();}

serviceImpl 实现类:serviceImpl .java代码如下:

##定义初始变量#set($tableName = $tool.append($tableInfo.name, "ServiceImpl"))##设置回调$!callback.setFileName($tool.append($tableName, ".java"))$!callback.setSavePath($tool.append($tableInfo.savePath, "/service/impl"))##拿到主键#if(!$tableInfo.pkColumn.isEmpty()) #set($pk = $tableInfo.pkColumn.get(0))#end#if($tableInfo.savePackageName)package $!{tableInfo.savePackageName}.#{end}service.impl;import $!{tableInfo.savePackageName}.entity.$!{tableInfo.name};import $!{tableInfo.savePackageName}.dao.$!{tableInfo.name}Dao;import $!{tableInfo.savePackageName}.service.$!{tableInfo.name}Service;import org.springframework.transaction.annotation.Transactional;import org.springframework.stereotype.Service;import com.github.pagehelper.PageHelper;import com.github.pagehelper.PageInfo;import javax.annotation.Resource;import java.util.List;/** * $!{tableInfo.comment}($!{tableInfo.name}表)服务实现类 * * @author protagonist * @since $!time.currTime() */@Service("$!tool.firstLowerCase($!{tableInfo.name})ServiceImpl")public class $!{tableName} implements $!{tableInfo.name}Service { @Resource private $!{tableInfo.name}Dao $!tool.firstLowerCase($!{tableInfo.name})Dao; /** * 通过ID查询单条数据 * * @param $!pk.name 主键 * @return 实例对象 */ @Override public $!{tableInfo.name} selectById($!pk.shortType $!pk.name) { return this.$!{tool.firstLowerCase($!{tableInfo.name})}Dao.selectById($!pk.name); } /** * 分页查询 * * @param current 当前页 * @param size 每一页的条数 * @return 对象列表 */ @Override public PageInfo<$!{tableInfo.name}> selectPage(int current, int size) { PageHelper.startPage(current,size); List<$!{tableInfo.name}> dataList = $!{tool.firstLowerCase($!{tableInfo.name})}Dao.selectAll(); return new PageInfo<>(dataList); } /** * 查询所有 * * @return 实例对象的集合 */ @Override public List<$!{tableInfo.name}> selectAll() { return this.$!{tool.firstLowerCase($!{tableInfo.name})}Dao.selectAll(); } /** * 根据条件查询 * * @return 实例对象的集合 */ @Override public List<$!{tableInfo.name}> selectList($!{tableInfo.name} $!{tool.firstLowerCase($!{tableInfo.name})}) { return this.$!{tool.firstLowerCase($!{tableInfo.name})}Dao.selectList($!{tool.firstLowerCase($!{tableInfo.name})}); } /** * 新增数据 * * @param $!tool.firstLowerCase($!{tableInfo.name}) 实例对象 * @return 实例对象 */ @Override @Transactional public int insert($!{tableInfo.name} $!tool.firstLowerCase($!{tableInfo.name})) { return this.$!{tool.firstLowerCase($!{tableInfo.name})}Dao.insert($!tool.firstLowerCase($!{tableInfo.name})); } /** * 批量新增 * * @param $!tool.firstLowerCase($!{tableInfo.name})s 实例对象的集合 * @return 生效的条数 */ @Override @Transactional public int batchInsert(List<$!{tableInfo.name}> $!tool.firstLowerCase($!{tableInfo.name})s) { return this.$!{tool.firstLowerCase($!{tableInfo.name})}Dao.batchInsert($!tool.firstLowerCase($!{tableInfo.name})s); } /** * 修改数据 * * @param $!tool.firstLowerCase($!{tableInfo.name}) 实例对象 * @return 实例对象 */ @Override @Transactional public $!{tableInfo.name} update($!{tableInfo.name} $!tool.firstLowerCase($!{tableInfo.name})) { this.$!{tool.firstLowerCase($!{tableInfo.name})}Dao.update($!tool.firstLowerCase($!{tableInfo.name})); return this.selectById($!{tool.firstLowerCase($!{tableInfo.name})}.get$!tool.firstUpperCase($pk.name)()); } /** * 通过主键删除数据 * * @param $!pk.name 主键 * @return 是否成功 */ @Override @Transactional public int deleteById($!pk.shortType $!pk.name) { return this.$!{tool.firstLowerCase($!{tableInfo.name})}Dao.deleteById($!pk.name); } /** * 查询总数据数 * * @return 数据总数 */ @Override public int count(){ return this.$!{tool.firstLowerCase($!{tableInfo.name})}Dao.count(); }}

dao层:dao.java代码如下

##定义初始变量#set($tableName = $tool.append($tableInfo.name, "Dao"))##设置回调$!callback.setFileName($tool.append($tableName, ".java"))$!callback.setSavePath($tool.append($tableInfo.savePath, "/dao"))##拿到主键#if(!$tableInfo.pkColumn.isEmpty()) #set($pk = $tableInfo.pkColumn.get(0))#end#if($tableInfo.savePackageName)package $!{tableInfo.savePackageName}.#{end}dao;import $!{tableInfo.savePackageName}.entity.$!{tableInfo.name};import org.apache.ibatis.annotations.Mapper;import org.apache.ibatis.annotations.Param;import java.util.List;/** * $!{tableInfo.comment}($!{tableInfo.name})表数据库访问层 * * @author protagonist * @since $!time.currTime() */ @Mapperpublic interface $!{tableName} { /** * 通过ID查询单条数据 * * @param $!pk.name 主键 * @return 实例对象 */ $!{tableInfo.name} selectById($!pk.shortType $!pk.name); /** * 查询全部 * * @return 对象列表 */ List<$!{tableInfo.name}> selectAll(); /** * 通过实体作为筛选条件查询 * * @param $!tool.firstLowerCase($!{tableInfo.name}) 实例对象 * @return 对象列表 */ List<$!{tableInfo.name}> selectList($!{tableInfo.name} $!tool.firstLowerCase($!{tableInfo.name})); /** * 新增数据 * * @param $!tool.firstLowerCase($!{tableInfo.name}) 实例对象 * @return 影响行数 */ int insert($!{tableInfo.name} $!tool.firstLowerCase($!{tableInfo.name})); /** * 批量新增 * * @param $!tool.firstLowerCase($!{tableInfo.name})s 实例对象的集合 * @return 影响行数 */ int batchInsert(List<$!{tableInfo.name}> $!tool.firstLowerCase($!{tableInfo.name})s); /** * 修改数据 * * @param $!tool.firstLowerCase($!{tableInfo.name}) 实例对象 * @return 影响行数 */ int update($!{tableInfo.name} $!tool.firstLowerCase($!{tableInfo.name})); /** * 通过主键删除数据 * * @param $!pk.name 主键 * @return 影响行数 */ int deleteById($!pk.shortType $!pk.name); /** * 查询总数据数 * * @return 数据总数 */ int count();}

mapper.xml代码如下:

##引入mybatis支持$!mybatisSupport##设置保存名称与保存位置$!callback.setFileName($tool.append($!{tableInfo.name}, "Dao.xml"))$!callback.setSavePath($tool.append($modulePath, "/src/main/resources/mapper"))##拿到主键#if(!$tableInfo.pkColumn.isEmpty()) #set($pk = $tableInfo.pkColumn.get(0))#end<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"><mapper namespace="$!{tableInfo.savePackageName}.dao.$!{tableInfo.name}Dao"> <!-- 结果集 --> <resultMap type="$!{tableInfo.savePackageName}.entity.$!{tableInfo.name}" id="$!{tableInfo.name}Map">#foreach($column in $tableInfo.fullColumn) <result property="$!column.name" column="$!column.obj.name" jdbcType="$!column.ext.jdbcType"/>#end </resultMap> <!-- 基本字段 --> <sql id="Base_Column_List"> #allSqlColumn() </sql> <!-- 查询单个 --> <select id="selectById" resultMap="$!{tableInfo.name}Map"> select <include refid="Base_Column_List" /> from $!tableInfo.obj.name where $!pk.obj.name = #{$!pk.name} </select> <!-- 查询全部 --> <select id="selectAll" resultMap="$!{tableInfo.name}Map"> select <include refid="Base_Column_List" /> from $!tableInfo.obj.name </select> <!--通过实体作为筛选条件查询--> <select id="selectList" resultMap="$!{tableInfo.name}Map"> select <include refid="Base_Column_List" /> from $!tableInfo.obj.name <where> #foreach($column in $tableInfo.fullColumn) <if test="$!column.name != null#if($column.type.equals("java.lang.String")) and $!column.name != ''#end"> and $!column.obj.name = #{$!column.name} </if> #end </where> </select> <!-- 新增所有列 --> <insert id="insert" keyProperty="$!pk.name" useGeneratedKeys="true"> insert into $!{tableInfo.obj.name}(#foreach($column in $tableInfo.fullColumn)$!column.obj.name#if($velocityHasNext), #end#end) values ( #foreach($column in $tableInfo.fullColumn)#{$!{column.name}}#if($velocityHasNext), #end#end) </insert> <!-- 批量新增 --> <insert id="batchInsert"> insert into $!{tableInfo.obj.name}(#foreach($column in $tableInfo.fullColumn)$!column.obj.name#if($velocityHasNext), #end#end) values <foreach collection="$!tool.firstLowerCase($!{tableInfo.name})s" item="item" index="index" separator=","> ( #foreach($column in $tableInfo.fullColumn) #{item.$!{column.name}}#if($velocityHasNext), #end#end ) </foreach> </insert> <!-- 通过主键修改数据 --> <update id="update"> update $!{tableInfo.obj.parent.name}.$!{tableInfo.obj.name} <set> #foreach($column in $tableInfo.otherColumn) <if test="$!column.name != null#if($column.type.equals("java.lang.String")) and $!column.name != ''#end"> $!column.obj.name = #{$!column.name}, </if> #end </set> where $!pk.obj.name = #{$!pk.name} </update> <!--通过主键删除--> <delete id="deleteById"> delete from $!{tableInfo.obj.name} where $!pk.obj.name = #{$!pk.name} </delete> <!-- 总数 resultType="int"> select count(*) from $!{tableInfo.obj.name} </select></mapper>

测试成功!

代码就全部生成出来了!

大众vs5参数配置

2021款捷达VS5采用了大尺寸六边形的前格栅设计,其内部则使用了点阵式加以点缀,配合其J型的品牌LOGO,视觉效果突出。同时,保险杠两边的大尺寸C字形雾灯线条,让该车看上去更加动感、年轻。下方的包围处还用了银色饰板进行包裹装饰,使整车的运动感和辨识度提升不少,相信这也很符合年轻车主的审美。

一汽-大众捷达-捷达VS5

灯光方面,梯形大灯棱角分明,全系车型均采用LED光源照明。除此之外,还标配了 LED日间行车灯和大灯高度可调功能,顶配车型还配备了自动头灯及大灯延时关闭功能。

车身侧面设计延续了大众一贯的简约、伶俐风格,一条锋利的腰线从前轮眉处直接贯穿至后尾灯组,整体十分流畅自然且不失力量感。与此同时,车门底部向内凹陷的造型增加了层次感。尾部造型也是很讲究,两个尾灯采用的是“Y”型设计,后包围和前包围一样,用的是银色饰板进行装饰,提升了整体的辨识度。车身尺寸方面,长宽高分别为4419/1841/1616mm,轴距为2630mm。

内饰设计简洁明了,毫无花哨的赘余线条,各个功能区一目了然,上手零难度。并且中控台向驾驶员一侧倾斜,提升了驾驶员的操作便利性。内饰用料上以硬质材料为主,这点略显遗憾,不过整体的视觉效果还是不错的。8英寸的中控屏幕界面清晰明了,CarPlay、CarLife、WeLink手机互联都有支持,兼容了不同操作系统和使用习惯的手机用户。

方向盘为大众经典的三辐样式设计,低配车型同样带有多功能按键。顶配车型方向盘采用真皮材质包裹,其它车型则采用皮质包裹,握感舒适、灵巧,并支持四向调节功能。仪表盘采用传统的双圆筒+单色行车电脑组合,并没有过多的亮点。不过这块小屏能显示的信息还是挺丰富的。

座椅方面,进取型采用织物材质包覆,其它车型则采用仿皮材质包裹。这样的用料也反映了它的车型定位,好在内部填充上比较足,整体的支撑性还是不错的。顶配车型还支持主驾驶座电动调节及前排座椅加热功能,进一步提升了车内的乘坐舒适性。后排无论是腿部还是头部都有较为宽敞的余量,中间位置坐垫较平而且柔软,但地台凸起较高。

动力方面,捷达VS5搭载大众EA211系列的1.4T涡轮增压发动机,并已满足国VI排放标准。发动机最大功率为150马力,最大扭矩为250N·m,与之相匹配的是5挡手动或6挡手自一体变速箱。

推荐车型:2020款 280TSI自动悦享型

捷达VS5不论是软件还是硬件,水平都很不错。1.4T+6AT的动力总成成熟可靠,在耐久性方面也经历了考验。整体来说,捷达VS5适合对汽车表面的东西要求不高,但是对车的机械素质有追求的消费者去选择。

车系中较为推荐自动悦享型,相较于自动进取型其换装了18英寸轮圈,配置上增加了前排侧气囊、疲劳驾驶提示、前驻车雷达、倒车影像、无钥匙启动、驾驶位无钥匙进入等功能,价格上仅高出了7000元,还是非常值得的。根据汽车之家真实车主价格显示,目前终端优惠力度不大,如果您感兴趣的话不妨关注一下。


声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,谢谢。

上一篇: 麒麟960(全面解析华为麒麟960芯片的性能和优势)

下一篇: 氯冉酸(关于氯冉酸简述)



推荐阅读

网站内容来自网络,如有侵权请联系我们,立即删除! | 软文发布 | 粤ICP备2021106084号