ltt преди 2 години
родител
ревизия
6b3a0883a9
променени са 16 файла, в които са добавени 1005 реда и са изтрити 4 реда
  1. 73 0
      sckw-modules/sckw-order/src/main/java/com/sckw/order/controller/KwpWantBuyController.java
  2. 11 0
      sckw-modules/sckw-order/src/main/java/com/sckw/order/dao/KwpWantBuyMapper.java
  3. 5 0
      sckw-modules/sckw-order/src/main/java/com/sckw/order/dao/KwpWantBuyTradingMapper.java
  4. 5 0
      sckw-modules/sckw-order/src/main/java/com/sckw/order/model/KwoWantBuy.java
  5. 78 0
      sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/req/UpdateWantBuyParam.java
  6. 23 0
      sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/req/WantBuyDels.java
  7. 59 0
      sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/req/WantBuySelectParam.java
  8. 30 0
      sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/res/TableTopRes.java
  9. 81 0
      sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/res/WantBuySelectRes.java
  10. 20 0
      sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/res/WantBuyTradingRes.java
  11. 22 0
      sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoWantBuyAddressService.java
  12. 33 0
      sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoWantBuyTradingService.java
  13. 386 2
      sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwpWantBuyService.java
  14. 2 2
      sckw-modules/sckw-order/src/main/resources/bootstrap-dev.yml
  15. 141 0
      sckw-modules/sckw-order/src/main/resources/mapper/KwoWantBuyMapper.xml
  16. 36 0
      sckw-modules/sckw-order/src/main/resources/mapper/KwoWantBuyTradingMapper.xml

+ 73 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/controller/KwpWantBuyController.java

@@ -3,12 +3,17 @@ package com.sckw.order.controller;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.order.model.vo.req.AddWantBuyParam;
 import com.sckw.order.model.vo.req.UpdateWantBuyParam;
+import com.sckw.order.model.vo.req.WantBuyDels;
+import com.sckw.order.model.vo.req.WantBuySelectParam;
 import com.sckw.order.serivce.KwpWantBuyService;
 import lombok.RequiredArgsConstructor;
 import org.springframework.http.MediaType;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.HashMap;
+import java.util.List;
+
 /**
  * @desc: 求购controller
  * @author: yzc
@@ -21,6 +26,26 @@ public class KwpWantBuyController {
 
     private final KwpWantBuyService kwpWantBuyService;
 
+    /**
+     * @desc: 求购分页查询
+     * @author lt
+     * @Date 15:34 2023/7/26 0026
+    **/
+    @PostMapping(value = "/select", produces = MediaType.APPLICATION_JSON_VALUE)
+    public HttpResult select(@RequestBody WantBuySelectParam wantBuySelectParam) {
+        return HttpResult.ok(kwpWantBuyService.select(wantBuySelectParam));
+    }
+
+    /**
+     * @desc: 求购大厅
+     * @author lt
+     * @Date 15:34 2023/7/26 0026
+    **/
+    @PostMapping(value = "/buyHallList", produces = MediaType.APPLICATION_JSON_VALUE)
+    public HttpResult buyHallList(@RequestBody WantBuySelectParam wantBuySelectParam) {
+        return HttpResult.ok(kwpWantBuyService.buyHallList(wantBuySelectParam));
+    }
+
     /**
      * @desc: 新增求购草稿
      * @author: yzc
@@ -47,6 +72,39 @@ public class KwpWantBuyController {
         return HttpResult.ok("新增求购上架成功");
     }
 
+    /**
+     * @desc: 求购上架
+     * @Author: lt
+     * @Date: 13:39 2023/7/25 0025
+    **/
+    @GetMapping(value = "/putOnShelves", produces = MediaType.APPLICATION_JSON_VALUE)
+    public HttpResult putOnShelves(@RequestParam Long id) {
+        kwpWantBuyService.putOnShelves(id);
+        return HttpResult.ok("求购上架成功");
+    }
+
+    /**
+     * @desc: 求购批量下架
+     * @Author: lt
+     * @Date: 13:39 2023/7/25 0025
+    **/
+    @PostMapping(value = "/batchTakeOffShelves", produces = MediaType.APPLICATION_JSON_VALUE)
+    public HttpResult batchTakeOffShelves(@RequestBody WantBuyDels ids) {
+        kwpWantBuyService.batchTakeOffShelves(ids);
+        return HttpResult.ok("批量下架成功");
+    }
+
+    /**
+     * @desc: 求购批量删除
+     * @Author: lt
+     * @Date: 13:39 2023/7/25 0025
+    **/
+    @PostMapping(value = "/dels", produces = MediaType.APPLICATION_JSON_VALUE)
+    public HttpResult dels(@RequestBody WantBuyDels ids) {
+        kwpWantBuyService.dels(ids);
+        return HttpResult.ok("批量删除成功");
+    }
+
     /**
      * @desc: 求购详情
      * @author: yzc
@@ -59,10 +117,25 @@ public class KwpWantBuyController {
         return HttpResult.ok(kwpWantBuyService.detail(id));
     }
 
+    /**
+     * @desc: 求购编辑
+     * @author lt
+     * @Date 15:22 2023/7/26 0026
+    **/
     @PostMapping(value = "/update", produces = MediaType.APPLICATION_JSON_VALUE)
     public HttpResult update(@RequestBody @Validated UpdateWantBuyParam updateWantBuyParam) {
         kwpWantBuyService.update(updateWantBuyParam);
         return HttpResult.ok("求购修改成功!");
     }
 
+    /**
+     * @desc 求购角标统计
+     * @author lt
+     * @Date 15:23 2023/7/26 0026
+    **/
+    @PostMapping(value = "/statistic", produces = MediaType.APPLICATION_JSON_VALUE)
+    public HttpResult statistic(@RequestBody WantBuySelectParam params)
+    {
+        return HttpResult.ok(kwpWantBuyService.statistic(params));
+    }
 }

