48 lines
2.3 KiB
Markdown
48 lines
2.3 KiB
Markdown
|
CREATE TABLE `goods` (
|
|||
|
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
|||
|
`goods_name` varchar(127) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '商品名称',
|
|||
|
`category_id` int(11) NULL DEFAULT 0 COMMENT '商品所属类目ID',
|
|||
|
`brand` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '0' COMMENT '商品品牌',
|
|||
|
`gallery` varchar(1023) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '[]' COMMENT '商品宣传图片列表,采用JSON数组格式',
|
|||
|
`brief` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '商品简介',
|
|||
|
`is_on_sale` tinyint(1) NULL DEFAULT 1 COMMENT '是否上架 0为下架 1为上架',
|
|||
|
`sort_order` smallint(4) NULL DEFAULT 100 COMMENT '排序',
|
|||
|
`pic_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '商品页面商品图片',
|
|||
|
`type` tinyint(1) NULL DEFAULT 0 COMMENT '商品类型',
|
|||
|
`unit` varchar(31) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '件' COMMENT '商品单位,例如件、盒',
|
|||
|
`counter_price` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '专柜价格(原价 / 划线价)',
|
|||
|
`retail_price` decimal(10, 2) NULL DEFAULT 100000.00 COMMENT '零售价格(售价 / 未划线价)',
|
|||
|
`detail` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '商品详细介绍,是富文本格式',
|
|||
|
`deleted` tinyint(1) NULL DEFAULT 0 COMMENT '逻辑删除 0为正常 1为删除',
|
|||
|
PRIMARY KEY (`id`) USING BTREE,
|
|||
|
INDEX `category_id`(`category_id`) USING BTREE,
|
|||
|
INDEX `brand_id`(`brand`) USING BTREE,
|
|||
|
INDEX `sort_order`(`sort_order`) USING BTREE
|
|||
|
);
|
|||
|
|
|||
|
创建该表的 updateGood 的 Mybatils 方法 <update id="updateGood">
|
|||
|
|
|||
|
Good实体类如下
|
|||
|
|
|||
|
public class Good {
|
|||
|
Long id;
|
|||
|
String goodsName;
|
|||
|
Integer categoryId;
|
|||
|
String brand;
|
|||
|
String gallery;
|
|||
|
String brief;
|
|||
|
Boolean isOnSale;
|
|||
|
Integer sortOrder;
|
|||
|
String picUrl;
|
|||
|
Integer type;
|
|||
|
String unit;
|
|||
|
Double counterPrice;
|
|||
|
Double retailPrice;
|
|||
|
String detail;
|
|||
|
Boolean deleted;
|
|||
|
}
|
|||
|
|
|||
|
以下是一些要求
|
|||
|
parameterType="com.cxyxiaomo.epp.common.pojo.Good"
|
|||
|
where 条件所引用的Java变量都需要先判断是否为null或空
|
|||
|
输出应该为一个 ```code``` 包起来的代码片段
|