mirror of
https://gitee.com/coder-xiaomo/flashsale
synced 2025-01-10 11:48:14 +08:00
README.md添加MVC项目结构表;数据库变动。可正常显示UserModel
This commit is contained in:
parent
25cc33f5bf
commit
b7c3b87c3b
124
.idea/uiDesigner.xml
generated
Normal file
124
.idea/uiDesigner.xml
generated
Normal file
@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
@ -11,7 +11,7 @@
|
||||
Target Server Version : 50726
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 01/03/2022 15:16:20
|
||||
Date: 01/03/2022 17:01:05
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
@ -35,7 +35,7 @@ CREATE TABLE `user_info` (
|
||||
-- ----------------------------
|
||||
-- Records of user_info
|
||||
-- ----------------------------
|
||||
INSERT INTO `user_info` VALUES (1, '第一个用户', 2, 18, '110', 'phone', '');
|
||||
INSERT INTO `user_info` VALUES (1, 'admin', 2, 18, '110', 'phone', '');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for user_password
|
||||
@ -53,5 +53,6 @@ CREATE TABLE `user_password` (
|
||||
-- ----------------------------
|
||||
-- Records of user_password
|
||||
-- ----------------------------
|
||||
INSERT INTO `user_password` VALUES (1, '21232f297a57a5a743894a0e4a801fc3', 1);
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
30
README.md
30
README.md
@ -6,4 +6,32 @@
|
||||
|
||||
数据库版本:MySQL 5.7
|
||||
|
||||
项目数据库文件:[点击打开](./Others/sql/flashsale.sql)
|
||||
项目数据库文件:[点击打开](./Others/sql/flashsale.sql)
|
||||
|
||||
### 默认用户
|
||||
|
||||
> 用户名密码均为 `admin`
|
||||
|
||||
### 本次修改通过以下方式查看👇
|
||||
|
||||
> http://localhost:8090/user/get?id=1
|
||||
|
||||
### 层次结构(以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 |
|
||||
|
||||
**Tips:** Model与Data Object并非完全一一对应,例如UserModel是由ServiceImpl将UserDataObject和UserPasswordDataObject组装而成的。
|
@ -1,11 +1,10 @@
|
||||
package com.cxyxiaomo.flashsale;
|
||||
|
||||
import com.cxyxiaomo.flashsale.dao.userDataObjectMapper;
|
||||
import com.cxyxiaomo.flashsale.dataobject.userDataObject;
|
||||
import com.cxyxiaomo.flashsale.dao.UserDataObjectMapper;
|
||||
import com.cxyxiaomo.flashsale.dataobject.UserDataObject;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@ -20,12 +19,12 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
public class App {
|
||||
|
||||
@Autowired
|
||||
private userDataObjectMapper userDOMapper;
|
||||
private UserDataObjectMapper userDOMapper;
|
||||
|
||||
|
||||
@RequestMapping("/")
|
||||
public String home() {
|
||||
userDataObject userDO = userDOMapper.selectByPrimaryKey(1);
|
||||
UserDataObject userDO = userDOMapper.selectByPrimaryKey(1);
|
||||
if (userDO == null) {
|
||||
return "用户对象不存在!";
|
||||
} else {
|
||||
|
@ -0,0 +1,26 @@
|
||||
package com.cxyxiaomo.flashsale.controller;
|
||||
|
||||
import com.cxyxiaomo.flashsale.service.UserService;
|
||||
import com.cxyxiaomo.flashsale.service.model.UserModel;
|
||||
import org.apache.catalina.User;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
@Controller("user") // 允许被SpringBoot扫描到
|
||||
@RequestMapping("/user") // 通过 "/user" 访问到
|
||||
public class UserController {
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@RequestMapping("/get")
|
||||
@ResponseBody
|
||||
public UserModel getUser(@RequestParam(name = "id") Integer id) {
|
||||
// 调用Services服务获取对应id的用户对象并返回给前端
|
||||
UserModel userModel = userService.getUserById(id);
|
||||
return userModel;
|
||||
}
|
||||
}
|
53
src/main/java/com/cxyxiaomo/flashsale/dao/UserDOMapper.java
Normal file
53
src/main/java/com/cxyxiaomo/flashsale/dao/UserDOMapper.java
Normal file
@ -0,0 +1,53 @@
|
||||
package com.cxyxiaomo.flashsale.dao;
|
||||
|
||||
import com.cxyxiaomo.flashsale.dataobject.UserDO;
|
||||
|
||||
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(UserDO 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(UserDO 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
|
||||
*/
|
||||
UserDO 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(UserDO 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(UserDO record);
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package com.cxyxiaomo.flashsale.dao;
|
||||
|
||||
import com.cxyxiaomo.flashsale.dataobject.UserPasswordDO;
|
||||
|
||||
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(UserPasswordDO 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(UserPasswordDO 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
|
||||
*/
|
||||
UserPasswordDO selectByPrimaryKey(Integer id);
|
||||
|
||||
UserPasswordDO 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(UserPasswordDO 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(UserPasswordDO record);
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
package com.cxyxiaomo.flashsale.dao;
|
||||
|
||||
import com.cxyxiaomo.flashsale.dataobject.userDataObject;
|
||||
import com.cxyxiaomo.flashsale.dataobject.UserDataObject;
|
||||
|
||||
public interface userDataObjectMapper {
|
||||
public interface UserDataObjectMapper {
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table user_info
|
||||
@ -17,7 +17,7 @@ public interface userDataObjectMapper {
|
||||
*
|
||||
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
|
||||
*/
|
||||
int insert(userDataObject record);
|
||||
int insert(UserDataObject record);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
@ -25,7 +25,7 @@ public interface userDataObjectMapper {
|
||||
*
|
||||
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
|
||||
*/
|
||||
int insertSelective(userDataObject record);
|
||||
int insertSelective(UserDataObject record);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
@ -33,7 +33,7 @@ public interface userDataObjectMapper {
|
||||
*
|
||||
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
|
||||
*/
|
||||
userDataObject selectByPrimaryKey(Integer id);
|
||||
UserDataObject selectByPrimaryKey(Integer id);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
@ -41,7 +41,7 @@ public interface userDataObjectMapper {
|
||||
*
|
||||
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
|
||||
*/
|
||||
int updateByPrimaryKeySelective(userDataObject record);
|
||||
int updateByPrimaryKeySelective(UserDataObject record);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
@ -49,5 +49,5 @@ public interface userDataObjectMapper {
|
||||
*
|
||||
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
|
||||
*/
|
||||
int updateByPrimaryKey(userDataObject record);
|
||||
int updateByPrimaryKey(UserDataObject record);
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
package com.cxyxiaomo.flashsale.dao;
|
||||
|
||||
import com.cxyxiaomo.flashsale.dataobject.userPasswordDataObject;
|
||||
import com.cxyxiaomo.flashsale.dataobject.UserPasswordDataObject;
|
||||
|
||||
public interface userPasswordDataObjectMapper {
|
||||
public interface UserPasswordDataObjectMapper {
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table user_password
|
||||
@ -17,7 +17,7 @@ public interface userPasswordDataObjectMapper {
|
||||
*
|
||||
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
|
||||
*/
|
||||
int insert(userPasswordDataObject record);
|
||||
int insert(UserPasswordDataObject record);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
@ -25,7 +25,7 @@ public interface userPasswordDataObjectMapper {
|
||||
*
|
||||
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
|
||||
*/
|
||||
int insertSelective(userPasswordDataObject record);
|
||||
int insertSelective(UserPasswordDataObject record);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
@ -33,7 +33,9 @@ public interface userPasswordDataObjectMapper {
|
||||
*
|
||||
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
|
||||
*/
|
||||
userPasswordDataObject selectByPrimaryKey(Integer id);
|
||||
UserPasswordDataObject selectByPrimaryKey(Integer id);
|
||||
|
||||
UserPasswordDataObject selectByUserId(Integer userId);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
@ -41,7 +43,7 @@ public interface userPasswordDataObjectMapper {
|
||||
*
|
||||
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
|
||||
*/
|
||||
int updateByPrimaryKeySelective(userPasswordDataObject record);
|
||||
int updateByPrimaryKeySelective(UserPasswordDataObject record);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
@ -49,5 +51,5 @@ public interface userPasswordDataObjectMapper {
|
||||
*
|
||||
* @mbg.generated Tue Mar 01 14:58:29 CST 2022
|
||||
*/
|
||||
int updateByPrimaryKey(userPasswordDataObject record);
|
||||
int updateByPrimaryKey(UserPasswordDataObject record);
|
||||
}
|
234
src/main/java/com/cxyxiaomo/flashsale/dataobject/UserDO.java
Normal file
234
src/main/java/com/cxyxiaomo/flashsale/dataobject/UserDO.java
Normal file
@ -0,0 +1,234 @@
|
||||
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();
|
||||
}
|
||||
}
|
@ -0,0 +1,102 @@
|
||||
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;
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
package com.cxyxiaomo.flashsale.dataobject;
|
||||
|
||||
public class userDataObject {
|
||||
public class UserDataObject {
|
||||
/**
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.cxyxiaomo.flashsale.dataobject;
|
||||
|
||||
public class userPasswordDataObject {
|
||||
public class UserPasswordDataObject {
|
||||
/**
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
|
@ -0,0 +1,8 @@
|
||||
package com.cxyxiaomo.flashsale.service;
|
||||
|
||||
import com.cxyxiaomo.flashsale.service.model.UserModel;
|
||||
|
||||
public interface UserService {
|
||||
// 通过用户id获取用户对象的方法
|
||||
UserModel getUserById(Integer id);
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
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.service.UserService;
|
||||
import com.cxyxiaomo.flashsale.service.model.UserModel;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class UserServiceImpl implements UserService {
|
||||
|
||||
@Autowired
|
||||
private UserDataObjectMapper userDataObjectMapper;
|
||||
@Autowired
|
||||
private UserPasswordDataObjectMapper userPasswordDataObjectMapper;
|
||||
|
||||
@Override
|
||||
public UserModel getUserById(Integer id) {
|
||||
// 调用UserDataObjectMapper获取到对应的用户DataObject
|
||||
UserDataObject userDO = userDataObjectMapper.selectByPrimaryKey(id);
|
||||
if (userDO == null) {
|
||||
return null;
|
||||
} else {
|
||||
// 通过用户id获取对应的用户加密密码信息
|
||||
UserPasswordDataObject userPwdDO = userPasswordDataObjectMapper.selectByUserId(userDO.getId());
|
||||
return convertFromDataObject(userDO, userPwdDO);
|
||||
}
|
||||
}
|
||||
|
||||
private UserModel convertFromDataObject(UserDataObject userDataObject, UserPasswordDataObject userPasswordDataObject) {
|
||||
|
||||
if (userDataObject == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
UserModel userModel = new UserModel();
|
||||
BeanUtils.copyProperties(userDataObject, userModel);
|
||||
if (userDataObject != null) {
|
||||
// 不可再使用copyProperties,因为里面id字段是重复的
|
||||
userModel.setEncryptPassword(userPasswordDataObject.getEncrptPassword());
|
||||
}
|
||||
|
||||
return userModel;
|
||||
}
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
package com.cxyxiaomo.flashsale.service.model;
|
||||
|
||||
public class UserModel {
|
||||
private Integer id;
|
||||
private String name;
|
||||
private Byte gender;
|
||||
private String age;
|
||||
private String telphone;
|
||||
private String registerMode;
|
||||
private String thirdPartyId;
|
||||
|
||||
private String encryptPassword;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Byte getGender() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
public void setGender(Byte gender) {
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
public String getAge() {
|
||||
return age;
|
||||
}
|
||||
|
||||
public void setAge(String age) {
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
public String getTelphone() {
|
||||
return telphone;
|
||||
}
|
||||
|
||||
public void setTelphone(String telphone) {
|
||||
this.telphone = telphone;
|
||||
}
|
||||
|
||||
public String getRegisterMode() {
|
||||
return registerMode;
|
||||
}
|
||||
|
||||
public void setRegisterMode(String registerMode) {
|
||||
this.registerMode = registerMode;
|
||||
}
|
||||
|
||||
public String getThirdPartyId() {
|
||||
return thirdPartyId;
|
||||
}
|
||||
|
||||
public void setThirdPartyId(String thirdPartyId) {
|
||||
this.thirdPartyId = thirdPartyId;
|
||||
}
|
||||
|
||||
public String getEncryptPassword() {
|
||||
return encryptPassword;
|
||||
}
|
||||
|
||||
public void setEncryptPassword(String encryptPassword) {
|
||||
this.encryptPassword = encryptPassword;
|
||||
}
|
||||
}
|
157
src/main/resources/mapping/UserDOMapper.xml
Normal file
157
src/main/resources/mapping/UserDOMapper.xml
Normal file
@ -0,0 +1,157 @@
|
||||
<?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.UserDO">
|
||||
<!--
|
||||
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.UserDO">
|
||||
<!--
|
||||
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.UserDO">
|
||||
<!--
|
||||
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.UserDO">
|
||||
<!--
|
||||
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.UserDO">
|
||||
<!--
|
||||
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>
|
117
src/main/resources/mapping/UserPasswordDOMapper.xml
Normal file
117
src/main/resources/mapping/UserPasswordDOMapper.xml
Normal file
@ -0,0 +1,117 @@
|
||||
<?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.UserPasswordDO">
|
||||
<!--
|
||||
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.UserPasswordDO">
|
||||
<!--
|
||||
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.UserPasswordDO">
|
||||
<!--
|
||||
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.UserPasswordDO">
|
||||
<!--
|
||||
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.UserPasswordDO">
|
||||
<!--
|
||||
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>
|
@ -1,7 +1,7 @@
|
||||
<?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">
|
||||
<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.
|
||||
@ -43,7 +43,7 @@
|
||||
delete from user_info
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.cxyxiaomo.flashsale.dataobject.userDataObject">
|
||||
<insert id="insert" parameterType="com.cxyxiaomo.flashsale.dataobject.UserDataObject">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
@ -56,7 +56,7 @@
|
||||
#{age,jdbcType=INTEGER}, #{telephone,jdbcType=VARCHAR}, #{registerMode,jdbcType=VARCHAR},
|
||||
#{thirdPartyId,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.cxyxiaomo.flashsale.dataobject.userDataObject">
|
||||
<insert id="insertSelective" parameterType="com.cxyxiaomo.flashsale.dataobject.UserDataObject">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
@ -110,7 +110,7 @@
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.cxyxiaomo.flashsale.dataobject.userDataObject">
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.cxyxiaomo.flashsale.dataobject.UserDataObject">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
@ -139,7 +139,7 @@
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.cxyxiaomo.flashsale.dataobject.userDataObject">
|
||||
<update id="updateByPrimaryKey" parameterType="com.cxyxiaomo.flashsale.dataobject.UserDataObject">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?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">
|
||||
<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.
|
||||
@ -30,6 +30,12 @@
|
||||
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
|
||||
@ -39,7 +45,7 @@
|
||||
delete from user_password
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.cxyxiaomo.flashsale.dataobject.userPasswordDataObject">
|
||||
<insert id="insert" parameterType="com.cxyxiaomo.flashsale.dataobject.UserPasswordDataObject">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
@ -50,7 +56,7 @@
|
||||
values (#{id,jdbcType=INTEGER}, #{encrptPassword,jdbcType=VARCHAR}, #{userId,jdbcType=INTEGER}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.cxyxiaomo.flashsale.dataobject.userPasswordDataObject">
|
||||
<insert id="insertSelective" parameterType="com.cxyxiaomo.flashsale.dataobject.UserPasswordDataObject">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
@ -80,7 +86,7 @@
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.cxyxiaomo.flashsale.dataobject.userPasswordDataObject">
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.cxyxiaomo.flashsale.dataobject.UserPasswordDataObject">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
@ -97,7 +103,7 @@
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.cxyxiaomo.flashsale.dataobject.userPasswordDataObject">
|
||||
<update id="updateByPrimaryKey" parameterType="com.cxyxiaomo.flashsale.dataobject.UserPasswordDataObject">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
|
Loading…
Reference in New Issue
Block a user