+ 11 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/dao/KwpWantBuyMapper.java

@@ -2,7 +2,13 @@ package com.sckw.order.dao;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.sckw.order.model.KwoWantBuy;
+import com.sckw.order.model.vo.req.WantBuySelectParam;
+import com.sckw.order.model.vo.res.TableTopRes;
+import com.sckw.order.model.vo.res.WantBuySelectRes;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * @desc: 求购mapper
@@ -12,4 +18,9 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 public interface KwpWantBuyMapper extends BaseMapper<KwoWantBuy> {
 
+    List<WantBuySelectRes> queryBuyHallList(@Param("wantBuyReq") WantBuySelectParam wantBuyReq);
+
+    List<WantBuySelectRes> pageSelect(@Param("wantBuyReq") WantBuySelectParam wantBuyReq);
+
+    List<TableTopRes> statisticsCount(@Param("wantBuyReq") WantBuySelectParam wantBuyReq);
 }

+ 5 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/dao/KwpWantBuyTradingMapper.java

@@ -3,6 +3,9 @@ package com.sckw.order.dao;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.sckw.order.model.KwoWantBuyTrading;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * @desc: 求购支付方式mapper
@@ -12,4 +15,6 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 public interface KwpWantBuyTradingMapper extends BaseMapper<KwoWantBuyTrading> {
 
+    void insertBatch(@Param(value = "list") List<KwoWantBuyTrading> list);
+
 }

+ 5 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/KwoWantBuy.java

@@ -29,6 +29,11 @@ public class KwoWantBuy extends BaseModel implements Serializable {
      */
     private Long entId;
 
+    /**
+     * 企业名称
+     */
+    private String entName;
+
     /**
      * 商品名称
      */

+ 78 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/req/UpdateWantBuyParam.java

@@ -1,8 +1,15 @@
 package com.sckw.order.model.vo.req;
 
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Pattern;
 import lombok.Getter;
 import lombok.Setter;
 import lombok.ToString;
+import org.hibernate.validator.constraints.Length;
+
+import java.util.List;
 
 /**
  * @desc: 修改求购请求参数
@@ -13,4 +20,75 @@ import lombok.ToString;
 @Setter
 @ToString
 public class UpdateWantBuyParam {
+
+    /**
+     * 求购单id
+     */
+    @NotNull(message = "求购单id不能为空")
+    private Long id;
+
+    /**
+     * 商品名称
+     */
+    @NotBlank(message = "商品名称不能为空")
+    @Length(max = 50, message = "商品名称最多支持50字")
+    private String name;
+
+    /**
+     * 商品分类
+     */
+    @Length(max = 32, message = "商品分类最多支持32字")
+    private String goodsType;
+
+    /**
+     * 商品规格
+     */
+    @Length(max = 20, message = "商品规格最多支持20字")
+    private String spec;
+
+    /**
+     * 支付方式集合
+     */
+    private List<String> tradings;
+
+    /**
+     * 求购单价
+     */
+    @NotBlank(message = "求购单价不能为空")
+    @Length(max = 20, message = "求购单价最多支持20字")
+    private String price;
+
+    /**
+     * 求购总量
+     */
+    @NotBlank(message = "求购总量不能为空")
+    @Length(max = 20, message = "求购总量最多支持20字")
+    private String amount;
+
+    /**
+     * 联系人姓名
+     */
+    @NotBlank(message = "联系人姓名不能为空")
+    @Length(max = 32, message = "联系人姓名最多支持32字")
+    private String contacts;
+
+    /**
+     * 联系电话
+     */
+    @NotBlank(message = "联系电话不能为空")
+    @Pattern(regexp = "^1[3456789]\\d{9}$", message = "非法手机号格式")
+    private String phone;
+
+    /**
+     * 地址信息
+     */
+    @Valid
+    private WantBuyAddressParam addressInfo;
+
+    @Length(max = 200, message = "备注最多支持200字")
+    private String remark;
+
+
+
+
 }

+ 23 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/req/WantBuyDels.java

@@ -0,0 +1,23 @@
+package com.sckw.order.model.vo.req;
+
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotEmpty;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.sckw.core.utils.LongToStringUtils;
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author: lt
+ * @Date: 2023-07-25-15:10
+ */
+@Getter
+@Setter
+@ToString
+public class WantBuyDels {
+    @NotBlank(message = "ids不能为空")
+    private String ids;
+}

+ 59 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/req/WantBuySelectParam.java

@@ -0,0 +1,59 @@
+package com.sckw.order.model.vo.req;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.sckw.core.model.page.PageRequest;
+import jakarta.validation.constraints.NotNull;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serial;
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author: lt
+ * @Date: 2023-07-26-15:43
+ */
+@Getter
+@Setter
+public class WantBuySelectParam extends PageRequest {
+
+    @Serial
+    private static final long serialVersionUID = 1881051859375157819L;
+
+    /**
+     * 关键字搜索
+     */
+    private String keywords;
+
+    /**
+     * 状态 来自com.sckw.core.common.enums.enums.DictEnum.GOODS_STATUS_0
+     */
+    private String status;
+    /**
+     * (雷总说的集合都用字符串)页面搜索筛选的时候专用
+     */
+    private List<String> statuss;
+
+    /**
+     * 支付集合字符串
+     */
+    private String trading;
+    /**
+     * 字符串转集合进行筛选
+     */
+    private List<Long> tradings;
+
+    private String areaCode;
+    private String areaLevel;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @NotNull(message = "生成开始时间不能为空")
+    private LocalDateTime startCreateTime;
+    @NotNull(message = "生成结束时间不能为空")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private LocalDateTime endCreateTime;
+
+
+}

+ 30 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/res/TableTopRes.java

@@ -0,0 +1,30 @@
+package com.sckw.order.model.vo.res;
+
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+/**
+ * @Description:
+ * @Author: lt
+ * @Date: 2023-07-27-10:57
+ */
+@Getter
+@Setter
+@ToString
+public class TableTopRes {
+    /**
+     * tab名称
+     */
+    private String name;
+
+    /**
+     * 状态值
+     */
+    private String value;
+
+    /**
+     * 统计值
+     */
+    private long total;
+}

+ 81 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/res/WantBuySelectRes.java

@@ -0,0 +1,81 @@
+package com.sckw.order.model.vo.res;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.sckw.order.model.KwoWantBuyTrading;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author: lt
+ * @Date: 2023-07-26-15:48
+ */
+@Getter
+@Setter
+public class WantBuySelectRes {
+
+    private Long id;
+
+    /**
+     * 商品名称
+     */
+    private String name;
+
+
+    private String entName;
+
+    /**
+     * 商品分类
+     */
+    private String goodsType;
+
+    /**
+     * 规格
+     */
+    private String spec;
+
+    /**
+     * 支付方式
+     */
+    private String tradings;
+
+    /**
+     * 求购单价
+     */
+    private String price;
+
+    /**
+     * 求购总量
+     */
+    private String amount;
+
+    /**
+     * 常见时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" ,timezone = "GMT+8")
+    private Date createTime;
+    /**
+     * 更新时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" ,timezone = "GMT+8")
+    private Date updateTime;
+
+    /**
+     * 状态
+     */
+    private Integer status;
+    private String statusLabel;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    //private List<KwoWantBuyTrading> wantBuyTradings;
+    private List<WantBuyTradingRes> wantBuyTradings;
+
+
+}

+ 20 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/model/vo/res/WantBuyTradingRes.java

@@ -0,0 +1,20 @@
+package com.sckw.order.model.vo.res;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @Description:
+ * @Author: lt
+ * @Date: 2023-07-26-20:26
+ */
+@Getter
+@Setter
+public class WantBuyTradingRes {
+
+    private Long wantBuyId;
+
+    private String trading;
+
+
+}

+ 22 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoWantBuyAddressService.java

@@ -1,10 +1,18 @@
 package com.sckw.order.serivce;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.sckw.core.model.constant.Global;
+import com.sckw.core.utils.CollectionUtils;
 import com.sckw.order.dao.KwpWantBuyAddressMapper;
+import com.sckw.order.model.KwoTradeOrderAddress;
+import com.sckw.order.model.KwoWantBuyAddress;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * @desc: 求购地址信息service
  * @author: yzc
@@ -17,4 +25,18 @@ public class KwoWantBuyAddressService {
 
     private final KwpWantBuyAddressMapper kwpWantBuyAddress;
 
+    public List<KwoWantBuyAddress> getByAddressId(Long addressId) {
+        LambdaQueryWrapper<KwoWantBuyAddress> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(KwoWantBuyAddress::getWantBuyId, addressId).eq(KwoWantBuyAddress::getDelFlag, Global.NO);
+        List<KwoWantBuyAddress> list = kwpWantBuyAddress.selectList(wrapper);
+        return CollectionUtils.emptyIfNull(list);
+    }
+
+    public void delAddressByWantBuyIds(List<String> wantBuyIds) {
+        LambdaUpdateWrapper<KwoWantBuyAddress> wrapper = new LambdaUpdateWrapper<>();
+        wrapper.in(KwoWantBuyAddress::getWantBuyId, wantBuyIds).eq(KwoWantBuyAddress::getDelFlag, Global.NO)
+                        .set(KwoWantBuyAddress::getDelFlag, Global.YES);
+        kwpWantBuyAddress.update(null,wrapper);
+    }
+
 }

+ 33 - 0
sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwoWantBuyTradingService.java

@@ -1,10 +1,17 @@
 package com.sckw.order.serivce;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.sckw.core.model.constant.Global;
 import com.sckw.order.dao.KwpWantBuyTradingMapper;
+import com.sckw.order.model.KwoTradeOrderAddress;
+import com.sckw.order.model.KwoWantBuyTrading;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * @desc: 求购支付service
  * @author: yzc
@@ -17,6 +24,32 @@ public class KwoWantBuyTradingService {
 
     private final KwpWantBuyTradingMapper kwpWantBuyTradingMapper;
 
+    public void insertBatch(List<KwoWantBuyTrading> list) {
+        kwpWantBuyTradingMapper.insertBatch(list);
+    }
+
+    public List<KwoWantBuyTrading> getByWantBuyId(Long wantBuyId) {
+        LambdaQueryWrapper<KwoWantBuyTrading> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(KwoWantBuyTrading::getWantBuyId, wantBuyId).eq(KwoWantBuyTrading::getDelFlag, Global.NO);
+        List<KwoWantBuyTrading> list = kwpWantBuyTradingMapper.selectList(wrapper);
+        return list;
+    }
+
+    //根据wangtBuyId删除
+    public Integer deleteByWantBuyid(Long wantBuyid){
+        LambdaUpdateWrapper<KwoWantBuyTrading> wrapper = new LambdaUpdateWrapper<>();
+        wrapper.eq(KwoWantBuyTrading::getWantBuyId, wantBuyid).set(KwoWantBuyTrading::getDelFlag, Global.YES);
+        return kwpWantBuyTradingMapper.update(null,wrapper);
+    }
+
+    //根据wangtBuyIds批量删除
+    public void delTradingByWantBuyids(List<String> ids)
+    {
+        LambdaUpdateWrapper<KwoWantBuyTrading> wrapper = new LambdaUpdateWrapper<>();
+        wrapper.in(KwoWantBuyTrading::getWantBuyId, ids).eq(KwoWantBuyTrading::getDelFlag, Global.NO).set(KwoWantBuyTrading::getDelFlag, Global.YES);
+        kwpWantBuyTradingMapper.update(null,wrapper);
+    }
+
 
 
 }

