Commit 79524274 by zhengxj

finish 集成mybatis generator on 20181225 by zhengxj

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@16031 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent 03be1aad
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.glsx</groupId>
<artifactId>car-service-generator</artifactId>
<version>1.0.0</version>
<name>car-service-generator</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<parent>
<groupId>com.glsx</groupId>
<artifactId>car-service</artifactId>
<version>1.0.0</version>
<relativePath>../pom.xml</relativePath> <!--本例中此处是可选的-->
</parent>
<dependencies>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
</dependency>
<!-- 数据库 -->
<dependency><!-- 分页插件 -->
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.1.2</version>
</dependency>
<dependency>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-core</artifactId>
<version>1.3.5</version>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.0</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- spring-boot -->
<dependency><!-- 热部署 -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional><!-- true:依赖不会传递 -->
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<!-- 把tomcat-jdbc连接池排除掉,这样spring-boot就会寻找是否有HikariCP可用 -->
<exclusion>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven
defaults (may be moved to parent pom) -->
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
</configuration>
</plugin>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.5</version>
<executions>
<execution>
<id>Generate MyBatis Artifacts</id>
<phase>package</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- generator 工具配置文件的位置 -->
<configurationFile>src/main/resources/mybatis/generator-config.xml</configurationFile>
<!--允许移动生成的文件 -->
<verbose>true</verbose>
<!-- 是否覆盖 -->
<overwrite>true</overwrite>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
/**
*
*/
package com.glsx.generator.utils;
import java.io.File;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import org.mybatis.generator.api.MyBatisGenerator;
import org.mybatis.generator.config.Configuration;
import org.mybatis.generator.config.xml.ConfigurationParser;
import org.mybatis.generator.exception.InvalidConfigurationException;
import org.mybatis.generator.exception.XMLParserException;
import org.mybatis.generator.internal.DefaultShellCallback;
/**
* @ClassName: AutoGenerator
* @Description: TODO(这里用一句话描述这个类的作用)
* @author Zheng Xiajun
* @date 2018年12月25日
*
*/
public class AutoGenerator {
public static void main(String[] args)
throws IOException, XMLParserException, InvalidConfigurationException, SQLException, InterruptedException {
List<String> warnings = new ArrayList<String>();
boolean overwrite = true;
// ****** 修改成本地绝对路径******
File configFile = new File(
"D:/Application/eclipse-jee-mars/workspace/car-service/car-service/car-service-generator/src/main/resource/mybatis/generator-config.xml");
ConfigurationParser cp = new ConfigurationParser(warnings);
Configuration config = cp.parseConfiguration(configFile);
DefaultShellCallback callback = new DefaultShellCallback(overwrite);
MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings);
System.out.println("Begin to generate....");
myBatisGenerator.generate(null);
System.out.println("Generate successfully....");
}
}
package com.glsx.manager.dao;
import com.glsx.manager.entity.SysMenu;
public interface SysMenuMapper {
int deleteByPrimaryKey(Integer id);
int insert(SysMenu record);
int insertSelective(SysMenu record);
SysMenu selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(SysMenu record);
int updateByPrimaryKey(SysMenu record);
}
\ No newline at end of file \ No newline at end of file
package com.glsx.manager.dao;
import com.glsx.manager.entity.SysOrganization;
import com.glsx.manager.entity.SysOrganizationExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface SysOrganizationMapper {
long countByExample(SysOrganizationExample example);
int deleteByExample(SysOrganizationExample example);
int deleteByPrimaryKey(Integer id);
int insert(SysOrganization record);
int insertSelective(SysOrganization record);
List<SysOrganization> selectByExample(SysOrganizationExample example);
SysOrganization selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("record") SysOrganization record, @Param("example") SysOrganizationExample example);
int updateByExample(@Param("record") SysOrganization record, @Param("example") SysOrganizationExample example);
int updateByPrimaryKeySelective(SysOrganization record);
int updateByPrimaryKey(SysOrganization record);
}
\ No newline at end of file \ No newline at end of file
package com.glsx.manager.entity;
import java.util.Date;
public class SysMenu {
private Integer id;
private String menu_name;
private Integer parent_id;
private Integer sort_value;
private String right_des;
private String request_add;
private String menu_status;
private String menu_type;
private String menu_icon;
private Date create_time;
private Date update_time;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getMenu_name() {
return menu_name;
}
public void setMenu_name(String menu_name) {
this.menu_name = menu_name == null ? null : menu_name.trim();
}
public Integer getParent_id() {
return parent_id;
}
public void setParent_id(Integer parent_id) {
this.parent_id = parent_id;
}
public Integer getSort_value() {
return sort_value;
}
public void setSort_value(Integer sort_value) {
this.sort_value = sort_value;
}
public String getRight_des() {
return right_des;
}
public void setRight_des(String right_des) {
this.right_des = right_des == null ? null : right_des.trim();
}
public String getRequest_add() {
return request_add;
}
public void setRequest_add(String request_add) {
this.request_add = request_add == null ? null : request_add.trim();
}
public String getMenu_status() {
return menu_status;
}
public void setMenu_status(String menu_status) {
this.menu_status = menu_status == null ? null : menu_status.trim();
}
public String getMenu_type() {
return menu_type;
}
public void setMenu_type(String menu_type) {
this.menu_type = menu_type == null ? null : menu_type.trim();
}
public String getMenu_icon() {
return menu_icon;
}
public void setMenu_icon(String menu_icon) {
this.menu_icon = menu_icon == null ? null : menu_icon.trim();
}
public Date getCreate_time() {
return create_time;
}
public void setCreate_time(Date create_time) {
this.create_time = create_time;
}
public Date getUpdate_time() {
return update_time;
}
public void setUpdate_time(Date update_time) {
this.update_time = update_time;
}
}
\ No newline at end of file \ No newline at end of file
package com.glsx.manager.entity;
import java.util.Date;
public class SysOrganization {
private Integer id;
private Integer parentId;
private String orgName;
private String orgStatus;
private String orgType;
private Date createTime;
private Integer sortValue;
private Date updateTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getParentId() {
return parentId;
}
public void setParentId(Integer parentId) {
this.parentId = parentId;
}
public String getOrgName() {
return orgName;
}
public void setOrgName(String orgName) {
this.orgName = orgName == null ? null : orgName.trim();
}
public String getOrgStatus() {
return orgStatus;
}
public void setOrgStatus(String orgStatus) {
this.orgStatus = orgStatus == null ? null : orgStatus.trim();
}
public String getOrgType() {
return orgType;
}
public void setOrgType(String orgType) {
this.orgType = orgType == null ? null : orgType.trim();
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Integer getSortValue() {
return sortValue;
}
public void setSortValue(Integer sortValue) {
this.sortValue = sortValue;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
\ No newline at end of file \ No newline at end of file
<?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="com.glsx.manager.dao.SysMenuMapper">
<resultMap id="BaseResultMap" type="com.glsx.manager.entity.SysMenu">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="menu_name" jdbcType="VARCHAR" property="menu_name" />
<result column="parent_id" jdbcType="INTEGER" property="parent_id" />
<result column="sort_value" jdbcType="INTEGER" property="sort_value" />
<result column="right_des" jdbcType="VARCHAR" property="right_des" />
<result column="request_add" jdbcType="VARCHAR" property="request_add" />
<result column="menu_status" jdbcType="CHAR" property="menu_status" />
<result column="menu_type" jdbcType="CHAR" property="menu_type" />
<result column="menu_icon" jdbcType="VARCHAR" property="menu_icon" />
<result column="create_time" jdbcType="TIMESTAMP" property="create_time" />
<result column="update_time" jdbcType="TIMESTAMP" property="update_time" />
</resultMap>
<sql id="Base_Column_List">
id, menu_name, parent_id, sort_value, right_des, request_add, menu_status, menu_type,
menu_icon, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from sys-menu
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from sys-menu
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.glsx.manager.entity.SysMenu">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into sys-menu (menu_name, parent_id, sort_value,
right_des, request_add, menu_status,
menu_type, menu_icon, create_time,
update_time)
values (#{menu_name,jdbcType=VARCHAR}, #{parent_id,jdbcType=INTEGER}, #{sort_value,jdbcType=INTEGER},
#{right_des,jdbcType=VARCHAR}, #{request_add,jdbcType=VARCHAR}, #{menu_status,jdbcType=CHAR},
#{menu_type,jdbcType=CHAR}, #{menu_icon,jdbcType=VARCHAR}, #{create_time,jdbcType=TIMESTAMP},
#{update_time,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.glsx.manager.entity.SysMenu">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into sys-menu
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="menu_name != null">
menu_name,
</if>
<if test="parent_id != null">
parent_id,
</if>
<if test="sort_value != null">
sort_value,
</if>
<if test="right_des != null">
right_des,
</if>
<if test="request_add != null">
request_add,
</if>
<if test="menu_status != null">
menu_status,
</if>
<if test="menu_type != null">
menu_type,
</if>
<if test="menu_icon != null">
menu_icon,
</if>
<if test="create_time != null">
create_time,
</if>
<if test="update_time != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="menu_name != null">
#{menu_name,jdbcType=VARCHAR},
</if>
<if test="parent_id != null">
#{parent_id,jdbcType=INTEGER},
</if>
<if test="sort_value != null">
#{sort_value,jdbcType=INTEGER},
</if>
<if test="right_des != null">
#{right_des,jdbcType=VARCHAR},
</if>
<if test="request_add != null">
#{request_add,jdbcType=VARCHAR},
</if>
<if test="menu_status != null">
#{menu_status,jdbcType=CHAR},
</if>
<if test="menu_type != null">
#{menu_type,jdbcType=CHAR},
</if>
<if test="menu_icon != null">
#{menu_icon,jdbcType=VARCHAR},
</if>
<if test="create_time != null">
#{create_time,jdbcType=TIMESTAMP},
</if>
<if test="update_time != null">
#{update_time,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.glsx.manager.entity.SysMenu">
update sys-menu
<set>
<if test="menu_name != null">
menu_name = #{menu_name,jdbcType=VARCHAR},
</if>
<if test="parent_id != null">
parent_id = #{parent_id,jdbcType=INTEGER},
</if>
<if test="sort_value != null">
sort_value = #{sort_value,jdbcType=INTEGER},
</if>
<if test="right_des != null">
right_des = #{right_des,jdbcType=VARCHAR},
</if>
<if test="request_add != null">
request_add = #{request_add,jdbcType=VARCHAR},
</if>
<if test="menu_status != null">
menu_status = #{menu_status,jdbcType=CHAR},
</if>
<if test="menu_type != null">
menu_type = #{menu_type,jdbcType=CHAR},
</if>
<if test="menu_icon != null">
menu_icon = #{menu_icon,jdbcType=VARCHAR},
</if>
<if test="create_time != null">
create_time = #{create_time,jdbcType=TIMESTAMP},
</if>
<if test="update_time != null">
update_time = #{update_time,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.glsx.manager.entity.SysMenu">
update sys-menu
set menu_name = #{menu_name,jdbcType=VARCHAR},
parent_id = #{parent_id,jdbcType=INTEGER},
sort_value = #{sort_value,jdbcType=INTEGER},
right_des = #{right_des,jdbcType=VARCHAR},
request_add = #{request_add,jdbcType=VARCHAR},
menu_status = #{menu_status,jdbcType=CHAR},
menu_type = #{menu_type,jdbcType=CHAR},
menu_icon = #{menu_icon,jdbcType=VARCHAR},
create_time = #{create_time,jdbcType=TIMESTAMP},
update_time = #{update_time,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file \ No newline at end of file
<?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="com.glsx.manager.dao.SysOrganizationMapper">
<resultMap id="BaseResultMap" type="com.glsx.manager.entity.SysOrganization">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="parent_id" jdbcType="INTEGER" property="parentId" />
<result column="org_name" jdbcType="VARCHAR" property="orgName" />
<result column="org_status" jdbcType="CHAR" property="orgStatus" />
<result column="org_type" jdbcType="CHAR" property="orgType" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="sort_value" jdbcType="INTEGER" property="sortValue" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, parent_id, org_name, org_status, org_type, create_time, sort_value, update_time
</sql>
<select id="selectByExample" parameterType="com.glsx.manager.entity.SysOrganizationExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
'false' as QUERYID,
<include refid="Base_Column_List" />
from sys-organization
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from sys-organization
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from sys-organization
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="com.glsx.manager.entity.SysOrganizationExample">
delete from sys-organization
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.glsx.manager.entity.SysOrganization">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into sys-organization (parent_id, org_name, org_status,
org_type, create_time, sort_value,
update_time)
values (#{parentId,jdbcType=INTEGER}, #{orgName,jdbcType=VARCHAR}, #{orgStatus,jdbcType=CHAR},
#{orgType,jdbcType=CHAR}, #{createTime,jdbcType=TIMESTAMP}, #{sortValue,jdbcType=INTEGER},
#{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.glsx.manager.entity.SysOrganization">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into sys-organization
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="parentId != null">
parent_id,
</if>
<if test="orgName != null">
org_name,
</if>
<if test="orgStatus != null">
org_status,
</if>
<if test="orgType != null">
org_type,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="sortValue != null">
sort_value,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="parentId != null">
#{parentId,jdbcType=INTEGER},
</if>
<if test="orgName != null">
#{orgName,jdbcType=VARCHAR},
</if>
<if test="orgStatus != null">
#{orgStatus,jdbcType=CHAR},
</if>
<if test="orgType != null">
#{orgType,jdbcType=CHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="sortValue != null">
#{sortValue,jdbcType=INTEGER},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.glsx.manager.entity.SysOrganizationExample" resultType="java.lang.Long">
select count(*) from sys-organization
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update sys-organization
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=INTEGER},
</if>
<if test="record.parentId != null">
parent_id = #{record.parentId,jdbcType=INTEGER},
</if>
<if test="record.orgName != null">
org_name = #{record.orgName,jdbcType=VARCHAR},
</if>
<if test="record.orgStatus != null">
org_status = #{record.orgStatus,jdbcType=CHAR},
</if>
<if test="record.orgType != null">
org_type = #{record.orgType,jdbcType=CHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.sortValue != null">
sort_value = #{record.sortValue,jdbcType=INTEGER},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update sys-organization
set id = #{record.id,jdbcType=INTEGER},
parent_id = #{record.parentId,jdbcType=INTEGER},
org_name = #{record.orgName,jdbcType=VARCHAR},
org_status = #{record.orgStatus,jdbcType=CHAR},
org_type = #{record.orgType,jdbcType=CHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
sort_value = #{record.sortValue,jdbcType=INTEGER},
update_time = #{record.updateTime,jdbcType=TIMESTAMP}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.glsx.manager.entity.SysOrganization">
update sys-organization
<set>
<if test="parentId != null">
parent_id = #{parentId,jdbcType=INTEGER},
</if>
<if test="orgName != null">
org_name = #{orgName,jdbcType=VARCHAR},
</if>
<if test="orgStatus != null">
org_status = #{orgStatus,jdbcType=CHAR},
</if>
<if test="orgType != null">
org_type = #{orgType,jdbcType=CHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="sortValue != null">
sort_value = #{sortValue,jdbcType=INTEGER},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.glsx.manager.entity.SysOrganization">
update sys-organization
set parent_id = #{parentId,jdbcType=INTEGER},
org_name = #{orgName,jdbcType=VARCHAR},
org_status = #{orgStatus,jdbcType=CHAR},
org_type = #{orgType,jdbcType=CHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
sort_value = #{sortValue,jdbcType=INTEGER},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file \ No newline at end of file
<?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="com.glsx.manager.mapper.TestMapper" >
<resultMap id="baseUserResultMap" type="com.glsx.manager.pojo.Test" >
<id column="id" property="id"/>
<result column="username" property="username"/>
</resultMap>
<select id="get" parameterType="com.glsx.manager.pojo.Test" resultMap="baseUserResultMap">
select
u.id, u.username
from user u
where id = #{id}
</select>
<select id="list" resultMap="baseUserResultMap">
select
u.id, u.username
from user u
</select>
</mapper>
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<context id="MySQL2Tables" targetRuntime="MyBatis3"
defaultModelType="flat">
<commentGenerator>
<property name="suppressDate" value="true" />
<property name="suppressAllComments" value="true" />
</commentGenerator>
<!--数据库链接地址账号密码 -->
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://192.168.0.39:3306/glsx_car_service?useSSL=false"
userId="root" password="123456">
</jdbcConnection>
<!-- true:使用BigDecimal对应DECIMAL和 NUMERIC数据类型 -->
<!-- false:默认, scale>0;length>18:使用BigDecimal; scale=0;length[10,18]:使用Long;
scale=0;length[5,9]:使用Integer; scale=0;length<5:使用Short; -->
<javaTypeResolver
type="org.mybatis.generator.internal.types.JavaTypeResolverDefaultImpl">
<property name="forceBigDecimals" value="false" />
</javaTypeResolver>
<!--生成Model类存放位置 -->
<javaModelGenerator targetPackage="com.glsx.manager.entity"
targetProject="src/main/java">
<!-- 在targetPackage的基础上,根据数据库的schema再生成一层package,最终生成的类放在这个package下,默认为false -->
<property name="enableSubPackages" value="true" />
<!-- 设置是否在getter方法中,对String类型字段调用trim()方法 -->
<property name="trimStrings" value="true" />
<!-- for MyBatis3/MyBatis3Simple 自动为每一个生成的类创建一个构造方法,构造方法包含了所有的field;而不是使用setter; -->
<property name="constructorBased" value="false" />
<!-- for MyBatis3/MyBatis3Simple 是否创建一个不可变的类,如果为true, 那么MBG会创建一个没有setter方法的类,取而代之的是类似constructorBased的类 -->
<property name="immutable" value="false" />
</javaModelGenerator>
<!--生成映射文件存放位置 -->
<sqlMapGenerator targetPackage="mappers"
targetProject="src/main/resource">
<property name="enableSubPackages" value="true" />
</sqlMapGenerator>
<!--生成Dao类存放位置 -->
<javaClientGenerator type="XMLMAPPER"
targetPackage="com.glsx.manager.dao" targetProject="src/main/java">
<property name="enableSubPackages" value="true" />
</javaClientGenerator>
<!--生成对应表及类名 -->
<table tableName="sys-organization" enableCountByExample="true"
enableUpdateByExample="true" enableDeleteByExample="true"
enableSelectByExample="true" selectByExampleQueryId="false">
<property name="useActualColumnNames" value="false" />
<!-- 需要插入时返回主键值,请将此属性打开,column值为主键的列明 -->
<generatedKey column="id" sqlStatement="MySql" identity="true" />
</table>
</context>
</generatorConfiguration>
...@@ -14,8 +14,9 @@ ...@@ -14,8 +14,9 @@
<url>http://www.example.com</url> <url>http://www.example.com</url>
<description>汽车服务共享平台</description> <description>汽车服务共享平台</description>
<modules> <modules>
<module>car-service-manager</module> <module>car-service-manager</module>
<module>car-service-generator</module>
</modules> </modules>
<properties> <properties>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!