Compare commits
No commits in common. "97584f417ed553a6e37cd4e69f9887f2b3fdc605" and "6a1a56dcb3681e9039a40d93147bf2946582bf98" have entirely different histories.
97584f417e
...
6a1a56dcb3
|
|
@ -4,8 +4,6 @@ import com.njzscloud.common.core.utils.R;
|
|||
import com.njzscloud.common.mp.support.PageParam;
|
||||
import com.njzscloud.common.mp.support.PageResult;
|
||||
import com.njzscloud.dispose.cst.order.pojo.entity.OrderTransEntity;
|
||||
import com.njzscloud.dispose.cst.order.pojo.param.OrderTransQueryParam;
|
||||
import com.njzscloud.dispose.cst.order.pojo.result.OrderTransResult;
|
||||
import com.njzscloud.dispose.cst.order.service.OrderTransService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -65,7 +63,9 @@ public class OrderTransController {
|
|||
* 分页查询
|
||||
*/
|
||||
@GetMapping("/paging")
|
||||
public R<PageResult<OrderTransResult>> paging(PageParam pageParam, OrderTransQueryParam queryParam) {
|
||||
return R.success(orderTransService.paging(pageParam, queryParam));
|
||||
public R<PageResult<OrderTransEntity>> paging(PageParam pageParam, OrderTransEntity orderTransEntity) {
|
||||
return R.success(orderTransService.paging(pageParam, orderTransEntity));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
package com.njzscloud.dispose.cst.order.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njzscloud.dispose.cst.order.pojo.entity.OrderTransEntity;
|
||||
import com.njzscloud.dispose.cst.order.pojo.result.OrderTransResult;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 运输信息
|
||||
|
|
@ -19,6 +15,6 @@ public interface OrderTransMapper extends BaseMapper<OrderTransEntity> {
|
|||
|
||||
OrderTransResult getById(Long id);
|
||||
|
||||
IPage<OrderTransResult> paging(Page<Object> page, @Param("ew") QueryWrapper<?> ew);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,66 +0,0 @@
|
|||
package com.njzscloud.dispose.cst.order.pojo.param;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 运输分页查询参数
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
public class OrderTransQueryParam {
|
||||
|
||||
/**
|
||||
* 下单时间 - 开始
|
||||
*/
|
||||
private LocalDateTime orderTimeStart;
|
||||
|
||||
/**
|
||||
* 下单时间 - 结束
|
||||
*/
|
||||
private LocalDateTime orderTimeEnd;
|
||||
|
||||
/**
|
||||
* 运输公司(组织Id)
|
||||
*/
|
||||
private Long transOrgId;
|
||||
|
||||
/**
|
||||
* 车牌
|
||||
*/
|
||||
private String truckLicensePlate;
|
||||
|
||||
/**
|
||||
* 订单号(sn)
|
||||
*/
|
||||
private String sn;
|
||||
|
||||
/**
|
||||
* 车次
|
||||
*/
|
||||
private Integer trainNum;
|
||||
|
||||
/**
|
||||
* 站点名称
|
||||
*/
|
||||
private String stationName;
|
||||
|
||||
/**
|
||||
* 订单状态
|
||||
*/
|
||||
private String orderStatus;
|
||||
|
||||
/**
|
||||
* 运输状态
|
||||
*/
|
||||
private String transStatus;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,21 +1,11 @@
|
|||
package com.njzscloud.dispose.cst.order.service;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njzscloud.common.core.ex.Exceptions;
|
||||
import com.njzscloud.common.mp.support.PageParam;
|
||||
import com.njzscloud.common.mp.support.PageResult;
|
||||
import com.njzscloud.common.security.util.SecurityUtil;
|
||||
import com.njzscloud.dispose.cst.customer.constant.IdentityCategory;
|
||||
import com.njzscloud.dispose.cst.customer.pojo.entity.CustomerEntity;
|
||||
import com.njzscloud.dispose.cst.customer.service.CustomerService;
|
||||
import com.njzscloud.dispose.cst.order.mapper.OrderTransMapper;
|
||||
import com.njzscloud.dispose.cst.order.pojo.entity.OrderTransEntity;
|
||||
import com.njzscloud.dispose.cst.order.pojo.param.OrderTransQueryParam;
|
||||
import com.njzscloud.dispose.cst.order.pojo.result.OrderTransResult;
|
||||
import com.njzscloud.dispose.sys.auth.pojo.result.MyResult;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -33,8 +23,6 @@ import java.util.List;
|
|||
@RequiredArgsConstructor
|
||||
public class OrderTransService extends ServiceImpl<OrderTransMapper, OrderTransEntity> {
|
||||
|
||||
private final CustomerService customerService;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void add(OrderTransEntity orderTransEntity) {
|
||||
this.save(orderTransEntity);
|
||||
|
|
@ -54,46 +42,9 @@ public class OrderTransService extends ServiceImpl<OrderTransMapper, OrderTransE
|
|||
return this.getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询,返回联表结果
|
||||
*/
|
||||
public PageResult<OrderTransResult> paging(PageParam pageParam, OrderTransQueryParam param) {
|
||||
QueryWrapper<OrderTransResult> ew = Wrappers.<OrderTransResult>query()
|
||||
.eq("cot.deleted", Boolean.FALSE);
|
||||
if (param != null) {
|
||||
ew.ge(param.getOrderTimeStart() != null, "co.order_time", param.getOrderTimeStart())
|
||||
.le(param.getOrderTimeEnd() != null, "co.order_time", param.getOrderTimeEnd())
|
||||
.eq(param.getTransOrgId() != null, "co.trans_org_id", param.getTransOrgId())
|
||||
.like(StrUtil.isNotBlank(param.getTruckLicensePlate()), "cot.truck_license_plate", param.getTruckLicensePlate())
|
||||
.like(StrUtil.isNotBlank(param.getSn()), "co.sn", param.getSn())
|
||||
.eq(param.getTrainNum() != null, "cot.train_num", param.getTrainNum())
|
||||
.like(StrUtil.isNotBlank(param.getStationName()), "co.station_name", param.getStationName())
|
||||
.eq(StrUtil.isNotBlank(param.getOrderStatus()), "co.order_status", param.getOrderStatus())
|
||||
.eq(StrUtil.isNotBlank(param.getTransStatus()), "cot.trans_status", param.getTransStatus());
|
||||
}
|
||||
// 管理员查看全部,非管理员按身份过滤
|
||||
if (!SecurityUtil.isAdmin()) {
|
||||
MyResult userDetail = SecurityUtil.loginUser();
|
||||
Long currentCustomerId = userDetail.getCurrentCustomerId();
|
||||
if (currentCustomerId != null) {
|
||||
CustomerEntity customer = customerService.getById(currentCustomerId);
|
||||
if (customer != null && customer.getIdentityCategory() != null) {
|
||||
ew.eq(IdentityCategory.ChanFei.equals(customer.getIdentityCategory())
|
||||
|| IdentityCategory.CaiGou.equals(customer.getIdentityCategory()),
|
||||
"co.customer_id", currentCustomerId);
|
||||
ew.eq(IdentityCategory.YunShu.equals(customer.getIdentityCategory()),
|
||||
"co.trans_customer_id", currentCustomerId);
|
||||
ew.eq(IdentityCategory.SiJi.equals(customer.getIdentityCategory()),
|
||||
"cot.driver_customer_id", currentCustomerId);
|
||||
} else {
|
||||
throw Exceptions.clierr("客户信息或客户身份类型不存在");
|
||||
}
|
||||
} else {
|
||||
throw Exceptions.clierr("当前登录人无客户信息");
|
||||
}
|
||||
}
|
||||
|
||||
return PageResult.of(baseMapper.paging(pageParam.toPage(), ew));
|
||||
public PageResult<OrderTransEntity> paging(PageParam pageParam, OrderTransEntity orderTransEntity) {
|
||||
return PageResult.of(this.page(pageParam.toPage(), Wrappers.query(orderTransEntity)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,10 @@
|
|||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
cot.id AS id,
|
||||
cot
|
||||
.
|
||||
id
|
||||
AS id,
|
||||
cot.train_num AS train_num,
|
||||
cot.order_id AS order_id,
|
||||
cot.trans_status AS trans_status,
|
||||
|
|
@ -107,14 +110,6 @@
|
|||
left join cst_order co on co.id = cot.order_id
|
||||
WHERE cot.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="paging" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List"/>
|
||||
FROM cst_order_trans cot
|
||||
left join cst_order co on co.id = cot.order_id
|
||||
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
|
||||
${ew.customSqlSegment}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue