()数据库配置
常见语句
Create table ‘my_table’(
int id not null auto_increment
)

()
建表的时候出现text,bigInt,decimal

()需要设置默认值时
用@RequestParam注解。value属性“parentId”必须跟form表单里面的name属性保持一致
@RequestParam、@RequestBody和@ModelAttribute区别可以详见下面文章
https://www.cnblogs.com/zeroingToOne/p/8992746.html

public ServerResponse addCategory(HttpSession session,String categoryName,@RequestParam(value = "parentId",defaultValue = "0") int parentId)

类开始建造
属性,构造方法,int,get方法
ServerResponse.java 文件 通用的
其中@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)—>json序列化后为null的对象,key会消失。如data为null ,都不显示
其中

 @JsonIgnorepublic  boolean isSuccess(){return this.status==ResponseCode.SUCCESS.getCode();}

这句代码块的意思是返回的json中不会包含isSuccess这个方法。

package com.mmall.common;import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.map.annotate.JsonSerialize;import java.io.Serializable;/*** @Classname ServerResponse* @Description TODO* @Date 2019/2/1 21:35* @Created by tengfei*/
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class ServerResponse<T> implements Serializable {
private int status;
private String msg;
private T data;
private ServerResponse(int status){this.status=status;
}private  ServerResponse(int status,String msg){this.status=status;this.msg=msg;}private  ServerResponse(int status,String msg,T data){this.status=status;this.msg=msg;this.data=data;}private  ServerResponse(int status,T data){this.status=status;this.data=data;}@JsonIgnorepublic  boolean isSuccess(){return this.status==ResponseCode.SUCCESS.getCode();}public  int getStatus(){return  status;}public  String getMsg(){return msg;}public  T getData(){return  data;}public  static  <T> ServerResponse<T> createBySuccess(){return new ServerResponse<T>(ResponseCode.SUCCESS.getCode());}public  static  <T> ServerResponse<T> createBySuccessMsg(String msg){return new ServerResponse<T>(ResponseCode.SUCCESS.getCode(),msg);}public static <T> ServerResponse<T> createBySuccess(T data){return  new ServerResponse<T>(ResponseCode.SUCCESS.getCode(),data);}public static <T> ServerResponse<T> createBySuccess(String msg,T data){return  new ServerResponse(ResponseCode.SUCCESS.getCode(),msg,data);}public  static  <T> ServerResponse<T> createByError(){return new ServerResponse<T>(ResponseCode.ERROR.getCode(),ResponseCode.ERROR.getDesc());}public static  <T> ServerResponse<T> createByErrorMsg(String errorMessage){return new ServerResponse<T> (ResponseCode.ERROR.getCode(),errorMessage);}public static  <T> ServerResponse<T> createByErrorCodeMessage(int errorCode,String errorMsg){return  new ServerResponse<>(errorCode,errorMsg);}
}

controller

相关@Controller和@RestController的区别可以详见下面链接
https://www.cnblogs.com/shuaifing/p/8119664.html
其中@RestController注解相当于@ResponseBody + @Controller
此时Controller中的方法无法返回jsp页面,或者html,配置的视图解析器 InternalResourceViewResolver不起作用,返回的内容就是Return 里的内容。
@responseBody注解的使用,可查阅
https://www.cnblogs.com/qiankun-site/p/5774325.html

@Controller
@RequestMapping("/user/")
public class UserController {@Autowiredprivate IUserService iUserService;// 登录@RequestMapping(value = "login.do", method = RequestMethod.POST)@ResponseBodypublic ServerResponse<User> login(String username, String password, HttpSession session) {ServerResponse<User> response = iUserService.login(username, password);if (response.isSuccess()) {session.setAttribute(Const.CURRENT_USER, response.getData());}return response;}}

其中

 @Autowiredprivate IUserService iUserService;

iUserService想要注入成功,必须在ServiceImpl里面添加@Service注解,并且value属性为“iUserService”;

@Service("iUserService")
public class UserServiceImpl implements IUserService {

当上述检查OK之后。可设置下IDEA settings
https://blog.csdn.net/leonliu06/article/details/79345910

Usermapper中的一段代码块

