【update】规范传参null设置为空

This commit is contained in:
nixj 2024-05-27 10:10:37 +08:00
parent 21470758cf
commit bd97a78306
5 changed files with 12 additions and 17 deletions

View File

@ -14,6 +14,6 @@ public class ConsumptionDetailQuery extends BaseQuery{
* 0-火车 1飞机 2酒店 3打车 * 0-火车 1飞机 2酒店 3打车
*/ */
private Integer productType; private Integer productType;
private String userName; private String userName="";
private String orderNo; private String orderNo="";
} }

View File

@ -8,7 +8,7 @@ import java.util.List;
@Data @Data
public class ItineraryPageQuery extends BaseQuery { public class ItineraryPageQuery extends BaseQuery {
private String applicant;// 申请人 private String applicant="";// 申请人
private String actualOrderNo; //申请单号 private String actualOrderNo=""; //申请单号
private List<String> userIds=new ArrayList<>(); private List<String> userIds=new ArrayList<>();
} }

View File

@ -9,13 +9,13 @@ import java.util.List;
@Data @Data
public class OrderPageQuery extends BaseQuery { public class OrderPageQuery extends BaseQuery {
//订单号 //订单号
private String oderNo; private String oderNo="";
//申请单号 //申请单号
private String actualOrderNo; private String actualOrderNo="";
//出行人 //出行人
private String travelers; private String travelers="";
//预订人 //预订人
private String applicant; private String applicant="";
//开始日期 //开始日期
private String startTime; private String startTime;
//结束日期 //结束日期
@ -23,6 +23,6 @@ public class OrderPageQuery extends BaseQuery {
//产品类型 //产品类型
private String productType; private String productType;
//部门名称 //部门名称
private String deptName; private String deptName="";
private List<String> userIds=new ArrayList<>(); private List<String> userIds=new ArrayList<>();
} }

View File

@ -54,7 +54,8 @@ public class JdbcConsumptionDetailRepositoryImpl implements JdbcConsumptionDetai
} }
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
if (dto.getActualOrderNo()!=null&&dto.getActualOrderNo().isEmpty()){ //设置null
if (dto.getActualOrderNo().isEmpty()){
dto.setActualOrderNo(null); dto.setActualOrderNo(null);
} }
params.put("actualOrderNo", dto.getActualOrderNo()); params.put("actualOrderNo", dto.getActualOrderNo());
@ -74,12 +75,6 @@ public class JdbcConsumptionDetailRepositoryImpl implements JdbcConsumptionDetai
@Override @Override
public PageResult<? extends BaseExcel> pageConsumptionDetail(ConsumptionDetailQuery dto) { public PageResult<? extends BaseExcel> pageConsumptionDetail(ConsumptionDetailQuery dto) {
if (dto.getUserName()==null){
dto.setUserName("");
}
if (dto.getOrderNo()==null){
dto.setOrderNo("");
}
PageRequest pageRequest = PageRequest PageRequest pageRequest = PageRequest
.of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("id").descending()); .of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("id").descending());
Page<? extends BaseExcel> data=new PageImpl<>(Collections.emptyList()); Page<? extends BaseExcel> data=new PageImpl<>(Collections.emptyList());

View File

@ -90,7 +90,7 @@ public class ManageServiceImpl implements ManageService {
@Override @Override
public PageResult<ItineraryPageDto> itineraryPageQuery(ItineraryPageQuery dto) { public PageResult<ItineraryPageDto> itineraryPageQuery(ItineraryPageQuery dto) {
List<User> users=new ArrayList<>(); List<User> users=new ArrayList<>();
if (dto.getApplicant()!=null&&!dto.getApplicant().isEmpty()){ if (!dto.getApplicant().isEmpty()){
users=jdbcUserRepository.findAllByNameContains(dto.getApplicant()); users=jdbcUserRepository.findAllByNameContains(dto.getApplicant());
if (users==null||users.isEmpty()){ if (users==null||users.isEmpty()){
return null; return null;