Merge branch 'master' of gitee.com:zhijiantianya/onemall

This commit is contained in:
benpaodeyouyusi 2020-05-10 23:38:31 +08:00
commit a00c4eb054
13 changed files with 34 additions and 23 deletions

View File

@ -3,6 +3,7 @@ package cn.iocoder.mall.product.biz.dao.product;
import cn.iocoder.mall.product.biz.dataobject.product.ProductBrandDO;
import cn.iocoder.mall.product.biz.dataobject.product.ProductCategoryDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
/**

View File

@ -1,6 +1,7 @@
package cn.iocoder.mall.product.biz.dataobject.product;
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
@ -9,6 +10,7 @@ import lombok.experimental.Accessors;
*/
@Data
@Accessors(chain = true)
@TableName("product_category")
public class ProductCategoryDO extends DeletableDO {
/**

View File

@ -5,6 +5,8 @@ import cn.iocoder.mall.product.biz.dto.category.ProductCategoryAddDTO;
import cn.iocoder.mall.product.biz.dto.category.ProductCategoryDeleteDTO;
import cn.iocoder.mall.product.biz.dto.category.ProductCategoryUpdateDTO;
import cn.iocoder.mall.product.biz.dto.category.ProductCategoryUpdateStatusDTO;
import javax.validation.Valid;
import java.util.List;
@ -26,26 +28,26 @@ public interface ProductCategoryService {
* @param productCategoryAddDTO
* @return
*/
ProductCategoryBO addProductCategory(ProductCategoryAddDTO productCategoryAddDTO);
ProductCategoryBO addProductCategory(@Valid ProductCategoryAddDTO productCategoryAddDTO);
/**
* 更新商品分类
* @param productCategoryUpdateDTO
* @return
*/
Boolean updateProductCategory(ProductCategoryUpdateDTO productCategoryUpdateDTO);
Boolean updateProductCategory(@Valid ProductCategoryUpdateDTO productCategoryUpdateDTO);
/**
* 更新商品分类状态
* @param productCategoryUpdateStatusDTO
* @return
*/
Boolean updateProductCategoryStatus(ProductCategoryUpdateStatusDTO productCategoryUpdateStatusDTO);
Boolean updateProductCategoryStatus(@Valid ProductCategoryUpdateStatusDTO productCategoryUpdateStatusDTO);
/**
* 删除商品分类
* @param productCategoryDeleteDTO
* @return
*/
Boolean deleteProductCategory(ProductCategoryDeleteDTO productCategoryDeleteDTO);
Boolean deleteProductCategory(@Valid ProductCategoryDeleteDTO productCategoryDeleteDTO);
}

View File

@ -49,7 +49,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService {
* @return
*/
@Override
public ProductCategoryBO addProductCategory(@Valid ProductCategoryAddDTO productCategoryAddDTO) {
public ProductCategoryBO addProductCategory(ProductCategoryAddDTO productCategoryAddDTO) {
// 校验父分类
validParent(productCategoryAddDTO.getPid());
// 保存到数据库
@ -69,7 +69,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService {
* @return
*/
@Override
public Boolean updateProductCategory(@Valid ProductCategoryUpdateDTO productCategoryUpdateDTO) {
public Boolean updateProductCategory(ProductCategoryUpdateDTO productCategoryUpdateDTO) {
// 校验当前分类是否存在
if (productCategoryMapper.selectById(productCategoryUpdateDTO.getId()) == null) {
throw ServiceExceptionUtil.exception(PRODUCT_CATEGORY_NOT_EXISTS);
@ -98,7 +98,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService {
* @return
*/
@Override
public Boolean updateProductCategoryStatus(@Valid ProductCategoryUpdateStatusDTO productCategoryUpdateStatusDTO) {
public Boolean updateProductCategoryStatus(ProductCategoryUpdateStatusDTO productCategoryUpdateStatusDTO) {
Integer productCategoryId = productCategoryUpdateStatusDTO.getId();
Integer status = productCategoryUpdateStatusDTO.getStatus();
// 校验商品分类是否存在
@ -128,7 +128,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService {
* @return
*/
@Override
public Boolean deleteProductCategory(@Valid ProductCategoryDeleteDTO productCategoryDeleteDTO) {
public Boolean deleteProductCategory(ProductCategoryDeleteDTO productCategoryDeleteDTO) {
Integer productCategoryId = productCategoryDeleteDTO.getId();
// 校验分类是否存在
ProductCategoryDO productCategory = productCategoryMapper.selectById(productCategoryId);
@ -148,10 +148,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService {
}
// TODO 伟帆 补充只有不存在商品才可以删除
// 标记删除商品分类
ProductCategoryDO updateProductCategory = new ProductCategoryDO()
.setId(productCategoryId);
updateProductCategory.setDeleted(DeletedStatusEnum.DELETED_YES.getValue());
productCategoryMapper.updateById(updateProductCategory);
productCategoryMapper.deleteById(productCategoryId);
// TODO 伟帆 操作日志
return true;
}

View File

@ -69,7 +69,7 @@ public class AdminsProductCategoryController {
@PostMapping("/add")
@ApiOperation(value = "创建商品分类")
public CommonResult<AdminsProductCategoryAddResponse> add(@RequestBody AdminsProductCategoryAddRequest adminsProductCategoryAddRequest) {
public CommonResult<AdminsProductCategoryAddResponse> add(AdminsProductCategoryAddRequest adminsProductCategoryAddRequest) {
// 转换 ProductCategoryAddDTO 对象
ProductCategoryAddDTO productCategoryAddDTO = ProductCategoryConvert.INSTANCE.convertToAddDTO(AdminSecurityContextHolder.getContext().getAdminId(), adminsProductCategoryAddRequest);
// 创建商品分类
@ -80,7 +80,7 @@ public class AdminsProductCategoryController {
@PostMapping("/update")
@ApiOperation(value = "更新商品分类")
public CommonResult<Boolean> update(@RequestBody AdminsProductCategoryUpdateRequest adminsProductCategoryUpdateRequest) {
public CommonResult<Boolean> update(AdminsProductCategoryUpdateRequest adminsProductCategoryUpdateRequest) {
// 创建 ProductCategoryUpdateDTO 对象
ProductCategoryUpdateDTO productCategoryUpdateDTO = ProductCategoryConvert.INSTANCE.convertToUpdateDTO(AdminSecurityContextHolder.getContext().getAdminId(), adminsProductCategoryUpdateRequest);
// 更新商品分类
@ -89,7 +89,7 @@ public class AdminsProductCategoryController {
@PostMapping("/update_status")
@ApiOperation(value = "更新商品分类状态")
public CommonResult<Boolean> updateStatus(@RequestBody AdminsProductCategoryUpdateStatusRequest adminsProductCategoryUpdateStatusRequest) {
public CommonResult<Boolean> updateStatus(AdminsProductCategoryUpdateStatusRequest adminsProductCategoryUpdateStatusRequest) {
// 创建 ProductCategoryUpdateStatusDTO 对象
ProductCategoryUpdateStatusDTO productCategoryUpdateStatusDTO = ProductCategoryConvert.INSTANCE.convertToUpdateStatusDTO(AdminSecurityContextHolder.getContext().getAdminId(),
adminsProductCategoryUpdateStatusRequest);

View File

@ -2,7 +2,7 @@
dubbo:
# Spring Cloud Alibaba Dubbo 专属配置
cloud:
subscribed-services: '' # 设置订阅的应用列表,默认为 * 订阅所有应用
subscribed-services: 'system-application' # 设置订阅的应用列表,默认为 * 订阅所有应用
# Dubbo 提供者的协议
protocol:
name: dubbo

View File

@ -4,6 +4,7 @@ import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
/**
@ -11,7 +12,7 @@ import java.util.List;
*/
@Data
@Accessors(chain = true)
public class AuthorizationCheckPermissionsRequest {
public class AuthorizationCheckPermissionsRequest implements Serializable {
@NotNull(message = "账号不能为空")
private Integer accountId;

View File

@ -4,13 +4,14 @@ import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* OAuth2 模块 - 访问令牌认证 Request
*/
@Data
@Accessors(chain = true)
public class OAuth2AccessTokenAuthenticateRequest {
public class OAuth2AccessTokenAuthenticateRequest implements Serializable {
@NotNull(message = "访问令牌不能为空")
private String accessToken;

View File

@ -4,6 +4,7 @@ import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
/**
@ -11,7 +12,7 @@ import java.util.Date;
*/
@Data
@Accessors(chain = true)
public class AccessLogAddRequest {
public class AccessLogAddRequest implements Serializable {
/**
* 用户编号 -

View File

@ -4,6 +4,7 @@ import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
/**
@ -11,7 +12,7 @@ import java.util.Date;
*/
@Data
@Accessors(chain = true)
public class ExceptionLogAddRequest {
public class ExceptionLogAddRequest implements Serializable {
/**
* 账号编号

View File

@ -3,12 +3,14 @@ package cn.iocoder.mall.system.rpc.response.admin;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* Admin 模块 - Admin 信息 Response
*/
@Data
@Accessors(chain = true)
public class AdminResponse {
public class AdminResponse implements Serializable {
/**
* 管理员编号

View File

@ -3,6 +3,7 @@ package cn.iocoder.mall.system.rpc.response.oauth2;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
@ -10,7 +11,7 @@ import java.util.Date;
*/
@Data
@Accessors(chain = true)
public class OAuth2AccessTokenResponse {
public class OAuth2AccessTokenResponse implements Serializable {
/**
* 访问令牌

View File

@ -3,12 +3,14 @@ package cn.iocoder.mall.system.rpc.response.user;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* User 模块 - User 信息 Response
*/
@Data
@Accessors(chain = true)
public class UserResponse {
public class UserResponse implements Serializable {
/**
* 用户编号