 User selectLogin(@Param("username") String username, @Param("password") String password);

mybatis在传递多个参数的时候需要使用@Param注解,在UserMapper.xml sql对应的时候需要对应@Param(“username”)里面的“username”而不是“ String username”中的 “username”。

当写UserMapper.xml时

<resultMap id="BaseResultMap" type="com.mmall.pojo.User" ><constructor ><idArg column="id" jdbcType="INTEGER" javaType="java.lang.Integer" /><arg column="username" jdbcType="VARCHAR" javaType="java.lang.String" /><arg column="password" jdbcType="VARCHAR" javaType="java.lang.String" /><arg column="email" jdbcType="VARCHAR" javaType="java.lang.String" /><arg column="phone" jdbcType="VARCHAR" javaType="java.lang.String" /><arg column="question" jdbcType="VARCHAR" javaType="java.lang.String" /><arg column="answer" jdbcType="VARCHAR" javaType="java.lang.String" /><arg column="role" jdbcType="INTEGER" javaType="java.lang.Integer" /><arg column="create_time" jdbcType="TIMESTAMP" javaType="java.util.Date" /><arg column="update_time" jdbcType="TIMESTAMP" javaType="java.util.Date" /></constructor></resultMap>
<sql id="Base_Column_List" >id, username, password, email, phone, question, answer, role, create_time, update_time</sql>

resultType:基本数据类型。
resultMap:当返回值是很多值的时候。如BaseResultMap
parameterType:value:map 为java.util.Map的缩写

<select id="selectLogin" resultMap="BaseResultMap" parameterType="map">select<include refid="Base_Column_List" />from mmall_userwhere username=#{username}and password=#{password}</select>

其中
id为UserMapper里面的方法名selectLogin

 <include refid="Base_Column_List" />

该语句会把 id, username, password, email, phone, question, answer, role, create_time 这几个属性都贴进来。杜绝使用*来进行导入。

tips:
()相关token
UUID.randomUUID().toString()是javaJDK提供的一个自动生成主键的方法。UUID通用唯一识别码,UUID的唯一缺陷在于生成的结果串会比较长

String forgetToken = UUID.randomUUID().toString();

() isNotBlank和 isNotEmpty的区别
1,isNotEmpty(str)等价于 str != null && str.length > 0。

2,isNotBlank(str) 等价于 str != null && str.length > 0 && str.trim().length > 0。

()如何理解token,guava缓存

商品管理模块

数据库设计

购物车模块

收货地址模块

支付模块

订单管理模块

云服务器线上部署,自动发布

附上主干合并分支,分支合并主干的命令
1、主干合并分支
进入分支,更新分支代码
(branch)git pull;
切换主干
(branch)git checkout master;
在主干上合并分支branch
(master)git merge branch --squash
提交合并后的代码
(master)git commit -m ‘合并备注’
将代码推送到远程仓库
(master)git push
2、分支合并主干
进入主干,更新主干代码
(master)git pull;
切换分支
(master)git checkout branch;
在分支上合并主干
(branch)git merge master --squash
提交合并后的代码
(branch)git commit -m ‘合并备注’
将代码推送到远程仓库

mmall 学习笔记--分类管理模块,商品管理模块,购物车模块,收货地址模块,支付模块,订单管理模块,云服务器线上部署,自动发布,相关推荐

  1. 微信小程序的选择收货地址、新增地址、地址管理等模块的总结(1)

    这几天主要在做公司微信小程序项目2.0版本的一些新增功能,其中就包括把原来的地址等个人固定信息独立成一个模块进行管理(选择收货地址),包括新增地址.地址修改.删除等可以直接选取个人地址而不需要每次都填 ...

  2. 写收货地址代码模块的思路整理——省市联动

    最近,一个同事接到一个开发任务,其中有一个功能模块就是关于收货地址的,在收货地址的回显上遇到了一些麻烦,因为我之前做过收货地址的模块,因此将经验总结于下,供大家参考: 所用技术:AngularJs 一 ...

  3. 商品属性对应表,商品相册表,用户表,用户收货地址表,地区表,购物车表,送货方式表,订单表,订单明细表的数据库设计

