更新订单分页查询接口
This commit is contained in:
parent
fb19a6504d
commit
de8230d5ed
97
README.md
97
README.md
@ -6,73 +6,42 @@
|
||||
|
||||
## 描述
|
||||
|
||||
本项目是一款仓储管理系统,核心模块是仓储管理,附加销售管理及人员管理等模块。
|
||||
  本项目是一款仓储管理系统,核心模块是仓储管理,附加销售管理及人员管理等模块。
|
||||
|
||||
## 技术栈
|
||||
|
||||
项目后端使用SpringBoot开发,前端使用Vue框架开发。
|
||||
  项目后端使用SpringBoot开发,前端使用Vue框架开发。
|
||||
|
||||
具体使用的部分技术如下:
|
||||
## 第三方组件及依赖
|
||||
|
||||
<table style="text-align: center">
|
||||
<tr>
|
||||
<th></th>
|
||||
<th style="text-align: center">名称</th>
|
||||
<th style="text-align: center">版本</th>
|
||||
<th style="text-align: center">描述</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td rowspan = "4">后端</td>
|
||||
<td>SpringBoot</td>
|
||||
<td>2.3.7-Release</td>
|
||||
<td>一个轻量级的IoC控制反转容器框架</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SpringSecurity</td>
|
||||
<td>5.3.6-Release</td>
|
||||
<td>安全管理和权限控制框架</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Thymeleaf</td>
|
||||
<td>2.3.7-Release</td>
|
||||
<td>现代的服务器端 Java 模板引擎</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Mybatis</td>
|
||||
<td>3.5.6</td>
|
||||
<td>一款优秀的数据持久层框架</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td rowspan = "5">前端</td>
|
||||
<td>Vue</td>
|
||||
<td>3.2.31</td>
|
||||
<td>构建用户界面的MVVM渐进式框架</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Vue-router</td>
|
||||
<td>4.0.12</td>
|
||||
<td>Vue的路由管理器</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Bootstrap</td>
|
||||
<td>5.1.3</td>
|
||||
<td>简介灵活的前端框架</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Axios</td>
|
||||
<td>0.26.0</td>
|
||||
<td>基于 promise 的网络请求库</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Element-Plus</td>
|
||||
<td>2.0.2</td>
|
||||
<td>饿了么出品的Vue3组件库</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>数据库</td>
|
||||
<td>Sqlite</td>
|
||||
<td>3.34.0</td>
|
||||
<td>使用最广泛的关系型单文件数据库</td>
|
||||
</tr>
|
||||
</table>
|
||||
- **SpringBoot** `2.3.7-Release`
|
||||
> 一个轻量级的IoC控制反转容器框架
|
||||
- **SpringSecurity** `5.3.6-Release`
|
||||
> 安全管理和权限控制框架
|
||||
- **Thymeleaf** `2.3.7-Release`
|
||||
> 现代的服务器端 Java 模板引擎
|
||||
- **Mybatis** `3.5.6`
|
||||
> 一款优秀的数据持久层框架
|
||||
- **Vue** `3.2.31`
|
||||
> 构建用户界面的MVVM渐进式框架
|
||||
- **Vue-router** `4.0.12`
|
||||
> Vue的路由管理器
|
||||
- **Bootstrap** `5.1.3`
|
||||
> 简洁灵活的前端框架
|
||||
- **Axios** `0.26.0`
|
||||
> 基于 promise 的网络请求库
|
||||
- **Element-Plus** `2.0.2`
|
||||
> 饿了么出品的Vue3组件库
|
||||
- **Echarts** `5.3.1`
|
||||
> 用于快速构建基于 Web 的可视化的声明性框架
|
||||
- **Sqlite** `3.34.0`
|
||||
> 使用最广泛的关系型单文件数据库
|
||||
|
||||
## 构建
|
||||
|
||||
  需要Maven3、JDK11+
