1
0
mirror of https://gitee.com/coder-xiaomo/flashsale synced 2025-01-10 11:48:14 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

DataObject统一为简写'DO'

This commit is contained in:
程序员小墨 2022-03-01 17:17:59 +08:00
parent b7c3b87c3b
commit efd4e04343
16 changed files with 41 additions and 759 deletions

View File

@ -18,20 +18,20 @@
### 层次结构以User为例自上向下
| | 目录 | Java对象类型 | 说明 | 举例 |
| ----------------------------- |-----------------------| ----------------- | ----------------------- | -------------------------------- |
| **<nobr>Controller层</nobr>** | | | | |
| Controller | controller | 类 class | | controller.UserController |
| Controller | controller/viewobject | 类 class | | controller.UserController |
| | | | | |
| **<nobr>Service层</nobr>** | 转换成业务模型 | | | |
| Service | service | 接口 interface | | service.UserService |
| ServiceImpl | service/impl | Service接口实现类 | 将DataObject组装成Model | service.impl.UserServiceImpl |
| Model | service/model | 类 class | 用户模型Model | service.model.UserModel |
| | | | | |
| **<nobr>Dao层</nobr>** | 对数据库的映射 | | | |
| Mapper | dao | 接口 interface | | dao.UserDataObjectMapper |
| Mapping | resources/mapping | Mapper接口实现类 | xml格式SQL语句 | mapping/UserDataObjectMapper.xml |
| Data Object | dataobject | 类 class | | dataobject.UserDataObject |
| | 目录 | Java对象类型 | 说明 | 举例 |
| ----------------------------- |-----------------------| ----------------- | ----------------------- | ----------------------------- |
| **<nobr>Controller层</nobr>** | | | | |
| Controller | controller | 类 class | | controller.UserController |
| Controller | controller/viewobject | 类 class | | controller.UserController |
| | | | | |
| **<nobr>Service层</nobr>** | 转换成业务模型 | | | |
| Service | service | 接口 interface | | service.UserService |
| ServiceImpl | service/impl | Service接口实现类 | 将DataObject组装成Model | service.impl.UserServiceImpl |
| Model | service/model | 类 class | 用户模型Model | service.model.UserModel |
| | | | | |
| **<nobr>Dao层</nobr>** | 对数据库的映射 | | | |
| Mapper | dao | 接口 interface | | dao.UserDOMapper |
| Mapping | resources/mapping | Mapper接口实现类 | xml格式SQL语句 | mapping/UserDOMapper.xml |
| Data Object | dataobject | 类 class | | dataobject.UserDO |
**Tips:** Model与Data Object并非完全一一对应例如UserModel是由ServiceImpl将UserDataObject和UserPasswordDataObject组装而成的。
**Tips:** Model与Data Object并非完全一一对应例如UserModel是由ServiceImpl将UserDO和UserPasswordDO组装而成的。

View File