+ 386 - 2
sckw-modules/sckw-order/src/main/java/com/sckw/order/serivce/KwpWantBuyService.java

@@ -1,12 +1,35 @@
 package com.sckw.order.serivce;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.sckw.core.common.enums.enums.DictEnum;
+import com.sckw.core.common.enums.enums.DictTypeEnum;
+import com.sckw.core.exception.BusinessException;
+import com.sckw.core.model.constant.Global;
+import com.sckw.core.model.page.PageRes;
+import com.sckw.core.utils.BeanUtils;
+import com.sckw.core.utils.CollectionUtils;
+import com.sckw.core.utils.IdWorker;
+import com.sckw.core.utils.StringUtils;
+import com.sckw.core.web.context.LoginUserHolder;
+import com.sckw.order.dao.KwpWantBuyAddressMapper;
 import com.sckw.order.dao.KwpWantBuyMapper;
+import com.sckw.order.dao.KwpWantBuyTradingMapper;
+import com.sckw.order.model.*;
 import com.sckw.order.model.vo.req.AddWantBuyParam;
 import com.sckw.order.model.vo.req.UpdateWantBuyParam;
-import com.sckw.order.model.vo.res.WantBuyDetailRes;
+import com.sckw.order.model.vo.req.WantBuyDels;
+import com.sckw.order.model.vo.req.WantBuySelectParam;
+import com.sckw.order.model.vo.res.*;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * @desc: 求购service
@@ -19,23 +42,384 @@ import org.springframework.stereotype.Service;
 public class KwpWantBuyService {
 
     private final KwpWantBuyMapper kwpWantBuyMapper;
+
+    private final KwpWantBuyTradingMapper kwpWantBuyTradingMapper;
+    private final KwpWantBuyAddressMapper kwpWantBuyAddressMapper;
     private final KwoWantBuyAddressService kwoWantBuyAddressService;
     private final KwoWantBuyTradingService kwoWantBuyTradingService;
 
+    public PageRes<WantBuySelectRes> buyHallList(WantBuySelectParam wantBuySelectParam){
+        //如果有求购方式的查询条件,需要先查询出求购方式的id
+        if (StringUtils.isNotBlank(wantBuySelectParam.getTrading())) {
+            List<Long> longs = setWantBuyTradings(wantBuySelectParam);
+            wantBuySelectParam.setTradings(longs);
+        }
+        List<WantBuySelectRes> wantBuyDto = kwpWantBuyMapper.queryBuyHallList(wantBuySelectParam);
+        if (CollectionUtils.isEmpty(wantBuyDto)) {
+            return new PageRes<>();
+        }
+        wantBuyDto.forEach(wantBuySelectRes -> {
+            List<String> tradings = wantBuySelectRes.getWantBuyTradings().stream()
+                    .map(wantBuyTradingRes -> DictEnum.getLabel(DictTypeEnum.TRADE_TYPE.getType(), wantBuyTradingRes.getTrading()))
+                    .collect(Collectors.toList());
+            String tradingsString = String.join(Global.COMMA, tradings);
+            wantBuySelectRes.setTradings(tradingsString);
+
+            String statusLabel = DictEnum.getLabel(DictTypeEnum.GOODS_STATUS.getType(), String.valueOf(wantBuySelectRes.getStatus()));
+            wantBuySelectRes.setStatusLabel(statusLabel);
+        });
+        return new PageRes<>(new PageInfo<>(wantBuyDto));
+    }
+
+    public PageRes<WantBuySelectRes> select(WantBuySelectParam wantBuySelectParam) {
+        if (StringUtils.isNotBlank(wantBuySelectParam.getTrading())) {
+            List<Long> longs = setWantBuyTradings(wantBuySelectParam);
+            wantBuySelectParam.setTradings(longs);
+        }
+        if (StringUtils.isNotBlank(wantBuySelectParam.getStatus())) {
+            List<String> stringList = Arrays.asList(wantBuySelectParam.getStatus().split(","));
+            wantBuySelectParam.setStatuss(stringList);
+        }
+        PageHelper.startPage(wantBuySelectParam.getPage(), wantBuySelectParam.getPageSize());
+        List<WantBuySelectRes> wantBuyDto = kwpWantBuyMapper.pageSelect(wantBuySelectParam);
+        if (CollectionUtils.isEmpty(wantBuyDto)) {
+            return new PageRes<>();
+        }
+        //把查询出来的集合wantBuyTradings里面对的tranding 转成字符串放在String里面
+        wantBuyDto.forEach(wantBuySelectRes -> {
+            List<String> tradings = wantBuySelectRes.getWantBuyTradings().stream()
+                    .map(wantBuyTradingRes -> DictEnum.getLabel(DictTypeEnum.TRADE_TYPE.getType(), wantBuyTradingRes.getTrading()))
+                    .collect(Collectors.toList());
+            String tradingsString = String.join(Global.COMMA, tradings);
+            wantBuySelectRes.setTradings(tradingsString);
+
+            String statusLabel = DictEnum.getLabel(DictTypeEnum.GOODS_STATUS.getType(), String.valueOf(wantBuySelectRes.getStatus()));
+            wantBuySelectRes.setStatusLabel(statusLabel);
+        });
+
+        return new PageRes<>(new PageInfo<>(wantBuyDto));
+    }
+
+    private List<Long> setWantBuyTradings(WantBuySelectParam wantBuySelectParam) {
+        List<String> stringList = Arrays.asList(wantBuySelectParam.getTrading().split(","));
+        LambdaQueryWrapper<KwoWantBuyTrading> wrapper = new LambdaQueryWrapper<>();
+        wrapper.in(KwoWantBuyTrading::getTrading, stringList);
+        List<KwoWantBuyTrading> wantBuyTradings = kwpWantBuyTradingMapper.selectList(wrapper);
+        //从上面的集合拿出所有tranding循环拼接成一个List<String>集合
+        return wantBuyTradings.stream().map(KwoWantBuyTrading::getWantBuyId).distinct().collect(Collectors.toList());
 
+    }
+
+
+    /**
+     * @Desc 求购草稿新增
+     * @Author lt
+     * @Param
+     * @Return
+     * @Date 11:56 2023/7/25 0025
+     **/
     public void addDraft(AddWantBuyParam param) {
+        Integer status = Integer.valueOf(DictEnum.GOODS_STATUS_0.getValue());  //保存草稿
+        String message = "求购草稿";
+        addWantBuy(param, message, status);
 
     }
 
+
+    /**
+     * @Desc 求购上架新增
+     * @Author lt
+     * @Param
+     * @Return
+     * @Date 11:57 2023/7/25 0025
+     **/
     public void addShelves(AddWantBuyParam param) {
+        Integer status = Integer.valueOf(DictEnum.GOODS_STATUS_1.getValue());   //上架
+        String message = "求购上架";
+        addWantBuy(param, message, status);
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    public void addWantBuy(AddWantBuyParam param, String message, Integer status) {
+        Date currentDate = new Date();
+        Long entId = LoginUserHolder.getEntId();
+        if (Objects.isNull(entId)) {
+            throw new BusinessException("企业ID不存在,请重新登录");
+        }
+//        KwoWantBuy kwoWantBuy = BeanUtils.copyProperties(param, KwoWantBuy.class);
+        KwoWantBuy kwoWantBuy = new KwoWantBuy();
+        Long userId = LoginUserHolder.getUserId();
+        kwoWantBuy.setEntId(LoginUserHolder.getEntId()).setEntName(LoginUserHolder.getEntName())
+                .setName(param.getName()).setGoodsType(param.getGoodsType())
+                .setSpec(param.getSpec()).setPrice(param.getPrice())
+                .setAmount(param.getAmount()).setContacts(param.getContacts())
+                .setPhone(param.getPhone()).setId(new IdWorker(1L).nextId())
+                .setRemark(param.getRemark()).setStatus(status).setCreateBy(userId)
+                .setCreateTime(currentDate).setUpdateBy(userId)
+                .setUpdateTime(currentDate).setDelFlag(Global.NO);
+
+
+        kwpWantBuyMapper.insert(kwoWantBuy);
+        if (Objects.isNull(kwoWantBuy.getId())) {
+            throw new BusinessException(message + "失败");
+        }
+        /*
+        支付方式添加
+         */
+        List<String> list = param.getTradings();
+        if (list != null && !list.isEmpty()) {
+            Date currentDateTime = new Date();
+            List<KwoWantBuyTrading> tradingList = list.stream()
+                    .map(item -> {
+                        KwoWantBuyTrading kwoWantBuyTrading = new KwoWantBuyTrading();
+                        kwoWantBuyTrading.setWantBuyId(kwoWantBuy.getId());
+                        kwoWantBuyTrading.setTrading(item);
+                        kwoWantBuyTrading.setCreateBy(userId);
+                        kwoWantBuyTrading.setCreateTime(currentDateTime);
+                        kwoWantBuyTrading.setUpdateTime(currentDateTime);
+                        kwoWantBuyTrading.setStatus(status);
+                        return kwoWantBuyTrading;
+                    })
+                    .collect(Collectors.toList());
+            kwoWantBuyTradingService.insertBatch(tradingList);
+        }
+        /*
+        地址信息添加,如果存在地址信息-新增入库
+         */
+        if (Objects.nonNull(param.getAddressInfo())) {
+            KwoWantBuyAddress address = new KwoWantBuyAddress();
+            Long idWorker = new IdWorker(1L).nextId();
+            address.setWantBuyId(kwoWantBuy.getId());
+            address.setName(param.getAddressInfo().getName());
+            address.setType(param.getAddressInfo().getType());
+            address.setContacts(param.getAddressInfo().getContacts());
+            address.setPhone(param.getAddressInfo().getPhone());
+            address.setCityCode(param.getAddressInfo().getCityCode());
+            address.setCityName(param.getAddressInfo().getCityName());
+            address.setDetailAddress(param.getAddressInfo().getDetailAddress());
+            address.setLat(param.getAddressInfo().getLat());
+            address.setLng(param.getAddressInfo().getLng());
+            address.setFence(param.getAddressInfo().getFence());
+            address.setId(idWorker);
+            address.setCreateBy(LoginUserHolder.getUserId());
+            address.setCreateTime(new Date());
+            address.setUpdateTime(new Date());
+            kwpWantBuyAddressMapper.insert(address);
+        }
+    }
+
+    /**
+     * @Desc: 求购上架
+     * @Author: lt
+     * @Date: 13:38 2023/7/25 0025
+     **/
+    public void putOnShelves(Long id) {
+        KwoWantBuy kwoWantBuy = kwpWantBuyMapper.selectById(id);
+        if (Objects.isNull(kwoWantBuy)) {
+            throw new BusinessException("求购信息不存在");
+        }
+        if (kwoWantBuy.getStatus().equals(Integer.valueOf(DictEnum.GOODS_STATUS_1.getValue()))) {
+            throw new BusinessException("求购信息已上架");
+        }
+        kwoWantBuy.setStatus(Integer.valueOf(DictEnum.GOODS_STATUS_1.getValue()));
+        kwpWantBuyMapper.updateById(kwoWantBuy);
+    }
+
+    /**
+     * @desc 求购批量下架
+     * @author lt
+     * @Date 14:56 2023/7/25 0025
+     **/
+    public void batchTakeOffShelves(WantBuyDels param) {
+        if (BeanUtils.isEmpty(param)) throw new BusinessException("请提供需要下架的产品");
+        List<String> ids = List.of(param.getIds().split(","));
+        //1.查询ids所属产品只有status=1的才能下架,如果存在其它状态的则不能下架
+        LambdaUpdateWrapper<KwoWantBuy> updateWrapper = new LambdaUpdateWrapper<>();
+        updateWrapper.eq(KwoWantBuy::getDelFlag, Global.NO).in(KwoWantBuy::getId, ids);
+        updateWrapper.set(KwoWantBuy::getStatus, DictEnum.GOODS_STATUS_2.getValue())
+                .set(KwoWantBuy::getUpdateBy, LoginUserHolder.getUserId())
+                .set(KwoWantBuy::getUpdateTime, new Date());
+        kwpWantBuyMapper.update(null, updateWrapper);
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    public void dels(WantBuyDels param) {
+        List<String> ids = List.of(param.getIds().split(","));
+        LambdaUpdateWrapper<KwoWantBuy> updateWrapper = new LambdaUpdateWrapper<>();
+        updateWrapper.in(KwoWantBuy::getId, ids).eq(KwoWantBuy::getDelFlag, Global.NO)
+                .set(KwoWantBuy::getDelFlag, Global.YES)
+                .set(KwoWantBuy::getUpdateBy, LoginUserHolder.getUserId())
+                .set(KwoWantBuy::getUpdateTime, new Date());
+        kwpWantBuyMapper.update(null, updateWrapper);
+        //删除地址信息
+        kwoWantBuyAddressService.delAddressByWantBuyIds(ids);
+        //删除支付方式
+        kwoWantBuyTradingService.delTradingByWantBuyids(ids);
 
     }
 
     public WantBuyDetailRes detail(Long id) {
-        return null;
+        //先判断求购订单是否存在
+        KwoWantBuy kwoWantBuy = kwpWantBuyMapper.selectById(id);
+        if (Objects.isNull(kwoWantBuy)) {
+            throw new BusinessException("求购信息不存在");
+        }
+        WantBuyDetailRes responseData = BeanUtils.copyProperties(kwoWantBuy, WantBuyDetailRes.class);
+        //TODO 还未定义好求购状态(从表里面拿还是enum)
+        responseData.setStatusLabel(DictEnum.getLabel(DictTypeEnum.GOODS_STATUS.getType(), String.valueOf(responseData.getStatus())));
+        //求购地址信息
+        KwoWantBuyAddress address = kwpWantBuyAddressMapper.selectOne(new LambdaQueryWrapper<KwoWantBuyAddress>()
+                .eq(KwoWantBuyAddress::getWantBuyId, id).eq(KwoWantBuyAddress::getDelFlag, Global.NO));
+        if (Objects.nonNull(address)) {
+            WantBuyAddressDetailRes wantBuyAddressInfo = BeanUtils.copyProperties(address, WantBuyAddressDetailRes.class);
+            wantBuyAddressInfo.setTypeLabel(DictEnum.getLabel(DictTypeEnum.TORDER_ADDRESS_TYPE.getType(), String.valueOf(wantBuyAddressInfo.getType())));
+            System.out.println(wantBuyAddressInfo);
+            responseData.setAddressInfo(wantBuyAddressInfo);
+        }
+        //求购支付方式集合
+        List<KwoWantBuyTrading> tradingList = kwoWantBuyTradingService.getByWantBuyId(id);
+        if (Objects.nonNull(tradingList) && !tradingList.isEmpty()) {
+            List<String> tradings = tradingList.stream().map(KwoWantBuyTrading::getTrading).collect(Collectors.toList());
+            responseData.setTradings(tradings);
+//            ArrayList<String> objects = new ArrayList<>();
+//            for (String trading : tradings) {
+//                objects.add(DictEnum.getLabel(DictTypeEnum.TRADE_TYPE.getType(),trading));
+//            }
+            //改成stream流的方式
+            List<String> result = tradings.stream()
+                    .map(trading -> DictEnum.getLabel(DictTypeEnum.TRADE_TYPE.getType(), trading))
+                    .collect(Collectors.toList());
+            String tradingLabels = String.join(",", result);
+            //获取到的是一个集合,需要转换成字符串
+            responseData.setTradingLabels(tradingLabels);
+        }
+        return responseData;
     }
 
+    /**
+     * @desc: 更新求购信息
+     * @author lt
+     * @Date 15:20 2023/7/26 0026
+     **/
     public void update(UpdateWantBuyParam param) {
+        Long id = param.getId();
+        KwoWantBuy kwoWantBuy = selectOneById(id);
+        if (Objects.isNull(kwoWantBuy)) throw new BusinessException("求购信息不存在");
+        //1.更新求购信息
+        Date currentDate = new Date();
+        Long userId = LoginUserHolder.getUserId();
+        KwoWantBuy wantBuy = BeanUtils.copyProperties(param, KwoWantBuy.class);
+        wantBuy.setUpdateBy(userId);
+        wantBuy.setUpdateTime(currentDate);
+        kwpWantBuyMapper.updateById(wantBuy);
+        //int i = kwpWantBuyMapper.updateById(wantBuy);
+        //2.更新求购地址信息,判断是否存在地址信息
+
+        if (Objects.nonNull(param.getAddressInfo())) {
+            //判断是否存在地址信息
+            LambdaQueryWrapper<KwoWantBuyAddress> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(KwoWantBuyAddress::getWantBuyId, id).eq(KwoWantBuyAddress::getDelFlag, Global.NO);
+            KwoWantBuyAddress kwoWantBuyAddress = kwpWantBuyAddressMapper.selectOne(queryWrapper);
+            //存在地址信息则更新,不存在则新增
+
+            KwoWantBuyAddress kwoWantBuyAddress1 = BeanUtils.copyProperties(param.getAddressInfo(), KwoWantBuyAddress.class);
+            kwoWantBuyAddress1.setUpdateTime(currentDate);
+            kwoWantBuyAddress1.setUpdateBy(userId);
+            if (Objects.nonNull(kwoWantBuyAddress)) {
+                kwoWantBuyAddress1.setId(kwoWantBuyAddress.getId());
+                kwpWantBuyAddressMapper.updateById(kwoWantBuyAddress1);
+            } else {
+                //不存在则新增地址信息
+                kwoWantBuyAddress1.setWantBuyId(id);
+                kwoWantBuyAddress1.setCreateTime(currentDate);
+                kwoWantBuyAddress1.setCreateBy(userId);
+                kwpWantBuyAddressMapper.insert(kwoWantBuyAddress1);
+            }
+        }
+        //3.更新求购支付方式
+        List<String> tradings = param.getTradings();
+        if (CollectionUtils.isNotEmpty(tradings)) {
+            kwoWantBuyTradingService.deleteByWantBuyid(id);
+            ArrayList<KwoWantBuyTrading> list = new ArrayList<>(param.getTradings().size());
+            for (String trading : tradings) {
+                KwoWantBuyTrading kwoWantBuyTrading = new KwoWantBuyTrading();
+                kwoWantBuyTrading.setWantBuyId(id);
+                kwoWantBuyTrading.setTrading(trading);
+                kwoWantBuyTrading.setCreateTime(currentDate);
+                kwoWantBuyTrading.setUpdateTime(currentDate);
+                kwoWantBuyTrading.setCreateBy(userId);
+                list.add(kwoWantBuyTrading);
+            }
+            kwpWantBuyTradingMapper.insertBatch(list);
+        }
+
+
+    }
+
+
+    /**
+     * @param id
+     * @return
+     * @Desc: 根据id查询求购信息
+     */
+    public KwoWantBuy selectOneById(Long id) {
+        LambdaQueryWrapper<KwoWantBuy> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(KwoWantBuy::getId, id)
+                .eq(KwoWantBuy::getDelFlag, Global.NO);
+        return kwpWantBuyMapper.selectOne(queryWrapper);
+    }
+
+    /**
+     * @param
+     * @return
+     * @Desc: 查询求购角标统计数量
+     */
+    public Map statistic(WantBuySelectParam params) {
+        if (StringUtils.isNotBlank(params.getTrading())) {
+            List<Long> longs = setWantBuyTradings(params);
+            params.setTradings(longs);
+        }
+        if (StringUtils.isNotBlank(params.getStatus())) {
+            List<String> stringList = Arrays.asList(params.getStatus().split(","));
+            params.setStatuss(stringList);
+        }
+        /**统计数据**/
+        List<TableTopRes> counts = kwpWantBuyMapper.statisticsCount(params);
+        long tatol = counts.size();
+        System.out.println(counts);
+
+        /**全部数据-处理**/
+        List<TableTopRes> countList = new ArrayList();
+        TableTopRes allCount = new TableTopRes();
+//        allCount.setValue(String.valueOf(DictEnum.GOODS_STATUS_0));
+        allCount.setTotal(tatol);
+        allCount.setName("全部");
+        countList.add(allCount);
+
+        /**数据处理**/
+        Map<String, Integer> statusMap = new HashMap<>();
+        statusMap.put("保存", Integer.valueOf(DictEnum.GOODS_STATUS_0.getValue()));
+        statusMap.put("下架", Integer.valueOf(DictEnum.GOODS_STATUS_2.getValue()));
+        statusMap.put("上架", Integer.valueOf(DictEnum.GOODS_STATUS_1.getValue()));
+        for (Map.Entry<String, Integer> entry : statusMap.entrySet()) {
+            System.out.println(entry.getKey() + "--->" + entry.getValue());
+            TableTopRes count = new TableTopRes();
+            int smlTotal = 0;
+            for (TableTopRes topCount : counts) {
+                if (topCount.getValue() != null && !topCount.getValue().isEmpty() && Integer.parseInt(topCount.getValue()) == entry.getValue()) {
+                    smlTotal++;
+                }
+            }
+            count.setName(entry.getKey());
+            count.setValue(String.valueOf(entry.getValue()));
+            count.setTotal(smlTotal);
+            countList.add(count);
+        }
 
+        /**数据组装**/
+        Map tableCount = new HashMap();
+        tableCount.put("tableTop", countList);
+        tableCount.put("tableBottom", tatol);
+        return tableCount;
     }
 }

+ 2 - 2
sckw-modules/sckw-order/src/main/resources/bootstrap-dev.yml

@@ -5,7 +5,7 @@ spring:
         # 服务注册地址
         server-addr: 10.10.10.230:8848
         # 命名空间
-        namespace: sckw-service-platform-dev
+        namespace: sckw-lt
         # 共享配置
         group: sckw-service-platform
       config:
@@ -14,7 +14,7 @@ spring:
         # 配置文件格式
         file-extension: yaml
         # 命名空间
-        namespace: sckw-service-platform-dev
+        namespace: sckw-lt
         # 共享配置
         group: sckw-service-platform
         #可以读多个配置文件  需要在同一个命名空间下面可以是不同的组

+ 141 - 0
sckw-modules/sckw-order/src/main/resources/mapper/KwoWantBuyMapper.xml

@@ -0,0 +1,141 @@
+<?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.sckw.order.dao.KwpWantBuyMapper">
+
+    <resultMap id="wangBuyResultMap" type="com.sckw.order.model.vo.res.WantBuySelectRes">
+        <id column="id" property="id"/>
+        <result column="name" property="name"/>
+        <result column="entName" property="entName"/>
+        <result column="goodsType" property="goodsType"/>
+        <result column="spec" property="spec"/>
+        <result column="price" property="price"/>
+        <result column="amount" property="amount"/>
+        <result column="status" property="status"/>
+        <result column="remark" property="remark"/>
+        <result column="createTime" property="createTime"/>
+        <result column="updateTime" property="updateTime"/>
+        <collection property="wantBuyTradings" column="id" ofType="com.sckw.order.model.vo.res.WantBuyTradingRes" javaType="java.util.List" select="tradingSql" >
+            <id column="wantBuyId" property="wantBuyId"/>
+            <result column="trading" property="trading"/>
+        </collection>
+    </resultMap>
+
+    <select id="pageSelect" resultMap="wangBuyResultMap" resultType="com.sckw.order.model.vo.res.WantBuySelectRes">
+        select id
+        ,`name`
+        ,goods_type goodsType
+        , spec
+        , price
+        , amount
+        , status
+        , remark
+        , create_time createTime
+        , update_time updateTime
+        from kwo_want_buy
+        <where>
+            del_flag = 0
+            <if test="wantBuyReq.statuss != null and wantBuyReq.statuss.size() > 0">
+                and status in
+                <foreach collection="wantBuyReq.statuss" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="wantBuyReq.startCreateTime != null and wantBuyReq.endCreateTime != null">
+                and create_time between #{wantBuyReq.startCreateTime,jdbcType=TIMESTAMP} and
+                #{wantBuyReq.endCreateTime,jdbcType=TIMESTAMP}
+            </if>
+            <if test="wantBuyReq.tradings != null and wantBuyReq.tradings.size() > 0">
+                and id in
+                <foreach collection="wantBuyReq.tradings" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="wantBuyReq.keywords != null and wantBuyReq.keywords != ''">
+                and (
+                `name` like concat('%', #{wantBuyReq.keywords,jdbcType=VARCHAR}, '%')
+                )
+            </if>
+        </where>
+        order by create_time desc
+    </select>
+
+<!--    <resultMap id="tradIngMap" type="com.sckw.order.model.KwoWantBuyTrading">-->
+    <resultMap id="tradIngMap" type="com.sckw.order.model.vo.res.WantBuyTradingRes">
+        <id column="wantBuyId" property="wantBuyId"/>
+        <result column="trading" property="trading"/>
+    </resultMap>
+
+
+    <select id="tradingSql" resultMap="tradIngMap">
+        select want_buy_id wantBuyId, trading
+        from kwo_want_buy_trading
+        <where>
+            del_flag = 0
+            and want_buy_id = #{id}
+        </where>
+    </select>
+
+
+
+    <select id="statisticsCount"  resultType="com.sckw.order.model.vo.res.TableTopRes" parameterType="java.util.Map">
+        select `status` value
+        from kwo_want_buy
+        <where>
+            del_flag = 0
+            <if test="wantBuyReq.statuss != null">
+                and status = #{wantBuyReq.statuss}
+            </if>
+            <if test="wantBuyReq.startCreateTime != null and wantBuyReq.endCreateTime != null">
+                and create_time between #{wantBuyReq.startCreateTime,jdbcType=TIMESTAMP} and
+                #{wantBuyReq.endCreateTime,jdbcType=TIMESTAMP}
+            </if>
+            <if test="wantBuyReq.tradings != null and wantBuyReq.tradings.size() > 0">
+                and id in
+                <foreach collection="wantBuyReq.tradings" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="wantBuyReq.keywords != null and wantBuyReq.keywords != ''">
+                and (
+                `name` like concat('%', #{wantBuyReq.keywords,jdbcType=VARCHAR}, '%')
+                )
+            </if>
+        </where>
+        order by create_time desc
+    </select>
+
+
+    <select id="queryBuyHallList"  resultMap="wangBuyResultMap" resultType="com.sckw.order.model.vo.res.WantBuySelectRes">
+        select id
+             ,`name`
+             , ent_name entName
+             , goods_type goodsType
+             , spec
+             , price
+             , amount
+             , status
+             , remark
+             , create_time createTime
+             , update_time updateTime
+        from kwo_want_buy
+        <where>
+            del_flag = 0
+            <if test="wantBuyReq.startCreateTime != null and wantBuyReq.endCreateTime != null">
+                and create_time between #{wantBuyReq.startCreateTime,jdbcType=TIMESTAMP} and
+                #{wantBuyReq.endCreateTime,jdbcType=TIMESTAMP}
+            </if>
+            <if test="wantBuyReq.tradings != null and wantBuyReq.tradings.size() > 0">
+                and id in
+                <foreach collection="wantBuyReq.tradings" item="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="wantBuyReq.keywords != null and wantBuyReq.keywords != ''">
+                and (
+                `name` like concat('%', #{wantBuyReq.keywords,jdbcType=VARCHAR}, '%')
+                )
+            </if>
+        </where>
+        order by create_time desc
+    </select>
+</mapper>

+ 36 - 0
sckw-modules/sckw-order/src/main/resources/mapper/KwoWantBuyTradingMapper.xml

@@ -0,0 +1,36 @@
+<?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.sckw.order.dao.KwpWantBuyTradingMapper">
+
+    <insert id="insertBatch">
+        insert into kwo_want_buy_trading
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            id,
+            want_buy_id,
+            trading,
+            remark,
+            status,
+            create_by,
+            create_time,
+            update_by,
+            update_time,
+            del_flag
+        </trim>
+        values
+        <foreach collection="list" item="item" separator=",">
+            <trim prefix="(" suffix=")" suffixOverrides=",">
+                #{item.id,jdbcType=BIGINT},
+                #{item.wantBuyId,jdbcType=BIGINT},
+                #{item.trading,jdbcType=VARCHAR},
+                #{item.remark,jdbcType=VARCHAR},
+                #{item.status,jdbcType=VARCHAR},
+                #{item.createBy,jdbcType=VARCHAR},
+                #{item.createTime,jdbcType=VARCHAR},
+                #{item.updateBy,jdbcType=VARCHAR},
+                #{item.updateTime,jdbcType=VARCHAR},
+                #{item.delFlag,jdbcType=VARCHAR}
+            </trim>
+        </foreach>
+    </insert>
+
+</mapper>