提交 045e06d0 作者: 张小凤

RentalOrdersController(delete)

上级 bcde6373
package com.mmc.pms.controller;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.model.dto.OrderInfoDTO;
import com.mmc.pms.model.qo.OrderInfoQO;
import com.mmc.pms.service.RentalOrdersService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
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.RestController;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletRequest;
/**
* @Author small @Date 2023/5/25 9:42 @Version 1.0
*/
@Api(tags = {"租赁相关-接口废弃"})
@RestController
@RequestMapping("/RentalOrders")
@ApiIgnore
public class RentalOrdersController {
@Autowired private RentalOrdersService rentalOrdersService;
@ApiOperation(value = "租赁订单-分页-列表")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = OrderInfoDTO.class)})
@PostMapping("listPcWechatOrder")
public ResultBody listPcWechatOrder(HttpServletRequest request, @RequestBody OrderInfoQO param) {
return ResultBody.success(
// this.getCurrentAccount(request)
rentalOrdersService.listPcOrderInfo(param, null));
}
@ApiOperation(value = "小程序-云仓-订单-分页-列表")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = OrderInfoDTO.class)})
@PostMapping("listPageWechatOrder")
public ResultBody listPageWechatOrder(
HttpServletRequest request, @RequestBody OrderInfoQO param) {
return ResultBody.success(rentalOrdersService.listPageWechatOrder(null, param));
}
}
package com.mmc.pms.dao;
import com.mmc.pms.entity.OrderInfoDO;
import com.mmc.pms.model.qo.OrderInfoQO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @Author small @Date 2023/5/25 10:01 @Version 1.0
*/
@Mapper
public interface RentalOrdersDao {
Integer countPcOrderInfo(OrderInfoQO param);
List<OrderInfoDO> listPcOrderInfo(OrderInfoQO param);
int countPageOrderInfo(OrderInfoQO param);
List<OrderInfoDO> listPageOrderInfo(OrderInfoQO param);
}
package com.mmc.pms.model.qo;
import com.mmc.pms.common.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
/**
* @Author small @Date 2023/5/25 9:52 @Version 1.0
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
// @ApiModel(value = "com.mmc.csf.model.qo.OrderInfoQO", description = "订单QO")
public class OrderInfoQO implements Serializable {
private static final long serialVersionUID = -3503119623575892302L;
@ApiModelProperty(value = "用户ID", hidden = true)
private Integer repoAccountId;
@ApiModelProperty(value = "关键字")
private String keyword;
@ApiModelProperty(value = "pc-买家账号")
private String keyword1;
@ApiModelProperty(value = "pc-订单编号")
private String keyword2;
@ApiModelProperty(value = "pc-商品编号")
private String keyword3;
@ApiModelProperty(value = "pc-商品名称")
private String keyword4;
@ApiModelProperty(value = "订单状态:查字典")
private String tranStatus;
@ApiModelProperty(value = "pc-开始时间")
private String startTime;
@ApiModelProperty(value = "pc-结束时间")
private String endTime;
@ApiModelProperty(value = "用户ID", hidden = true)
private List<Integer> userIds;
@ApiModelProperty(value = "单位ID", hidden = true)
private List<Integer> companys;
@ApiModelProperty(value = "页码", required = true)
@NotNull(
message = "页码不能为空",
groups = {Page.class})
@Min(value = 1, groups = Page.class)
private Integer pageNo;
@ApiModelProperty(value = "每页显示数", required = true)
@NotNull(
message = "每页显示数不能为空",
groups = {Page.class})
@Min(value = 1, groups = Page.class)
private Integer pageSize;
public void buildCurrentPage() {
this.pageNo = (pageNo - 1) * pageSize;
}
}
package com.mmc.pms.service.Impl;
import com.mmc.pms.dao.RentalOrdersDao;
import com.mmc.pms.model.dto.BaseAccountDTO;
import com.mmc.pms.model.dto.OrderInfoDTO;
import com.mmc.pms.model.qo.OrderInfoQO;
import com.mmc.pms.page.PageResult;
import com.mmc.pms.service.RentalOrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Author small @Date 2023/5/25 9:44 @Version 1.0
*/
@Service
public class RentalOrdersServiceImpl implements RentalOrdersService {
@Autowired private RentalOrdersDao rentalOrdersDao;
@Override
public PageResult listPcOrderInfo(OrderInfoQO param, BaseAccountDTO cuser) {
if (!cuser.isManage()) {
param.setCompanys(cuser.getCompanyInfo().getCompanys());
}
Integer count = rentalOrdersDao.countPcOrderInfo(param);
if (count == 0) {
return PageResult.buildPage(param.getPageNo(), param.getPageSize(), count);
}
Integer pageNo = param.getPageNo();
param.buildCurrentPage();
List<OrderInfoDTO> data =
rentalOrdersDao.listPcOrderInfo(param).stream()
.map(
d -> {
return d.buildOrderInfoDTO();
})
.collect(Collectors.toList());
return PageResult.buildPage(pageNo, param.getPageSize(), count, data);
}
@Override
public PageResult listPageWechatOrder(BaseAccountDTO account, OrderInfoQO param) {
param.setRepoAccountId(account.getId());
int count = rentalOrdersDao.countPageOrderInfo(param);
if (count == 0) {
return PageResult.buildPage(param.getPageNo(), param.getPageSize(), count);
}
Integer pageNo = param.getPageNo();
param.buildCurrentPage();
List<OrderInfoDTO> data =
rentalOrdersDao.listPageOrderInfo(param).stream()
.map(
d -> {
return d.buildOrderInfoDTO();
})
.collect(Collectors.toList());
return PageResult.buildPage(pageNo, param.getPageSize(), count, data);
}
}
package com.mmc.pms.service;
import com.mmc.pms.model.dto.BaseAccountDTO;
import com.mmc.pms.model.qo.OrderInfoQO;
import com.mmc.pms.page.PageResult;
/**
* @Author small @Date 2023/5/25 9:44 @Version 1.0
*/
public interface RentalOrdersService {
PageResult listPcOrderInfo(OrderInfoQO param, BaseAccountDTO cuser);
PageResult listPageWechatOrder(BaseAccountDTO account, OrderInfoQO param);
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mmc.pms.dao.RentalOrdersDao">
<resultMap id="orderInfoResultMap"
type="com.mmc.pms.entity.OrderInfoDO">
<id property="id" column="id"/>
<result property="orderNo" column="order_no"/>
<result property="wareInfoId" column="ware_info_id"/>
<result property="wareNo" column="ware_no"/>
<result property="wareTitle" column="ware_title"/>
<result property="wareImg" column="ware_img"/>
<result property="skuInfoId" column="sku_info_id"/>
<result property="skuTitle" column="sku_title"/>
<result property="repoAccountId" column="repo_account_id"/>
<result property="uid" column="uid"/>
<result property="buyerName" column="buyer_name"/>
<result property="buyerPhone" column="buyer_phone"/>
<result property="unitPrice" column="unit_price"/>
<result property="wareNum" column="ware_num"/>
<result property="shouldPay" column="should_pay"/>
<result property="actualPay" column="actual_pay"/>
<result property="orderType" column="order_type"/>
<result property="deposit" column="deposit"/>
<result property="rentPrice" column="rent_price"/>
<result property="startDate" column="start_date"/>
<result property="endDate" column="end_date"/>
<result property="payDay" column="pay_day"/>
<result property="tranStatus" column="tran_status"/>
<result property="exWare" column="ex_ware"/>
<result property="remark" column="remark"/>
<result property="pfRemark" column="pf_remark"/>
<result property="shutReason" column="shut_reason"/>
<result property="payNo" column="pay_no"/>
<result property="payTime" column="pay_time"/>
<result property="sendWareTime" column="send_ware_time"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<result property="rcdCompanyId" column="rcd_company_id"/>
<association property="receipt"
javaType="com.mmc.pms.entity.OrderReceiptDO"
resultMap="orderReceiptResultMap"></association>
</resultMap>
<resultMap id="orderReceiptResultMap"
type="com.mmc.pms.entity.OrderReceiptDO">
<id property="id" column="id"/>
<result property="orderInfoId" column="order_info_id"/>
<result property="receiptMethod" column="receipt_method"/>
<result property="takeName" column="take_name"/>
<result property="takePhone" column="take_phone"/>
<result property="region" column="region"/>
<result property="detailAddress" column="detail_address"/>
<result property="repoName" column="repo_name"/>
<result property="repoAddress" column="repo_address"/>
<result property="bookPhone" column="book_phone"/>
<result property="sendExCode" column="send_ex_code"/>
<result property="sendExNo" column="send_ex_no"/>
<result property="sendAddress" column="send_address"/>
<result property="renMethod" column="ren_method"/>
<result property="renPhone" column="ren_phone"/>
<result property="renName" column="ren_name"/>
<result property="renExCode" column="ren_ex_code"/>
<result property="renExNo" column="ren_ex_no"/>
<result property="renAddress" column="ren_address"/>
<result property="renRepoName" column="ren_repo_name"/>
<result property="renRepoAddr" column="ren_repo_addr"/>
<result property="renRepoPhone" column="ren_repo_phone"/>
<result property="createTime" column="create_time"/>
<result property="exName" column="ex_name"/>
</resultMap>
<select id="countPcOrderInfo" resultType="java.lang.Integer" parameterType="com.mmc.pms.model.qo.OrderInfoQO">
select count(*)
from order_info o
<where>1=1
<if test=" keyword1 != null and keyword1 != '' ">
and (
o.uid like CONCAT('%',#{keyword1},'%')
or o.buyer_name like CONCAT('%',#{keyword1},'%')
)
</if>
<if test=" keyword2 != null and keyword2 != '' ">
and (
o.order_no like CONCAT('%',#{keyword2},'%')
)
</if>
<if test=" keyword3 != null and keyword3 != '' ">
and (
o.ware_no like CONCAT('%',#{keyword3},'%')
)
</if>
<if test=" keyword4 != null and keyword4 != '' ">
and (
o.ware_title like CONCAT('%',#{keyword4},'%')
)
</if>
<if test=" startTime != null and startTime != '' ">
and o.create_time &gt;= STR_TO_DATE(#{startTime},'%Y-%m-%d %H:%i:%s')
</if>
<if test=" endTime != null and endTime != '' ">
and o.create_time &lt;= STR_TO_DATE(#{endTime},'%Y-%m-%d %H:%i:%s')
</if>
<if test=" tranStatus != null and tranStatus != '' ">
and o.tran_status = #{tranStatus}
</if>
<if test=" userIds != null">
<foreach collection="userIds" item="id" open="and o.repo_account_id in (" close=")" separator=",">
#{id}
</foreach>
</if>
<if test=" companys != null ">
<foreach collection="companys" item="id" open="and o.rcd_company_id in (" close=")" separator=",">
#{id}
</foreach>
</if>
</where>
</select>
<select id="listPcOrderInfo" resultMap="orderInfoResultMap" parameterType="com.mmc.pms.model.qo.OrderInfoQO">
select o.id,o.order_no,o.ware_title,o.sku_title,o.ware_img,o.deposit,
o.unit_price,o.ware_num,o.buyer_name,o.buyer_phone,o.uid,o.remark,
o.tran_status,o.should_pay,o.actual_pay,o.pf_remark,o.create_time,o.ware_no,
rp.order_info_id,rp.receipt_method,rp.take_name,
rp.take_phone,rp.region,rp.detail_address,rp.repo_name,rp.repo_address,
rp.book_phone,rp.send_ex_code,rp.send_ex_no,rp.send_address,rp.ren_method,
rp.ren_phone,rp.ren_name,rp.ren_ex_code,rp.ren_ex_no,rp.ren_address,rp.ren_repo_name,
rp.ren_repo_addr,rp.ren_repo_phone
from order_info o
inner join order_receipt rp on rp.order_info_id=o.id
<where>1=1
<if test=" keyword1 != null and keyword1 != '' ">
and (
o.uid like CONCAT('%',#{keyword1},'%')
or o.buyer_name like CONCAT('%',#{keyword1},'%')
)
</if>
<if test=" keyword2 != null and keyword2 != '' ">
and (
o.order_no like CONCAT('%',#{keyword2},'%')
)
</if>
<if test=" keyword3 != null and keyword3 != '' ">
and (
o.ware_no like CONCAT('%',#{keyword3},'%')
)
</if>
<if test=" keyword4 != null and keyword4 != '' ">
and (
o.ware_title like CONCAT('%',#{keyword4},'%')
)
</if>
<if test=" startTime != null and startTime != '' ">
and o.create_time &gt;= STR_TO_DATE(#{startTime},'%Y-%m-%d %H:%i:%s')
</if>
<if test=" endTime != null and endTime != '' ">
and o.create_time &lt;= STR_TO_DATE(#{endTime},'%Y-%m-%d %H:%i:%s')
</if>
<if test=" tranStatus != null and tranStatus != '' ">
and o.tran_status = #{tranStatus}
</if>
<if test=" userIds != null">
<foreach collection="userIds" item="id" open="and o.repo_account_id in (" close=")" separator=",">
#{id}
</foreach>
</if>
<if test=" companys != null ">
<foreach collection="companys" item="id" open="and o.rcd_company_id in (" close=")" separator=",">
#{id}
</foreach>
</if>
</where>
order by o.create_time DESC
limit #{pageNo},#{pageSize}
</select>
<select id="countPageOrderInfo" resultType="java.lang.Integer" parameterType="com.mmc.pms.model.qo.OrderInfoQO">
select count(*)
from order_info o
<where>
o.repo_account_id = #{repoAccountId}
<if test=" tranStatus!=null and tranStatus!='' ">
and o.tran_status = #{tranStatus}
</if>
<if test=" keyword!=null and keyword!='' ">
and (
o.ware_title like CONCAT('%',#{keyword},'%')
or o.order_no like CONCAT('%',#{keyword},'%')
)
</if>
</where>
</select>
<select id="listPageOrderInfo" resultMap="orderInfoResultMap" parameterType="com.mmc.pms.model.qo.OrderInfoQO">
select o.id,o.order_no,o.ware_title,o.ware_img,o.sku_title,o.tran_status,
o.ware_num,o.should_pay,o.actual_pay,
rp.order_info_id,rp.receipt_method,rp.take_name,
rp.take_phone,rp.region,rp.detail_address,rp.repo_name,rp.repo_address,
rp.book_phone,rp.send_ex_code,rp.send_ex_no,rp.send_address,rp.ren_method,
rp.ren_phone,rp.ren_name,rp.ren_ex_code,rp.ren_ex_no,rp.ren_address,rp.ren_repo_name,
rp.ren_repo_addr,rp.ren_repo_phone
from order_info o
inner join order_receipt rp on rp.order_info_id=o.id
<where>
o.repo_account_id = #{repoAccountId}
<if test=" tranStatus!=null and tranStatus!='' ">
and o.tran_status = #{tranStatus}
</if>
<if test=" keyword!=null and keyword!='' ">
and (
o.ware_title like CONCAT('%',#{keyword},'%')
or o.order_no like CONCAT('%',#{keyword},'%')
)
</if>
</where>
order by o.create_time DESC
limit #{pageNo},#{pageSize}
</select>
</mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论