|
||||
|
||||
```
|
||||
mvn compile
|
||||
mvn package
|
||||
```
|
||||
|
@ -1,16 +1,13 @@
|
||||
package icu.mmmc.InventoryProMax.controller;
|
||||
|
||||
import icu.mmmc.InventoryProMax.exception.UserNotFoundException;
|
||||
import icu.mmmc.InventoryProMax.mapper.entity.OrderEntity;
|
||||
import icu.mmmc.InventoryProMax.service.OrderService;
|
||||
import icu.mmmc.InventoryProMax.vo.PageInfo;
|
||||
import icu.mmmc.InventoryProMax.vo.ResultStatus;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 订单接口
|
||||
@ -43,6 +40,20 @@ public class OrderController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询订单
|
||||
*
|
||||
* @param currentPage 页码
|
||||
* @param search 搜索
|
||||
* @return 订单列表
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/listPage")
|
||||
@PreAuthorize("hasAnyRole(@userRoles.roleSell)")
|
||||
public PageInfo<OrderEntity> listPage(@RequestParam(defaultValue = "1") int currentPage, @RequestParam(defaultValue = "") String search) {
|
||||
return orderService.listPage(currentPage, search);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public OrderController setOrderService(OrderService orderService) {
|
||||
this.orderService = orderService;
|
||||
|
@ -5,6 +5,8 @@ import icu.mmmc.InventoryProMax.mapper.entity.OrderItemEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单数据访问接口
|
||||
*
|
||||
@ -22,8 +24,25 @@ public interface OrderMapper {
|
||||
|
||||
/**
|
||||
* 插入一个条目
|
||||
*
|
||||
* @param item 物品
|
||||
* @return 结果
|
||||
*/
|
||||
int insertItem(@Param("item")OrderItemEntity item);
|
||||
int insertItem(@Param("item") OrderItemEntity item);
|
||||
|
||||
/**
|
||||
* 列出订单
|
||||
*
|
||||
* @param search 搜索
|
||||
* @return 订单列表
|
||||
*/
|
||||
List<OrderEntity> listOrders(@Param("search") String search);
|
||||
|
||||
/**
|
||||
* 列出条目
|
||||
*
|
||||
* @param ordId 订单id
|
||||
* @return 物品列表
|
||||
*/
|
||||
List<OrderItemEntity> listItems(@Param("ordId") int ordId);
|
||||
}
|
||||
|
@ -1,11 +1,14 @@
|
||||
package icu.mmmc.InventoryProMax.service;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import icu.mmmc.InventoryProMax.dto.UserInfo;
|
||||
import icu.mmmc.InventoryProMax.mapper.InventoryMapper;
|
||||
import icu.mmmc.InventoryProMax.mapper.OrderMapper;
|
||||
import icu.mmmc.InventoryProMax.mapper.entity.InventoryEntity;
|
||||
import icu.mmmc.InventoryProMax.mapper.entity.OrderEntity;
|
||||
import icu.mmmc.InventoryProMax.mapper.entity.OrderItemEntity;
|
||||
import icu.mmmc.InventoryProMax.vo.PageInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -99,6 +102,22 @@ public class OrderService {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询订单
|
||||
*
|
||||
* @param currentPage 页码
|
||||
* @param search 搜索
|
||||
* @return 订单列表
|
||||
*/
|
||||
public PageInfo<OrderEntity> listPage(int currentPage, String search) {
|
||||
PageHelper.startPage(currentPage, 10);
|
||||
Page<OrderEntity> orderEntityPage = (Page<OrderEntity>) orderMapper.listOrders(search);
|
||||
for (OrderEntity entity : orderEntityPage) {
|
||||
entity.setItems(orderMapper.listItems(entity.getId()));
|
||||
}
|
||||
return new PageInfo<>(orderEntityPage, currentPage, orderEntityPage.getTotal(), orderEntityPage.getPages());
|
||||
}
|
||||
|
||||
@Autowired
|
||||
public OrderService setUserCenterService(UserCenterService userCenterService) {
|
||||
this.userCenterService = userCenterService;
|
||||
|
@ -17,6 +17,23 @@
|
||||
<result column="remarks" property="remarks"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="order_column">
|
||||
id,
|
||||
seller,
|
||||
receiver_name,
|
||||
receiver_phone,
|
||||
receiver_address,
|
||||
status,amount,
|
||||
pay_form,
|
||||
pay_order_no,
|
||||
pay_time,
|
||||
is_invoice,
|
||||
invoice_client,
|
||||
remarks,
|
||||
create_time
|
||||
</sql>
|
||||
|
||||
<resultMap id="orderItemMap" type="icu.mmmc.InventoryProMax.mapper.entity.OrderItemEntity">
|
||||
<result column="id" property="id"/>
|
||||
<result column="ord_id" property="ordId"/>
|
||||
@ -33,6 +50,22 @@
|
||||
<result column="create_time" property="createTime"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="item_column">
|
||||
id,
|
||||
ord_id,
|
||||
pro_id,
|
||||
inv_id,
|
||||
title,
|
||||
model,
|
||||
unit,
|
||||
count,
|
||||
price,
|
||||
discount,
|
||||
amount,
|
||||
remarks,
|
||||
create_time
|
||||
</sql>
|
||||
|
||||
<!-- 插入一个订单 -->
|
||||
<insert id="insertOrder" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
||||
INSERT INTO t_orders
|
||||
@ -100,4 +133,29 @@
|
||||
#{item.createTime},
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<!-- 列出订单 -->
|
||||
<select id="listOrders" resultMap="orderMap">
|
||||
<bind name="search_str" value="'%'+search+'%'"/>
|
||||
SELECT
|
||||
<include refid="order_column"/>
|
||||
FROM t_orders
|
||||
WHERE
|
||||
seller LIKE #{search_str}
|
||||
OR receiver_name LIKE #{search_str}
|
||||
OR receiver_phone LIKE #{search_str}
|
||||
OR receiver_address LIKE #{search_str}
|
||||
OR pay_order_no LIKE #{search_str}
|
||||
OR invoice_client LIKE #{search_str}
|
||||
OR remarks LIKE #{search_str}
|
||||
ORDER BY id DESC
|
||||
</select>
|
||||
|
||||
<!-- 列出条目 -->
|
||||
<select id="listItems" resultMap="orderItemMap">
|
||||
SELECT
|
||||
<include refid="item_column"/>
|
||||
FROM t_order_items
|
||||
WHERE ord_id = #{ordId}
|
||||
</select>
|
||||
</mapper>
|
Loading…
x
Reference in New Issue
Block a user