    商品的属性 通用属性: 名称 价格 图片 存放goods表 扩展属性,也叫规格参数,不同类型的商品其规格参数是不一样的,服装有尺码,颜色,材料等,手机有分辨率,内存,存储,摄像头,书籍有作者,出版社 ...

  4. 淘宝API接口系列,获取购买到的商品订单列表,订单详情,订单物流,收货地址列表,买家信息,买家token,卖出的商品订单列表

    custom自定义API操作 buyer_order_list获取购买到的商品订单列表 buyer_order_detail获取购买到的商品订单详情 buyer_order_express获取购买到的 ...

  5. UNIAPP实战项目笔记43 购物车页面修改收货地址和修改默认地址

    UNIAPP实战项目笔记43 购物车页面修改收货地址和修改默认地址 实际案例图片 修改收货地址和修改默认地址页面布局和功能 具体内容图片自己替换哈,随便找了个图片的做示例 用到了vuex的状态机,具体 ...

  6. 淘宝API接口系列,获取购买到的商品订单列表,卖出的商品订单列表,订单详情,订单物流,买家信息,收货地址列表,买家token

    custom自定义API操作 buyer_order_list获取购买到的商品订单列表 buyer_order_detail获取购买到的商品订单详情 buyer_order_express获取购买到的 ...

  7. 用户输入商品价格和商品数量,以及收货地址,可以自动打印订单信息 分析:

    ①:需要输入3个数据,所以需要3个变量来存储 price num address ②:需要计算总的价格 total ③:页面打印生成表格,里面填充数据即可 ④:记得最好使用模板字符串 <!DOC ...

  8. dcloud管理收货地址mui

    为什么80%的码农都做不了架构师?>>>    <!doctype html> <html> <head> <meta charset=&q ...

  9. 微信小程序功能:全选和反选--修改商品数量、删除商品--计算总价格和总数量--收货地址

    微信小程序–购物车页面(核心) 包含功能点: 全选和反选 计算:总价格和总数量 修改商品数量.删除商品 收货地址 结构:cart.wxml <!-- 收货地址 --> <view c ...

最新文章

  1. 软件体系结构的第3次实验(软件体系结构风格之应用 )
  2. 电梯里为什么放镜子?90%的人都不知道
  3. 【C语言】C语言里++能随便用吗?
  4. Redis持久化方式之RDB
  5. python线程安全吗_线程安全及Python中的GIL
  6. 基于element ui的收起展开检索条件效果
  7. 用WPF+MongoDB开发房产信息收集器(3)——MongoDB入门
  8. 小区门口的健身房,就是韭菜收割厂
  9. AmMap创建交互式Flash地图
  10. 【BZOJ4198】【NOI2015】荷马史诗(贪心,Huffman树)
  11. 如何设计三极管控制继电器电路
  12. MySQL-压缩包版本下载安装
  13. 计算机应用基础165791,[2018年最新整理]人大网大计算机应用基础试题答案.doc
  14. 做不到这些?再干十年你也只能是个普通码农!
  15. Pycharm Debugger - Frames Not Available
  16. MySql中增加注释、追加注释、修改注释、查看注释
  17. [OpenGL] 屏幕后处理:景深效果
  18. javaweb基于SSM开发学生请假管理系统 课程设计 毕业设计源码
  19. 如何快速创建在线员工培训课程
  20. 数据库基础知识和常见术语学习

热门文章

  1. vue axios 实现 文件流下载(前后端分离跨域问题的解决)
  2. 子类重写父类方法时权限修饰符的关系
  3. cascade down_cascade是什么意思_ cascade的翻译_音标_读音_用法_例句_爱词霸在线词典...
  4. Angular 解决浏览器缓存 快捷犀利之招
  5. 张高兴的 .NET IoT 入门指南:(七)制作一个气象站
  6. 别给12306 辩解了
  7. 我用 Python 自制成语接龙小游戏,刺激
  8. 封装微信微博QQ分享lib快速使用
  9. Eclipse RCP 开发系列入门教程
  10. android canvas光晕绘制_为ImageView增加iphone式的光晕效果