Commit 6b20d566 authored by shiyu's avatar shiyu

竞拍出价列表

parent f66382b5
......@@ -119,6 +119,7 @@ public class ShiroConfig {
filterChainDefinitionMap.put("/admin/sysIMRecord/**", "anon");
filterChainDefinitionMap.put("/admin/consignSaleManage/**", "anon");
filterChainDefinitionMap.put("/admin/returnOrderManage/**", "anon");
filterChainDefinitionMap.put("/admin/supplierItem/**", "anon");
filterChainDefinitionMap.put("/admin/invitationCode/**", "anon");
// filterChainDefinitionMap.put("/admin/**", "anon");
......
package com.wwdz.ch.admin.controller;
import com.alibaba.fastjson.JSON;
import com.wwdz.ch.admin.service.SysIMService;
import com.wwdz.ch.admin.service.SysSupplierItemService;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dto.request.distribution.SupplierItemRequestDto;
import com.xxdxxs.service.FormHandler;
import com.xxdxxs.validation.Validator;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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;
@RestController
@RequestMapping("/admin/supplierItem")
public class SysSupplierItemController {
private static final Logger logger = LoggerFactory.getLogger(SysSupplierItemController.class);
@Autowired
SysSupplierItemService supplierItemService;
@ApiOperation(value = "新增商品")
@PostMapping("/create")
public Result create(@RequestBody SupplierItemRequestDto dto) {
logger.info("新增商品,请求参数:{}", JSON.toJSONString(dto));
Validator validator = new Validator(FormHandler.ofEntity(dto));
validator.set("name", "商品名称").must().string()
.set("distributionPrice", "商品供货价").must().string()
.set("type", "商品类型").must().number()
.end();
if (!validator.isValid()) {
return Result.failed(validator.getErrorInfo());
}
return supplierItemService.create(dto);
}
}
package com.wwdz.ch.admin.impl;
import com.github.pagehelper.PageInfo;
import com.wwdz.ch.admin.service.SysSupplierItemService;
import com.wwdz.ch.core.consts.DistributionEnum;
import com.wwdz.ch.core.entity.SupplierItemVo;
import com.wwdz.ch.core.type.PageSearchResult;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.core.util.MediaUtil;
import com.wwdz.ch.core.util.PriceUtil;
import com.wwdz.ch.db.dao.SwitchDao;
import com.wwdz.ch.db.dao.distribution.*;
import com.wwdz.ch.db.domain.distribution.*;
import com.wwdz.ch.db.dto.request.distribution.SupplierItemRequestDto;
import com.xxdxxs.utils.DateUtils;
import com.xxdxxs.utils.EntityMapper;
import com.xxdxxs.utils.StringUtils;
import org.redisson.api.RedissonClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Service
public class SysSupplierItemServiceImpl implements SysSupplierItemService {
private static final Logger logger = LoggerFactory.getLogger(SysSupplierItemServiceImpl.class);
@Autowired
SupplierItemDao supplierItemDao;
@Autowired
DistributorShareRecordDao distributorShareRecordDao;
@Autowired
DistributionOrderDao distributionOrderDao;
@Autowired
RedissonClient redissonClient;
@Autowired
DistributorBindDao distributorBindDao;
@Autowired
UserRecentBrowseDao userRecentBrowseDao;
@Autowired
private SwitchDao switchDao;
@Autowired
AuctionConfigDao auctionConfigDao;
@Override
@Transactional
public Result create(SupplierItemRequestDto dto) {
try {
Date now = new Date();
//商品表中新增数据
SupplierItem supplierItem = new SupplierItem();
EntityMapper.copyAttribute(dto, supplierItem);
supplierItem.setDistributionPrice(PriceUtil.convertPriceFromStr(dto.getDistributionPrice()));
if (StringUtils.hasLength(dto.getSupplyPrice())) {
supplierItem.setSupplyPrice(PriceUtil.convertPriceFromStr(dto.getSupplyPrice()));
}
supplierItem.setSort(1);
supplierItem.setCreateTime(now);
supplierItem.setUpdateTime(now);
supplierItem.setIsOnSale(true);
supplierItem.setIsDeleted(false);
long itemId = supplierItemDao.insert(supplierItem);
//竞拍商品,维护竞拍配置
if (dto.getType() == DistributionEnum.DistributionTypeEnum.AUCTION.getCode()) {
AuctionConfig auctionConfig = new AuctionConfig();
auctionConfig.setItemId(itemId);
auctionConfig.setIsValid(true);
auctionConfig.setStartTime(DateUtils.parseString(dto.getAuctionStartTime()));
auctionConfig.setEndTime(DateUtils.parseString(dto.getAuctionEndTime()));
auctionConfig.setRealEndTime(DateUtils.parseString(dto.getAuctionEndTime()));
auctionConfig.setStartPrice(PriceUtil.convertPriceFromStr(dto.getStartPrice()));
auctionConfig.setAddExtent(PriceUtil.convertPriceFromStr(dto.getAddExtent()));
auctionConfig.setCreateTime(now);
auctionConfig.setUpdateTime(now);
auctionConfigDao.insert(auctionConfig);
}
return Result.success();
} catch (Exception e) {
logger.error("新增商品失败 error : {}", e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
}
return Result.failed();
}
@Override
public Result findList(SupplierItemRequestDto dto) {
try {
List<SupplierItemVo> supplierItemVos = new ArrayList<>();
List<SupplierItem> supplierItemList = supplierItemDao.findList(dto);
PageInfo<SupplierItem> pageInfo = new PageInfo(supplierItemList);
supplierItemList.forEach(supplierItem -> {
SupplierItemVo supplierItemVo = new SupplierItemVo();
EntityMapper.copyAttribute(supplierItem, supplierItemVo);
supplierItemVo.setSupplyPrice(PriceUtil.convertPriceFenToYuan(supplierItem.getSupplyPrice()));
supplierItemVo.setDistributionPrice(PriceUtil.convertPriceFenToYuan(supplierItem.getDistributionPrice()));
supplierItemVo.setHomePageImage(MediaUtil.getHomePageImage(supplierItem.getImages(), supplierItem.getVideos()));
supplierItemVos.add(supplierItemVo);
});
return Result.success(PageSearchResult.of(pageInfo, supplierItemVos));
} catch (Exception e) {
logger.error("商品列表查询失败 error : {}", e);
}
return Result.failed();
}
@Override
public Result findDetail(SupplierItemRequestDto dto) {
try {
SupplierItemVo supplierItemVo = new SupplierItemVo();
long itemId = dto.getId();
SupplierItem supplierItem = supplierItemDao.findById(itemId);
EntityMapper.copyAttribute(supplierItem, supplierItemVo);
supplierItemVo.setItemId(supplierItem.getId());
supplierItemVo.setSupplyPrice(PriceUtil.convertPriceFenToYuan(supplierItem.getSupplyPrice()));
supplierItemVo.setDistributionPrice(PriceUtil.convertPriceFenToYuan(supplierItem.getDistributionPrice()));
supplierItemVo.setHomePageImage(MediaUtil.getHomePageImage(supplierItem.getImages(), supplierItem.getVideos()));
return Result.success(supplierItemVo);
} catch (Exception e) {
logger.error("商品详情查询失败 error : {}", e);
}
return Result.failed();
}
public Result updateDistributionPrice(SupplierItemRequestDto dto) {
try {
SupplierItem supplierItem = new SupplierItem();
supplierItem.setId(dto.getId());
supplierItem.setDistributionPrice(PriceUtil.convertPriceFromStr(dto.getDistributionPrice()));
supplierItemDao.update(supplierItem);
//把该商品所关联的所有分享链接都改为无效
distributorShareRecordDao.updateDisEnabled(dto.getId());
return Result.success();
} catch (Exception e) {
logger.error("商品修改供货价,设置分享链接无效 error : {}", e);
}
return Result.failed();
}
}
package com.wwdz.ch.admin.service;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dto.request.distribution.SupplierItemRequestDto;
public interface SysSupplierItemService {
/**
* 新增商品
* @param dto
* @return
*/
Result create(SupplierItemRequestDto dto);
/**
* 查询供应商商品列表
* @param dto
* @return
*/
Result findList(SupplierItemRequestDto dto);
/**
* 查询供应商商品详情
* @param dto
* @return
*/
Result findDetail(SupplierItemRequestDto dto);
}
......@@ -82,4 +82,79 @@ public class DistributionEnum {
}
/**
* 分销类型
*/
public enum DistributionTypeEnum {
FIXED_PRICE(1, "一口价"),
AUCTION(2, "竞拍"),
;
private int code;
private String des;
DistributionTypeEnum(int code, String des) {
this.code = code;
this.des = des;
}
public static String getNameByCode(int code) {
for (DistributionTypeEnum distributionTypeEnum : DistributionTypeEnum.values()) {
if (code == distributionTypeEnum.getCode()) {
return distributionTypeEnum.getDes();
}
}
return null;
}
public int getCode() {
return code;
}
public String getDes() {
return des;
}
}
/**
* 竞拍状态
*/
public enum AuctionStateEnum {
NOT_START(1, "未开拍"),
IN_AUCTION(2, "拍卖中"),
END(3, "已截拍")
;
private int code;
private String des;
AuctionStateEnum(int code, String des) {
this.code = code;
this.des = des;
}
public static String getNameByCode(int code) {
for (AuctionStateEnum auctionStateEnum : AuctionStateEnum.values()) {
if (code == auctionStateEnum.getCode()) {
return auctionStateEnum.getDes();
}
}
return null;
}
public int getCode() {
return code;
}
public String getDes() {
return des;
}
}
}
package com.wwdz.ch.wx.entity.vo.distribution;
package com.wwdz.ch.core.entity;
import com.wwdz.ch.core.util.PriceUtil;
import com.xxdxxs.entity.Entity;
......
package com.wwdz.ch.db.dao.distribution;
import com.wwdz.ch.db.domain.distribution.AuctionConfig;
import java.util.Date;
public interface AuctionConfigDao {
/**
* 插入新记录
*
* @param auctionConfig
* @return
*/
int insert(AuctionConfig auctionConfig);
/**
* 根据商品id查询拍卖设置
* @param itemId
* @return
*/
AuctionConfig findByItemId(long itemId);
/**
* 更新截拍时间
* @param itemId
* @param realEndTime
* @return
*/
int updateRealEndTime(long itemId, Date realEndTime);
/**
* 拍卖结束
* @param itemId
* @return
*/
int setEnd(long itemId);
}
package com.wwdz.ch.db.dao.distribution;
import com.wwdz.ch.db.domain.distribution.AuctionRecord;
import com.wwdz.ch.db.dto.request.distribution.AuctionRecordRequestDto;
import java.util.List;
public interface AuctionRecordDao {
/**
* 插入新记录
*
* @param auctionRecord
* @return
*/
int insert(AuctionRecord auctionRecord);
/**
* 更新记录
* 价格被反超时,设置islead字段为false
* @param itemId
* @return
*/
int updateNotLead(long itemId);
/**
* 查询出价记录
* @param dto
* @return
*/
List<AuctionRecord> find(AuctionRecordRequestDto dto);
/**
* 查询出价记录
* @param dto
* @return
*/
List<AuctionRecord> findByPage(AuctionRecordRequestDto dto);
/**
* 查询最新的一条出价记录
* @param itemId
* @return
*/
AuctionRecord findLastedRecord(long itemId);
/**
* 统计出价次数
* @param dto
* @return
*/
long count(AuctionRecordRequestDto dto);
}
......@@ -11,6 +11,8 @@ import java.util.List;
public interface SupplierItemDao {
long insert(SupplierItem supplierItem);
/**
* 查询商品列表
* @param supplierItemRequestDto
......
......@@ -10,7 +10,7 @@ import lombok.Data;
/**
* @author shiyu
* @date 2024/01/31
* @date 2024/02/29
*/
@Data
public class DistributionOrder implements Entity {
......@@ -131,6 +131,11 @@ public class DistributionOrder implements Entity {
*/
private Integer state;
/**
* 订单类型1一口价2竞拍
*/
private Integer type;
private static final long serialVersionUID = 1L;
@Override
......@@ -163,6 +168,7 @@ public class DistributionOrder implements Entity {
sb.append(", updateTime=").append(updateTime);
sb.append(", shareRecordId=").append(shareRecordId);
sb.append(", state=").append(state);
sb.append(", type=").append(type);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
......@@ -203,7 +209,8 @@ public class DistributionOrder implements Entity {
&& (this.getFinishTime() == null ? other.getFinishTime() == null : this.getFinishTime().equals(other.getFinishTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getShareRecordId() == null ? other.getShareRecordId() == null : this.getShareRecordId().equals(other.getShareRecordId()))
&& (this.getState() == null ? other.getState() == null : this.getState().equals(other.getState()));
&& (this.getState() == null ? other.getState() == null : this.getState().equals(other.getState()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()));
}
@Override
......@@ -234,6 +241,7 @@ public class DistributionOrder implements Entity {
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getShareRecordId() == null) ? 0 : getShareRecordId().hashCode());
result = prime * result + ((getState() == null) ? 0 : getState().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
return result;
}
......@@ -268,7 +276,8 @@ public class DistributionOrder implements Entity {
finishTime("finish_time", "finishTime", "TIMESTAMP", false),
updateTime("update_time", "updateTime", "TIMESTAMP", false),
shareRecordId("share_record_id", "shareRecordId", "VARCHAR", false),
state("state", "state", "INTEGER", true);
state("state", "state", "INTEGER", true),
type("type", "type", "INTEGER", true);
/**
* This field was generated by MyBatis Generator.
......
......@@ -3415,6 +3415,138 @@ public class DistributionOrderExample {
addCriterion("`state` not between", value1, value2, "state");
return (Criteria) this;
}
public Criteria andTypeIsNull() {
addCriterion("`type` is null");
return (Criteria) this;
}
public Criteria andTypeIsNotNull() {
addCriterion("`type` is not null");
return (Criteria) this;
}
public Criteria andTypeEqualTo(Integer value) {
addCriterion("`type` =", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distribution_order
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeEqualToColumn(DistributionOrder.Column column) {
addCriterion(new StringBuilder("`type` = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeNotEqualTo(Integer value) {
addCriterion("`type` <>", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distribution_order
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeNotEqualToColumn(DistributionOrder.Column column) {
addCriterion(new StringBuilder("`type` <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeGreaterThan(Integer value) {
addCriterion("`type` >", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distribution_order
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeGreaterThanColumn(DistributionOrder.Column column) {
addCriterion(new StringBuilder("`type` > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeGreaterThanOrEqualTo(Integer value) {
addCriterion("`type` >=", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distribution_order
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeGreaterThanOrEqualToColumn(DistributionOrder.Column column) {
addCriterion(new StringBuilder("`type` >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeLessThan(Integer value) {
addCriterion("`type` <", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distribution_order
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeLessThanColumn(DistributionOrder.Column column) {
addCriterion(new StringBuilder("`type` < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeLessThanOrEqualTo(Integer value) {
addCriterion("`type` <=", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distribution_order
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeLessThanOrEqualToColumn(DistributionOrder.Column column) {
addCriterion(new StringBuilder("`type` <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeIn(List<Integer> values) {
addCriterion("`type` in", values, "type");
return (Criteria) this;
}
public Criteria andTypeNotIn(List<Integer> values) {
addCriterion("`type` not in", values, "type");
return (Criteria) this;
}
public Criteria andTypeBetween(Integer value1, Integer value2) {
addCriterion("`type` between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andTypeNotBetween(Integer value1, Integer value2) {
addCriterion("`type` not between", value1, value2, "type");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
......
......@@ -10,7 +10,7 @@ import lombok.Data;
/**
* @author shiyu
* @date 2024/01/25
* @date 2024/02/29
*/
@Data
public class DistributorShareRecord implements Entity {
......@@ -51,6 +51,11 @@ public class DistributorShareRecord implements Entity {
*/
private Boolean enabled;
/**
* 分享类型1一口价2竞拍
*/
private Integer type;
private static final long serialVersionUID = 1L;
@Override
......@@ -67,6 +72,7 @@ public class DistributorShareRecord implements Entity {
sb.append(", shopId=").append(shopId);
sb.append(", createTime=").append(createTime);
sb.append(", enabled=").append(enabled);
sb.append(", type=").append(type);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
......@@ -91,7 +97,8 @@ public class DistributorShareRecord implements Entity {
&& (this.getDistributorId() == null ? other.getDistributorId() == null : this.getDistributorId().equals(other.getDistributorId()))
&& (this.getShopId() == null ? other.getShopId() == null : this.getShopId().equals(other.getShopId()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getEnabled() == null ? other.getEnabled() == null : this.getEnabled().equals(other.getEnabled()));
&& (this.getEnabled() == null ? other.getEnabled() == null : this.getEnabled().equals(other.getEnabled()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()));
}
@Override
......@@ -106,6 +113,7 @@ public class DistributorShareRecord implements Entity {
result = prime * result + ((getShopId() == null) ? 0 : getShopId().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getEnabled() == null) ? 0 : getEnabled().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
return result;
}
......@@ -124,7 +132,8 @@ public class DistributorShareRecord implements Entity {
distributorId("distributor_id", "distributorId", "BIGINT", false),
shopId("shop_id", "shopId", "BIGINT", false),
createTime("create_time", "createTime", "TIMESTAMP", false),
enabled("enabled", "enabled", "BIT", false);
enabled("enabled", "enabled", "BIT", false),
type("type", "type", "INTEGER", true);
/**
* This field was generated by MyBatis Generator.
......
......@@ -1213,6 +1213,138 @@ public class DistributorShareRecordExample {
addCriterion("enabled not between", value1, value2, "enabled");
return (Criteria) this;
}
public Criteria andTypeIsNull() {
addCriterion("`type` is null");
return (Criteria) this;
}
public Criteria andTypeIsNotNull() {
addCriterion("`type` is not null");
return (Criteria) this;
}
public Criteria andTypeEqualTo(Integer value) {
addCriterion("`type` =", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distributor_share_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeEqualToColumn(DistributorShareRecord.Column column) {
addCriterion(new StringBuilder("`type` = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeNotEqualTo(Integer value) {
addCriterion("`type` <>", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distributor_share_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeNotEqualToColumn(DistributorShareRecord.Column column) {
addCriterion(new StringBuilder("`type` <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeGreaterThan(Integer value) {
addCriterion("`type` >", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distributor_share_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeGreaterThanColumn(DistributorShareRecord.Column column) {
addCriterion(new StringBuilder("`type` > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeGreaterThanOrEqualTo(Integer value) {
addCriterion("`type` >=", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distributor_share_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeGreaterThanOrEqualToColumn(DistributorShareRecord.Column column) {
addCriterion(new StringBuilder("`type` >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeLessThan(Integer value) {
addCriterion("`type` <", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distributor_share_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeLessThanColumn(DistributorShareRecord.Column column) {
addCriterion(new StringBuilder("`type` < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeLessThanOrEqualTo(Integer value) {
addCriterion("`type` <=", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distributor_share_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeLessThanOrEqualToColumn(DistributorShareRecord.Column column) {
addCriterion(new StringBuilder("`type` <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeIn(List<Integer> values) {
addCriterion("`type` in", values, "type");
return (Criteria) this;
}
public Criteria andTypeNotIn(List<Integer> values) {
addCriterion("`type` not in", values, "type");
return (Criteria) this;
}
public Criteria andTypeBetween(Integer value1, Integer value2) {
addCriterion("`type` between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andTypeNotBetween(Integer value1, Integer value2) {
addCriterion("`type` not between", value1, value2, "type");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
......
......@@ -10,7 +10,7 @@ import lombok.Data;
/**
* @author shiyu
* @date 2024/02/19
* @date 2024/02/29
*/
@Data
public class SupplierItem implements Entity {
......@@ -76,6 +76,11 @@ public class SupplierItem implements Entity {
*/
private Integer buyLimitNum;
/**
* 商品类型1一口价2竞拍
*/
private Integer type;
/**
* 商品图片,分号分隔
*/
......@@ -112,6 +117,7 @@ public class SupplierItem implements Entity {
sb.append(", updateTime=").append(updateTime);
sb.append(", isDeleted=").append(isDeleted);
sb.append(", buyLimitNum=").append(buyLimitNum);
sb.append(", type=").append(type);
sb.append(", images=").append(images);
sb.append(", videos=").append(videos);
sb.append(", description=").append(description);
......@@ -145,6 +151,7 @@ public class SupplierItem implements Entity {
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getIsDeleted() == null ? other.getIsDeleted() == null : this.getIsDeleted().equals(other.getIsDeleted()))
&& (this.getBuyLimitNum() == null ? other.getBuyLimitNum() == null : this.getBuyLimitNum().equals(other.getBuyLimitNum()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
&& (this.getImages() == null ? other.getImages() == null : this.getImages().equals(other.getImages()))
&& (this.getVideos() == null ? other.getVideos() == null : this.getVideos().equals(other.getVideos()))
&& (this.getDescription() == null ? other.getDescription() == null : this.getDescription().equals(other.getDescription()));
......@@ -167,6 +174,7 @@ public class SupplierItem implements Entity {
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getIsDeleted() == null) ? 0 : getIsDeleted().hashCode());
result = prime * result + ((getBuyLimitNum() == null) ? 0 : getBuyLimitNum().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
result = prime * result + ((getImages() == null) ? 0 : getImages().hashCode());
result = prime * result + ((getVideos() == null) ? 0 : getVideos().hashCode());
result = prime * result + ((getDescription() == null) ? 0 : getDescription().hashCode());
......@@ -194,6 +202,7 @@ public class SupplierItem implements Entity {
updateTime("update_time", "updateTime", "TIMESTAMP", false),
isDeleted("is_deleted", "isDeleted", "BIT", false),
buyLimitNum("buy_limit_num", "buyLimitNum", "INTEGER", false),
type("type", "type", "INTEGER", true),
images("images", "images", "LONGVARCHAR", false),
videos("videos", "videos", "LONGVARCHAR", false),
description("description", "description", "LONGVARCHAR", false);
......
......@@ -1883,6 +1883,138 @@ public class SupplierItemExample {
addCriterion("buy_limit_num not between", value1, value2, "buyLimitNum");
return (Criteria) this;
}
public Criteria andTypeIsNull() {
addCriterion("`type` is null");
return (Criteria) this;
}
public Criteria andTypeIsNotNull() {
addCriterion("`type` is not null");
return (Criteria) this;
}
public Criteria andTypeEqualTo(Integer value) {
addCriterion("`type` =", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table supplier_item
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeEqualToColumn(SupplierItem.Column column) {
addCriterion(new StringBuilder("`type` = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeNotEqualTo(Integer value) {
addCriterion("`type` <>", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table supplier_item
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeNotEqualToColumn(SupplierItem.Column column) {
addCriterion(new StringBuilder("`type` <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeGreaterThan(Integer value) {
addCriterion("`type` >", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table supplier_item
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeGreaterThanColumn(SupplierItem.Column column) {
addCriterion(new StringBuilder("`type` > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeGreaterThanOrEqualTo(Integer value) {
addCriterion("`type` >=", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table supplier_item
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeGreaterThanOrEqualToColumn(SupplierItem.Column column) {
addCriterion(new StringBuilder("`type` >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeLessThan(Integer value) {
addCriterion("`type` <", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table supplier_item
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeLessThanColumn(SupplierItem.Column column) {
addCriterion(new StringBuilder("`type` < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeLessThanOrEqualTo(Integer value) {
addCriterion("`type` <=", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table supplier_item
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeLessThanOrEqualToColumn(SupplierItem.Column column) {
addCriterion(new StringBuilder("`type` <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeIn(List<Integer> values) {
addCriterion("`type` in", values, "type");
return (Criteria) this;
}
public Criteria andTypeNotIn(List<Integer> values) {
addCriterion("`type` not in", values, "type");
return (Criteria) this;
}
public Criteria andTypeBetween(Integer value1, Integer value2) {
addCriterion("`type` between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andTypeNotBetween(Integer value1, Integer value2) {
addCriterion("`type` not between", value1, value2, "type");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
......
package com.wwdz.ch.db.dto.request.distribution;
import com.wwdz.ch.db.dto.request.BaseRequestDto;
import com.xxdxxs.entity.Entity;
import lombok.Data;
import java.util.Date;
@Data
public class AuctionConfigRequestDto extends BaseRequestDto implements Entity {
private Integer id;
/**
* 商品id
*/
private Long itemId;
/**
* 竞拍开始时间
*/
private Date startTime;
/**
* 竞拍结束时间
*/
private Date endTime;
/**
* 起拍价
*/
private Long startPrice;
/**
* 加价幅度
*/
private Long addExtent;
/**
* 实际竞拍结束时间
*/
private Date realEndTime;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 是否有效
*/
private Boolean isValid;
}
package com.wwdz.ch.db.dto.request.distribution;
import com.wwdz.ch.db.dto.request.BaseRequestDto;
import com.xxdxxs.entity.Entity;
import lombok.Data;
import java.util.Date;
@Data
public class AuctionRecordRequestDto extends BaseRequestDto implements Entity {
private Integer id;
/**
* 商品id
*/
private Long itemId;
/**
* 用户id
*/
private Long userId;
/**
* 出价
*/
private Long price;
/**
* 出价时间
*/
private Date createTime;
/**
* 分享id
*/
private String shareRecordId;
/**
* 分享商id
*/
private Long distributorId;
/**
* 价格是否领先
*/
private Boolean isLead;
}
......@@ -4,6 +4,7 @@ import com.wwdz.ch.db.dto.request.BaseRequestDto;
import com.xxdxxs.entity.Entity;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
......@@ -34,11 +35,42 @@ public class SupplierItemRequestDto extends BaseRequestDto implements Entity {
*/
private Integer stock;
/**
* 进货价格
*前端传过来的单位是元,后台要处理为分
*/
private String supplyPrice;
/**
* 商品名称
*/
private String name;
/**
* 置顶图片
*/
private String topImage;
/**
* 商品图片,分号分隔
*/
private String images;
/**
* 商品视频,分号分隔
*/
private String videos;
/**
* 限购数量
*/
private Integer buyLimitNum;
/**
* 商品详细介绍,是富文本格式
*/
private String description;
/**
* 分销价格,前端传过来的单位是元,后台要处理为分
*/
......@@ -75,4 +107,36 @@ public class SupplierItemRequestDto extends BaseRequestDto implements Entity {
* 是否是店家
*/
private Boolean isShop;
/**
* 商品类型1一口价2竞拍
*/
private Integer type;
/**
* 竞拍开始时间
*/
private String auctionStartTime;
/**
* 竞拍结束时间
*/
private String auctionEndTime;
/**
* 起拍价
* 单位元 需要转为分
*/
private String startPrice;
/**
* 加价幅度
* 单位元 需要转为分
*/
private String addExtent;
/**
* 实际竞拍结束时间
*/
private Date realEndTime;
}
package com.wwdz.ch.db.impl.distribution;
import com.wwdz.ch.db.dao.distribution.AuctionConfigDao;
import com.wwdz.ch.db.domain.distribution.AuctionConfig;
import com.wwdz.ch.db.domain.distribution.AuctionConfigExample;
import com.wwdz.ch.db.mapper.distribution.AuctionConfigMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.Date;
@Repository
public class AuctionConfigDaoImpl implements AuctionConfigDao {
@Autowired
AuctionConfigMapper auctionConfigMapper;
@Override
public int insert(AuctionConfig auctionConfig) {
return auctionConfigMapper.insert(auctionConfig);
}
@Override
public AuctionConfig findByItemId(long itemId) {
AuctionConfigExample example = new AuctionConfigExample();
AuctionConfigExample.Criteria criteria = example.createCriteria();
criteria.andItemIdEqualTo(itemId);
return auctionConfigMapper.selectOneByExample(example);
}
@Override
public int updateRealEndTime(long itemId, Date realEndTime) {
AuctionConfigExample example = new AuctionConfigExample();
AuctionConfigExample.Criteria criteria = example.createCriteria();
criteria.andItemIdEqualTo(itemId);
AuctionConfig auctionConfig = new AuctionConfig();
auctionConfig.setUpdateTime(new Date());
auctionConfig.setRealEndTime(realEndTime);
return auctionConfigMapper.updateByExampleSelective(auctionConfig, example);
}
@Override
public int setEnd(long itemId) {
AuctionConfigExample example = new AuctionConfigExample();
AuctionConfigExample.Criteria criteria = example.createCriteria();
criteria.andItemIdEqualTo(itemId);
AuctionConfig auctionConfig = new AuctionConfig();
auctionConfig.setUpdateTime(new Date());
auctionConfig.setIsValid(false);
return auctionConfigMapper.updateByExampleSelective(auctionConfig, example);
}
}
package com.wwdz.ch.db.impl.distribution;
import com.github.pagehelper.PageHelper;
import com.wwdz.ch.db.dao.distribution.AuctionRecordDao;
import com.wwdz.ch.db.domain.distribution.AuctionRecord;
import com.wwdz.ch.db.domain.distribution.AuctionRecordExample;
import com.wwdz.ch.db.dto.request.distribution.AuctionRecordRequestDto;
import com.wwdz.ch.db.mapper.distribution.AuctionRecordMapper;
import com.xxdxxs.db.component.JdbcHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public class AuctionRecordDaoImpl implements AuctionRecordDao {
@Autowired
AuctionRecordMapper auctionRecordMapper;
@Override
public int insert(AuctionRecord auctionRecord) {
return auctionRecordMapper.insert(auctionRecord);
}
@Override
public int updateNotLead(long itemId) {
AuctionRecordExample example = new AuctionRecordExample();
AuctionRecordExample.Criteria criteria = example.createCriteria();
criteria.andItemIdEqualTo(itemId);
AuctionRecord auctionRecord = new AuctionRecord();
auctionRecord.setIsLead(false);
return auctionRecordMapper.updateByExampleSelective(auctionRecord, example);
}
@Override
public List<AuctionRecord> find(AuctionRecordRequestDto dto) {
AuctionRecordExample example = new AuctionRecordExample();
AuctionRecordExample.Criteria criteria = example.createCriteria();
JdbcHelper.ifPresent(dto.getItemId(), criteria::andItemIdEqualTo);
JdbcHelper.ifPresent(dto.getUserId(), criteria::andUserIdEqualTo);
JdbcHelper.ifPresent(dto.getIsLead(), criteria::andIsLeadEqualTo);
return auctionRecordMapper.selectByExample(example);
}
@Override
public List<AuctionRecord> findByPage(AuctionRecordRequestDto dto) {
AuctionRecordExample example = new AuctionRecordExample();
AuctionRecordExample.Criteria criteria = example.createCriteria();
JdbcHelper.ifPresent(dto.getItemId(), criteria::andItemIdEqualTo);
JdbcHelper.ifPresent(dto.getUserId(), criteria::andUserIdEqualTo);
JdbcHelper.ifPresent(dto.getIsLead(), criteria::andIsLeadEqualTo);
example.setOrderByClause("create_time desc");
PageHelper.startPage(dto.getPage(), dto.getLimit());
return auctionRecordMapper.selectByExample(example);
}
@Override
public AuctionRecord findLastedRecord(long itemId) {
AuctionRecordExample example = new AuctionRecordExample();
AuctionRecordExample.Criteria criteria = example.createCriteria();
criteria.andItemIdEqualTo(itemId);
criteria.andIsLeadEqualTo(true);
return auctionRecordMapper.selectOneByExample(example);
}
@Override
public long count(AuctionRecordRequestDto dto) {
AuctionRecordExample example = new AuctionRecordExample();
AuctionRecordExample.Criteria criteria = example.createCriteria();
JdbcHelper.ifPresent(dto.getItemId(), criteria::andItemIdEqualTo);
JdbcHelper.ifPresent(dto.getUserId(), criteria::andUserIdEqualTo);
JdbcHelper.ifPresent(dto.getIsLead(), criteria::andIsLeadEqualTo);
return auctionRecordMapper.countByExample(example);
}
}
......@@ -21,6 +21,12 @@ public class SupplierItemDaoImpl implements SupplierItemDao {
@Autowired
SupplierItemMapper supplierItemMapper;
@Override
public long insert(SupplierItem supplierItem) {
supplierItemMapper.insert(supplierItem);
return supplierItem.getId();
}
@Override
public List<SupplierItem> findList(SupplierItemRequestDto dto) {
SupplierItemExample supplierItemExample = new SupplierItemExample();
......
package com.wwdz.ch.db.mapper.distribution;
import com.wwdz.ch.db.domain.distribution.AuctionConfig;
import com.wwdz.ch.db.domain.distribution.AuctionConfigExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface AuctionConfigMapper {
long countByExample(AuctionConfigExample example);
int deleteByExample(AuctionConfigExample example);
int deleteByPrimaryKey(Integer id);
int insert(AuctionConfig record);
int insertSelective(AuctionConfig record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
AuctionConfig selectOneByExample(AuctionConfigExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
AuctionConfig selectOneByExampleSelective(@Param("example") AuctionConfigExample example, @Param("selective") AuctionConfig.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
List<AuctionConfig> selectByExampleSelective(@Param("example") AuctionConfigExample example, @Param("selective") AuctionConfig.Column ... selective);
List<AuctionConfig> selectByExample(AuctionConfigExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
AuctionConfig selectByPrimaryKeySelective(@Param("id") Integer id, @Param("selective") AuctionConfig.Column ... selective);
AuctionConfig selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("record") AuctionConfig record, @Param("example") AuctionConfigExample example);
int updateByExample(@Param("record") AuctionConfig record, @Param("example") AuctionConfigExample example);
int updateByPrimaryKeySelective(AuctionConfig record);
int updateByPrimaryKey(AuctionConfig record);
}
\ No newline at end of file
......@@ -72,7 +72,7 @@
<javaClientGenerator type="XMLMAPPER" targetPackage="com.wwdz.ch.db.mapper.distribution"
targetProject="ch-dao/src/main/java"/>
<table tableName="refund_order" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true">
<table tableName="distribution_order" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true">
<generatedKey column="id" sqlStatement="Mysql" identity="true" />
</table>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment