banner、商品、商品分类等代码的 REVIEW
This commit is contained in:
parent
16a39255f9
commit
c34c501fb8
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.mall.product.biz.enums.category;
|
package cn.iocoder.mall.product.biz.enums.category;
|
||||||
|
|
||||||
|
// TODO FROM 芋艿 to sunderui:改到枚举类,我之前没弄对,哈哈哈
|
||||||
public interface ProductCategoryConstants {
|
public interface ProductCategoryConstants {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -40,15 +40,9 @@ public interface ProductSpuConvert {
|
|||||||
})
|
})
|
||||||
ProductSpuBO convert(ProductSpuDO spu);
|
ProductSpuBO convert(ProductSpuDO spu);
|
||||||
|
|
||||||
@Named("translatePicUrlsFromString")
|
|
||||||
default List<String> translatePicUrlsFromString(String picUrls) {
|
|
||||||
return StringUtil.split(picUrls, ",");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Mappings({})
|
@Mappings({})
|
||||||
List<ProductSpuBO> convert(List<ProductSpuDO> spus);
|
List<ProductSpuBO> convert(List<ProductSpuDO> spus);
|
||||||
|
|
||||||
|
|
||||||
@Mappings({
|
@Mappings({
|
||||||
@Mapping(source = "picUrls", target = "picUrls", ignore = true)
|
@Mapping(source = "picUrls", target = "picUrls", ignore = true)
|
||||||
})
|
})
|
||||||
@ -131,4 +125,9 @@ public interface ProductSpuConvert {
|
|||||||
return spuDetailList;
|
return spuDetailList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Named("translatePicUrlsFromString")
|
||||||
|
default List<String> translatePicUrlsFromString(String picUrls) {
|
||||||
|
return StringUtil.split(picUrls, ",");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
|
// TODO FROM 芋艿 to sunderui && q2118cs:貌似重复了,只要保留一个哈
|
||||||
public class ProductSpuAddDTO {
|
public class ProductSpuAddDTO {
|
||||||
|
|
||||||
// ========== 基本信息 =========
|
// ========== 基本信息 =========
|
||||||
|
@ -114,6 +114,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService {
|
|||||||
throw ServiceExceptionUtil.exception(PRODUCT_CATEGORY_DELETE_ONLY_DISABLE);
|
throw ServiceExceptionUtil.exception(PRODUCT_CATEGORY_DELETE_ONLY_DISABLE);
|
||||||
}
|
}
|
||||||
// 只有不存在子分类才可以删除
|
// 只有不存在子分类才可以删除
|
||||||
|
// TODO FROM 芋艿 to jiangweifan:Wrappers 只用在 Mapper 层
|
||||||
Integer childCount = productCategoryMapper.selectCount(
|
Integer childCount = productCategoryMapper.selectCount(
|
||||||
Wrappers.<ProductCategoryDO>lambdaQuery().eq(ProductCategoryDO::getPid, productCategoryId)
|
Wrappers.<ProductCategoryDO>lambdaQuery().eq(ProductCategoryDO::getPid, productCategoryId)
|
||||||
);
|
);
|
||||||
|
@ -15,6 +15,7 @@ import java.util.Date;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
|
// TODO FROM 芋艿 to 小范:捉摸是不是先统一的 BannerBO;另外,biz 不使用 swagger 注解哈,其他 banner 的 dto 和 bo 也一起改改哈;
|
||||||
public class BannerListBO implements Serializable {
|
public class BannerListBO implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ public interface BannerMapper extends BaseMapper<BannerDO> {
|
|||||||
* @param dto
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
// TODO FROM 芋艿 to 小范:Page 方法哈
|
||||||
default IPage<BannerDO> selectBannerList(BannerListDTO dto) {
|
default IPage<BannerDO> selectBannerList(BannerListDTO dto) {
|
||||||
LambdaQueryWrapper<BannerDO> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<BannerDO> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
if (StringUtils.isEmpty(dto.getStatus())) {
|
if (StringUtils.isEmpty(dto.getStatus())) {
|
||||||
|
@ -48,6 +48,7 @@ public interface BannerService {
|
|||||||
*/
|
*/
|
||||||
void updateBanner(BannerUpdateDTO adminsBannerUpdateDTO);
|
void updateBanner(BannerUpdateDTO adminsBannerUpdateDTO);
|
||||||
|
|
||||||
|
// TODO FROM 芋艿 to 小范:貌似要把 dto 搞起来,嘿嘿;
|
||||||
/**
|
/**
|
||||||
* 更新 - banner 状态
|
* 更新 - banner 状态
|
||||||
*
|
*
|
||||||
|
@ -17,7 +17,7 @@ import java.io.Serializable;
|
|||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class BannerAddRequest implements Serializable {
|
public class BannerAddRequest implements Serializable {
|
||||||
|
|
||||||
@NotNull
|
@NotNull // TODO FROM 芋艿 to 小范:提示要加下,哈哈哈
|
||||||
@ApiModelProperty("跳转链接")
|
@ApiModelProperty("跳转链接")
|
||||||
private Integer url;
|
private Integer url;
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import lombok.experimental.Accessors;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/** // TODO FROM 芋艿 to 2447007062:最好加下字段的注释哈;
|
||||||
* @author:mac
|
* @author:mac
|
||||||
* @descriptio
|
* @descriptio
|
||||||
* @create: 2020-5-12 20:43:00
|
* @create: 2020-5-12 20:43:00
|
||||||
|
@ -26,7 +26,7 @@ public interface UserMapper extends BaseMapper<UserDO> {
|
|||||||
*/
|
*/
|
||||||
default IPage<UserDO> selectUserPage(UserPageDTO userPageDTO) {
|
default IPage<UserDO> selectUserPage(UserPageDTO userPageDTO) {
|
||||||
// TODO FROM 芋艿 to jwf1173:看下 QueryWrapperX 噢,已经提供判空啦
|
// TODO FROM 芋艿 to jwf1173:看下 QueryWrapperX 噢,已经提供判空啦
|
||||||
// TODO FROM 伟帆 to 芋艿: 这里是使用MP原生的判空,支持lambda好,还是使用QueryWrapperX,使用字段名字符串的好呢
|
// TODO FROM 伟帆 to 芋艿: 这里是使用MP原生的判空,支持lambda好,还是使用QueryWrapperX,使用字段名字符串的好呢;reply:没特别想好,现在建议还是 QueryWrapperX
|
||||||
return this.selectPage(new Page<>(userPageDTO.getPageNo(), userPageDTO.getPageSize()),
|
return this.selectPage(new Page<>(userPageDTO.getPageNo(), userPageDTO.getPageSize()),
|
||||||
Wrappers.<UserDO>query().lambda()
|
Wrappers.<UserDO>query().lambda()
|
||||||
.eq(StringUtils.isNotBlank(userPageDTO.getNickname()), UserDO::getNickname, userPageDTO.getNickname())
|
.eq(StringUtils.isNotBlank(userPageDTO.getNickname()), UserDO::getNickname, userPageDTO.getNickname())
|
||||||
|
@ -4,14 +4,13 @@ import lombok.Data;
|
|||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 访问日志添加 DTO
|
* 访问日志添加 DTO
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class AccessLogPageDTO {
|
public class AccessLogPageDTO { // TODO FROM 芋艿 to 2447007062:有个 PageParams 类哈,可以继承
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,7 +48,7 @@ public class SystemLogServiceImpl implements SystemLogService {
|
|||||||
@SuppressWarnings("Duplicates")
|
@SuppressWarnings("Duplicates")
|
||||||
public PageResult<AccessLogBO> getAccessLogPage(AccessLogPageDTO accessLogPageDTO) {
|
public PageResult<AccessLogBO> getAccessLogPage(AccessLogPageDTO accessLogPageDTO) {
|
||||||
PageResult<AccessLogBO> accessLogPageBOPageResult = SystemLogConvert.INSTANCE.convertPage(
|
PageResult<AccessLogBO> accessLogPageBOPageResult = SystemLogConvert.INSTANCE.convertPage(
|
||||||
accessLogMapper.selectPage(accessLogPageDTO));
|
accessLogMapper.selectPage(accessLogPageDTO)); // TODO FROM 芋艿 to 2447007062:可以考虑直接 return,简洁 + IDEA 不告警;
|
||||||
return accessLogPageBOPageResult;
|
return accessLogPageBOPageResult;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,8 @@ public class SystemLogController {
|
|||||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||||
|
|
||||||
|
// TODO FROM 芋艿 to 2447007062:不要留这么大的空行;
|
||||||
|
// TODO FROM 芋艿 to 2447007062:使用 Request 接收参数噢;
|
||||||
AccessLogPageDTO accessLogPageDTO = new AccessLogPageDTO().setAccountId(accountId)
|
AccessLogPageDTO accessLogPageDTO = new AccessLogPageDTO().setAccountId(accountId)
|
||||||
.setPageNo(pageNo).setPageSize(pageSize);
|
.setPageNo(pageNo).setPageSize(pageSize);
|
||||||
// 查询分页
|
// 查询分页
|
||||||
|
@ -19,7 +19,7 @@ public interface AccessLogConvert {
|
|||||||
AccessLogConvert INSTANCE = Mappers.getMapper(AccessLogConvert.class);
|
AccessLogConvert INSTANCE = Mappers.getMapper(AccessLogConvert.class);
|
||||||
|
|
||||||
|
|
||||||
@Mappings({})
|
@Mappings({}) // TODO FROM 芋艿 to 2447007062:注意空行哟;另外,如果不需要专门 mapping,可以不添加该注解,嘿嘿。
|
||||||
PageResult<AccessLogPageResponse> convert(PageResult<AccessLogBO> result);
|
PageResult<AccessLogPageResponse> convert(PageResult<AccessLogBO> result);
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ package cn.iocoder.mall.user.rpc.convert.user;
|
|||||||
import cn.iocoder.mall.user.biz.bo.user.UserAddressBO;
|
import cn.iocoder.mall.user.biz.bo.user.UserAddressBO;
|
||||||
import cn.iocoder.mall.user.rpc.response.user.UserAddressResponse;
|
import cn.iocoder.mall.user.rpc.response.user.UserAddressResponse;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mappings;
|
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -17,7 +16,6 @@ public interface UserAddressRPCConvert {
|
|||||||
|
|
||||||
UserAddressRPCConvert INSTANCE = Mappers.getMapper(UserAddressRPCConvert.class);
|
UserAddressRPCConvert INSTANCE = Mappers.getMapper(UserAddressRPCConvert.class);
|
||||||
|
|
||||||
// TODO DONE FROM 芋艿 to 小范:如果不用映射,可以不用 @Mappings 哈
|
|
||||||
@Mappings({})
|
|
||||||
UserAddressResponse convert(UserAddressBO userAddressBO);
|
UserAddressResponse convert(UserAddressBO userAddressBO);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user