From eed6af63bc3fecb17b84b6d4dacdffef08306a56 Mon Sep 17 00:00:00 2001 From: chencheng Date: Fri, 25 Aug 2023 20:51:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E5=86=8C=E7=94=A8=E6=88=B7=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=BA=97=E9=93=BA=E8=81=94=E5=8A=A8;=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=9C=88=E5=B1=82=E7=AE=A1=E7=90=86;=E5=BA=97?= =?UTF-8?q?=E9=93=BA=E7=AE=A1=E7=90=86=E6=96=B0=E5=A2=9E=E5=9C=88=E5=B1=82?= =?UTF-8?q?=E8=81=94=E5=8A=A8;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cc/hiver/core/common/utils/NameUtil.java | 4 +- hiver-modules/hiver-app/pom.xml | 6 + .../src/main/resources/mapper/ShopMapper.xml | 11 - hiver-modules/hiver-base/pom.xml | 8 + .../controller/manage/UserController.java | 29 +- hiver-modules/hiver-mall/pom.xml | 29 ++ .../mall/controller/CommonController.java | 4 +- .../hiver/mall/controller/MallController.java | 4 +- .../ProductAttributeController.java | 20 +- .../ProductAttributeValueController.java | 16 + .../controller/ProductCategoryController.java | 4 +- .../mall/controller/ProductController.java | 14 +- .../mall/controller/ShopAreaController.java | 194 ++++++++++ .../mall/controller}/ShopController.java | 70 +++- .../java/cc/hiver/mall/dao/ShopAreaDao.java | 56 +++ .../main/java/cc/hiver/mall}/dao/ShopDao.java | 28 +- .../java/cc/hiver/mall/dao/ShopUserDao.java | 4 + .../cc/hiver/mall/dao/mapper/MallMapper.java | 2 +- .../hiver/mall/dao/mapper/ShopAreaMapper.java | 27 ++ .../cc/hiver/mall}/dao/mapper/ShopMapper.java | 10 +- .../main/java/cc/hiver/mall}/entity/Shop.java | 19 +- .../java/cc/hiver/mall/entity/ShopArea.java | 56 +++ .../cc/hiver/mall/pojo/vo/MallUserVo.java | 2 +- .../hiver/mall/service/ShopAreaService.java | 40 ++ .../cc/hiver/mall}/service/ShopService.java | 21 +- .../hiver/mall/service/ShopUserService.java | 7 +- .../mall/service/mybatis/IMallService.java | 2 +- .../mall}/service/mybatis/IShopService.java | 4 +- .../mybatis/ProductAttributeService.java | 1 - .../mall/service/mybatis/ProductService.java | 1 - .../mall/serviceimpl/ShopAreaServiceImpl.java | 58 +++ .../mall}/serviceimpl/ShopServiceImpl.java | 19 +- .../mall/serviceimpl/ShopUserServiceImpl.java | 5 + .../serviceimpl/mybatis/IMallServiceImpl.java | 2 +- .../serviceimpl/mybatis/IShopServiceImpl.java | 8 +- .../mybatis/ProductAttributeServiceImpl.java | 4 +- .../src/main/resources/generatorConfig.xml | 59 +++ .../src/main/resources/mapper/MallMapper.xml | 2 +- .../main/resources/mapper/ShopAreaMapper.xml | 164 +++++++++ .../src/main/resources/mapper/ShopMapper.xml | 344 ++++++++++++++++++ .../main/resources/mapper/ShopUserMapper.xml | 141 +++++++ 41 files changed, 1419 insertions(+), 80 deletions(-) delete mode 100644 hiver-modules/hiver-app/src/main/resources/mapper/ShopMapper.xml create mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopAreaController.java rename hiver-modules/{hiver-app/src/main/java/cc/hiver/app/controller/admin => hiver-mall/src/main/java/cc/hiver/mall/controller}/ShopController.java (59%) create mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/ShopAreaDao.java rename hiver-modules/{hiver-app/src/main/java/cc/hiver/app => hiver-mall/src/main/java/cc/hiver/mall}/dao/ShopDao.java (55%) create mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/ShopAreaMapper.java rename hiver-modules/{hiver-app/src/main/java/cc/hiver/app => hiver-mall/src/main/java/cc/hiver/mall}/dao/mapper/ShopMapper.java (72%) rename hiver-modules/{hiver-app/src/main/java/cc/hiver/app => hiver-mall/src/main/java/cc/hiver/mall}/entity/Shop.java (83%) create mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ShopArea.java create mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/ShopAreaService.java rename hiver-modules/{hiver-app/src/main/java/cc/hiver/app => hiver-mall/src/main/java/cc/hiver/mall}/service/ShopService.java (73%) rename hiver-modules/{hiver-app/src/main/java/cc/hiver/app => hiver-mall/src/main/java/cc/hiver/mall}/service/mybatis/IShopService.java (82%) create mode 100644 hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/ShopAreaServiceImpl.java rename hiver-modules/{hiver-app/src/main/java/cc/hiver/app => hiver-mall/src/main/java/cc/hiver/mall}/serviceimpl/ShopServiceImpl.java (83%) rename hiver-modules/{hiver-app/src/main/java/cc/hiver/app => hiver-mall/src/main/java/cc/hiver/mall}/serviceimpl/mybatis/IShopServiceImpl.java (73%) create mode 100644 hiver-modules/hiver-mall/src/main/resources/generatorConfig.xml create mode 100644 hiver-modules/hiver-mall/src/main/resources/mapper/ShopAreaMapper.xml create mode 100644 hiver-modules/hiver-mall/src/main/resources/mapper/ShopMapper.xml create mode 100644 hiver-modules/hiver-mall/src/main/resources/mapper/ShopUserMapper.xml diff --git a/hiver-core/src/main/java/cc/hiver/core/common/utils/NameUtil.java b/hiver-core/src/main/java/cc/hiver/core/common/utils/NameUtil.java index 40d9a928..456e1cd5 100644 --- a/hiver-core/src/main/java/cc/hiver/core/common/utils/NameUtil.java +++ b/hiver-core/src/main/java/cc/hiver/core/common/utils/NameUtil.java @@ -98,9 +98,9 @@ public class NameUtil { if (StrUtil.isNotBlank(username) && userService.findByUsername(username) != null) { throw new HiverException("该登录账号已被注册"); } - if (StrUtil.isNotBlank(email) && userService.findByEmail(email) != null) { + /*if (StrUtil.isNotBlank(email) && userService.findByEmail(email) != null) { throw new HiverException("该邮箱已被注册"); - } + }*/ if (StrUtil.isNotBlank(mobile) && userService.findByMobile(mobile) != null) { throw new HiverException("该手机号已被注册"); } diff --git a/hiver-modules/hiver-app/pom.xml b/hiver-modules/hiver-app/pom.xml index a1eacf29..7008152b 100644 --- a/hiver-modules/hiver-app/pom.xml +++ b/hiver-modules/hiver-app/pom.xml @@ -34,5 +34,11 @@ jsch 0.1.55 + + cc.hiver + hiver-mall + 1.0-SNAPSHOT + compile + \ No newline at end of file diff --git a/hiver-modules/hiver-app/src/main/resources/mapper/ShopMapper.xml b/hiver-modules/hiver-app/src/main/resources/mapper/ShopMapper.xml deleted file mode 100644 index bbe19947..00000000 --- a/hiver-modules/hiver-app/src/main/resources/mapper/ShopMapper.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - \ No newline at end of file diff --git a/hiver-modules/hiver-base/pom.xml b/hiver-modules/hiver-base/pom.xml index f6f004a3..dc2060a1 100644 --- a/hiver-modules/hiver-base/pom.xml +++ b/hiver-modules/hiver-base/pom.xml @@ -9,5 +9,13 @@ 4.0.0 基础模块 + + + cc.hiver + hiver-mall + 1.0-SNAPSHOT + compile + + hiver-base \ No newline at end of file diff --git a/hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/UserController.java b/hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/UserController.java index 939ce64d..a298a96a 100644 --- a/hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/UserController.java +++ b/hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/UserController.java @@ -1,17 +1,13 @@ package cc.hiver.base.controller.manage; import cc.hiver.base.async.AddMessage; -import cc.hiver.core.common.annotation.SystemLog; import cc.hiver.core.common.constant.CommonConstant; import cc.hiver.core.common.constant.UserConstant; -import cc.hiver.core.common.enums.LogType; -import cc.hiver.core.common.exception.HiverException; import cc.hiver.core.common.redis.RedisTemplateHelper; import cc.hiver.core.common.utils.*; import cc.hiver.core.common.vo.PageVo; import cc.hiver.core.common.vo.Result; import cc.hiver.core.common.vo.SearchVo; -import cc.hiver.core.config.security.SecurityUserDetails; import cc.hiver.core.dao.mapper.DeleteMapper; import cc.hiver.core.entity.Department; import cc.hiver.core.entity.Role; @@ -20,6 +16,9 @@ import cc.hiver.core.entity.UserRole; import cc.hiver.core.service.*; import cc.hiver.core.service.mybatis.IUserRoleService; import cc.hiver.core.vo.RoleDTO; +import cc.hiver.mall.entity.ShopUser; +import cc.hiver.mall.service.ShopService; +import cc.hiver.mall.service.ShopUserService; import cn.hutool.core.util.StrUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -29,8 +28,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.annotation.CacheConfig; import org.springframework.cache.annotation.CacheEvict; import org.springframework.data.domain.Page; -import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; -import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; @@ -89,6 +86,12 @@ public class UserController { @Autowired private SecurityUtil securityUtil; + @Autowired + private ShopService shopService; + + @Autowired + private ShopUserService shopUserService; + @PersistenceContext private EntityManager entityManager; @@ -244,7 +247,9 @@ public class UserController { @RequestMapping(value = "/admin/add", method = RequestMethod.POST) @ApiOperation(value = "添加用户") public Result add(@Valid User u, - @RequestParam(required = false) String[] roleIds) { + @RequestParam(required = false) String[] roleIds, + @RequestParam(required = false) String userType, + @RequestParam(required = false) String shopId) { // 校验是否已存在 NameUtil.checkUserInfo(u); if (StrUtil.isBlank(u.getNickname())) { @@ -271,6 +276,16 @@ public class UserController { }).collect(Collectors.toList()); userRoleService.saveOrUpdateAll(userRoles); } + //添加店铺和用户信息 + ShopUser shopUser = shopUserService.selectByUserIdAndShopId(u.getId(), shopId); + if (shopUser != null) { + return ResultUtil.success("该员工已添加"); + } + shopUser = new ShopUser(); + shopUser.setType(Integer.valueOf(userType)); + shopUser.setUserId(u.getId()); + shopUser.setShopId(shopId); + shopUserService.save(shopUser); // 发送创建账号消息 addMessage.addSendMessage(user.getId()); return ResultUtil.success("添加成功"); diff --git a/hiver-modules/hiver-mall/pom.xml b/hiver-modules/hiver-mall/pom.xml index 42e3d0a7..c6436d81 100644 --- a/hiver-modules/hiver-mall/pom.xml +++ b/hiver-modules/hiver-mall/pom.xml @@ -18,4 +18,33 @@ 1.0-SNAPSHOT + + + + org.mybatis.generator + mybatis-generator-maven-plugin + 1.3.2 + + true + true + + + + Generate Mybatis Artifacts + + generate + + + + + + org.mybatis.generator + mybatis-generator-core + 1.3.2 + + + + + + \ 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 7d083f43..6fb6ca8c 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 @@ -1,7 +1,7 @@ package cc.hiver.mall.controller; -import cc.hiver.app.entity.Shop; -import cc.hiver.app.service.mybatis.IShopService; +import cc.hiver.mall.entity.Shop; +import cc.hiver.mall.service.mybatis.IShopService; import cc.hiver.core.common.exception.HiverException; import cc.hiver.core.common.utils.PageUtil; import cc.hiver.core.common.utils.ResultUtil; diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/MallController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/MallController.java index ae629bf4..d78f0ffc 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/MallController.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/MallController.java @@ -1,14 +1,14 @@ package cc.hiver.mall.controller; -import cc.hiver.app.entity.Shop; -import cc.hiver.app.service.ShopService; import cc.hiver.core.common.utils.ResultUtil; import cc.hiver.core.common.utils.SecurityUtil; import cc.hiver.core.common.vo.Result; import cc.hiver.core.entity.User; import cc.hiver.core.service.UserService; import cc.hiver.core.vo.UserVo; +import cc.hiver.mall.entity.Shop; import cc.hiver.mall.entity.ShopUser; +import cc.hiver.mall.service.ShopService; import cc.hiver.mall.service.ShopUserService; import cc.hiver.mall.service.mybatis.IMallService; import cn.hutool.core.util.StrUtil; diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductAttributeController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductAttributeController.java index 9863018e..b3768df3 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductAttributeController.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductAttributeController.java @@ -2,10 +2,8 @@ package cc.hiver.mall.controller; import cc.hiver.core.common.utils.ResultUtil; import cc.hiver.core.common.vo.Result; -import cc.hiver.mall.entity.Product; import cc.hiver.mall.entity.ProductAttribute; import cc.hiver.mall.service.mybatis.ProductAttributeService; -import cc.hiver.mall.service.mybatis.ProductService; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -69,4 +67,22 @@ public class ProductAttributeController { return new ResultUtil>().setData(list); } + @RequestMapping(value = "/selectById", method = RequestMethod.GET) + @ApiOperation(value = "根据属性id查询货品属性列表") + public Result selectById(String id) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("id",id); + List list = productAttributeService.list(queryWrapper); + return new ResultUtil>().setData(list); + } + + @RequestMapping(value = "/selectByCategoryId", method = RequestMethod.GET) + @ApiOperation(value = "根据分类id查询货品属性列表") + public Result selectByCategoryId(String categoryId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("category_id",categoryId); + List list = productAttributeService.list(queryWrapper); + return new ResultUtil>().setData(list); + } + } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductAttributeValueController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductAttributeValueController.java index 39a27933..dbccb743 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductAttributeValueController.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductAttributeValueController.java @@ -29,6 +29,13 @@ public class ProductAttributeValueController { @RequestMapping(value = "/save", method = RequestMethod.POST) @ApiOperation(value = "新增货品属性值") public Result save(ProductAttributeValue productAttributeValue) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("attribute_id",productAttributeValue.getAttributeId()); + queryWrapper.eq("value",productAttributeValue.getValue()); + List list = productAttributeValueService.list(queryWrapper); + if(list.size()>0){ + return ResultUtil.error("该属性已存在,请勿重复添加!"); + } boolean result = productAttributeValueService.save(productAttributeValue); if(result) { return ResultUtil.success("添加成功"); @@ -67,4 +74,13 @@ public class ProductAttributeValueController { return new ResultUtil>().setData(list); } + @RequestMapping(value = "/selectByAttributeId", method = RequestMethod.GET) + @ApiOperation(value = "根据属性id查询货品属性值列表") + public Result selectByAttributeId(String id) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("attribute_id",id); + List list = productAttributeValueService.list(queryWrapper); + return new ResultUtil>().setData(list); + } + } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductCategoryController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductCategoryController.java index 15fca0f3..ef6b5e3f 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductCategoryController.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductCategoryController.java @@ -2,10 +2,8 @@ package cc.hiver.mall.controller; import cc.hiver.core.common.utils.ResultUtil; import cc.hiver.core.common.vo.Result; -import cc.hiver.mall.entity.Product; import cc.hiver.mall.entity.ProductCategory; import cc.hiver.mall.service.mybatis.ProductCategoryService; -import cc.hiver.mall.service.mybatis.ProductService; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -69,4 +67,6 @@ public class ProductCategoryController { return new ResultUtil>().setData(list); } + + } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductController.java index b136f378..96cd9d94 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductController.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductController.java @@ -3,24 +3,16 @@ package cc.hiver.mall.controller; import cc.hiver.core.common.utils.ResultUtil; import cc.hiver.core.common.vo.Result; import cc.hiver.mall.entity.Product; -import cc.hiver.mall.pojo.form.GoodsForm; -import cc.hiver.mall.pojo.query.GoodsPageQuery; -import cc.hiver.mall.pojo.vo.GoodsDetailVO; -import cc.hiver.mall.pojo.vo.GoodsPageVO; -import cc.hiver.mall.pojo.vo.MallGoodsDetailVO; -import cc.hiver.mall.pojo.vo.MallGoodsPageVO; -import cc.hiver.mall.service.mybatis.GoodsService; import cc.hiver.mall.service.mybatis.ProductService; -import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; import java.util.List; diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopAreaController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopAreaController.java new file mode 100644 index 00000000..bdc92662 --- /dev/null +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopAreaController.java @@ -0,0 +1,194 @@ +package cc.hiver.mall.controller; + +import cc.hiver.core.common.constant.CommonConstant; +import cc.hiver.core.common.redis.RedisTemplateHelper; +import cc.hiver.core.common.utils.CommonUtil; +import cc.hiver.core.common.utils.HibernateProxyTypeAdapter; +import cc.hiver.core.common.utils.ResultUtil; +import cc.hiver.core.common.utils.SecurityUtil; +import cc.hiver.core.common.vo.Result; +import cc.hiver.core.dao.mapper.DeleteMapper; +import cc.hiver.core.entity.User; +import cc.hiver.mall.entity.ShopArea; +import cc.hiver.mall.service.ShopAreaService; +import cc.hiver.mall.service.ShopService; +import cn.hutool.core.util.StrUtil; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.reflect.TypeToken; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheConfig; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.concurrent.TimeUnit; + +/** + * 圈层管理接口 + * + * @author cc + */ +@Slf4j +@RestController +@Api(tags = "圈层管理接口") +@RequestMapping("/hiver/app/shopArea") +@CacheConfig(cacheNames = "shopArea") +@Transactional +public class ShopAreaController { + @Autowired + private ShopAreaService shopAreaService; + + @Autowired + private DeleteMapper deleteMapper; + + @Autowired + private RedisTemplateHelper redisTemplate; + + @Autowired + private SecurityUtil securityUtil; + + @Autowired + private ShopService shopService; + + @RequestMapping(value = "/getByParentId/{parentId}", method = RequestMethod.GET) + @ApiOperation(value = "通过parentId获取") + public Result> getByParentId(@PathVariable String parentId, + @ApiParam("是否开始数据权限过滤") + @RequestParam(required = false, defaultValue = "true") Boolean openDataFilter) { + List list; + User u = securityUtil.getCurrUserSimple(); + String key = "ShopArea::" + parentId + ":" + u.getId() + "_" + openDataFilter; + String v = redisTemplate.get(key); + if (StrUtil.isNotBlank(v)) { + list = new Gson().fromJson(v, new TypeToken>() { + }.getType()); + return new ResultUtil>().setData(list); + } + list = shopAreaService.findByParentIdOrderBySortOrder(parentId, openDataFilter); + setInfo(list); + redisTemplate.set(key, new GsonBuilder().registerTypeAdapterFactory(HibernateProxyTypeAdapter.FACTORY).create().toJson(list), 15L, TimeUnit.DAYS); + return new ResultUtil>().setData(list); + } + + @RequestMapping(value = "/add", method = RequestMethod.POST) + @ApiOperation(value = "添加") + public Result add(ShopArea ShopArea) { + ShopArea d = shopAreaService.save(ShopArea); + // 如果不是添加的一级 判断设置上级为父节点标识 + if (!CommonConstant.PARENT_ID.equals(ShopArea.getParentId())) { + ShopArea parent = shopAreaService.get(ShopArea.getParentId()); + if (parent.getIsParent() == null || !parent.getIsParent()) { + parent.setIsParent(true); + shopAreaService.update(parent); + } + } + // 更新缓存 + redisTemplate.deleteByPattern("ShopArea::*"); + // 删除数据权限缓存 + //redisTemplate.deleteByPattern("userRole::depIds:*"); + return ResultUtil.success("添加成功"); + } + + @RequestMapping(value = "/edit", method = RequestMethod.POST) + @ApiOperation(value = "编辑") + public Result edit(ShopArea ShopArea, + @RequestParam(required = false) String[] mainHeader, + @RequestParam(required = false) String[] viceHeader) { + if (ShopArea.getId().equals(ShopArea.getParentId())) { + return ResultUtil.error("上级节点不能为自己"); + } + ShopArea old = shopAreaService.get(ShopArea.getId()); + String oldParentId = old.getParentId(); + String oldTitle = old.getTitle(); + ShopArea d = shopAreaService.update(ShopArea); + // 先删除原数据 + + // 如果该节点不是一级节点 且修改了级别 判断上级还有无子节点 + if (!CommonConstant.PARENT_ID.equals(oldParentId) && !oldParentId.equals(ShopArea.getParentId())) { + ShopArea parent = shopAreaService.get(oldParentId); + List children = shopAreaService.findByParentIdOrderBySortOrder(parent.getId(), false); + if (parent != null && (children == null || children.isEmpty())) { + parent.setIsParent(false); + shopAreaService.update(parent); + } + } + + shopService.updateShopAreaTitle(ShopArea.getId(),ShopArea.getTitle()); + + // 手动删除所有圈层缓存 + redisTemplate.deleteByPattern("ShopArea:*"); + return ResultUtil.success("编辑成功"); + } + + @RequestMapping(value = "/delByIds", method = RequestMethod.POST) + @ApiOperation(value = "批量通过id删除") + public Result delByIds(@RequestParam String[] ids) { + for (String id : ids) { + deleteRecursion(id, ids); + } + // 手动删除所有圈层缓存 + redisTemplate.deleteByPattern("ShopArea:*"); + + return ResultUtil.success("批量通过id删除数据成功"); + } + + public void deleteRecursion(String id, String[] ids) { + /*List list = userService.findByShopAreaId(id); + if (list != null && list.size() > 0) { + throw new HiverException("删除失败,包含正被用户使用关联的圈层"); + }*/ + // 获得其父节点 + ShopArea dep = shopAreaService.get(id); + ShopArea parent = null; + if (StrUtil.isNotBlank(dep.getParentId())) { + parent = shopAreaService.findById(dep.getParentId()); + } + shopAreaService.delete(id); + + + // 删除流程关联节点 + // deleteMapper.deleteActNode(id); + // 判断父节点是否还有子节点 + if (parent != null) { + List children = shopAreaService.findByParentIdOrderBySortOrder(parent.getId(), false); + if (children == null || children.isEmpty()) { + parent.setIsParent(false); + shopAreaService.update(parent); + } + } + // 递归删除 + List ShopAreas = shopAreaService.findByParentIdOrderBySortOrder(id, false); + for (ShopArea d : ShopAreas) { + if (!CommonUtil.judgeIds(d.getId(), ids)) { + deleteRecursion(d.getId(), ids); + } + } + } + + @RequestMapping(value = "/search", method = RequestMethod.GET) + @ApiOperation(value = "圈层名模糊搜索") + public Result> searchByTitle(@RequestParam String title, + @ApiParam("是否开始数据权限过滤") @RequestParam(required = false, defaultValue = "true") Boolean openDataFilter) { + List list = shopAreaService.findByTitleLikeOrderBySortOrder("%" + title + "%", openDataFilter); + setInfo(list); + return new ResultUtil>().setData(list); + } + + public void setInfo(List list) { + // lambda表达式 + list.forEach(item -> { + if (!CommonConstant.PARENT_ID.equals(item.getParentId())) { + ShopArea parent = shopAreaService.get(item.getParentId()); + item.setParentTitle(parent.getTitle()); + } else { + item.setParentTitle("一级圈层"); + } + + }); + } +} diff --git a/hiver-modules/hiver-app/src/main/java/cc/hiver/app/controller/admin/ShopController.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopController.java similarity index 59% rename from hiver-modules/hiver-app/src/main/java/cc/hiver/app/controller/admin/ShopController.java rename to hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopController.java index 7d0d802f..ac583d46 100644 --- a/hiver-modules/hiver-app/src/main/java/cc/hiver/app/controller/admin/ShopController.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopController.java @@ -13,15 +13,20 @@ 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 cc.hiver.app.controller.admin; +package cc.hiver.mall.controller; -import cc.hiver.app.entity.Shop; -import cc.hiver.app.service.ShopService; import cc.hiver.core.common.constant.ShopConstant; 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.Shop; +import cc.hiver.mall.entity.ShopArea; +import cc.hiver.mall.entity.ShopUser; +import cc.hiver.mall.service.ShopAreaService; +import cc.hiver.mall.service.ShopService; +import cc.hiver.mall.service.ShopUserService; +import cn.hutool.core.util.StrUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; @@ -29,7 +34,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.web.bind.annotation.*; +import java.util.Arrays; import java.util.List; +import java.util.stream.Collectors; /** * @author cc @@ -42,6 +49,12 @@ public class ShopController { @Autowired private ShopService shopService; + @Autowired + private ShopAreaService shopAreaService; + + @Autowired + private ShopUserService shopUserService; + @RequestMapping(value = "/getAll", method = RequestMethod.GET) @ApiOperation(value = "获取全部数据") public Result> getAll() { @@ -56,7 +69,26 @@ public class ShopController { if (shopService.findByShopName(shop.getShopName()) != null) { return ResultUtil.error("店铺名称已经存在"); } + if (StrUtil.isNotBlank(shop.getShopArea())) { + ShopArea d = shopAreaService.get(shop.getShopArea()); + if (d != null) { + shop.setShopAreaTitle(d.getTitle()); + } + } else { + shop.setShopArea(null); + shop.setShopAreaTitle(""); + } + shopService.save(shop); + + if (shop.getShopMangerId() != null) { + // 添加店长 + List shopUsers = Arrays.asList(shop.getShopMangerId()).stream().map(e -> { + return new ShopUser().setShopId(shop.getId()).setUserId(e).setType(1); + }).collect(Collectors.toList()); + shopUserService.saveOrUpdateAll(shopUsers); + } + return ResultUtil.success("添加成功"); } @@ -64,7 +96,27 @@ public class ShopController { @ResponseBody @ApiOperation(value = "编辑") public Result edit(Shop shop) { + if (StrUtil.isNotBlank(shop.getShopArea())) { + ShopArea d = shopAreaService.get(shop.getShopArea()); + if (d != null) { + shop.setShopAreaTitle(d.getTitle()); + } + } else { + shop.setShopArea(null); + shop.setShopAreaTitle(""); + } shopService.update(shop); + + // 删除店铺用户 + shopUserService.deleteAllByShopId(shop.getId()); + //重新添加店长 + if (shop.getShopMangerId() != null) { + // 添加角色 + List shopUsers = Arrays.asList(shop.getShopMangerId()).stream().map(e -> { + return new ShopUser().setShopId(shop.getId()).setUserId(e).setType(1); + }).collect(Collectors.toList()); + shopUserService.saveOrUpdateAll(shopUsers); + } return ResultUtil.success("编辑成功"); } @@ -75,14 +127,17 @@ public class ShopController { for (String id : ids) { Shop shop = shopService.get(id); shopService.delete(id); + // 删除店铺用户 + shopUserService.deleteAllByShopId(id); } + return ResultUtil.success("删除成功"); } @RequestMapping(value = "/getByCondition", method = RequestMethod.GET) @ApiOperation(value = "多条件分页获取公司列表") public Result> getByCondition(Shop shop, - PageVo pageVo) { + PageVo pageVo) { Page page = shopService.findByCondition(shop, PageUtil.initPage(pageVo)); return new ResultUtil>().setData(page); } @@ -106,4 +161,11 @@ public class ShopController { return ResultUtil.success("操作成功"); } + + @RequestMapping(value = "/getShopInfoByUserid", method = RequestMethod.GET) + @ApiOperation(value = "根据用户id获取店铺信息") + public Result> getShopInfoByUserid(@RequestParam String userId) { + List list = shopService.getShopInfoByUserid(userId); + return new ResultUtil>().setData(list); + } } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/ShopAreaDao.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/ShopAreaDao.java new file mode 100644 index 00000000..349ac35d --- /dev/null +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/ShopAreaDao.java @@ -0,0 +1,56 @@ +package cc.hiver.mall.dao; + +import cc.hiver.mall.entity.ShopArea; +import cc.hiver.core.base.HiverBaseDao; + +import java.util.List; + +/** + * 圈层数据处理层 + * + * @author cc + */ +public interface ShopAreaDao extends HiverBaseDao { + /** + * 通过父id获取 升序 + * + * @param parentId + * @return + */ + List findByParentIdOrderBySortOrder(String parentId); + + /** + * 通过父id获取 升序 数据权限 + * + * @param parentId + * @param shopAreas + * @return + */ + List findByParentIdAndIdInOrderBySortOrder(String parentId, List shopAreas); + + /** + * 通过父id和状态获取 升序 + * + * @param parentId + * @param status + * @return + */ + List findByParentIdAndStatusOrderBySortOrder(String parentId, Integer status); + + /** + * 圈层名模糊搜索 升序 + * + * @param title + * @return + */ + List findByTitleLikeOrderBySortOrder(String title); + + /** + * 圈层名模糊搜索 升序 数据权限 + * + * @param title + * @param shopAreas + * @return + */ + List findByTitleLikeAndIdInOrderBySortOrder(String title, List shopAreas); +} \ No newline at end of file diff --git a/hiver-modules/hiver-app/src/main/java/cc/hiver/app/dao/ShopDao.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/ShopDao.java similarity index 55% rename from hiver-modules/hiver-app/src/main/java/cc/hiver/app/dao/ShopDao.java rename to hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/ShopDao.java index f8d03131..d8469bf3 100644 --- a/hiver-modules/hiver-app/src/main/java/cc/hiver/app/dao/ShopDao.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/ShopDao.java @@ -13,14 +13,12 @@ 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 cc.hiver.app.dao; +package cc.hiver.mall.dao; -import cc.hiver.app.entity.Shop; +import cc.hiver.mall.entity.Shop; import cc.hiver.core.base.HiverBaseDao; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; -import org.springframework.data.jpa.domain.Specification; -import org.springframework.lang.Nullable; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; import java.util.List; @@ -35,4 +33,22 @@ public interface ShopDao extends HiverBaseDao { * @return */ Shop findByShopName(String shopName); + + /** + * 更新圈层名称 + * + * @param shopArea + * @param shopAreaTitle + */ + @Modifying + @Query("update Shop u set u.shopAreaTitle=?2 where u.shopArea=?1") + void updateShopAreaTitle(String shopArea, String shopAreaTitle); + + /** + * 根据用户id获取店铺信息 + * + * @param userId + */ + @Query(value = "select * from t_shop where id in (select shop_id from t_shop_user where user_id = ?)",nativeQuery = true) + List getShopInfoByUserid(String userId); } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/ShopUserDao.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/ShopUserDao.java index a2d45047..05ea54c3 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/ShopUserDao.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/ShopUserDao.java @@ -2,7 +2,11 @@ package cc.hiver.mall.dao; import cc.hiver.core.base.HiverBaseDao; import cc.hiver.mall.entity.ShopUser; +import org.springframework.data.jpa.repository.Query; public interface ShopUserDao extends HiverBaseDao { void deleteAllByShopId(String shopId); + + @Query(value = "select * from t_shop_user where user_id = ? and shop_id = ?",nativeQuery = true) + ShopUser selectByUserIdAndShopId(String userId,String shopId); } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/MallMapper.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/MallMapper.java index 5cfa8b4e..5ae019a5 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/MallMapper.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/MallMapper.java @@ -1,6 +1,6 @@ package cc.hiver.mall.dao.mapper; -import cc.hiver.app.entity.Shop; +import cc.hiver.mall.entity.Shop; import cc.hiver.core.vo.UserVo; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Param; diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/ShopAreaMapper.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/ShopAreaMapper.java new file mode 100644 index 00000000..ab79ff39 --- /dev/null +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/ShopAreaMapper.java @@ -0,0 +1,27 @@ +/* +Copyright [2022] [https://hiver.cc] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License 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 cc.hiver.mall.dao.mapper; + +import cc.hiver.mall.entity.ShopArea; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author cc + */ +@Mapper +public interface ShopAreaMapper extends BaseMapper { +} diff --git a/hiver-modules/hiver-app/src/main/java/cc/hiver/app/dao/mapper/ShopMapper.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/ShopMapper.java similarity index 72% rename from hiver-modules/hiver-app/src/main/java/cc/hiver/app/dao/mapper/ShopMapper.java rename to hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/ShopMapper.java index aae3119b..f07a90f5 100644 --- a/hiver-modules/hiver-app/src/main/java/cc/hiver/app/dao/mapper/ShopMapper.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/ShopMapper.java @@ -1,13 +1,13 @@ -package cc.hiver.app.dao.mapper; +package cc.hiver.mall.dao.mapper; -import cc.hiver.app.entity.Shop; +import cc.hiver.mall.entity.Shop; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; -import org.springframework.stereotype.Repository; import java.util.List; -@Repository +@Mapper public interface ShopMapper extends BaseMapper { /** * 通过用户ID获得管理的所有店铺 @@ -16,4 +16,4 @@ public interface ShopMapper extends BaseMapper { * @return */ List findByUserId(@Param("userId") String userId); -} +} \ No newline at end of file diff --git a/hiver-modules/hiver-app/src/main/java/cc/hiver/app/entity/Shop.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Shop.java similarity index 83% rename from hiver-modules/hiver-app/src/main/java/cc/hiver/app/entity/Shop.java rename to hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Shop.java index 3a6dcfec..23403262 100644 --- a/hiver-modules/hiver-app/src/main/java/cc/hiver/app/entity/Shop.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Shop.java @@ -13,7 +13,7 @@ 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 cc.hiver.app.entity; +package cc.hiver.mall.entity; import cc.hiver.core.base.HiverBaseEntity; import cc.hiver.core.vo.UserVo; @@ -28,6 +28,7 @@ import org.hibernate.annotations.DynamicUpdate; import javax.persistence.Entity; import javax.persistence.Table; import javax.persistence.Transient; +import java.math.BigDecimal; import java.util.List; /** @@ -54,14 +55,26 @@ public class Shop extends HiverBaseEntity { @ApiModelProperty(value = "店长id") private String shopMangerId; - @ApiModelProperty(value = "区域") + @ApiModelProperty(value = "所属圈层") private String shopArea; + @ApiModelProperty(value = "所属圈层名称") + private String shopAreaTitle; + + @ApiModelProperty(value = "归属商圈层级") + private String businessDistrictLevel; + + @ApiModelProperty(value = "联系方式") + private String contactPhone; + + @ApiModelProperty(value = "店铺图标") + private String shopIcon; + @ApiModelProperty(value = "地址") private String shopAddress; @ApiModelProperty(value = "年费") - private String yearFee; + private BigDecimal yearFee; @ApiModelProperty(value = "充值时间") private String chargeTime; diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ShopArea.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ShopArea.java new file mode 100644 index 00000000..5141139c --- /dev/null +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ShopArea.java @@ -0,0 +1,56 @@ +package cc.hiver.mall.entity; + +import cc.hiver.core.base.HiverBaseEntity; +import cc.hiver.core.common.constant.CommonConstant; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.hibernate.annotations.DynamicInsert; +import org.hibernate.annotations.DynamicUpdate; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Table; +import javax.persistence.Transient; +import java.math.BigDecimal; + +/** + * 圈层实体类 + * + * @author cc + */ +@Data +@Entity +@DynamicInsert +@DynamicUpdate +@Table(name = "t_shop_area") +@TableName("t_shop_area") +@ApiModel(value = "圈层") +public class ShopArea extends HiverBaseEntity { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "圈层名称") + private String title; + + @ApiModelProperty(value = "父id") + @Column(nullable = false) + private String parentId; + + @ApiModelProperty(value = "是否为父节点(含子节点) 默认false") + private Boolean isParent = false; + + @ApiModelProperty(value = "排序值") + @Column(precision = 10, scale = 2) + private BigDecimal sortOrder; + + @ApiModelProperty(value = "是否启用 0启用 -1禁用") + private Integer status = CommonConstant.STATUS_NORMAL; + + @Transient + @TableField(exist = false) + @ApiModelProperty(value = "父节点名称") + private String parentTitle; + +} \ No newline at end of file diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/MallUserVo.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/MallUserVo.java index e8225320..f8cf369e 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/MallUserVo.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/MallUserVo.java @@ -1,6 +1,6 @@ package cc.hiver.mall.pojo.vo; -import cc.hiver.app.entity.Shop; +import cc.hiver.mall.entity.Shop; import cc.hiver.core.entity.User; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/ShopAreaService.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/ShopAreaService.java new file mode 100644 index 00000000..d5286ab5 --- /dev/null +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/ShopAreaService.java @@ -0,0 +1,40 @@ +package cc.hiver.mall.service; + +import cc.hiver.mall.entity.ShopArea; +import cc.hiver.core.base.HiverBaseService; + +import java.util.List; + +/** + * 圈层接口 + * + * @author cc + */ +public interface ShopAreaService extends HiverBaseService { + /** + * 通过父id获取 升序 + * + * @param parentId + * @param openDataFilter 是否开启数据权限 + * @return + */ + List findByParentIdOrderBySortOrder(String parentId, Boolean openDataFilter); + + /** + * 通过父id和状态获取 + * + * @param parentId + * @param status + * @return + */ + List findByParentIdAndStatusOrderBySortOrder(String parentId, Integer status); + + /** + * 圈层名模糊搜索 升序 + * + * @param title + * @param openDataFilter 是否开启数据权限 + * @return + */ + List findByTitleLikeOrderBySortOrder(String title, Boolean openDataFilter); +} \ No newline at end of file diff --git a/hiver-modules/hiver-app/src/main/java/cc/hiver/app/service/ShopService.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/ShopService.java similarity index 73% rename from hiver-modules/hiver-app/src/main/java/cc/hiver/app/service/ShopService.java rename to hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/ShopService.java index 78ae1657..4f1b15cf 100644 --- a/hiver-modules/hiver-app/src/main/java/cc/hiver/app/service/ShopService.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/ShopService.java @@ -13,13 +13,15 @@ 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 cc.hiver.app.service; +package cc.hiver.mall.service; -import cc.hiver.app.entity.Shop; +import cc.hiver.mall.entity.Shop; import cc.hiver.core.base.HiverBaseService; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; +import java.util.List; + /** * @author cc */ @@ -40,4 +42,19 @@ public interface ShopService extends HiverBaseService { * @return */ Shop findByShopName(String shopName); + + /** + * 更新圈层名称 + * + * @param shopArea + * @param shopAreaTitle + */ + void updateShopAreaTitle(String shopArea, String shopAreaTitle); + + /** + * 根据用户id获取店铺信息 + * + * @param userId + */ + List getShopInfoByUserid(String userId); } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/ShopUserService.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/ShopUserService.java index 67ae2839..8a1a3cb7 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/ShopUserService.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/ShopUserService.java @@ -3,6 +3,11 @@ package cc.hiver.mall.service; import cc.hiver.core.base.HiverBaseService; import cc.hiver.mall.entity.ShopUser; -public interface ShopUserService extends HiverBaseService { + +public interface +ShopUserService extends HiverBaseService { void deleteAllByShopId(String shopId); + + ShopUser selectByUserIdAndShopId(String userId,String shopId); + } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/IMallService.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/IMallService.java index b7a0bc86..af0a3ea2 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/IMallService.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/IMallService.java @@ -1,6 +1,6 @@ package cc.hiver.mall.service.mybatis; -import cc.hiver.app.entity.Shop; +import cc.hiver.mall.entity.Shop; import cc.hiver.core.vo.UserVo; import com.baomidou.mybatisplus.extension.service.IService; import org.apache.ibatis.annotations.Param; diff --git a/hiver-modules/hiver-app/src/main/java/cc/hiver/app/service/mybatis/IShopService.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/IShopService.java similarity index 82% rename from hiver-modules/hiver-app/src/main/java/cc/hiver/app/service/mybatis/IShopService.java rename to hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/IShopService.java index 1540effc..19f4fce9 100644 --- a/hiver-modules/hiver-app/src/main/java/cc/hiver/app/service/mybatis/IShopService.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/IShopService.java @@ -1,6 +1,6 @@ -package cc.hiver.app.service.mybatis; +package cc.hiver.mall.service.mybatis; -import cc.hiver.app.entity.Shop; +import cc.hiver.mall.entity.Shop; import com.baomidou.mybatisplus.extension.service.IService; import org.apache.ibatis.annotations.Param; diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/ProductAttributeService.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/ProductAttributeService.java index dc72dc46..984099f2 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/ProductAttributeService.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/ProductAttributeService.java @@ -1,7 +1,6 @@ package cc.hiver.mall.service.mybatis; import cc.hiver.mall.entity.ProductAttribute; -import cc.hiver.mall.entity.ProductCategory; import com.baomidou.mybatisplus.extension.service.IService; public interface ProductAttributeService extends IService { diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/ProductService.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/ProductService.java index 7bc8a82a..3ffac352 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/ProductService.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/ProductService.java @@ -1,6 +1,5 @@ package cc.hiver.mall.service.mybatis; -import cc.hiver.mall.entity.GoodsAttribute; import cc.hiver.mall.entity.Product; import com.baomidou.mybatisplus.extension.service.IService; diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/ShopAreaServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/ShopAreaServiceImpl.java new file mode 100644 index 00000000..3742bd0b --- /dev/null +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/ShopAreaServiceImpl.java @@ -0,0 +1,58 @@ +package cc.hiver.mall.serviceimpl; + +import cc.hiver.mall.dao.ShopAreaDao; +import cc.hiver.mall.entity.ShopArea; +import cc.hiver.mall.service.ShopAreaService; +import cc.hiver.core.common.utils.SecurityUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +/** + * 部门接口实现 + * + * @author Yazhi Li + */ +@Slf4j +@Service +@Transactional +public class ShopAreaServiceImpl implements ShopAreaService { + @Autowired + private ShopAreaDao shopAreaDao; + + @Autowired + private SecurityUtil securityUtil; + + @Override + public ShopAreaDao getRepository() { + return shopAreaDao; + } + + @Override + public List findByParentIdOrderBySortOrder(String parentId, Boolean openDataFilter) { + // 数据权限 + List depIds = securityUtil.getDeparmentIds(); + if (depIds != null && depIds.size() > 0 && openDataFilter) { + return shopAreaDao.findByParentIdAndIdInOrderBySortOrder(parentId, depIds); + } + return shopAreaDao.findByParentIdOrderBySortOrder(parentId); + } + + @Override + public List findByParentIdAndStatusOrderBySortOrder(String parentId, Integer status) { + return shopAreaDao.findByParentIdAndStatusOrderBySortOrder(parentId, status); + } + + @Override + public List findByTitleLikeOrderBySortOrder(String title, Boolean openDataFilter) { + // 数据权限 + List depIds = securityUtil.getDeparmentIds(); + if (depIds != null && depIds.size() > 0 && openDataFilter) { + return shopAreaDao.findByTitleLikeAndIdInOrderBySortOrder(title, depIds); + } + return shopAreaDao.findByTitleLikeOrderBySortOrder(title); + } +} \ No newline at end of file diff --git a/hiver-modules/hiver-app/src/main/java/cc/hiver/app/serviceimpl/ShopServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/ShopServiceImpl.java similarity index 83% rename from hiver-modules/hiver-app/src/main/java/cc/hiver/app/serviceimpl/ShopServiceImpl.java rename to hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/ShopServiceImpl.java index 7097b5ae..0f07bf4b 100644 --- a/hiver-modules/hiver-app/src/main/java/cc/hiver/app/serviceimpl/ShopServiceImpl.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/ShopServiceImpl.java @@ -13,11 +13,11 @@ 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 cc.hiver.app.serviceimpl; +package cc.hiver.mall.serviceimpl; -import cc.hiver.app.dao.ShopDao; -import cc.hiver.app.entity.Shop; -import cc.hiver.app.service.ShopService; +import cc.hiver.mall.dao.ShopDao; +import cc.hiver.mall.entity.Shop; +import cc.hiver.mall.service.ShopService; import cc.hiver.core.base.HiverBaseDao; import cn.hutool.core.util.StrUtil; import lombok.extern.slf4j.Slf4j; @@ -75,4 +75,15 @@ public class ShopServiceImpl implements ShopService { public Shop findByShopName(String ShopName) { return shopDao.findByShopName(ShopName); } + + @Override + public void updateShopAreaTitle(String shopArea, String shopAreaTitle){ + shopDao.updateShopAreaTitle(shopArea,shopAreaTitle); + } + + @Override + public List getShopInfoByUserid(String userId) { + return shopDao.getShopInfoByUserid(userId); + } + } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/ShopUserServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/ShopUserServiceImpl.java index bebdebbd..64ef9a6a 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/ShopUserServiceImpl.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/ShopUserServiceImpl.java @@ -25,4 +25,9 @@ public class ShopUserServiceImpl implements ShopUserService { public void deleteAllByShopId(String shopId) { shopUserDao.deleteAllByShopId(shopId); } + + @Override + public ShopUser selectByUserIdAndShopId(String userId, String shopId) { + return shopUserDao.selectByUserIdAndShopId(userId,shopId); + } } diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/IMallServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/IMallServiceImpl.java index 7e067046..47237740 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/IMallServiceImpl.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/IMallServiceImpl.java @@ -1,6 +1,6 @@ package cc.hiver.mall.serviceimpl.mybatis; -import cc.hiver.app.entity.Shop; +import cc.hiver.mall.entity.Shop; import cc.hiver.core.vo.UserVo; import cc.hiver.mall.dao.mapper.MallMapper; import cc.hiver.mall.service.mybatis.IMallService; diff --git a/hiver-modules/hiver-app/src/main/java/cc/hiver/app/serviceimpl/mybatis/IShopServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/IShopServiceImpl.java similarity index 73% rename from hiver-modules/hiver-app/src/main/java/cc/hiver/app/serviceimpl/mybatis/IShopServiceImpl.java rename to hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/IShopServiceImpl.java index 2453c862..ceecde84 100644 --- a/hiver-modules/hiver-app/src/main/java/cc/hiver/app/serviceimpl/mybatis/IShopServiceImpl.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/IShopServiceImpl.java @@ -1,8 +1,8 @@ -package cc.hiver.app.serviceimpl.mybatis; +package cc.hiver.mall.serviceimpl.mybatis; -import cc.hiver.app.dao.mapper.ShopMapper; -import cc.hiver.app.entity.Shop; -import cc.hiver.app.service.mybatis.IShopService; +import cc.hiver.mall.dao.mapper.ShopMapper; +import cc.hiver.mall.entity.Shop; +import cc.hiver.mall.service.mybatis.IShopService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; diff --git a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ProductAttributeServiceImpl.java b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ProductAttributeServiceImpl.java index 6ff89da4..522bd1fd 100644 --- a/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ProductAttributeServiceImpl.java +++ b/hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ProductAttributeServiceImpl.java @@ -1,14 +1,12 @@ package cc.hiver.mall.serviceimpl.mybatis; import cc.hiver.mall.dao.mapper.ProductAttributeMapper; -import cc.hiver.mall.dao.mapper.ProductMapper; -import cc.hiver.mall.entity.Product; import cc.hiver.mall.entity.ProductAttribute; import cc.hiver.mall.service.mybatis.ProductAttributeService; -import cc.hiver.mall.service.mybatis.ProductService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; @Service public class ProductAttributeServiceImpl extends ServiceImpl implements ProductAttributeService { + } diff --git a/hiver-modules/hiver-mall/src/main/resources/generatorConfig.xml b/hiver-modules/hiver-mall/src/main/resources/generatorConfig.xml new file mode 100644 index 00000000..c95056b5 --- /dev/null +++ b/hiver-modules/hiver-mall/src/main/resources/generatorConfig.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
diff --git a/hiver-modules/hiver-mall/src/main/resources/mapper/MallMapper.xml b/hiver-modules/hiver-mall/src/main/resources/mapper/MallMapper.xml index 92215b5a..75056b5c 100644 --- a/hiver-modules/hiver-mall/src/main/resources/mapper/MallMapper.xml +++ b/hiver-modules/hiver-mall/src/main/resources/mapper/MallMapper.xml @@ -1,7 +1,7 @@ - SELECT DISTINCT m.* FROM t_shop m LEFT JOIN t_shop_user um ON m.id = um.shop_id diff --git a/hiver-modules/hiver-mall/src/main/resources/mapper/ShopAreaMapper.xml b/hiver-modules/hiver-mall/src/main/resources/mapper/ShopAreaMapper.xml new file mode 100644 index 00000000..2409be23 --- /dev/null +++ b/hiver-modules/hiver-mall/src/main/resources/mapper/ShopAreaMapper.xml @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + + id, create_by, create_time, del_flag, update_by, update_time, is_parent, parent_id, + sort_order, status, title + + + + delete from t_shop_area + where id = #{id,jdbcType=VARCHAR} + + + insert into t_shop_area (id, create_by, create_time, + del_flag, update_by, update_time, + is_parent, parent_id, sort_order, + status, title) + values (#{id,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, + #{delFlag,jdbcType=INTEGER}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, + #{isParent,jdbcType=BIT}, #{parentId,jdbcType=VARCHAR}, #{sortOrder,jdbcType=DECIMAL}, + #{status,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR}) + + + insert into t_shop_area + + + id, + + + create_by, + + + create_time, + + + del_flag, + + + update_by, + + + update_time, + + + is_parent, + + + parent_id, + + + sort_order, + + + status, + + + title, + + + + + #{id,jdbcType=VARCHAR}, + + + #{createBy,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + #{delFlag,jdbcType=INTEGER}, + + + #{updateBy,jdbcType=VARCHAR}, + + + #{updateTime,jdbcType=TIMESTAMP}, + + + #{isParent,jdbcType=BIT}, + + + #{parentId,jdbcType=VARCHAR}, + + + #{sortOrder,jdbcType=DECIMAL}, + + + #{status,jdbcType=INTEGER}, + + + #{title,jdbcType=VARCHAR}, + + + + + update t_shop_area + + + create_by = #{createBy,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + del_flag = #{delFlag,jdbcType=INTEGER}, + + + update_by = #{updateBy,jdbcType=VARCHAR}, + + + update_time = #{updateTime,jdbcType=TIMESTAMP}, + + + is_parent = #{isParent,jdbcType=BIT}, + + + parent_id = #{parentId,jdbcType=VARCHAR}, + + + sort_order = #{sortOrder,jdbcType=DECIMAL}, + + + status = #{status,jdbcType=INTEGER}, + + + title = #{title,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=VARCHAR} + + + update t_shop_area + set create_by = #{createBy,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + del_flag = #{delFlag,jdbcType=INTEGER}, + update_by = #{updateBy,jdbcType=VARCHAR}, + update_time = #{updateTime,jdbcType=TIMESTAMP}, + is_parent = #{isParent,jdbcType=BIT}, + parent_id = #{parentId,jdbcType=VARCHAR}, + sort_order = #{sortOrder,jdbcType=DECIMAL}, + status = #{status,jdbcType=INTEGER}, + title = #{title,jdbcType=VARCHAR} + where id = #{id,jdbcType=VARCHAR} + + \ No newline at end of file diff --git a/hiver-modules/hiver-mall/src/main/resources/mapper/ShopMapper.xml b/hiver-modules/hiver-mall/src/main/resources/mapper/ShopMapper.xml new file mode 100644 index 00000000..de96ec12 --- /dev/null +++ b/hiver-modules/hiver-mall/src/main/resources/mapper/ShopMapper.xml @@ -0,0 +1,344 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id, create_by, create_time, del_flag, update_by, update_time, shop_name, shop_owner_id, + shop_manger_id, shop_area, shop_address, year_fee, charge_time, start_time, end_time, + status, business_district_level, contact_phone, shop_icon, defaulted, region, shop_area_title + + + remark + + + + delete from t_shop + where id = #{id,jdbcType=VARCHAR} + + + insert into t_shop (id, create_by, create_time, + del_flag, update_by, update_time, + shop_name, shop_owner_id, shop_manger_id, + shop_area, shop_address, year_fee, + charge_time, start_time, end_time, + status, business_district_level, contact_phone, + shop_icon, defaulted, region, + shop_area_title, remark) + values (#{id,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, + #{delFlag,jdbcType=INTEGER}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, + #{shopName,jdbcType=VARCHAR}, #{shopOwnerId,jdbcType=VARCHAR}, #{shopMangerId,jdbcType=VARCHAR}, + #{shopArea,jdbcType=VARCHAR}, #{shopAddress,jdbcType=VARCHAR}, #{yearFee,jdbcType=VARCHAR}, + #{chargeTime,jdbcType=VARCHAR}, #{startTime,jdbcType=VARCHAR}, #{endTime,jdbcType=VARCHAR}, + #{status,jdbcType=INTEGER}, #{businessDistrictLevel,jdbcType=VARCHAR}, #{contactPhone,jdbcType=VARCHAR}, + #{shopIcon,jdbcType=VARCHAR}, #{defaulted,jdbcType=INTEGER}, #{region,jdbcType=VARCHAR}, + #{shopAreaTitle,jdbcType=VARCHAR}, #{remark,jdbcType=LONGVARCHAR}) + + + insert into t_shop + + + id, + + + create_by, + + + create_time, + + + del_flag, + + + update_by, + + + update_time, + + + shop_name, + + + shop_owner_id, + + + shop_manger_id, + + + shop_area, + + + shop_address, + + + year_fee, + + + charge_time, + + + start_time, + + + end_time, + + + status, + + + business_district_level, + + + contact_phone, + + + shop_icon, + + + defaulted, + + + region, + + + shop_area_title, + + + remark, + + + + + #{id,jdbcType=VARCHAR}, + + + #{createBy,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + #{delFlag,jdbcType=INTEGER}, + + + #{updateBy,jdbcType=VARCHAR}, + + + #{updateTime,jdbcType=TIMESTAMP}, + + + #{shopName,jdbcType=VARCHAR}, + + + #{shopOwnerId,jdbcType=VARCHAR}, + + + #{shopMangerId,jdbcType=VARCHAR}, + + + #{shopArea,jdbcType=VARCHAR}, + + + #{shopAddress,jdbcType=VARCHAR}, + + + #{yearFee,jdbcType=VARCHAR}, + + + #{chargeTime,jdbcType=VARCHAR}, + + + #{startTime,jdbcType=VARCHAR}, + + + #{endTime,jdbcType=VARCHAR}, + + + #{status,jdbcType=INTEGER}, + + + #{businessDistrictLevel,jdbcType=VARCHAR}, + + + #{contactPhone,jdbcType=VARCHAR}, + + + #{shopIcon,jdbcType=VARCHAR}, + + + #{defaulted,jdbcType=INTEGER}, + + + #{region,jdbcType=VARCHAR}, + + + #{shopAreaTitle,jdbcType=VARCHAR}, + + + #{remark,jdbcType=LONGVARCHAR}, + + + + + update t_shop + + + create_by = #{createBy,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + del_flag = #{delFlag,jdbcType=INTEGER}, + + + update_by = #{updateBy,jdbcType=VARCHAR}, + + + update_time = #{updateTime,jdbcType=TIMESTAMP}, + + + shop_name = #{shopName,jdbcType=VARCHAR}, + + + shop_owner_id = #{shopOwnerId,jdbcType=VARCHAR}, + + + shop_manger_id = #{shopMangerId,jdbcType=VARCHAR}, + + + shop_area = #{shopArea,jdbcType=VARCHAR}, + + + shop_address = #{shopAddress,jdbcType=VARCHAR}, + + + year_fee = #{yearFee,jdbcType=VARCHAR}, + + + charge_time = #{chargeTime,jdbcType=VARCHAR}, + + + start_time = #{startTime,jdbcType=VARCHAR}, + + + end_time = #{endTime,jdbcType=VARCHAR}, + + + status = #{status,jdbcType=INTEGER}, + + + business_district_level = #{businessDistrictLevel,jdbcType=VARCHAR}, + + + contact_phone = #{contactPhone,jdbcType=VARCHAR}, + + + shop_icon = #{shopIcon,jdbcType=VARCHAR}, + + + defaulted = #{defaulted,jdbcType=INTEGER}, + + + region = #{region,jdbcType=VARCHAR}, + + + shop_area_title = #{shopAreaTitle,jdbcType=VARCHAR}, + + + remark = #{remark,jdbcType=LONGVARCHAR}, + + + where id = #{id,jdbcType=VARCHAR} + + + update t_shop + set create_by = #{createBy,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + del_flag = #{delFlag,jdbcType=INTEGER}, + update_by = #{updateBy,jdbcType=VARCHAR}, + update_time = #{updateTime,jdbcType=TIMESTAMP}, + shop_name = #{shopName,jdbcType=VARCHAR}, + shop_owner_id = #{shopOwnerId,jdbcType=VARCHAR}, + shop_manger_id = #{shopMangerId,jdbcType=VARCHAR}, + shop_area = #{shopArea,jdbcType=VARCHAR}, + shop_address = #{shopAddress,jdbcType=VARCHAR}, + year_fee = #{yearFee,jdbcType=VARCHAR}, + charge_time = #{chargeTime,jdbcType=VARCHAR}, + start_time = #{startTime,jdbcType=VARCHAR}, + end_time = #{endTime,jdbcType=VARCHAR}, + status = #{status,jdbcType=INTEGER}, + business_district_level = #{businessDistrictLevel,jdbcType=VARCHAR}, + contact_phone = #{contactPhone,jdbcType=VARCHAR}, + shop_icon = #{shopIcon,jdbcType=VARCHAR}, + defaulted = #{defaulted,jdbcType=INTEGER}, + region = #{region,jdbcType=VARCHAR}, + shop_area_title = #{shopAreaTitle,jdbcType=VARCHAR}, + remark = #{remark,jdbcType=LONGVARCHAR} + where id = #{id,jdbcType=VARCHAR} + + + update t_shop + set create_by = #{createBy,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + del_flag = #{delFlag,jdbcType=INTEGER}, + update_by = #{updateBy,jdbcType=VARCHAR}, + update_time = #{updateTime,jdbcType=TIMESTAMP}, + shop_name = #{shopName,jdbcType=VARCHAR}, + shop_owner_id = #{shopOwnerId,jdbcType=VARCHAR}, + shop_manger_id = #{shopMangerId,jdbcType=VARCHAR}, + shop_area = #{shopArea,jdbcType=VARCHAR}, + shop_address = #{shopAddress,jdbcType=VARCHAR}, + year_fee = #{yearFee,jdbcType=VARCHAR}, + charge_time = #{chargeTime,jdbcType=VARCHAR}, + start_time = #{startTime,jdbcType=VARCHAR}, + end_time = #{endTime,jdbcType=VARCHAR}, + status = #{status,jdbcType=INTEGER}, + business_district_level = #{businessDistrictLevel,jdbcType=VARCHAR}, + contact_phone = #{contactPhone,jdbcType=VARCHAR}, + shop_icon = #{shopIcon,jdbcType=VARCHAR}, + defaulted = #{defaulted,jdbcType=INTEGER}, + region = #{region,jdbcType=VARCHAR}, + shop_area_title = #{shopAreaTitle,jdbcType=VARCHAR} + where id = #{id,jdbcType=VARCHAR} + + + \ No newline at end of file diff --git a/hiver-modules/hiver-mall/src/main/resources/mapper/ShopUserMapper.xml b/hiver-modules/hiver-mall/src/main/resources/mapper/ShopUserMapper.xml new file mode 100644 index 00000000..1c8696ac --- /dev/null +++ b/hiver-modules/hiver-mall/src/main/resources/mapper/ShopUserMapper.xml @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + id, create_by, create_time, del_flag, update_by, update_time, shop_id, type, user_id + + + + delete from t_shop_user + where id = #{id,jdbcType=VARCHAR} + + + insert into t_shop_user (id, create_by, create_time, + del_flag, update_by, update_time, + shop_id, type, user_id + ) + values (#{id,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, + #{delFlag,jdbcType=INTEGER}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, + #{shopId,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{userId,jdbcType=VARCHAR} + ) + + + insert into t_shop_user + + + id, + + + create_by, + + + create_time, + + + del_flag, + + + update_by, + + + update_time, + + + shop_id, + + + type, + + + user_id, + + + + + #{id,jdbcType=VARCHAR}, + + + #{createBy,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + #{delFlag,jdbcType=INTEGER}, + + + #{updateBy,jdbcType=VARCHAR}, + + + #{updateTime,jdbcType=TIMESTAMP}, + + + #{shopId,jdbcType=VARCHAR}, + + + #{type,jdbcType=INTEGER}, + + + #{userId,jdbcType=VARCHAR}, + + + + + update t_shop_user + + + create_by = #{createBy,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + del_flag = #{delFlag,jdbcType=INTEGER}, + + + update_by = #{updateBy,jdbcType=VARCHAR}, + + + update_time = #{updateTime,jdbcType=TIMESTAMP}, + + + shop_id = #{shopId,jdbcType=VARCHAR}, + + + type = #{type,jdbcType=INTEGER}, + + + user_id = #{userId,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=VARCHAR} + + + update t_shop_user + set create_by = #{createBy,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + del_flag = #{delFlag,jdbcType=INTEGER}, + update_by = #{updateBy,jdbcType=VARCHAR}, + update_time = #{updateTime,jdbcType=TIMESTAMP}, + shop_id = #{shopId,jdbcType=VARCHAR}, + type = #{type,jdbcType=INTEGER}, + user_id = #{userId,jdbcType=VARCHAR} + where id = #{id,jdbcType=VARCHAR} + + \ No newline at end of file