mall:完善收件地址
parent
96e2a27d07
commit
4ce76e82fc
@ -1,53 +0,0 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.spu.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
|
||||
/**
|
||||
* 商品spu Excel VO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class SpuExcelVO {
|
||||
|
||||
@ExcelProperty("主键")
|
||||
private Integer id;
|
||||
|
||||
@ExcelProperty("商品名称")
|
||||
private String name;
|
||||
|
||||
@ExcelProperty("卖点")
|
||||
private String sellPoint;
|
||||
|
||||
@ExcelProperty("描述")
|
||||
private String description;
|
||||
|
||||
@ExcelProperty("分类id")
|
||||
private Long categoryId;
|
||||
|
||||
@ExcelProperty("商品主图地址,* 数组,以逗号分隔,最多上传15张")
|
||||
private List<String> picUrls;
|
||||
|
||||
@ExcelProperty("排序字段")
|
||||
private Integer sort;
|
||||
|
||||
@ExcelProperty("点赞初始人数")
|
||||
private Integer likeCount;
|
||||
|
||||
@ExcelProperty("价格 单位使用:分")
|
||||
private Integer price;
|
||||
|
||||
@ExcelProperty("库存数量")
|
||||
private Integer quantity;
|
||||
|
||||
@ExcelProperty("上下架状态: 0 上架(开启) 1 下架(禁用)")
|
||||
private Boolean status;
|
||||
|
||||
@ExcelProperty("创建时间")
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@ -1,49 +0,0 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.spu.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.annotations.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@ApiModel(value = "管理后台 - 商品spu Excel 导出 Request VO", description = "参数和 SpuPageReqVO 是一致的")
|
||||
@Data
|
||||
public class SpuExportReqVO {
|
||||
|
||||
@ApiModelProperty(value = "商品名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "卖点")
|
||||
private String sellPoint;
|
||||
|
||||
@ApiModelProperty(value = "描述")
|
||||
private String description;
|
||||
|
||||
@ApiModelProperty(value = "分类id")
|
||||
private Long categoryId;
|
||||
|
||||
@ApiModelProperty(value = "商品主图地址,* 数组,以逗号分隔,最多上传15张")
|
||||
private List<String> picUrls;
|
||||
|
||||
@ApiModelProperty(value = "排序字段")
|
||||
private Integer sort;
|
||||
|
||||
@ApiModelProperty(value = "点赞初始人数")
|
||||
private Integer likeCount;
|
||||
|
||||
@ApiModelProperty(value = "价格 单位使用:分")
|
||||
private Integer price;
|
||||
|
||||
@ApiModelProperty(value = "库存数量")
|
||||
private Integer quantity;
|
||||
|
||||
@ApiModelProperty(value = "上下架状态: 0 上架(开启) 1 下架(禁用)")
|
||||
private Boolean status;
|
||||
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date[] createTime;
|
||||
|
||||
}
|
||||
@ -1,64 +1,22 @@
|
||||
package cn.iocoder.yudao.module.member.dal.mysql.address;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.address.AddressDO;
|
||||
import cn.iocoder.yudao.module.member.enums.AddressTypeEnum;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户收件地址 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface AddressMapper extends BaseMapperX<AddressDO> {
|
||||
|
||||
/**
|
||||
* 获取当前地址 根据id和userId
|
||||
* @param userId
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
default AddressDO getAddressByIdAndUserId(Long userId, Long id) {
|
||||
QueryWrapperX<AddressDO> queryWrapperX = new QueryWrapperX<>();
|
||||
queryWrapperX.eq("user_id", userId).eq("id", id);
|
||||
return selectList(queryWrapperX).stream().findFirst().orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取地址列表
|
||||
* @param userId
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
default List<AddressDO> selectListByUserIdAndType(Long userId, Integer type) {
|
||||
QueryWrapperX<AddressDO> queryWrapperX = new QueryWrapperX<AddressDO>().eq("user_id", userId)
|
||||
.eqIfPresent("type", type);
|
||||
return selectList(queryWrapperX);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取默认地址
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
default AddressDO getDefaultUserAddress(Long userId) {
|
||||
List<AddressDO> addressDOList = selectListByUserIdAndType(userId, AddressTypeEnum.DEFAULT.getType());
|
||||
return addressDOList.stream().findFirst().orElse(null);
|
||||
default AddressDO selectByIdAndUserId(Long id, Long userId) {
|
||||
return selectOne(AddressDO::getId, id, AddressDO::getUserId, userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取默认地址
|
||||
* @param id
|
||||
* @param addressTypeEnum
|
||||
* @return
|
||||
*/
|
||||
default int updateTypeById(Long id, AddressTypeEnum addressTypeEnum) {
|
||||
return updateById(new AddressDO().setId(id).setType(addressTypeEnum.getType()));
|
||||
default List<AddressDO> selectListByUserIdAndDefaulted(Long userId, Boolean defaulted) {
|
||||
return selectList(new LambdaQueryWrapperX<AddressDO>().eq(AddressDO::getUserId, userId)
|
||||
.eqIfPresent(AddressDO::getDefaulted, defaulted));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue