diff --git a/api/src/main/java/com/wansensoft/api/product/ProductAttributeController.java b/api/src/main/java/com/wansensoft/api/product/ProductAttributeController.java deleted file mode 100644 index 28f19665..00000000 --- a/api/src/main/java/com/wansensoft/api/product/ProductAttributeController.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2023-2033 WanSen AI Team, Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance - * with the License. A copy of the License is located at - * - * http://opensource.wansenai.com/apache2.0/ - * - * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES - * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions - * and limitations under the License. - */ -package com.wansensoft.api.product; - -import org.springframework.web.bind.annotation.RequestMapping; - -import org.springframework.web.bind.annotation.RestController; - -/** - *

- * 产品属性表 前端控制器 - *

- * - * @author James Zow - * @since 2023-09-05 - */ -@RestController -@RequestMapping("/product-attribute") -public class ProductAttributeController { - -} diff --git a/api/src/main/java/com/wansensoft/api/product/ProductAttributeController.kt b/api/src/main/java/com/wansensoft/api/product/ProductAttributeController.kt new file mode 100644 index 00000000..f5f86cc3 --- /dev/null +++ b/api/src/main/java/com/wansensoft/api/product/ProductAttributeController.kt @@ -0,0 +1,35 @@ +package com.wansensoft.api.product + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page +import com.wansensoft.dto.product.AddOrUpdateProductAttributeDTO +import com.wansensoft.dto.product.ProductAttributeQueryDTO +import com.wansensoft.service.product.ProductAttributeService +import com.wansensoft.utils.response.Response +import com.wansensoft.vo.product.ProductAttributeVO +import org.springframework.web.bind.annotation.DeleteMapping +import org.springframework.web.bind.annotation.GetMapping +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.RequestParam +import org.springframework.web.bind.annotation.RestController + +@RestController +@RequestMapping("/product/attribute") +class ProductAttributeController(private val productAttributeService: ProductAttributeService) { + + @PostMapping("/list") + fun productAttributeList(@RequestBody productAttributeQueryDTO: ProductAttributeQueryDTO): Response> { + return productAttributeService.productAttributeList(productAttributeQueryDTO) + } + + @PostMapping("/addOrUpdate") + fun addOrUpdateProductAttribute(@RequestBody productAttributeDTO: AddOrUpdateProductAttributeDTO): Response { + return productAttributeService.addOrUpdateProductAttribute(productAttributeDTO) + } + + @DeleteMapping("/deleteBatch") + fun deleteProductAttribute(@RequestParam ids: List): Response { + return productAttributeService.batchDeleteProductAttribute(ids) + } +} \ No newline at end of file diff --git a/api/src/main/java/com/wansensoft/api/product/ProductCategoryController.kt b/api/src/main/java/com/wansensoft/api/product/ProductCategoryController.kt index f84d45c9..f0cb9202 100644 --- a/api/src/main/java/com/wansensoft/api/product/ProductCategoryController.kt +++ b/api/src/main/java/com/wansensoft/api/product/ProductCategoryController.kt @@ -3,7 +3,7 @@ package com.wansensoft.api.product import com.wansensoft.dto.product.AddOrUpdateProductCategoryDTO import com.wansensoft.service.product.ProductCategoryService import com.wansensoft.utils.response.Response -import com.wansensoft.vo.ProductCategoryVO +import com.wansensoft.vo.product.ProductCategoryVO import org.springframework.web.bind.annotation.GetMapping import org.springframework.web.bind.annotation.PostMapping import org.springframework.web.bind.annotation.RequestBody diff --git a/domain/src/main/java/com/wansensoft/dto/product/AddOrUpdateProductAttributeDTO.kt b/domain/src/main/java/com/wansensoft/dto/product/AddOrUpdateProductAttributeDTO.kt new file mode 100644 index 00000000..39d006c6 --- /dev/null +++ b/domain/src/main/java/com/wansensoft/dto/product/AddOrUpdateProductAttributeDTO.kt @@ -0,0 +1,17 @@ +package com.wansensoft.dto.product + +import lombok.Data + +@Data +class AddOrUpdateProductAttributeDTO { + + var id : Long? = null + + var attributeName: String? = null + + var attributeValue: String? = null + + var remark: String? = null + + var sort: String? = null +} \ No newline at end of file diff --git a/domain/src/main/java/com/wansensoft/dto/product/ProductAttributeQueryDTO.kt b/domain/src/main/java/com/wansensoft/dto/product/ProductAttributeQueryDTO.kt new file mode 100644 index 00000000..98312a57 --- /dev/null +++ b/domain/src/main/java/com/wansensoft/dto/product/ProductAttributeQueryDTO.kt @@ -0,0 +1,10 @@ +package com.wansensoft.dto.product + +import com.wansensoft.dto.PageSizeDTO +import lombok.Data + +@Data +class ProductAttributeQueryDTO : PageSizeDTO() { + + val attributeName: String? = null +} \ No newline at end of file diff --git a/domain/src/main/java/com/wansensoft/entities/product/ProductAttribute.java b/domain/src/main/java/com/wansensoft/entities/product/ProductAttribute.java index a76d349d..90a976ba 100644 --- a/domain/src/main/java/com/wansensoft/entities/product/ProductAttribute.java +++ b/domain/src/main/java/com/wansensoft/entities/product/ProductAttribute.java @@ -52,6 +52,16 @@ public class ProductAttribute implements Serializable { */ private String attributeValue; + /** + * 备注 + */ + private String remark; + + /** + * 排序 + */ + private Integer sort; + /** * 创建时间 */ @@ -75,7 +85,7 @@ public class ProductAttribute implements Serializable { /** * 删除标记,0未删除,1删除 */ - private Boolean deleteFlag; + private Integer deleteFlag; } diff --git a/domain/src/main/java/com/wansensoft/vo/product/ProductAttributeVO.kt b/domain/src/main/java/com/wansensoft/vo/product/ProductAttributeVO.kt new file mode 100644 index 00000000..edb0ee2a --- /dev/null +++ b/domain/src/main/java/com/wansensoft/vo/product/ProductAttributeVO.kt @@ -0,0 +1,23 @@ +package com.wansensoft.vo.product + +import com.fasterxml.jackson.annotation.JsonFormat +import lombok.Data +import java.time.LocalDateTime + +@Data +class ProductAttributeVO { + + @JsonFormat(shape = JsonFormat.Shape.STRING) + var id : Long? = null + + var attributeName: String? = null + + var attributeValue: String? = null + + var remark: String? = null + + var sort: Int? = null + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + var createTime: LocalDateTime? = null +} \ No newline at end of file diff --git a/domain/src/main/java/com/wansensoft/vo/ProductCategoryVO.java b/domain/src/main/java/com/wansensoft/vo/product/ProductCategoryVO.java similarity index 97% rename from domain/src/main/java/com/wansensoft/vo/ProductCategoryVO.java rename to domain/src/main/java/com/wansensoft/vo/product/ProductCategoryVO.java index cd46a6a9..d4fe9bdd 100644 --- a/domain/src/main/java/com/wansensoft/vo/ProductCategoryVO.java +++ b/domain/src/main/java/com/wansensoft/vo/product/ProductCategoryVO.java @@ -10,7 +10,7 @@ * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ -package com.wansensoft.vo; +package com.wansensoft.vo.product; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.AllArgsConstructor; diff --git a/service/src/main/java/com/wansensoft/service/product/IProductAttributeService.java b/service/src/main/java/com/wansensoft/service/product/IProductAttributeService.java deleted file mode 100644 index 542bb800..00000000 --- a/service/src/main/java/com/wansensoft/service/product/IProductAttributeService.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2023-2033 WanSen AI Team, Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance - * with the License. A copy of the License is located at - * - * http://opensource.wansenai.com/apache2.0/ - * - * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES - * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions - * and limitations under the License. - */ -package com.wansensoft.service.product; - -import com.wansensoft.entities.product.ProductAttribute; -import com.baomidou.mybatisplus.extension.service.IService; - -/** - *

- * 产品属性表 服务类 - *

- */ -public interface IProductAttributeService extends IService { - -} diff --git a/service/src/main/java/com/wansensoft/service/product/ProductAttributeService.kt b/service/src/main/java/com/wansensoft/service/product/ProductAttributeService.kt new file mode 100644 index 00000000..2a746d01 --- /dev/null +++ b/service/src/main/java/com/wansensoft/service/product/ProductAttributeService.kt @@ -0,0 +1,30 @@ +/* + * Copyright 2023-2033 WanSen AI Team, Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance + * with the License. A copy of the License is located at + * + * http://opensource.wansenai.com/apache2.0/ + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES + * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ +package com.wansensoft.service.product + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page +import com.baomidou.mybatisplus.extension.service.IService +import com.wansensoft.dto.product.AddOrUpdateProductAttributeDTO +import com.wansensoft.dto.product.ProductAttributeQueryDTO +import com.wansensoft.entities.product.ProductAttribute +import com.wansensoft.utils.response.Response +import com.wansensoft.vo.product.ProductAttributeVO + +interface ProductAttributeService : IService { + + fun productAttributeList(productAttributeQuery : ProductAttributeQueryDTO?) : Response> + + fun addOrUpdateProductAttribute(productAttributeAddOrUpdate: AddOrUpdateProductAttributeDTO?) : Response + + fun batchDeleteProductAttribute(ids: List?) : Response +} \ No newline at end of file diff --git a/service/src/main/java/com/wansensoft/service/product/ProductCategoryService.kt b/service/src/main/java/com/wansensoft/service/product/ProductCategoryService.kt index 76016811..d7e21fb9 100644 --- a/service/src/main/java/com/wansensoft/service/product/ProductCategoryService.kt +++ b/service/src/main/java/com/wansensoft/service/product/ProductCategoryService.kt @@ -16,7 +16,7 @@ import com.baomidou.mybatisplus.extension.service.IService import com.wansensoft.dto.product.AddOrUpdateProductCategoryDTO import com.wansensoft.entities.product.ProductCategory import com.wansensoft.utils.response.Response -import com.wansensoft.vo.ProductCategoryVO +import com.wansensoft.vo.product.ProductCategoryVO interface ProductCategoryService : IService { diff --git a/service/src/main/java/com/wansensoft/service/product/impl/ProductAttributeServiceImpl.java b/service/src/main/java/com/wansensoft/service/product/impl/ProductAttributeServiceImpl.java deleted file mode 100644 index 753d8cff..00000000 --- a/service/src/main/java/com/wansensoft/service/product/impl/ProductAttributeServiceImpl.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2023-2033 WanSen AI Team, Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance - * with the License. A copy of the License is located at - * - * http://opensource.wansenai.com/apache2.0/ - * - * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES - * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions - * and limitations under the License. - */ -package com.wansensoft.service.product.impl; - -import com.wansensoft.service.product.IProductAttributeService; -import com.wansensoft.entities.product.ProductAttribute; -import com.wansensoft.mappers.product.ProductAttributeMapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; - -/** - *

- * 产品属性表 服务实现类 - *

- */ -@Service -public class ProductAttributeServiceImpl extends ServiceImpl implements IProductAttributeService { - -} diff --git a/service/src/main/java/com/wansensoft/service/product/impl/ProductAttributeServiceImpl.kt b/service/src/main/java/com/wansensoft/service/product/impl/ProductAttributeServiceImpl.kt new file mode 100644 index 00000000..fa5b9955 --- /dev/null +++ b/service/src/main/java/com/wansensoft/service/product/impl/ProductAttributeServiceImpl.kt @@ -0,0 +1,129 @@ +/* + * Copyright 2023-2033 WanSen AI Team, Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance + * with the License. A copy of the License is located at + * + * http://opensource.wansenai.com/apache2.0/ + * + * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES + * OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. + */ +package com.wansensoft.service.product.impl + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper +import com.baomidou.mybatisplus.extension.plugins.pagination.Page +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl +import com.wansensoft.dto.product.AddOrUpdateProductAttributeDTO +import com.wansensoft.dto.product.ProductAttributeQueryDTO +import com.wansensoft.entities.product.ProductAttribute +import com.wansensoft.mappers.product.ProductAttributeMapper +import com.wansensoft.service.product.ProductAttributeService +import com.wansensoft.service.user.ISysUserService +import com.wansensoft.utils.constants.CommonConstants +import com.wansensoft.utils.enums.BaseCodeEnum +import com.wansensoft.utils.enums.ProdcutCodeEnum +import com.wansensoft.utils.response.Response +import com.wansensoft.vo.product.ProductAttributeVO +import org.springframework.beans.BeanUtils +import org.springframework.stereotype.Service +import java.time.LocalDateTime + +@Service +open class ProductAttributeServiceImpl( + private val productAttributeMapper: ProductAttributeMapper, + private val userService: ISysUserService +):ServiceImpl(), ProductAttributeService { + + override fun productAttributeList(productAttributeQuery : ProductAttributeQueryDTO?): Response> { + val page = productAttributeQuery?.let { Page(it.page, it.pageSize) } + val wrapper = LambdaQueryWrapper().apply() { + productAttributeQuery?.attributeName?.let { like(ProductAttribute::getAttributeName, it) } + eq(ProductAttribute::getDeleteFlag, CommonConstants.NOT_DELETED) + } + + val result = page?.run { + productAttributeMapper.selectPage(this, wrapper) + if (records.isNotEmpty()) { + val listVo = records.map { attribute -> + ProductAttributeVO().apply { + BeanUtils.copyProperties(attribute, this) + } + } + Page().apply { + records = listVo + total = this@run.total + pages = this@run.pages + size = this@run.size + } + + } else { + Page() + } + }?: Page() + + return Response.responseData(result) + } + + override fun addOrUpdateProductAttribute(productAttributeAddOrUpdate: AddOrUpdateProductAttributeDTO?): Response { + productAttributeAddOrUpdate?.run { + val attribute = ProductAttribute().apply { + BeanUtils.copyProperties(this@run, this) + } + val userId = userService.currentUserId + when (attribute.id) { + null -> { + val wrapper = createWrapper(attribute) + val count = getCount(wrapper) + if (count > 0) { + return Response.responseMsg(ProdcutCodeEnum.PRODUCT_ATTRIBUTE_NAME_EXIST) + } + attribute.createTime = LocalDateTime.now() + attribute.createBy = userId + val saveResult = saveAttribute(attribute) + if (saveResult == 0) { + return Response.responseMsg(ProdcutCodeEnum.ADD_PRODUCT_ATTRIBUTE_ERROR) + } + return Response.responseMsg(ProdcutCodeEnum.ADD_PRODUCT_ATTRIBUTE_SUCCESS) + } + else -> { + val wrapper = createWrapper(attribute).ne(ProductAttribute::getId, attribute.id) + val count = getCount(wrapper) + if (count > 0) { + return Response.responseMsg(ProdcutCodeEnum.PRODUCT_ATTRIBUTE_NAME_EXIST) + } + attribute.updateBy = userId + attribute.updateTime = LocalDateTime.now() + val updateResult = updateAttribute(attribute) + if (updateResult == 0) { + return Response.responseMsg(ProdcutCodeEnum.UPDATE_PRODUCT_ATTRIBUTE_ERROR) + } + return Response.responseMsg(ProdcutCodeEnum.UPDATE_PRODUCT_ATTRIBUTE_SUCCESS) + } + } + } ?: return Response.responseMsg(BaseCodeEnum.PARAMETER_NULL) + } + + private fun createWrapper(attribute: ProductAttribute) = LambdaQueryWrapper().apply { + eq(ProductAttribute::getAttributeName, attribute.attributeName) + eq(ProductAttribute::getDeleteFlag, CommonConstants.NOT_DELETED) + } + + private fun getCount(wrapper: LambdaQueryWrapper) = productAttributeMapper.selectCount(wrapper) + + private fun saveAttribute(attribute: ProductAttribute) = productAttributeMapper.insert(attribute) + + private fun updateAttribute(attribute: ProductAttribute) = productAttributeMapper.updateById(attribute) + + override fun batchDeleteProductAttribute(ids: List?): Response { + // Change the status from unmodified to physically deleted data + ids?.let { + val deleteResult = productAttributeMapper.deleteBatchIds(ids) + if(deleteResult == 0) { + return Response.responseMsg(ProdcutCodeEnum.DELETE_PRODUCT_ATTRIBUTE_ERROR) + } + return Response.responseMsg(ProdcutCodeEnum.DELETE_PRODUCT_ATTRIBUTE_SUCCESS) + }?: return Response.responseMsg(BaseCodeEnum.PARAMETER_NULL) + } +} \ No newline at end of file diff --git a/service/src/main/java/com/wansensoft/service/product/impl/ProductCategoryServiceImpl.kt b/service/src/main/java/com/wansensoft/service/product/impl/ProductCategoryServiceImpl.kt index 6600944a..5a0fa606 100644 --- a/service/src/main/java/com/wansensoft/service/product/impl/ProductCategoryServiceImpl.kt +++ b/service/src/main/java/com/wansensoft/service/product/impl/ProductCategoryServiceImpl.kt @@ -12,7 +12,6 @@ */ package com.wansensoft.service.product.impl -import com.baomidou.mybatisplus.core.conditions.Wrapper import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl import com.wansensoft.dto.product.AddOrUpdateProductCategoryDTO import com.wansensoft.entities.product.ProductCategory @@ -24,7 +23,7 @@ import com.wansensoft.utils.constants.CommonConstants import com.wansensoft.utils.enums.BaseCodeEnum import com.wansensoft.utils.enums.ProdcutCodeEnum import com.wansensoft.utils.response.Response -import com.wansensoft.vo.ProductCategoryVO +import com.wansensoft.vo.product.ProductCategoryVO import org.springframework.beans.BeanUtils import org.springframework.stereotype.Service import org.springframework.util.StringUtils diff --git a/service/src/main/java/com/wansensoft/service/system/impl/SysMenuServiceImpl.kt b/service/src/main/java/com/wansensoft/service/system/impl/SysMenuServiceImpl.kt index ab92f6a0..fa4dc138 100644 --- a/service/src/main/java/com/wansensoft/service/system/impl/SysMenuServiceImpl.kt +++ b/service/src/main/java/com/wansensoft/service/system/impl/SysMenuServiceImpl.kt @@ -125,12 +125,8 @@ open class SysMenuServiceImpl( val menuData = JSONObject() val menuVos = ArrayList() - val userId = userService.getCurrentUserId() - if (!StringUtils.hasText(userId)) { - return Response.fail() - } - - val roleIds = userRoleRelService.queryByUserId(userId.toLong()) + val userId = userService.getCurrentUserId() ?: return Response.fail() + val roleIds = userRoleRelService.queryByUserId(userId) .map { it.roleId } if (roleIds.isNotEmpty()) { diff --git a/service/src/main/java/com/wansensoft/service/user/ISysUserService.java b/service/src/main/java/com/wansensoft/service/user/ISysUserService.java index b1ae5a43..d15990e4 100644 --- a/service/src/main/java/com/wansensoft/service/user/ISysUserService.java +++ b/service/src/main/java/com/wansensoft/service/user/ISysUserService.java @@ -42,9 +42,9 @@ public interface ISysUserService extends IService { UserInfoVO getCurrentUser(); - String getCurrentUserId(); + Long getCurrentUserId(); - String getCurrentTenantId(); + Long getCurrentTenantId(); String getCurrentUserName(); diff --git a/service/src/main/java/com/wansensoft/service/user/impl/SysUserServiceImpl.java b/service/src/main/java/com/wansensoft/service/user/impl/SysUserServiceImpl.java index 543af09c..0f8f8d9b 100644 --- a/service/src/main/java/com/wansensoft/service/user/impl/SysUserServiceImpl.java +++ b/service/src/main/java/com/wansensoft/service/user/impl/SysUserServiceImpl.java @@ -380,15 +380,15 @@ public UserInfoVO getCurrentUser() { } @Override - public String getCurrentUserId() { + public Long getCurrentUserId() { var token = httpServletRequestContextToken(); - return redisUtil.getString(token + ":userId"); + return Long.parseLong(redisUtil.getString(token + ":userId")); } @Override - public String getCurrentTenantId() { + public Long getCurrentTenantId() { var token = httpServletRequestContextToken(); - return redisUtil.getString(token + ":tenantId"); + return Long.parseLong(redisUtil.getString(token + ":tenantId")); } @Override @@ -401,7 +401,7 @@ public String getCurrentUserName() { public Response> userRole() { var userRoleVos = new ArrayList(); - var userId = Long.parseLong(getCurrentUserId()); + var userId = getCurrentUserId(); var ids = userRoleRelService.queryByUserId(userId).stream() .map(SysUserRoleRel::getRoleId).toList(); if (ids.isEmpty()) { @@ -565,8 +565,8 @@ private boolean addUserRoleRelations(Long userId, List roleIds) { .id(SnowflakeIdUtil.nextId()) .roleId(roleId) .userId(userId) - .tenantId(Long.parseLong(getCurrentTenantId())) - .createBy(Long.parseLong(getCurrentUserId())) + .tenantId(getCurrentTenantId()) + .createBy(getCurrentUserId()) .createTime(LocalDateTime.now()) .build(); userRoleReals.add(userRoleRel); @@ -581,8 +581,8 @@ private boolean addUserDeptRelations(Long userId, List deptIds) { .id(SnowflakeIdUtil.nextId()) .deptId(deptId) .userId(userId) - .tenantId(Long.parseLong(getCurrentTenantId())) - .createBy(Long.parseLong(getCurrentUserId())) + .tenantId(getCurrentTenantId()) + .createBy(getCurrentUserId()) .createTime(LocalDateTime.now()) .build(); userDeptReals.add(userDeptRel); @@ -660,10 +660,10 @@ public Response addOrUpdate(AddOrUpdateUserDTO addOrUpdateUserDTO) { .name(addOrUpdateUserDTO.getName()) .phoneNumber(addOrUpdateUserDTO.getPhoneNumber()) .email(addOrUpdateUserDTO.getEmail()) - .createBy(Long.parseLong(getCurrentUserId())) + .createBy(getCurrentUserId()) .createTime(LocalDateTime.now()) .description(addOrUpdateUserDTO.getRemake()) - .tenantId(Long.parseLong(getCurrentTenantId())) + .tenantId(getCurrentTenantId()) .build(); var saveUserResult = save(user); diff --git a/utils/src/main/java/com/wansensoft/utils/enums/ProdcutCodeEnum.java b/utils/src/main/java/com/wansensoft/utils/enums/ProdcutCodeEnum.java index f5eafce8..7b376888 100644 --- a/utils/src/main/java/com/wansensoft/utils/enums/ProdcutCodeEnum.java +++ b/utils/src/main/java/com/wansensoft/utils/enums/ProdcutCodeEnum.java @@ -5,17 +5,33 @@ @Getter public enum ProdcutCodeEnum { - ADD_PRODUCT_CATEGORY_SUCCESS("P0000", "添加产品分类成功"), + ADD_PRODUCT_CATEGORY_SUCCESS("P0000", "添加商品分类成功"), - ADD_PRODUCT_CATEGORY_ERROR("P0500", "添加产品分类失败"), + ADD_PRODUCT_CATEGORY_ERROR("P0500", "添加商品分类失败"), - UPDATE_PRODUCT_CATEGORY_SUCCESS("P0001", "修改产品分类成功"), + UPDATE_PRODUCT_CATEGORY_SUCCESS("P0001", "修改商品分类成功"), - UPDATE_PRODUCT_CATEGORY_ERROR("P0501", "修改产品分类失败"), + UPDATE_PRODUCT_CATEGORY_ERROR("P0501", "修改商品分类失败"), - DELETE_PRODUCT_CATEGORY_SUCCESS("P0002", "删除产品分类成功"), + DELETE_PRODUCT_CATEGORY_SUCCESS("P0002", "删除商品分类成功"), + + DELETE_PRODUCT_CATEGORY_ERROR("P0502", "删除商品分类失败"), + + // Product Attribute Code + PRODUCT_ATTRIBUTE_NAME_EXIST("P0506", "商品属性名称已存在"), + + ADD_PRODUCT_ATTRIBUTE_SUCCESS("P0003", "添加商品属性成功"), + + ADD_PRODUCT_ATTRIBUTE_ERROR("P0503", "添加商品属性失败"), + + UPDATE_PRODUCT_ATTRIBUTE_SUCCESS("P0004", "修改商品属性成功"), + + UPDATE_PRODUCT_ATTRIBUTE_ERROR("P0504", "修改商品属性失败"), + + DELETE_PRODUCT_ATTRIBUTE_SUCCESS("P0005", "删除商品属性成功"), + + DELETE_PRODUCT_ATTRIBUTE_ERROR("P0505", "删除商品属性失败"); - DELETE_PRODUCT_CATEGORY_ERROR("P0502", "删除产品分类失败"); private final String code;