From 47ab7756d736ba1a8d650dd64349299b4ed12337 Mon Sep 17 00:00:00 2001 From: delicacylee Date: Sun, 13 Aug 2023 22:25:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E5=9F=BA=E7=A1=80?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=B7=B2=E5=AE=8C=E6=88=90=EF=BC=8C=E8=BF=98?= =?UTF-8?q?=E6=9C=89=E4=B8=80=E4=BA=9BBUG=E9=9C=80=E8=A6=81=E5=A4=84?= =?UTF-8?q?=E7=90=86=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application.yml | 3 +- .../hiver/core/base/HiverBaseMallEntity.java | 2 +- .../core/common/constant/MallConstant.java | 5 + .../cc/hiver/core/vo/thorui/SelectVo.java | 22 +++ .../java/cc/hiver/core/vo/thorui/TreeVo.java | 58 ++++++ .../controller/admin/CompanyController.java | 2 +- .../main/java/cc/hiver/app/entity/Shop.java | 17 ++ .../src/main/resources/mapper/ShopMapper.xml | 2 +- .../mall/controller/CommonController.java | 10 +- .../controller/CustomAddressController.java | 24 ++- .../mall/controller/GoodsBrandController.java | 61 ++++-- .../mall/controller/GoodsCartController.java | 25 +-- .../controller/GoodsCategoryController.java | 41 +++- .../mall/controller/GoodsController.java | 32 +-- .../hiver/mall/controller/MallController.java | 142 ++++++++++---- .../mall/controller/SalesOrderController.java | 185 ++++++++++++++++++ .../mall/controller/SupplierControlller.java | 85 ++++++++ .../java/cc/hiver/mall/dao/GoodsBrandDao.java | 3 + .../main/java/cc/hiver/mall/dao/MallDao.java | 7 - .../java/cc/hiver/mall/dao/SalesOrderDao.java | 1 + .../cc/hiver/mall/dao/SalesOrderItemDao.java | 3 + .../java/cc/hiver/mall/dao/ShopUserDao.java | 8 + .../java/cc/hiver/mall/dao/SupplierDao.java | 7 + .../java/cc/hiver/mall/dao/UserMallDao.java | 8 - .../cc/hiver/mall/dao/mapper/MallMapper.java | 23 ++- .../cc/hiver/mall/entity/CustomAddress.java | 6 +- .../main/java/cc/hiver/mall/entity/Goods.java | 4 +- .../main/java/cc/hiver/mall/entity/Mall.java | 45 ----- .../java/cc/hiver/mall/entity/PopularUrl.java | 2 +- .../java/cc/hiver/mall/entity/SalesOrder.java | 7 +- .../cc/hiver/mall/entity/SalesOrderItem.java | 23 ++- .../java/cc/hiver/mall}/entity/ShopUser.java | 6 +- .../java/cc/hiver/mall/entity/Supplier.java | 44 +++++ .../java/cc/hiver/mall/entity/UserMall.java | 31 --- .../cc/hiver/mall/pojo/dto/CartItemDTO.java | 39 ++-- .../cc/hiver/mall/pojo/dto/GoodsStockDto.java | 6 + .../cc/hiver/mall/pojo/form/GoodsForm.java | 2 +- .../hiver/mall/pojo/form/SalesOrderForm.java | 43 ++++ .../query/CustomAddressQueryCriteria.java | 2 +- .../hiver/mall/pojo/query/GoodsPageQuery.java | 8 +- .../pojo/query/SalesOrderQueryCriteria.java | 22 +++ .../pojo/query/SupplierQueryCriteria.java | 18 ++ .../cc/hiver/mall/pojo/vo/GoodsPageVO.java | 2 + .../java/cc/hiver/mall/pojo/vo/QueryVo.java | 15 ++ .../cc/hiver/mall/pojo/vo/SalesOrderVo.java | 23 +++ .../cc/hiver/mall/service/CartService.java | 14 +- .../hiver/mall/service/GoodsBrandService.java | 6 +- .../cc/hiver/mall/service/MallService.java | 7 - .../mall/service/SalesOrderItemService.java | 3 + .../hiver/mall/service/SalesOrderService.java | 6 + .../hiver/mall/service/ShopUserService.java | 8 + .../hiver/mall/service/SupplierService.java | 11 ++ .../hiver/mall/service/UserMallService.java | 8 - .../service/mybatis/GoodsCategoryService.java | 7 +- .../mall/service/mybatis/IMallService.java | 23 ++- .../mall/serviceimpl/CartServiceImpl.java | 99 +++++----- .../serviceimpl/GoodsBrandServiceImpl.java | 29 +-- .../mall/serviceimpl/MallServiceImpl.java | 23 --- .../SalesOrderItemServiceImpl.java | 7 + .../serviceimpl/SalesOrderServiceImpl.java | 15 ++ .../mall/serviceimpl/ShopUserServiceImpl.java | 28 +++ .../mall/serviceimpl/SupplierServiceImpl.java | 33 ++++ .../mall/serviceimpl/UserMallServiceImpl.java | 28 --- .../mybatis/GoodsCategoryServiceImpl.java | 48 ++++- .../serviceimpl/mybatis/GoodsServiceImpl.java | 8 +- .../mybatis/GoodsStockServiceImpl.java | 12 +- .../serviceimpl/mybatis/IMallServiceImpl.java | 17 +- .../src/main/resources/mapper/GoodsMapper.xml | 35 +++- .../resources/mapper/GoodsStockMapper.xml | 20 +- .../src/main/resources/mapper/MallMapper.xml | 18 +- 70 files changed, 1221 insertions(+), 416 deletions(-) create mode 100644 hiver-core/src/main/java/cc/hiver/core/vo/thorui/SelectVo.java create mode 100644 hiver-core/src/main/java/cc/hiver/core/vo/thorui/TreeVo.java create mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/SalesOrderController.java create mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/SupplierControlller.java delete mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/MallDao.java create mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/ShopUserDao.java create mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/SupplierDao.java delete mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/UserMallDao.java delete mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Mall.java rename hiver-modules/{hiver-app/src/main/java/cc/hiver/app => hiver-mall/src/main/java/cc/hiver/mall}/entity/ShopUser.java (83%) create mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Supplier.java delete mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/UserMall.java create mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/form/SalesOrderForm.java create mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/query/SalesOrderQueryCriteria.java create mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/query/SupplierQueryCriteria.java create mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/QueryVo.java create mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/SalesOrderVo.java delete mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/MallService.java create mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/ShopUserService.java create mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/SupplierService.java delete mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/UserMallService.java delete mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/MallServiceImpl.java create mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/ShopUserServiceImpl.java create mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/SupplierServiceImpl.java delete mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/UserMallServiceImpl.java diff --git a/hiver-admin/src/main/resources/application.yml b/hiver-admin/src/main/resources/application.yml index 3268d6d7..944a6655 100644 --- a/hiver-admin/src/main/resources/application.yml +++ b/hiver-admin/src/main/resources/application.yml @@ -65,8 +65,9 @@ spring: # Redis 若设有密码自行添加配置password redis: host: 154.8.162.157 + # host: 127.0.0.1 # 数据库索引 默认0 - database: 1 + database: 0 port: 6379 # 超时时间 Duration类型 3秒 timeout: 3S diff --git a/hiver-core/src/main/java/cc/hiver/core/base/HiverBaseMallEntity.java b/hiver-core/src/main/java/cc/hiver/core/base/HiverBaseMallEntity.java index 00f747a1..bc489313 100644 --- a/hiver-core/src/main/java/cc/hiver/core/base/HiverBaseMallEntity.java +++ b/hiver-core/src/main/java/cc/hiver/core/base/HiverBaseMallEntity.java @@ -35,7 +35,7 @@ public abstract class HiverBaseMallEntity implements Serializable { private String id = SnowFlakeUtil.nextId().toString(); @ApiModelProperty("店铺id") - private String mallId; + private String shopId; @ApiModelProperty("办公区域") private String region; diff --git a/hiver-core/src/main/java/cc/hiver/core/common/constant/MallConstant.java b/hiver-core/src/main/java/cc/hiver/core/common/constant/MallConstant.java index 7fd4524b..84e5aa93 100644 --- a/hiver-core/src/main/java/cc/hiver/core/common/constant/MallConstant.java +++ b/hiver-core/src/main/java/cc/hiver/core/common/constant/MallConstant.java @@ -45,4 +45,9 @@ public interface MallConstant { * 会员购物车缓存KEY前缀 */ String MEMBER_CART_PREFIX = "MEMBER:CART:"; + + /** + * 订单前缀 + */ + String ORDER_PREFIX = "XD"; } diff --git a/hiver-core/src/main/java/cc/hiver/core/vo/thorui/SelectVo.java b/hiver-core/src/main/java/cc/hiver/core/vo/thorui/SelectVo.java new file mode 100644 index 00000000..d98667f7 --- /dev/null +++ b/hiver-core/src/main/java/cc/hiver/core/vo/thorui/SelectVo.java @@ -0,0 +1,22 @@ +package cc.hiver.core.vo.thorui; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +@ApiModel("tui-select模型") +@Data +@NoArgsConstructor +public class SelectVo { + public SelectVo(String text, String value) { + this.text = text; + this.value = value; + } + + @ApiModelProperty("选项键名") + private String text; + + @ApiModelProperty("选项键值") + private String value; +} diff --git a/hiver-core/src/main/java/cc/hiver/core/vo/thorui/TreeVo.java b/hiver-core/src/main/java/cc/hiver/core/vo/thorui/TreeVo.java new file mode 100644 index 00000000..944df898 --- /dev/null +++ b/hiver-core/src/main/java/cc/hiver/core/vo/thorui/TreeVo.java @@ -0,0 +1,58 @@ +package cc.hiver.core.vo.thorui; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +@ApiModel("tui-tree-view模型") +@Data +@NoArgsConstructor +public class TreeVo { + public TreeVo(String text, String value) { + this.text = text; + this.value = value; + } + + public TreeVo(String text, String value, String src) { + this.text = text; + this.value = value; + } + + public TreeVo(String text, String value, List children) { + this.text = text; + this.value = value; + } + + public TreeVo(String text, String value, String src, List children) { + this.text = text; + this.value = value; + this.children = children; + } + + public TreeVo(String text, String value, String src, Boolean collapsed, List children) { + this.text = text; + this.value = value; + this.collapsed = collapsed; + this.children = children; + } + + @ApiModelProperty("键名") + private String text; + + @ApiModelProperty("键值") + private String value; + + @ApiModelProperty(value = "图片") + private String src; + + @ApiModelProperty(value = "是否打开") + private Boolean collapsed = false; + + @ApiModelProperty(value = "子项") + @JsonInclude(value = JsonInclude.Include.NON_EMPTY) + private List children; +} diff --git a/hiver-modules/hiver-app/src/main/java/cc/hiver/app/controller/admin/CompanyController.java b/hiver-modules/hiver-app/src/main/java/cc/hiver/app/controller/admin/CompanyController.java index 280a0126..b35639d8 100644 --- a/hiver-modules/hiver-app/src/main/java/cc/hiver/app/controller/admin/CompanyController.java +++ b/hiver-modules/hiver-app/src/main/java/cc/hiver/app/controller/admin/CompanyController.java @@ -35,7 +35,7 @@ import java.util.List; */ @Slf4j @RestController -@Api(tags = "供应商接口") +@Api(tags = "公司接口") @RequestMapping(value = "/hiver/app/company/") public class CompanyController { @Autowired diff --git a/hiver-modules/hiver-app/src/main/java/cc/hiver/app/entity/Shop.java b/hiver-modules/hiver-app/src/main/java/cc/hiver/app/entity/Shop.java index ee6261c1..3a6dcfec 100644 --- a/hiver-modules/hiver-app/src/main/java/cc/hiver/app/entity/Shop.java +++ b/hiver-modules/hiver-app/src/main/java/cc/hiver/app/entity/Shop.java @@ -16,6 +16,8 @@ limitations under the License. package cc.hiver.app.entity; import cc.hiver.core.base.HiverBaseEntity; +import cc.hiver.core.vo.UserVo; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -25,6 +27,8 @@ import org.hibernate.annotations.DynamicUpdate; import javax.persistence.Entity; import javax.persistence.Table; +import javax.persistence.Transient; +import java.util.List; /** * 店铺实体类 @@ -76,4 +80,17 @@ public class Shop extends HiverBaseEntity { @ApiModelProperty(value = "是否默认商铺") private Integer defaulted; + + @ApiModelProperty(value = "所属区域") + private String region; + + @Transient + @TableField(exist = false) + @ApiModelProperty(value = "店员列表") + private String clerks; + + @Transient + @TableField(exist = false) + @ApiModelProperty(value = "店铺对应店员") + private List users; } diff --git a/hiver-modules/hiver-app/src/main/resources/mapper/ShopMapper.xml b/hiver-modules/hiver-app/src/main/resources/mapper/ShopMapper.xml index ab230ae1..bbe19947 100644 --- a/hiver-modules/hiver-app/src/main/resources/mapper/ShopMapper.xml +++ b/hiver-modules/hiver-app/src/main/resources/mapper/ShopMapper.xml @@ -5,7 +5,7 @@ SELECT DISTINCT m.* FROM t_shop m LEFT JOIN t_shop_user um ON m.id = um.shop_id - WHERE um.user_id = #{userId} AND m.status = 0 + WHERE m.status = 0 AND (um.user_id = #{userId} OR m.shop_owner_id = #{userId} OR m.shop_manger_id = #{userId}) ORDER BY m.defaulted DESC \ No newline at end of file diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CommonController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CommonController.java index 151c7742..86ec9a37 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CommonController.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CommonController.java @@ -12,6 +12,7 @@ import cc.hiver.core.common.vo.SearchVo; import cc.hiver.core.entity.*; import cc.hiver.core.service.UserService; import cc.hiver.mall.pojo.vo.MallUserVo; +import cn.hutool.core.util.StrUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; @@ -82,11 +83,14 @@ public class CommonController { if(userService.findByUsername(user.getUsername()) != null) { throw new HiverException(("该用户名已被注册")); } + if(userService.findByEmail(user.getEmail()) != null) { + throw new HiverException(("该邮箱地址已被注册")); + } // Username/UID 邀请码 user.setInviteCode(u.getId()).setDepartmentId(null).setDepartmentTitle("").setDescription(""); String newEncryptPass = new BCryptPasswordEncoder().encode(user.getPassword()); user.setPassword(newEncryptPass); - User result = userService.save(user); + userService.save(user); return ResultUtil.success("添加成功"); } @@ -95,7 +99,9 @@ public class CommonController { public Result edit(User u) { User old = userService.get(u.getId()); old.setNickname(u.getNickname()).setEmail(u.getEmail()).setAddress(u.getAddress()) - .setStreet(u.getStreet()).setSex(u.getSex()).setAvatar(u.getAvatar()); + .setStreet(u.getStreet()).setSex(u.getSex()); + if(StrUtil.isNotBlank(u.getAvatar())) + old.setAvatar(u.getAvatar()); userService.update(old); return ResultUtil.success("修改成功"); } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CustomAddressController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CustomAddressController.java index eee21d18..5d8e58e3 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CustomAddressController.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CustomAddressController.java @@ -2,8 +2,10 @@ package cc.hiver.mall.controller; import cc.hiver.core.common.utils.PageUtil; import cc.hiver.core.common.utils.ResultUtil; +import cc.hiver.core.common.utils.SecurityUtil; import cc.hiver.core.common.vo.PageVo; import cc.hiver.core.common.vo.Result; +import cc.hiver.core.entity.User; import cc.hiver.mall.entity.CustomAddress; import cc.hiver.mall.service.CustomAddressService; import cc.hiver.mall.pojo.query.CustomAddressQueryCriteria; @@ -15,6 +17,9 @@ import org.springframework.data.domain.Page; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; + @Slf4j @RestController @Api(tags = "客户地址接口") @@ -24,6 +29,12 @@ public class CustomAddressController { @Autowired private CustomAddressService customAddressService; + @Autowired + private SecurityUtil securityUtil; + + @PersistenceContext + private EntityManager entityManager; + @RequestMapping(value = "/getByCondition", method = RequestMethod.POST) @ApiOperation(value = "根据条件获得分页") public Result> queryAll(CustomAddressQueryCriteria criteria, PageVo pageVo) { @@ -41,6 +52,11 @@ public class CustomAddressController { @RequestMapping(value = "/save", method = RequestMethod.POST) @ApiOperation(value = "保存数据") public Result save(CustomAddress entity) { + User u = securityUtil.getCurrUser(); + // 清除持久上下文环境 避免后面语句导致持久化 + entityManager.detach(u); + u.setPassword(null); + entity.setUserId(u.getId()); CustomAddress address = customAddressService.save(entity); return new ResultUtil().setData(address); } @@ -48,7 +64,13 @@ public class CustomAddressController { @RequestMapping(value = "/edit", method = RequestMethod.POST) @ApiOperation(value = "更新数据") public Result edit(CustomAddress entity) { - CustomAddress address = customAddressService.update(entity); + CustomAddress data = customAddressService.findById(entity.getId()); + data.setConsigneeName(entity.getConsigneeName()); + data.setConsigneeArea(entity.getConsigneeArea()); + data.setConsigneeMobile(entity.getConsigneeMobile()); + data.setAddress(entity.getAddress()); + data.setZipCode(entity.getZipCode()); + CustomAddress address = customAddressService.update(data); return new ResultUtil().setData(address); } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/GoodsBrandController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/GoodsBrandController.java index 41b7146e..bd2d796f 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/GoodsBrandController.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/GoodsBrandController.java @@ -1,22 +1,19 @@ package cc.hiver.mall.controller; -import cc.hiver.core.base.HiverBaseController; -import cc.hiver.core.base.HiverBaseService; -import cc.hiver.core.common.utils.PageUtil; import cc.hiver.core.common.utils.ResultUtil; -import cc.hiver.core.common.vo.PageVo; import cc.hiver.core.common.vo.Result; import cc.hiver.mall.entity.GoodsBrand; +import cc.hiver.mall.pojo.vo.QueryVo; import cc.hiver.mall.service.GoodsBrandService; +import cn.hutool.core.util.StrUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.domain.Page; import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; + +import java.util.List; /** * 商品品牌控制器 @@ -28,20 +25,48 @@ import org.springframework.web.bind.annotation.RestController; @Api(tags = "商品品牌接口") @RequestMapping(value = "/hiver/app/brand/") @Transactional -public class GoodsBrandController extends HiverBaseController { +public class GoodsBrandController { @Autowired private GoodsBrandService goodsBrandService; - @Override - public HiverBaseService getService() { - return goodsBrandService; + @RequestMapping(value = "/getAll", method = RequestMethod.GET) + @ApiOperation(value = "获得商品品牌列表") + public Result> getAll(QueryVo queryVo) { + List list = goodsBrandService.findAllByShopId(queryVo.getShopId()); + return new ResultUtil>().setData(list); + } + + @RequestMapping(value = "/get/{id}", method = RequestMethod.GET) + @ApiOperation(value = "商品品牌详情") + public Result get(@PathVariable String id) { + GoodsBrand data = goodsBrandService.findById(id); + return new ResultUtil().setData(data); + } + + @RequestMapping(value = "/save", method = RequestMethod.POST) + @ApiOperation(value = "新增商品品牌") + public Result save(GoodsBrand entity) { + GoodsBrand data = goodsBrandService.save(entity); + return new ResultUtil().setData(data); + } + + @RequestMapping(value = "/edit", method = RequestMethod.POST) + @ApiOperation(value = "修改商品品牌") + public Result edit(GoodsBrand entity) { + GoodsBrand data = goodsBrandService.findById(entity.getId()); + if(StrUtil.isNotBlank(entity.getLogoUrl())) + data.setLogoUrl(entity.getLogoUrl()); + data.setStatus(entity.getStatus()); + goodsBrandService.update(data); + return new ResultUtil().setData(data); } - @RequestMapping(value = "/getByCondition", method = RequestMethod.GET) - @ApiOperation(value = "多条件分页获取品牌列表") - public Result> getByCondition(GoodsBrand goodsBrand, - PageVo pageVo) { - Page page = goodsBrandService.findByCondition(goodsBrand, PageUtil.initPage(pageVo)); - return new ResultUtil>().setData(page); + @RequestMapping(value = "/delByIds", method = RequestMethod.POST) + @ApiOperation(value = "删除商品品牌") + public Result delByIds(@RequestParam String[] ids) { + for (String id : ids) { + goodsBrandService.delete(id); + } + return ResultUtil.success("批量通过id删除数据成功"); } } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/GoodsCartController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/GoodsCartController.java index 31a0d48b..e0c22c72 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/GoodsCartController.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/GoodsCartController.java @@ -24,6 +24,7 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.extern.slf4j.Slf4j; +import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.RequestMapping; @@ -49,15 +50,15 @@ public class GoodsCartController { @RequestMapping(value = "/get", method = RequestMethod.GET) @ApiOperation(value = "查询购物车") - public Result> getCart() { - List result = cartService.listCartItems(securityUtil.getCurrUser().getId()); + public Result> getCart(@Param("购买人") String buyUserId) { + List result = cartService.listCartItems(securityUtil.getCurrUser().getId(), buyUserId); return new ResultUtil>().setData(result); } @RequestMapping(value = "/delete", method = RequestMethod.POST) @ApiOperation(value = "删除购物车") - public Result deleteCart() { - boolean result = cartService.deleteCart(securityUtil.getCurrUser().getId()); + public Result deleteCart(@Param("购买人") String buyUserId) { + boolean result = cartService.deleteCart(securityUtil.getCurrUser().getId(), buyUserId); if(result) { return ResultUtil.success("删除成功"); } else { @@ -67,15 +68,15 @@ public class GoodsCartController { @RequestMapping(value = "/add", method = RequestMethod.POST) @ApiOperation(value = "添加购物车商品") - public Result addCartItem(String skuId) { - cartService.addCartItem(skuId, securityUtil.getCurrUser().getId()); + public Result addCartItem(String skuId, Integer buyNum, String buyUserId) { + cartService.addCartItem(skuId, buyNum, securityUtil.getCurrUser().getId(), buyUserId); return ResultUtil.success(); } @RequestMapping(value = "/edit", method = RequestMethod.POST) @ApiOperation(value = "更新购物车商品") - public Result updateCartItem(CartItemDTO cartItem) { - boolean result = cartService.updateCartItem(cartItem, securityUtil.getCurrUser().getId()); + public Result updateCartItem(CartItemDTO cartItem, Integer buyNum, String buyUserId) { + boolean result = cartService.updateCartItem(cartItem, buyNum, securityUtil.getCurrUser().getId(), buyUserId); if(result) { return ResultUtil.success("更新成功"); } else { @@ -85,8 +86,8 @@ public class GoodsCartController { @RequestMapping(value = "/item/delete", method = RequestMethod.POST) @ApiOperation(value = "删除购物车商品") - public Result removeCartItem(String goodsStockId) { - boolean result = cartService.removeCartItem(goodsStockId, securityUtil.getCurrUser().getId()); + public Result removeCartItem(String goodsStockId, String buyUserId) { + boolean result = cartService.removeCartItem(goodsStockId, securityUtil.getCurrUser().getId(), buyUserId); if(result) { return ResultUtil.success("删除成功"); } else { @@ -96,8 +97,8 @@ public class GoodsCartController { @RequestMapping(value = "/_check", method = RequestMethod.POST) @ApiOperation(value = "全选/全不选购物车商品") - public Result check(@ApiParam("全选/全不选") boolean checked) { - boolean result = cartService.checkAll(checked, securityUtil.getCurrUser().getId()); + public Result check(@ApiParam("全选/全不选") boolean checked, @Param("购买人") String buyUserId) { + boolean result = cartService.checkAll(checked, securityUtil.getCurrUser().getId(), buyUserId); if(result) { return ResultUtil.success("设置成功"); } else { diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/GoodsCategoryController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/GoodsCategoryController.java index 29b7c59d..a736fb89 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/GoodsCategoryController.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/GoodsCategoryController.java @@ -1,8 +1,10 @@ package cc.hiver.mall.controller; +import cc.hiver.core.common.constant.CommonConstant; import cc.hiver.core.common.utils.ResultUtil; import cc.hiver.core.common.vo.Result; import cc.hiver.core.vo.Option; +import cc.hiver.core.vo.thorui.TreeVo; import cc.hiver.mall.entity.GoodsCategory; import cc.hiver.mall.entity.GoodsCategoryAttribute; import cc.hiver.mall.pojo.vo.GoodsCategoryVO; @@ -23,7 +25,7 @@ import java.util.List; @Slf4j @RestController @Api(tags = "商品分类接口") -@RequestMapping(value = "/hiver/app/goodsCategory/") +@RequestMapping(value = "/hiver/app/category/") @Transactional public class GoodsCategoryController { @Autowired @@ -34,25 +36,32 @@ public class GoodsCategoryController { @RequestMapping(value = "/list", method = RequestMethod.GET) @ApiOperation(value = "根据parentId获得商品分类列表") - public Result> list(@ApiParam("上级分类ID") String parentId) { - List list = goodsCategoryService.listCategory(parentId); + public Result> list(@ApiParam("上级分类ID") String parentId, @ApiParam("商铺ID") String shopId) { + List list = goodsCategoryService.listCategory(parentId, shopId); return new ResultUtil>().setData(list); } @RequestMapping(value = "/getAll", method = RequestMethod.GET) @ApiOperation(value = "获得商品分类列表") - public Result> getAll() { - List list = goodsCategoryService.listCategory(null); + public Result> getAll(@ApiParam("商铺ID") String shopId) { + List list = goodsCategoryService.listCategory(null, shopId); return new ResultUtil>().setData(list); } @RequestMapping(value = "/options", method = RequestMethod.GET) @ApiOperation(value = "商品分类级联列表") - public Result> listCategoryOptions() { - List