@ -1,7 +1,7 @@
package com.cxyxiaomo.flashsale;
import com.cxyxiaomo.flashsale.dao.UserDataObjectMapper;
import com.cxyxiaomo.flashsale.dataobject.UserDataObject;
import com.cxyxiaomo.flashsale.dao.UserDOMapper;
import com.cxyxiaomo.flashsale.dataobject.UserDO;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
@ -19,12 +19,12 @@ import org.springframework.web.bind.annotation.RestController;
public class App {
@Autowired
private UserDataObjectMapper userDOMapper;
private UserDOMapper userDOMapper;
@RequestMapping("/")
public String home() {
UserDataObject userDO = userDOMapper.selectByPrimaryKey(1);
UserDO userDO = userDOMapper.selectByPrimaryKey(1);
if (userDO == null) {
return "用户对象不存在!";
} else {

View File

@ -2,7 +2,7 @@ package com.cxyxiaomo.flashsale.dao;
import com.cxyxiaomo.flashsale.dataobject.UserDO;
public interface UserDataObjectMapper {
public interface UserDOMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_info

View File

@ -2,7 +2,7 @@ package com.cxyxiaomo.flashsale.dao;
import com.cxyxiaomo.flashsale.dataobject.UserPasswordDO;
public interface UserPasswordDataObjectMapper {
public interface UserPasswordDOMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_password

View File

@ -1,53 +0,0 @@
package com.cxyxiaomo.flashsale.dao;
import com.cxyxiaomo.flashsale.dataobject.UserDataObject;
public interface UserDataObjectMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_info
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
int deleteByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_info
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
int insert(UserDataObject record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_info
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
int insertSelective(UserDataObject record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_info
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
UserDataObject selectByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_info
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
int updateByPrimaryKeySelective(UserDataObject record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_info
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
int updateByPrimaryKey(UserDataObject record);
}

View File

@ -1,55 +0,0 @@
package com.cxyxiaomo.flashsale.dao;
import com.cxyxiaomo.flashsale.dataobject.UserPasswordDataObject;
public interface UserPasswordDataObjectMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_password
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
int deleteByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_password
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
int insert(UserPasswordDataObject record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_password
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
int insertSelective(UserPasswordDataObject record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_password
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
UserPasswordDataObject selectByPrimaryKey(Integer id);
UserPasswordDataObject selectByUserId(Integer userId);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_password
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
int updateByPrimaryKeySelective(UserPasswordDataObject record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table user_password
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
int updateByPrimaryKey(UserPasswordDataObject record);
}

View File

@ -1,6 +1,6 @@
package com.cxyxiaomo.flashsale.dataobject;
public class UserDataObject {
public class UserDO {
/**
*
* This field was generated by MyBatis Generator.

View File

@ -1,6 +1,6 @@
package com.cxyxiaomo.flashsale.dataobject;
public class UserPasswordDataObject {
public class UserPasswordDO {
/**
*
* This field was generated by MyBatis Generator.

View File

@ -1,234 +0,0 @@
package com.cxyxiaomo.flashsale.dataobject;
public class UserDataObject {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column user_info.id
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
private Integer id;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column user_info.name
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
private String name;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column user_info.gender
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
private Byte gender;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column user_info.age
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
private Integer age;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column user_info.telephone
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
private String telephone;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column user_info.register_mode
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
private String registerMode;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column user_info.third_party_id
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
private String thirdPartyId;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column user_info.id
*
* @return the value of user_info.id
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
public Integer getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column user_info.id
*
* @param id the value for user_info.id
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
public void setId(Integer id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column user_info.name
*
* @return the value of user_info.name
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
public String getName() {
return name;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column user_info.name
*
* @param name the value for user_info.name
*
* @mbg.generated Tue Mar 01 14:58:29 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 user_info.gender
*
* @return the value of user_info.gender
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
public Byte getGender() {
return gender;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column user_info.gender
*
* @param gender the value for user_info.gender
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
public void setGender(Byte gender) {
this.gender = gender;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column user_info.age
*
* @return the value of user_info.age
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
public Integer getAge() {
return age;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column user_info.age
*
* @param age the value for user_info.age
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
public void setAge(Integer age) {
this.age = age;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column user_info.telephone
*
* @return the value of user_info.telephone
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
public String getTelephone() {
return telephone;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column user_info.telephone
*
* @param telephone the value for user_info.telephone
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
public void setTelephone(String telephone) {
this.telephone = telephone == null ? null : telephone.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column user_info.register_mode
*
* @return the value of user_info.register_mode
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
public String getRegisterMode() {
return registerMode;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column user_info.register_mode
*
* @param registerMode the value for user_info.register_mode
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
public void setRegisterMode(String registerMode) {
this.registerMode = registerMode == null ? null : registerMode.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column user_info.third_party_id
*
* @return the value of user_info.third_party_id
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
public String getThirdPartyId() {
return thirdPartyId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column user_info.third_party_id
*
* @param thirdPartyId the value for user_info.third_party_id
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
public void setThirdPartyId(String thirdPartyId) {
this.thirdPartyId = thirdPartyId == null ? null : thirdPartyId.trim();
}
}

View File

@ -1,102 +0,0 @@
package com.cxyxiaomo.flashsale.dataobject;
public class UserPasswordDataObject {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column user_password.id
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
private Integer id;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column user_password.encrpt_password
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
private String encrptPassword;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column user_password.user_id
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
private Integer userId;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column user_password.id
*
* @return the value of user_password.id
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
public Integer getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column user_password.id
*
* @param id the value for user_password.id
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
public void setId(Integer id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column user_password.encrpt_password
*
* @return the value of user_password.encrpt_password
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
public String getEncrptPassword() {
return encrptPassword;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column user_password.encrpt_password
*
* @param encrptPassword the value for user_password.encrpt_password
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
public void setEncrptPassword(String encrptPassword) {
this.encrptPassword = encrptPassword == null ? null : encrptPassword.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column user_password.user_id
*
* @return the value of user_password.user_id
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
public Integer getUserId() {
return userId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column user_password.user_id
*
* @param userId the value for user_password.user_id
*
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
*/
public void setUserId(Integer userId) {
this.userId = userId;
}
}

View File

@ -1,9 +1,9 @@
package com.cxyxiaomo.flashsale.service.impl;
import com.cxyxiaomo.flashsale.dao.UserDataObjectMapper;
import com.cxyxiaomo.flashsale.dao.UserPasswordDataObjectMapper;
import com.cxyxiaomo.flashsale.dataobject.UserDataObject;
import com.cxyxiaomo.flashsale.dataobject.UserPasswordDataObject;
import com.cxyxiaomo.flashsale.dao.UserDOMapper;
import com.cxyxiaomo.flashsale.dao.UserPasswordDOMapper;
import com.cxyxiaomo.flashsale.dataobject.UserDO;
import com.cxyxiaomo.flashsale.dataobject.UserPasswordDO;
import com.cxyxiaomo.flashsale.service.UserService;
import com.cxyxiaomo.flashsale.service.model.UserModel;
import org.springframework.beans.BeanUtils;
@ -14,34 +14,34 @@ import org.springframework.stereotype.Service;
public class UserServiceImpl implements UserService {
@Autowired
private UserDataObjectMapper userDataObjectMapper;
private UserDOMapper userDOMapper;
@Autowired
private UserPasswordDataObjectMapper userPasswordDataObjectMapper;
private UserPasswordDOMapper userPasswordDOMapper;
@Override
public UserModel getUserById(Integer id) {
// 调用UserDataObjectMapper获取到对应的用户DataObject
UserDataObject userDO = userDataObjectMapper.selectByPrimaryKey(id);
UserDO userDO = userDOMapper.selectByPrimaryKey(id);
if (userDO == null) {
return null;
} else {
// 通过用户id获取对应的用户加密密码信息
UserPasswordDataObject userPwdDO = userPasswordDataObjectMapper.selectByUserId(userDO.getId());
UserPasswordDO userPwdDO = userPasswordDOMapper.selectByUserId(userDO.getId());
return convertFromDataObject(userDO, userPwdDO);
}
}
private UserModel convertFromDataObject(UserDataObject userDataObject, UserPasswordDataObject userPasswordDataObject) {
private UserModel convertFromDataObject(UserDO userDO, UserPasswordDO userPasswordDO) {
if (userDataObject == null) {
if (userDO == null) {
return null;
}
UserModel userModel = new UserModel();
BeanUtils.copyProperties(userDataObject, userModel);
if (userDataObject != null) {
BeanUtils.copyProperties(userDO, userModel);
if (userDO != null) {
// 不可再使用copyProperties因为里面id字段是重复的
userModel.setEncryptPassword(userPasswordDataObject.getEncrptPassword());
userModel.setEncryptPassword(userPasswordDO.getEncrptPassword());
}
return userModel;

View File

@ -1,6 +1,6 @@
<?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.cxyxiaomo.flashsale.dao.UserDataObjectMapper">
<mapper namespace="com.cxyxiaomo.flashsale.dao.UserDOMapper">
<resultMap id="BaseResultMap" type="com.cxyxiaomo.flashsale.dataobject.UserDO">
<!--
WARNING - @mbg.generated

View File

@ -1,6 +1,6 @@
<?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.cxyxiaomo.flashsale.dao.UserPasswordDataObjectMapper">
<mapper namespace="com.cxyxiaomo.flashsale.dao.UserPasswordDOMapper">
<resultMap id="BaseResultMap" type="com.cxyxiaomo.flashsale.dataobject.UserPasswordDO">
<!--
WARNING - @mbg.generated

View File

@ -1,157 +0,0 @@
<?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.cxyxiaomo.flashsale.dao.UserDataObjectMapper">
<resultMap id="BaseResultMap" type="com.cxyxiaomo.flashsale.dataobject.UserDataObject">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Tue Mar 01 14:58:29 CST 2022.
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="gender" jdbcType="TINYINT" property="gender" />
<result column="age" jdbcType="INTEGER" property="age" />
<result column="telephone" jdbcType="VARCHAR" property="telephone" />
<result column="register_mode" jdbcType="VARCHAR" property="registerMode" />
<result column="third_party_id" jdbcType="VARCHAR" property="thirdPartyId" />
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Tue Mar 01 14:58:29 CST 2022.
-->
id, name, gender, age, telephone, register_mode, third_party_id
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Tue Mar 01 14:58:29 CST 2022.
-->
select
<include refid="Base_Column_List" />
from user_info
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Tue Mar 01 14:58:29 CST 2022.
-->
delete from user_info
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.cxyxiaomo.flashsale.dataobject.UserDataObject">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Tue Mar 01 14:58:29 CST 2022.
-->
insert into user_info (id, name, gender,
age, telephone, register_mode,
third_party_id)
values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{gender,jdbcType=TINYINT},
#{age,jdbcType=INTEGER}, #{telephone,jdbcType=VARCHAR}, #{registerMode,jdbcType=VARCHAR},
#{thirdPartyId,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.cxyxiaomo.flashsale.dataobject.UserDataObject">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Tue Mar 01 14:58:29 CST 2022.
-->
insert into user_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="name != null">
name,
</if>
<if test="gender != null">
gender,
</if>
<if test="age != null">
age,
</if>
<if test="telephone != null">
telephone,
</if>
<if test="registerMode != null">
register_mode,
</if>
<if test="thirdPartyId != null">
third_party_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="gender != null">
#{gender,jdbcType=TINYINT},
</if>
<if test="age != null">
#{age,jdbcType=INTEGER},
</if>
<if test="telephone != null">
#{telephone,jdbcType=VARCHAR},
</if>
<if test="registerMode != null">
#{registerMode,jdbcType=VARCHAR},
</if>
<if test="thirdPartyId != null">
#{thirdPartyId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.cxyxiaomo.flashsale.dataobject.UserDataObject">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Tue Mar 01 14:58:29 CST 2022.
-->
update user_info
<set>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="gender != null">
gender = #{gender,jdbcType=TINYINT},
</if>
<if test="age != null">
age = #{age,jdbcType=INTEGER},
</if>
<if test="telephone != null">
telephone = #{telephone,jdbcType=VARCHAR},
</if>
<if test="registerMode != null">
register_mode = #{registerMode,jdbcType=VARCHAR},
</if>
<if test="thirdPartyId != null">
third_party_id = #{thirdPartyId,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.cxyxiaomo.flashsale.dataobject.UserDataObject">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Tue Mar 01 14:58:29 CST 2022.
-->
update user_info
set name = #{name,jdbcType=VARCHAR},
gender = #{gender,jdbcType=TINYINT},
age = #{age,jdbcType=INTEGER},
telephone = #{telephone,jdbcType=VARCHAR},
register_mode = #{registerMode,jdbcType=VARCHAR},
third_party_id = #{thirdPartyId,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

View File

@ -1,117 +0,0 @@
<?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.cxyxiaomo.flashsale.dao.UserPasswordDataObjectMapper">
<resultMap id="BaseResultMap" type="com.cxyxiaomo.flashsale.dataobject.UserPasswordDataObject">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Tue Mar 01 14:58:29 CST 2022.
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="encrpt_password" jdbcType="VARCHAR" property="encrptPassword" />
<result column="user_id" jdbcType="INTEGER" property="userId" />
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Tue Mar 01 14:58:29 CST 2022.
-->
id, encrpt_password, user_id
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Tue Mar 01 14:58:29 CST 2022.
-->
select
<include refid="Base_Column_List" />
from user_password
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectByUserId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from user_password
where user_id = #{userId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Tue Mar 01 14:58:29 CST 2022.
-->
delete from user_password
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.cxyxiaomo.flashsale.dataobject.UserPasswordDataObject">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Tue Mar 01 14:58:29 CST 2022.
-->
insert into user_password (id, encrpt_password, user_id
)
values (#{id,jdbcType=INTEGER}, #{encrptPassword,jdbcType=VARCHAR}, #{userId,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" parameterType="com.cxyxiaomo.flashsale.dataobject.UserPasswordDataObject">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Tue Mar 01 14:58:29 CST 2022.
-->
insert into user_password
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="encrptPassword != null">
encrpt_password,
</if>
<if test="userId != null">
user_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="encrptPassword != null">
#{encrptPassword,jdbcType=VARCHAR},
</if>
<if test="userId != null">
#{userId,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.cxyxiaomo.flashsale.dataobject.UserPasswordDataObject">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Tue Mar 01 14:58:29 CST 2022.
-->
update user_password
<set>
<if test="encrptPassword != null">
encrpt_password = #{encrptPassword,jdbcType=VARCHAR},
</if>
<if test="userId != null">
user_id = #{userId,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.cxyxiaomo.flashsale.dataobject.UserPasswordDataObject">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element was generated on Tue Mar 01 14:58:29 CST 2022.
-->
update user_password
set encrpt_password = #{encrptPassword,jdbcType=VARCHAR},
user_id = #{userId,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

View File

@ -34,7 +34,7 @@
</javaClientGenerator>
<!-- 生成对应表及其类名 -->
<table tableName="user_info" domainObjectName="userDataObject" enableCountByExample="false"
<table tableName="user_info" domainObjectName="userDO" enableCountByExample="false"
enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false"
selectByExampleQueryId="false">
<!--去除复杂操作语句-->
@ -44,7 +44,7 @@
<!--enableSelectByExample="false"-->
<!--selectByExampleQueryId="false"-->
</table>
<table tableName="user_password" domainObjectName="userPasswordDataObject" enableCountByExample="false"
<table tableName="user_password" domainObjectName="userPasswordDO" enableCountByExample="false"
enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false"
selectByExampleQueryId="false"></table>