Commit 8ebf8957ab3a203816e537ddff52b16b87366457
1 parent
29ca27c2
修改代码,提供模糊查询项目号或者内部编号接口
Showing
4 changed files
with
72 additions
and
4 deletions
src/main/java/com/order/erp/controller/OrderController.java
@@ -3,13 +3,13 @@ package com.order.erp.controller; | @@ -3,13 +3,13 @@ package com.order.erp.controller; | ||
3 | import com.order.erp.common.annotation.AnonymousAccess; | 3 | import com.order.erp.common.annotation.AnonymousAccess; |
4 | import com.order.erp.common.constant.ServerResult; | 4 | import com.order.erp.common.constant.ServerResult; |
5 | import com.order.erp.common.excel4j.exceptions.Excel4JException; | 5 | import com.order.erp.common.excel4j.exceptions.Excel4JException; |
6 | -import com.order.erp.domain.vo.order.OrderAddVO; | ||
7 | -import com.order.erp.domain.vo.order.OrderBaseInfoQueryVO; | ||
8 | -import com.order.erp.domain.vo.order.OrderUnlockFieldApplyVO; | ||
9 | -import com.order.erp.domain.vo.order.OrderUpdateVO; | 6 | +import com.order.erp.common.exception.BusinessException; |
7 | +import com.order.erp.domain.vo.order.*; | ||
8 | +import com.order.erp.mapper.order.OrderBaseInfoMapper; | ||
10 | import com.order.erp.service.order.OrderBaseInfoService; | 9 | import com.order.erp.service.order.OrderBaseInfoService; |
11 | import io.swagger.annotations.Api; | 10 | import io.swagger.annotations.Api; |
12 | import io.swagger.annotations.ApiOperation; | 11 | import io.swagger.annotations.ApiOperation; |
12 | +import org.springframework.beans.factory.annotation.Autowired; | ||
13 | import org.springframework.validation.annotation.Validated; | 13 | import org.springframework.validation.annotation.Validated; |
14 | import org.springframework.web.bind.annotation.PostMapping; | 14 | import org.springframework.web.bind.annotation.PostMapping; |
15 | import org.springframework.web.bind.annotation.RequestBody; | 15 | import org.springframework.web.bind.annotation.RequestBody; |
@@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.RestController; | @@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.RestController; | ||
19 | import javax.annotation.Resource; | 19 | import javax.annotation.Resource; |
20 | import javax.servlet.http.HttpServletResponse; | 20 | import javax.servlet.http.HttpServletResponse; |
21 | import java.io.IOException; | 21 | import java.io.IOException; |
22 | +import java.util.Objects; | ||
22 | 23 | ||
23 | /** | 24 | /** |
24 | * 订单基础信息表(OrderBaseInfo)表控制层 | 25 | * 订单基础信息表(OrderBaseInfo)表控制层 |
@@ -36,6 +37,9 @@ public class OrderController { | @@ -36,6 +37,9 @@ public class OrderController { | ||
36 | @Resource | 37 | @Resource |
37 | private OrderBaseInfoService orderBaseInfoService; | 38 | private OrderBaseInfoService orderBaseInfoService; |
38 | 39 | ||
40 | + @Resource | ||
41 | + private OrderBaseInfoMapper orderBaseInfoMapper; | ||
42 | + | ||
39 | /** | 43 | /** |
40 | * 分页查询 | 44 | * 分页查询 |
41 | * | 45 | * |
@@ -123,5 +127,21 @@ public class OrderController { | @@ -123,5 +127,21 @@ public class OrderController { | ||
123 | public ServerResult deleteById(@RequestBody OrderBaseInfoQueryVO orderBaseInfoQueryVO) { | 127 | public ServerResult deleteById(@RequestBody OrderBaseInfoQueryVO orderBaseInfoQueryVO) { |
124 | return orderBaseInfoService.deleteById(orderBaseInfoQueryVO); | 128 | return orderBaseInfoService.deleteById(orderBaseInfoQueryVO); |
125 | } | 129 | } |
130 | + | ||
131 | + /** | ||
132 | + * @param dto | ||
133 | + * @return ServerResult | ||
134 | + * @Description: 查询项目号或者内部编号 | ||
135 | + * @Author wmr | ||
136 | + * @CreateTime 2023/12/21 14:50 | ||
137 | + */ | ||
138 | + @ApiOperation("查询项目号或者内部编号") | ||
139 | + @PostMapping("/queryProjectNoAndInnerNo") | ||
140 | + public ServerResult queryProjectNoAndInnerNo(QueryProjectNoAndInnerNoDto dto) { | ||
141 | + if (Objects.isNull(dto.getProjectNo()) && Objects.isNull(dto.getInnerNo())) { | ||
142 | + throw new BusinessException("请传入项目号或内部编号"); | ||
143 | + } | ||
144 | + return ServerResult.success(orderBaseInfoMapper.queryProjectNoAndInnerNoDto(dto.getInnerNo() == null ? Boolean.TRUE : Boolean.FALSE, dto)); | ||
145 | + } | ||
126 | } | 146 | } |
127 | 147 |
src/main/java/com/order/erp/domain/vo/order/QueryProjectNoAndInnerNoDto.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | ||
2 | + | ||
3 | +import io.swagger.annotations.ApiModelProperty; | ||
4 | +import io.swagger.annotations.ApiOperation; | ||
5 | +import lombok.AllArgsConstructor; | ||
6 | +import lombok.Data; | ||
7 | +import lombok.NoArgsConstructor; | ||
8 | + | ||
9 | +import java.io.Serializable; | ||
10 | + | ||
11 | +/** | ||
12 | + * Date:2023/12/21 | ||
13 | + * Author:wmr | ||
14 | + * Description:查询项目号和内部编号Dto类 | ||
15 | + */ | ||
16 | +@ApiOperation("查询项目号和内部编号Dto类") | ||
17 | +@Data | ||
18 | +@AllArgsConstructor | ||
19 | +@NoArgsConstructor | ||
20 | +public class QueryProjectNoAndInnerNoDto implements Serializable { | ||
21 | + | ||
22 | + @ApiModelProperty(value = "项目号") | ||
23 | + private String projectNo; | ||
24 | + | ||
25 | + @ApiModelProperty(value = "内部编号") | ||
26 | + private String innerNo; | ||
27 | +} |
src/main/java/com/order/erp/mapper/order/OrderBaseInfoMapper.java
@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; | @@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
4 | import com.order.erp.domain.OrderStatusEnum; | 4 | import com.order.erp.domain.OrderStatusEnum; |
5 | import com.order.erp.domain.dto.order.OrderBaseInfoDO; | 5 | import com.order.erp.domain.dto.order.OrderBaseInfoDO; |
6 | import com.order.erp.domain.vo.OrderCountVO; | 6 | import com.order.erp.domain.vo.OrderCountVO; |
7 | +import com.order.erp.domain.vo.order.QueryProjectNoAndInnerNoDto; | ||
8 | +import org.apache.ibatis.annotations.Param; | ||
7 | import org.apache.ibatis.annotations.Select; | 9 | import org.apache.ibatis.annotations.Select; |
8 | 10 | ||
9 | import java.util.List; | 11 | import java.util.List; |
@@ -26,5 +28,8 @@ public interface OrderBaseInfoMapper extends BaseMapper<OrderBaseInfoDO> { | @@ -26,5 +28,8 @@ public interface OrderBaseInfoMapper extends BaseMapper<OrderBaseInfoDO> { | ||
26 | 28 | ||
27 | @Select("SELECT COUNT(*) as total_orders FROM order_base_info WHERE enable_flag=10 and YEAR(create_time) = YEAR(CURDATE())") | 29 | @Select("SELECT COUNT(*) as total_orders FROM order_base_info WHERE enable_flag=10 and YEAR(create_time) = YEAR(CURDATE())") |
28 | long countRecentYear(); | 30 | long countRecentYear(); |
31 | + | ||
32 | + List<QueryProjectNoAndInnerNoDto> queryProjectNoAndInnerNoDto(@Param("flag") Boolean flag, | ||
33 | + @Param("dto") QueryProjectNoAndInnerNoDto dto); | ||
29 | } | 34 | } |
30 | 35 |
src/main/resources/mapper/OrderBaseInfoMapper.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
3 | +<mapper namespace="com.order.erp.mapper.order.OrderBaseInfoMapper"> | ||
4 | + <select id="queryProjectNoAndInnerNoDto" resultType="com.order.erp.domain.vo.order.QueryProjectNoAndInnerNoDto"> | ||
5 | + SELECT project_no, | ||
6 | + inner_no | ||
7 | + FROM order_base_info | ||
8 | + WHERE enable_flag = 10 | ||
9 | + <if test="flag == true"> | ||
10 | + project_no like concat(#{dto.projectNo},'%') | ||
11 | + </if> | ||
12 | + <if test="flag == false"> | ||
13 | + inner_no like concat(#{dto.innerNo},'%') | ||
14 | + </if> | ||
15 | + </select> | ||
16 | +</mapper> |