1.mybatis逆向工程:
1)简介:根据表生成mapper层三部分代码:实体类,mapper接口,映射文件。
2)使用mybatis逆向工程:
a)创建工程:crm-mybatis-generator
b)添加插件:
pom.xml文件
- <?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.it.crm</groupId>
- <artifactId>crm-mybatis-generator</artifactId>
- <version>1.0-SNAPSHOT</version>
-
- <build>
- <plugins>
- <!--myBatis逆向工程插件-->
- <plugin>
- <groupId>org.mybatis.generator</groupId>
- <artifactId>mybatis-generator-maven-plugin</artifactId>
- <version>1.3.2</version>
- <configuration>
- <verbose>true</verbose>
- <overwrite>true</overwrite>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-
- </project>
c)添加配置文件:
数据库连接信息
generator.properties配置文件
jdbc.driverLocation:代表Maven仓库中mql的驱动文件的位置
- jdbc.driverLocation=D:/jsp/Maven/MavenTest/repository/mysql/mysql-connector-java/5.1.43/mysql-connector-java-5.1.43.jar
- jdbc.driverClass=com.mysql.jdbc.Driver
- jdbc.connectionURL=jdbc:mysql://127.0.0.1:3306/db_crm_ssm
- jdbc.userId=root
- jdbc.password=123456
generatorConfig.xml配置文件
当前把需要逆向生成的表全部已经写好了,需要逆向生成那些表就放出来那些表,已经生成过的需要再关进去。现在只需要逆向生成tbl_user表
- <?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>
-
- <!--指定mysql数据库驱动-->
- <!--<classPathEntry location="E://repository-p2p//mysql//mysql-connector-java//5.1.43//mysql-connector-java-5.1.43.jar"/>-->
-
- <!--导入属性配置-->
- <properties resource="generator.properties"></properties>
-
- <!--指定特定数据库的jdbc驱动jar包的位置-->
- <classPathEntry location="${jdbc.driverLocation}"/>
-
- <context id="default" targetRuntime="MyBatis3">
-
- <!-- optional,旨在创建class时,对注释进行控制,false生成注释,true无注释 -->
- <commentGenerator>
- <property name="suppressDate" value="false"/>
- <property name="suppressAllComments" value="false"/>
- </commentGenerator>
-
- <!--jdbc的数据库连接 -->
- <jdbcConnection
- driverClass="${jdbc.driverClass}"
- connectionURL="${jdbc.connectionURL}"
- userId="${jdbc.userId}"
- password="${jdbc.password}">
- </jdbcConnection>
-
-
- <!-- 非必需,类型处理器,在数据库类型和java类型之间的转换控制-->
- <javaTypeResolver>
- <property name="forceBigDecimals" value="false"/>
- </javaTypeResolver>
-
-
- <!-- Model模型生成器,用来生成含有主键key的类,记录类 以及查询Example类
- targetPackage 指定生成的model生成所在的包名
- targetProject 指定在该项目下所在的路径|指定生成到的工程名称
- -->
- <javaModelGenerator targetPackage="com.it.crm.settings.entity"
- targetProject="D:/SSM框架/SSM版CRMTest/crm/src/main/java">
-
- <!-- 是否允许子包,即targetPackage.schemaName.tableName -->
- <property name="enableSubPackages" value="false"/>
- <!-- 是否对model添加 构造函数 true添加,false不添加-->
- <property name="constructorBased" value="false"/>
- <!-- 是否对类CHAR类型的列的数据进行trim操作 -->
- <property name="trimStrings" value="true"/>
- <!-- 建立的Model对象是否 不可改变 即生成的Model对象不会有 setter方法,只有构造方法 -->
- <property name="immutable" value="false"/>
- </javaModelGenerator>
-
- <!--Mapper映射文件生成所在的目录 为每一个数据库的表生成对应的SqlMap文件 -->
- <sqlMapGenerator targetPackage="com.it.crm.settings.mapper"
- targetProject="D:/SSM框架/SSM版CRMTest/crm/src/main/java">
- <property name="enableSubPackages" value="false"/>
- </sqlMapGenerator>
-
- <!-- 客户端代码,生成易于使用的针对Model对象和XML配置文件 的代码
- type="ANNOTATEDMAPPER",生成Java Model 和基于注解的Mapper对象
- type="MIXEDMAPPER",生成基于注解的Java Model 和相应的Mapper对象
- type="XMLMAPPER",生成SQLMap XML文件和独立的Mapper接口
- -->
- <javaClientGenerator targetPackage="com.it.crm.settings.mapper"
- targetProject="D:/SSM框架/SSM版CRMTest/crm/src/main/java" type="XMLMAPPER">
- <property name="enableSubPackages" value="true"/>
- </javaClientGenerator>
-
-
- <table tableName="tbl_user" domainObjectName="User"
- enableCountByExample="false" enableUpdateByExample="false"
- enableDeleteByExample="false" enableSelectByExample="false"
- selectByExampleQueryId="false">
- </table>
-
- <!--
- <table tableName="tbl_clue" domainObjectName="Clue"
- enableCountByExample="false" enableUpdateByExample="false"
- enableDeleteByExample="false" enableSelectByExample="false"
- selectByExampleQueryId="false">
- </table>
- <table tableName="tbl_clue_activity_relation" domainObjectName="ClueActivityRelation"
- enableCountByExample="false" enableUpdateByExample="false"
- enableDeleteByExample="false" enableSelectByExample="false"
- selectByExampleQueryId="false">
- </table>
- <table tableName="tbl_clue_remark" domainObjectName="ClueRemark"
- enableCountByExample="false" enableUpdateByExample="false"
- enableDeleteByExample="false" enableSelectByExample="false"
- selectByExampleQueryId="false">
- </table>
- -->
- <!--
- <table tableName="tbl_contacts" domainObjectName="Contacts"
- enableCountByExample="false" enableUpdateByExample="false"
- enableDeleteByExample="false" enableSelectByExample="false"
- selectByExampleQueryId="false">
- </table>
- <table tableName="tbl_contacts_activity_relation" domainObjectName="ContactsActivityRelation"
- enableCountByExample="false" enableUpdateByExample="false"
- enableDeleteByExample="false" enableSelectByExample="false"
- selectByExampleQueryId="false">
- </table>
- <table tableName="tbl_contacts_remark" domainObjectName="ContactsRemark"
- enableCountByExample="false" enableUpdateByExample="false"
- enableDeleteByExample="false" enableSelectByExample="false"
- selectByExampleQueryId="false">
- </table>
- -->
- <!--
- <table tableName="tbl_customer" domainObjectName="Customer"
- enableCountByExample="false" enableUpdateByExample="false"
- enableDeleteByExample="false" enableSelectByExample="false"
- selectByExampleQueryId="false">
- </table>
- <table tableName="tbl_customer_remark" domainObjectName="CustomerRemark"
- enableCountByExample="false" enableUpdateByExample="false"
- enableDeleteByExample="false" enableSelectByExample="false"
- selectByExampleQueryId="false">
- </table>
- -->
- <!--
- <table tableName="tbl_dictionary_type" domainObjectName="DictionaryType"
- enableCountByExample="false" enableUpdateByExample="false"
- enableDeleteByExample="false" enableSelectByExample="false"
- selectByExampleQueryId="false">
- </table>
- <table tableName="tbl_dictionary_value" domainObjectName="DictionaryValue"
- enableCountByExample="false" enableUpdateByExample="false"
- enableDeleteByExample="false" enableSelectByExample="false"
- selectByExampleQueryId="false">
- </table>
- <table tableName="tbl_marketing_activities" domainObjectName="MarketingActivities"
- enableCountByExample="false" enableUpdateByExample="false"
- enableDeleteByExample="false" enableSelectByExample="false"
- selectByExampleQueryId="false">
- </table>
- <table tableName="tbl_marketing_activities_remark" domainObjectName="MarketingActivitiesRemark"
- enableCountByExample="false" enableUpdateByExample="false"
- enableDeleteByExample="false" enableSelectByExample="false"
- selectByExampleQueryId="false">
- </table>
- <table tableName="tbl_transaction" domainObjectName="Transaction"
- enableCountByExample="false" enableUpdateByExample="false"
- enableDeleteByExample="false" enableSelectByExample="false"
- selectByExampleQueryId="false">
- </table>
- <table tableName="tbl_transaction_history" domainObjectName="TransactionHistory"
- enableCountByExample="false" enableUpdateByExample="false"
- enableDeleteByExample="false" enableSelectByExample="false"
- selectByExampleQueryId="false">
- </table>
- <table tableName="tbl_transaction_remark" domainObjectName="TransactionRemark"
- enableCountByExample="false" enableUpdateByExample="false"
- enableDeleteByExample="false" enableSelectByExample="false"
- selectByExampleQueryId="false">
- </table>
- -->
- </context>
- </generatorConfiguration>
d)运行mybatis的逆向工程,根据指定表生成java代码,保存到指定的目录中。
双击蓝色阴影的插件
自动在crm项目中生成了这三个文件,实体类,用户接口,用户接口的映射文件。
User实体类
- package com.it.crm.settings.entity;
-
- public class User {
- /**
- * This field was generated by MyBatis Generator.
- * This field corresponds to the database column tbl_user.id
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- private String id;
-
- /**
- * This field was generated by MyBatis Generator.
- * This field corresponds to the database column tbl_user.login_act
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- private String loginAct;
-
- /**
- * This field was generated by MyBatis Generator.
- * This field corresponds to the database column tbl_user.name
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- private String name;
-
- /**
- * This field was generated by MyBatis Generator.
- * This field corresponds to the database column tbl_user.login_pwd
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- private String loginPwd;
-
- /**
- * This field was generated by MyBatis Generator.
- * This field corresponds to the database column tbl_user.email
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- private String email;
-
- /**
- * This field was generated by MyBatis Generator.
- * This field corresponds to the database column tbl_user.expire_time
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- private String expireTime;
-
- /**
- * This field was generated by MyBatis Generator.
- * This field corresponds to the database column tbl_user.lock_state
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- private String lockState;
-
- /**
- * This field was generated by MyBatis Generator.
- * This field corresponds to the database column tbl_user.deptno
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- private String deptno;
-
- /**
- * This field was generated by MyBatis Generator.
- * This field corresponds to the database column tbl_user.allow_ips
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- private String allowIps;
-
- /**
- * This field was generated by MyBatis Generator.
- * This field corresponds to the database column tbl_user.createTime
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- private String createtime;
-
- /**
- * This field was generated by MyBatis Generator.
- * This field corresponds to the database column tbl_user.create_by
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- private String createBy;
-
- /**
- * This field was generated by MyBatis Generator.
- * This field corresponds to the database column tbl_user.edit_time
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- private String editTime;
-
- /**
- * This field was generated by MyBatis Generator.
- * This field corresponds to the database column tbl_user.edit_by
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- private String editBy;
-
- /**
- * This method was generated by MyBatis Generator.
- * This method returns the value of the database column tbl_user.id
- *
- * @return the value of tbl_user.id
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- public String getId() {
- return id;
- }
-
- /**
- * This method was generated by MyBatis Generator.
- * This method sets the value of the database column tbl_user.id
- *
- * @param id the value for tbl_user.id
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- public void setId(String id) {
- this.id = id == null ? null : id.trim();
- }
-
- /**
- * This method was generated by MyBatis Generator.
- * This method returns the value of the database column tbl_user.login_act
- *
- * @return the value of tbl_user.login_act
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- public String getLoginAct() {
- return loginAct;
- }
-
- /**
- * This method was generated by MyBatis Generator.
- * This method sets the value of the database column tbl_user.login_act
- *
- * @param loginAct the value for tbl_user.login_act
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- public void setLoginAct(String loginAct) {
- this.loginAct = loginAct == null ? null : loginAct.trim();
- }
-
- /**
- * This method was generated by MyBatis Generator.
- * This method returns the value of the database column tbl_user.name
- *
- * @return the value of tbl_user.name
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- public String getName() {
- return name;
- }
-
- /**
- * This method was generated by MyBatis Generator.
- * This method sets the value of the database column tbl_user.name
- *
- * @param name the value for tbl_user.name
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- public void setName(String name) {
- this.name = name == null ? null : name.trim();
- }
-
- /**
- * This method was generated by MyBatis Generator.
- * This method returns the value of the database column tbl_user.login_pwd
- *
- * @return the value of tbl_user.login_pwd
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- public String getLoginPwd() {
- return loginPwd;
- }
-
- /**
- * This method was generated by MyBatis Generator.
- * This method sets the value of the database column tbl_user.login_pwd
- *
- * @param loginPwd the value for tbl_user.login_pwd
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- public void setLoginPwd(String loginPwd) {
- this.loginPwd = loginPwd == null ? null : loginPwd.trim();
- }
-
- /**
- * This method was generated by MyBatis Generator.
- * This method returns the value of the database column tbl_user.email
- *
- * @return the value of tbl_user.email
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- public String getEmail() {
- return email;
- }
-
- /**
- * This method was generated by MyBatis Generator.
- * This method sets the value of the database column tbl_user.email
- *
- * @param email the value for tbl_user.email
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- public void setEmail(String email) {
- this.email = email == null ? null : email.trim();
- }
-
- /**
- * This method was generated by MyBatis Generator.
- * This method returns the value of the database column tbl_user.expire_time
- *
- * @return the value of tbl_user.expire_time
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- public String getExpireTime() {
- return expireTime;
- }
-
- /**
- * This method was generated by MyBatis Generator.
- * This method sets the value of the database column tbl_user.expire_time
- *
- * @param expireTime the value for tbl_user.expire_time
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- public void setExpireTime(String expireTime) {
- this.expireTime = expireTime == null ? null : expireTime.trim();
- }
-
- /**
- * This method was generated by MyBatis Generator.
- * This method returns the value of the database column tbl_user.lock_state
- *
- * @return the value of tbl_user.lock_state
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- public String getLockState() {
- return lockState;
- }
-
- /**
- * This method was generated by MyBatis Generator.
- * This method sets the value of the database column tbl_user.lock_state
- *
- * @param lockState the value for tbl_user.lock_state
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- public void setLockState(String lockState) {
- this.lockState = lockState == null ? null : lockState.trim();
- }
-
- /**
- * This method was generated by MyBatis Generator.
- * This method returns the value of the database column tbl_user.deptno
- *
- * @return the value of tbl_user.deptno
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- public String getDeptno() {
- return deptno;
- }
-
- /**
- * This method was generated by MyBatis Generator.
- * This method sets the value of the database column tbl_user.deptno
- *
- * @param deptno the value for tbl_user.deptno
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- public void setDeptno(String deptno) {
- this.deptno = deptno == null ? null : deptno.trim();
- }
-
- /**
- * This method was generated by MyBatis Generator.
- * This method returns the value of the database column tbl_user.allow_ips
- *
- * @return the value of tbl_user.allow_ips
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- public String getAllowIps() {
- return allowIps;
- }
-
- /**
- * This method was generated by MyBatis Generator.
- * This method sets the value of the database column tbl_user.allow_ips
- *
- * @param allowIps the value for tbl_user.allow_ips
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- public void setAllowIps(String allowIps) {
- this.allowIps = allowIps == null ? null : allowIps.trim();
- }
-
- /**
- * This method was generated by MyBatis Generator.
- * This method returns the value of the database column tbl_user.createTime
- *
- * @return the value of tbl_user.createTime
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- public String getCreatetime() {
- return createtime;
- }
-
- /**
- * This method was generated by MyBatis Generator.
- * This method sets the value of the database column tbl_user.createTime
- *
- * @param createtime the value for tbl_user.createTime
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- public void setCreatetime(String createtime) {
- this.createtime = createtime == null ? null : createtime.trim();
- }
-
- /**
- * This method was generated by MyBatis Generator.
- * This method returns the value of the database column tbl_user.create_by
- *
- * @return the value of tbl_user.create_by
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- public String getCreateBy() {
- return createBy;
- }
-
- /**
- * This method was generated by MyBatis Generator.
- * This method sets the value of the database column tbl_user.create_by
- *
- * @param createBy the value for tbl_user.create_by
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- public void setCreateBy(String createBy) {
- this.createBy = createBy == null ? null : createBy.trim();
- }
-
- /**
- * This method was generated by MyBatis Generator.
- * This method returns the value of the database column tbl_user.edit_time
- *
- * @return the value of tbl_user.edit_time
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- public String getEditTime() {
- return editTime;
- }
-
- /**
- * This method was generated by MyBatis Generator.
- * This method sets the value of the database column tbl_user.edit_time
- *
- * @param editTime the value for tbl_user.edit_time
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- public void setEditTime(String editTime) {
- this.editTime = editTime == null ? null : editTime.trim();
- }
-
- /**
- * This method was generated by MyBatis Generator.
- * This method returns the value of the database column tbl_user.edit_by
- *
- * @return the value of tbl_user.edit_by
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- public String getEditBy() {
- return editBy;
- }
-
- /**
- * This method was generated by MyBatis Generator.
- * This method sets the value of the database column tbl_user.edit_by
- *
- * @param editBy the value for tbl_user.edit_by
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- public void setEditBy(String editBy) {
- this.editBy = editBy == null ? null : editBy.trim();
- }
- }
UserMapper接口
- package com.it.crm.settings.mapper;
-
- import com.it.crm.settings.entity.User;
-
- public interface UserMapper {
- /**
- * This method was generated by MyBatis Generator.
- * This method corresponds to the database table tbl_user
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- int deleteByPrimaryKey(String id);
-
- /**
- * This method was generated by MyBatis Generator.
- * This method corresponds to the database table tbl_user
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- int insert(User record);
-
- /**
- * This method was generated by MyBatis Generator.
- * This method corresponds to the database table tbl_user
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- int insertSelective(User record);
-
- /**
- * This method was generated by MyBatis Generator.
- * This method corresponds to the database table tbl_user
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- User selectByPrimaryKey(String id);
-
- /**
- * This method was generated by MyBatis Generator.
- * This method corresponds to the database table tbl_user
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- int updateByPrimaryKeySelective(User record);
-
- /**
- * This method was generated by MyBatis Generator.
- * This method corresponds to the database table tbl_user
- *
- * @mbggenerated Wed Jun 29 12:20:46 CST 2022
- */
- int updateByPrimaryKey(User record);
- }
UserMapper.xml映射文件
- <?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.it.crm.settings.mapper.UserMapper" >
- <resultMap id="BaseResultMap" type="com.it.crm.settings.entity.User" >
- <!--
- WARNING - @mbggenerated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Wed Jun 29 12:20:46 CST 2022.
- -->
- <id column="id" property="id" jdbcType="CHAR" />
- <result column="login_act" property="loginAct" jdbcType="VARCHAR" />
- <result column="name" property="name" jdbcType="VARCHAR" />
- <result column="login_pwd" property="loginPwd" jdbcType="VARCHAR" />
- <result column="email" property="email" jdbcType="VARCHAR" />
- <result column="expire_time" property="expireTime" jdbcType="CHAR" />
- <result column="lock_state" property="lockState" jdbcType="CHAR" />
- <result column="deptno" property="deptno" jdbcType="CHAR" />
- <result column="allow_ips" property="allowIps" jdbcType="VARCHAR" />
- <result column="createTime" property="createtime" jdbcType="CHAR" />
- <result column="create_by" property="createBy" jdbcType="VARCHAR" />
- <result column="edit_time" property="editTime" jdbcType="CHAR" />
- <result column="edit_by" property="editBy" jdbcType="VARCHAR" />
- </resultMap>
- <sql id="Base_Column_List" >
- <!--
- WARNING - @mbggenerated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Wed Jun 29 12:20:46 CST 2022.
- -->
- id, login_act, name, login_pwd, email, expire_time, lock_state, deptno, allow_ips,
- createTime, create_by, edit_time, edit_by
- </sql>
- <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
- <!--
- WARNING - @mbggenerated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Wed Jun 29 12:20:46 CST 2022.
- -->
- select
- <include refid="Base_Column_List" />
- from tbl_user
- where id = #{id,jdbcType=CHAR}
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
- <!--
- WARNING - @mbggenerated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Wed Jun 29 12:20:46 CST 2022.
- -->
- delete from tbl_user
- where id = #{id,jdbcType=CHAR}
- </delete>
- <insert id="insert" parameterType="com.it.crm.settings.entity.User" >
- <!--
- WARNING - @mbggenerated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Wed Jun 29 12:20:46 CST 2022.
- -->
- insert into tbl_user (id, login_act, name,
- login_pwd, email, expire_time,
- lock_state, deptno, allow_ips,
- createTime, create_by, edit_time,
- edit_by)
- values (#{id,jdbcType=CHAR}, #{loginAct,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
- #{loginPwd,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{expireTime,jdbcType=CHAR},
- #{lockState,jdbcType=CHAR}, #{deptno,jdbcType=CHAR}, #{allowIps,jdbcType=VARCHAR},
- #{createtime,jdbcType=CHAR}, #{createBy,jdbcType=VARCHAR}, #{editTime,jdbcType=CHAR},
- #{editBy,jdbcType=VARCHAR})
- </insert>
- <insert id="insertSelective" parameterType="com.it.crm.settings.entity.User" >
- <!--
- WARNING - @mbggenerated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Wed Jun 29 12:20:46 CST 2022.
- -->
- insert into tbl_user
- <trim prefix="(" suffix=")" suffixOverrides="," >
- <if test="id != null" >
- id,
- </if>
- <if test="loginAct != null" >
- login_act,
- </if>
- <if test="name != null" >
- name,
- </if>
- <if test="loginPwd != null" >
- login_pwd,
- </if>
- <if test="email != null" >
- email,
- </if>
- <if test="expireTime != null" >
- expire_time,
- </if>
- <if test="lockState != null" >
- lock_state,
- </if>
- <if test="deptno != null" >
- deptno,
- </if>
- <if test="allowIps != null" >
- allow_ips,
- </if>
- <if test="createtime != null" >
- createTime,
- </if>
- <if test="createBy != null" >
- create_by,
- </if>
- <if test="editTime != null" >
- edit_time,
- </if>
- <if test="editBy != null" >
- edit_by,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides="," >
- <if test="id != null" >
- #{id,jdbcType=CHAR},
- </if>
- <if test="loginAct != null" >
- #{loginAct,jdbcType=VARCHAR},
- </if>
- <if test="name != null" >
- #{name,jdbcType=VARCHAR},
- </if>
- <if test="loginPwd != null" >
- #{loginPwd,jdbcType=VARCHAR},
- </if>
- <if test="email != null" >
- #{email,jdbcType=VARCHAR},
- </if>
- <if test="expireTime != null" >
- #{expireTime,jdbcType=CHAR},
- </if>
- <if test="lockState != null" >
- #{lockState,jdbcType=CHAR},
- </if>
- <if test="deptno != null" >
- #{deptno,jdbcType=CHAR},
- </if>
- <if test="allowIps != null" >
- #{allowIps,jdbcType=VARCHAR},
- </if>
- <if test="createtime != null" >
- #{createtime,jdbcType=CHAR},
- </if>
- <if test="createBy != null" >
- #{createBy,jdbcType=VARCHAR},
- </if>
- <if test="editTime != null" >
- #{editTime,jdbcType=CHAR},
- </if>
- <if test="editBy != null" >
- #{editBy,jdbcType=VARCHAR},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.it.crm.settings.entity.User" >
- <!--
- WARNING - @mbggenerated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Wed Jun 29 12:20:46 CST 2022.
- -->
- update tbl_user
- <set >
- <if test="loginAct != null" >
- login_act = #{loginAct,jdbcType=VARCHAR},
- </if>
- <if test="name != null" >
- name = #{name,jdbcType=VARCHAR},
- </if>
- <if test="loginPwd != null" >
- login_pwd = #{loginPwd,jdbcType=VARCHAR},
- </if>
- <if test="email != null" >
- email = #{email,jdbcType=VARCHAR},
- </if>
- <if test="expireTime != null" >
- expire_time = #{expireTime,jdbcType=CHAR},
- </if>
- <if test="lockState != null" >
- lock_state = #{lockState,jdbcType=CHAR},
- </if>
- <if test="deptno != null" >
- deptno = #{deptno,jdbcType=CHAR},
- </if>
- <if test="allowIps != null" >
- allow_ips = #{allowIps,jdbcType=VARCHAR},
- </if>
- <if test="createtime != null" >
- createTime = #{createtime,jdbcType=CHAR},
- </if>
- <if test="createBy != null" >
- create_by = #{createBy,jdbcType=VARCHAR},
- </if>
- <if test="editTime != null" >
- edit_time = #{editTime,jdbcType=CHAR},
- </if>
- <if test="editBy != null" >
- edit_by = #{editBy,jdbcType=VARCHAR},
- </if>
- </set>
- where id = #{id,jdbcType=CHAR}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.it.crm.settings.entity.User" >
- <!--
- WARNING - @mbggenerated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Wed Jun 29 12:20:46 CST 2022.
- -->
- update tbl_user
- set login_act = #{loginAct,jdbcType=VARCHAR},
- name = #{name,jdbcType=VARCHAR},
- login_pwd = #{loginPwd,jdbcType=VARCHAR},
- email = #{email,jdbcType=VARCHAR},
- expire_time = #{expireTime,jdbcType=CHAR},
- lock_state = #{lockState,jdbcType=CHAR},
- deptno = #{deptno,jdbcType=CHAR},
- allow_ips = #{allowIps,jdbcType=VARCHAR},
- createTime = #{createtime,jdbcType=CHAR},
- create_by = #{createBy,jdbcType=VARCHAR},
- edit_time = #{editTime,jdbcType=CHAR},
- edit_by = #{editBy,jdbcType=VARCHAR}
- where id = #{id,jdbcType=CHAR}
- </update>
- </mapper>