mall学习笔记(5)

发布时间 2023-05-22 21:19:18作者: Capterlliar

花了点时间把前端抄抄删删改改,感觉自己完全理解了业务(bushi)。决定把成品项目clone下来搞搞。

1. pom modules

将一个项目分为多个模块,每个模块可以单独运行,子模块会继承父模块的依赖。子模块通过标签parent继承父模块。

maven 配置多模块项目 pom modules - 彼扬 - 博客园

2. <dependencyManagement>

放在父pom,不引用,作用是子pom引用里面的依赖时如果没有指定版本就用这里面的版本,方便集中管理。

3.  目录结构

后台接口

通用类及配置

简易演示版本

自动生成的map

前端接口

对接es的搜索模块

安全模块

4. example.createCriteria().andIdIn(ids).andStatusEqualTo(3);

删除在List里且status=3的条目

5. 

<insert id="insertList">
insert into cms_subject_product_relation (subject_id, product_id) values
<foreach collection="list" item="item" separator="," index="index">
(#{item.subjectId,jdbcType=BIGINT},
#{item.productId,jdbcType=BIGINT})
</foreach>
</insert>

mybatis之foreach用法 - Boblim - 博客园

6. 

List<OmsOrderOperateHistory> operateHistoryList = deliveryParamList.stream()
.map(omsOrderDeliveryParam -> {
OmsOrderOperateHistory history = new OmsOrderOperateHistory();
history.setOrderId(omsOrderDeliveryParam.getOrderId());
history.setCreateTime(new Date());
history.setOperateMan("后台管理员");
history.setOrderStatus(2);
history.setNote("完成发货");
return history;
}).collect(Collectors.toList());
orderOperateHistoryDao.insertList(operateHistoryList);

流式编程

由于是自设的参数,所以要单独写段sql

7. 

@Value("${aliyun.oss.dir.prefix}")
private String ALIYUN_OSS_DIR_PREFIX;

SpringBoot之Spring@Value属性注入使用详解 - 知乎

8.  MultipartFile

MultipartFile实现文件上传与下载 - 梨猫南北 - 博客园