首页 > 其他分享 >7.查询热销商品前四名的实现

7.查询热销商品前四名的实现

时间:2022-10-10 19:11:59浏览次数:33  
标签:COMMENT varchar 热销 DEFAULT private 查询 NULL id 四名

1.数据库

 

 1 CREATE TABLE t_product (
 2   id int(20) NOT NULL COMMENT '商品id',
 3   category_id int(20) DEFAULT NULL COMMENT '分类id',
 4   item_type varchar(100) DEFAULT NULL COMMENT '商品系列',
 5   title varchar(100) DEFAULT NULL COMMENT '商品标题',
 6   sell_point varchar(150) DEFAULT NULL COMMENT '商品卖点',
 7   price bigint(20) DEFAULT NULL COMMENT '商品单价',
 8   num int(10) DEFAULT NULL COMMENT '库存数量',
 9   image varchar(500) DEFAULT NULL COMMENT '图片路径',
10   status int(1) DEFAULT '1' COMMENT '商品状态  1:上架   2:下架   3:删除',
11   priority int(10) DEFAULT NULL COMMENT '显示优先级',
12   created_time datetime DEFAULT NULL COMMENT '创建时间',
13   modified_time datetime DEFAULT NULL COMMENT '最后修改时间',
14   created_user varchar(50) DEFAULT NULL COMMENT '创建人',
15   modified_user varchar(50) DEFAULT NULL COMMENT '最后修改人',
16   PRIMARY KEY (id)
17 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Product数据表

 

2.product实体类

package com.ku.store.entity;

import lombok.Data;

@Data
public class Product extends BaseEntity{
    private Integer id;
    private Integer categoryId;//类别id
    private String itemType;//项目
    private String title;
    private String sellPoint;//销售点
    private Long price;
    private Integer num;
    private String image;
    private Integer status;
    private Integer priority;//优先权
}
Product实体类

3.mapper层

  3.1.接口实现

 

  3.2.接口的xml实现

 

  3.3.测试接口方法

 

  3.4.测试结果

   

4.service层

  4.1.接口实现

 

  4.2.接口实现类

 

  4.3.实现类测试

 

  4.4.测试结果

5.controller层

  5.1.增强BaseController

 

  5.2.实现ProductController

 

  5.3.postman测试

 

6.小结

标签:COMMENT,varchar,热销,DEFAULT,private,查询,NULL,id,四名
From: https://www.cnblogs.com/kzf-99/p/16776851.html

相关文章