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

商品模型1

This commit is contained in:
程序员小墨 2022-03-03 13:01:50 +08:00
parent ef1fb1e815
commit ff76e441e4
4 changed files with 141 additions and 18 deletions

View File

@ -11,12 +11,47 @@
Target Server Version : 50726
File Encoding : 65001
Date: 02/03/2022 11:35:11
Date: 03/03/2022 12:57:18
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for item_info
-- ----------------------------
DROP TABLE IF EXISTS `item_info`;
CREATE TABLE `item_info` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`price` decimal(10, 0) NOT NULL DEFAULT 0,
`description` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`sales` int(11) NOT NULL,
`img_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of item_info
-- ----------------------------
-- ----------------------------
-- Table structure for item_stock
-- ----------------------------
DROP TABLE IF EXISTS `item_stock`;
CREATE TABLE `item_stock` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`stock` int(11) NOT NULL,
`item_id` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`) USING BTREE,
INDEX `item_id`(`item_id`) USING BTREE,
CONSTRAINT `item_stock_ibfk_1` FOREIGN KEY (`item_id`) REFERENCES `item_info` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of item_stock
-- ----------------------------
-- ----------------------------
-- Table structure for user_info
-- ----------------------------

View File

@ -149,8 +149,8 @@
<configuration>
<!--允许移动生成的文件-->
<verbose>true</verbose>
<!--允许自动覆盖文件真正企业开发不要设置成true-->
<overwrite>true</overwrite>
<!--允许自动覆盖文件真正企业开发不要设置成true-->
<overwrite>false</overwrite>
<!--mybatis配置文件路径-->
<configurationFile>
src/main/resources/mybatis-generator.xml

View File

@ -0,0 +1,82 @@
package com.cxyxiaomo.flashsale.service.model;
import java.math.BigDecimal;
public class ItemModel {
// 商品价格
private Integer id;
// 商品名称
private String title;
// 商品价格
private BigDecimal price;
// 商品的库存
private Integer stock;
// 商品的描述
private String description;
// 商品的销量
private Integer sales;
// 商品描述图片的URL
private String imgUrl;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public Integer getStock() {
return stock;
}
public void setStock(Integer stock) {
this.stock = stock;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Integer getSales() {
return sales;
}
public void setSales(Integer sales) {
this.sales = sales;
}
public String getImgUrl() {
return imgUrl;
}
public void setImgUrl(String imgUrl) {
this.imgUrl = imgUrl;
}
}

View File

@ -14,13 +14,13 @@
<!-- 生成 DataObject 类存放位置 -->
<javaModelGenerator targetPackage="com.cxyxiaomo.flashsale.dataobject" targetProject="src/main/java">
<property name="enableSubPackages" value="true" />
<property name="trimStrings" value="true" />
<property name="enableSubPackages" value="true"/>
<property name="trimStrings" value="true"/>
</javaModelGenerator>
<!-- 生成映射文件存放位置 -->
<sqlMapGenerator targetPackage="mapping" targetProject="src/main/resources">
<property name="enableSubPackages" value="true" />
<sqlMapGenerator targetPackage="mapping" targetProject="src/main/resources">
<property name="enableSubPackages" value="true"/>
</sqlMapGenerator>
<!-- 生成Dao类存放位置 -->
@ -30,21 +30,27 @@
type="XM1LMAPPER",生成SQLMap XML文件和独立的Mapper接口
-->
<javaClientGenerator type="XMLMAPPER" targetPackage="com.cxyxiaomo.flashsale.dao" targetProject="src/main/java">
<property name="enableSubPackages" value="true" />
<property name="enableSubPackages" value="true"/>
</javaClientGenerator>
<!--去除复杂操作语句-->
<!--enableCountByExample="false"-->
<!--enableUpdateByExample="false" -->
<!--enableDeleteByExample="false" -->
<!--enableSelectByExample="false"-->
<!--selectByExampleQueryId="false"-->
<!-- 生成对应表及其类名 -->
<table tableName="user_info" domainObjectName="userDO" enableCountByExample="false"
<table tableName="user_info" domainObjectName="UserDO" enableCountByExample="false"
enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false"
selectByExampleQueryId="false">
<!--去除复杂操作语句-->
<!--enableCountByExample="false"-->
<!--enableUpdateByExample="false" -->
<!--enableDeleteByExample="false" -->
<!--enableSelectByExample="false"-->
<!--selectByExampleQueryId="false"-->
</table>
<table tableName="user_password" domainObjectName="userPasswordDO" enableCountByExample="false"
selectByExampleQueryId="false"></table>
<table tableName="user_password" domainObjectName="UserPasswordDO" enableCountByExample="false"
enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false"
selectByExampleQueryId="false"></table>
<table tableName="item_info" domainObjectName="ItemDO" enableCountByExample="false"
enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false"
selectByExampleQueryId="false"></table>
<table tableName="item_stock" domainObjectName="ItemStockDO" enableCountByExample="false"
enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false"
selectByExampleQueryId="false"></table>