Browse Source

注册用户新增店铺联动;新增圈层管理;店铺管理新增圈层联动;

cangku
chencheng 3 years ago
parent
commit
eed6af63bc
  1. 4
      hiver-core/src/main/java/cc/hiver/core/common/utils/NameUtil.java
  2. 6
      hiver-modules/hiver-app/pom.xml
  3. 11
      hiver-modules/hiver-app/src/main/resources/mapper/ShopMapper.xml
  4. 8
      hiver-modules/hiver-base/pom.xml
  5. 29
      hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/UserController.java
  6. 29
      hiver-modules/hiver-mall/pom.xml
  7. 4
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CommonController.java
  8. 4
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/MallController.java
  9. 20
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductAttributeController.java
  10. 16
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductAttributeValueController.java
  11. 4
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductCategoryController.java
  12. 14
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductController.java
  13. 194
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopAreaController.java
  14. 70
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopController.java
  15. 56
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/ShopAreaDao.java
  16. 28
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/ShopDao.java
  17. 4
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/ShopUserDao.java
  18. 2
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/MallMapper.java
  19. 27
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/ShopAreaMapper.java
  20. 10
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/ShopMapper.java
  21. 19
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Shop.java
  22. 56
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ShopArea.java
  23. 2
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/MallUserVo.java
  24. 40
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/ShopAreaService.java
  25. 21
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/ShopService.java
  26. 7
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/ShopUserService.java
  27. 2
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/IMallService.java
  28. 4
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/IShopService.java
  29. 1
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/ProductAttributeService.java
  30. 1
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/ProductService.java
  31. 58
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/ShopAreaServiceImpl.java
  32. 19
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/ShopServiceImpl.java
  33. 5
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/ShopUserServiceImpl.java
  34. 2
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/IMallServiceImpl.java
  35. 8
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/IShopServiceImpl.java
  36. 4
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ProductAttributeServiceImpl.java
  37. 59
      hiver-modules/hiver-mall/src/main/resources/generatorConfig.xml
  38. 2
      hiver-modules/hiver-mall/src/main/resources/mapper/MallMapper.xml
  39. 164
      hiver-modules/hiver-mall/src/main/resources/mapper/ShopAreaMapper.xml
  40. 344
      hiver-modules/hiver-mall/src/main/resources/mapper/ShopMapper.xml
  41. 141
      hiver-modules/hiver-mall/src/main/resources/mapper/ShopUserMapper.xml

4
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("该手机号已被注册");
}

6
hiver-modules/hiver-app/pom.xml

@ -34,5 +34,11 @@
<artifactId>jsch</artifactId>
<version>0.1.55</version>
</dependency>
<dependency>
<groupId>cc.hiver</groupId>
<artifactId>hiver-mall</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

11
hiver-modules/hiver-app/src/main/resources/mapper/ShopMapper.xml

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cc.hiver.app.dao.mapper.ShopMapper">
<select id="findByUserId" resultType="cc.hiver.app.entity.Shop">
SELECT DISTINCT m.*
FROM t_shop m
LEFT JOIN t_shop_user um ON m.id = um.shop_id
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
</select>
</mapper>

8
hiver-modules/hiver-base/pom.xml

@ -9,5 +9,13 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<name>基础模块</name>
<dependencies>
<dependency>
<groupId>cc.hiver</groupId>
<artifactId>hiver-mall</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
<artifactId>hiver-base</artifactId>
</project>

29
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("添加成功");

29
hiver-modules/hiver-mall/pom.xml

@ -18,4 +18,33 @@
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.2</version>
<configuration>
<verbose>true</verbose>
<overwrite>true</overwrite>
</configuration>
<executions>
<execution>
<id>Generate Mybatis Artifacts</id>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-core</artifactId>
<version>1.3.2</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>

4
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;

4
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;

20
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<List<ProductAttribute>>().setData(list);
}
@RequestMapping(value = "/selectById", method = RequestMethod.GET)
@ApiOperation(value = "根据属性id查询货品属性列表")
public Result selectById(String id) {
QueryWrapper<ProductAttribute> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id",id);
List<ProductAttribute> list = productAttributeService.list(queryWrapper);
return new ResultUtil<List<ProductAttribute>>().setData(list);
}
@RequestMapping(value = "/selectByCategoryId", method = RequestMethod.GET)
@ApiOperation(value = "根据分类id查询货品属性列表")
public Result selectByCategoryId(String categoryId) {
QueryWrapper<ProductAttribute> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("category_id",categoryId);
List<ProductAttribute> list = productAttributeService.list(queryWrapper);
return new ResultUtil<List<ProductAttribute>>().setData(list);
}
}

16
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<ProductAttributeValue> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("attribute_id",productAttributeValue.getAttributeId());
queryWrapper.eq("value",productAttributeValue.getValue());
List<ProductAttributeValue> 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<List<ProductAttributeValue>>().setData(list);
}
@RequestMapping(value = "/selectByAttributeId", method = RequestMethod.GET)
@ApiOperation(value = "根据属性id查询货品属性值列表")
public Result selectByAttributeId(String id) {
QueryWrapper<ProductAttributeValue> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("attribute_id",id);
List<ProductAttributeValue> list = productAttributeValueService.list(queryWrapper);
return new ResultUtil<List<ProductAttributeValue>>().setData(list);
}
}

4
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<List<ProductCategory>>().setData(list);
}
}

14
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;

194
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<List<ShopArea>> getByParentId(@PathVariable String parentId,
@ApiParam("是否开始数据权限过滤")
@RequestParam(required = false, defaultValue = "true") Boolean openDataFilter) {
List<ShopArea> 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<List<ShopArea>>() {
}.getType());
return new ResultUtil<List<ShopArea>>().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<List<ShopArea>>().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<ShopArea> 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<User> 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<ShopArea> children = shopAreaService.findByParentIdOrderBySortOrder(parent.getId(), false);
if (children == null || children.isEmpty()) {
parent.setIsParent(false);
shopAreaService.update(parent);
}
}
// 递归删除
List<ShopArea> 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<List<ShopArea>> searchByTitle(@RequestParam String title,
@ApiParam("是否开始数据权限过滤") @RequestParam(required = false, defaultValue = "true") Boolean openDataFilter) {
List<ShopArea> list = shopAreaService.findByTitleLikeOrderBySortOrder("%" + title + "%", openDataFilter);
setInfo(list);
return new ResultUtil<List<ShopArea>>().setData(list);
}
public void setInfo(List<ShopArea> 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("一级圈层");
}
});
}
}

70
hiver-modules/hiver-app/src/main/java/cc/hiver/app/controller/admin/ShopController.java → 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<List<Shop>> 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<ShopUser> 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<Object> 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<ShopUser> 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<Page<Shop>> getByCondition(Shop shop,
PageVo pageVo) {
PageVo pageVo) {
Page<Shop> page = shopService.findByCondition(shop, PageUtil.initPage(pageVo));
return new ResultUtil<Page<Shop>>().setData(page);
}
@ -106,4 +161,11 @@ public class ShopController {
return ResultUtil.success("操作成功");
}
@RequestMapping(value = "/getShopInfoByUserid", method = RequestMethod.GET)
@ApiOperation(value = "根据用户id获取店铺信息")
public Result<List<Shop>> getShopInfoByUserid(@RequestParam String userId) {
List<Shop> list = shopService.getShopInfoByUserid(userId);
return new ResultUtil<List<Shop>>().setData(list);
}
}

56
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<ShopArea, String> {
/**
* 通过父id获取 升序
*
* @param parentId
* @return
*/
List<ShopArea> findByParentIdOrderBySortOrder(String parentId);
/**
* 通过父id获取 升序 数据权限
*
* @param parentId
* @param shopAreas
* @return
*/
List<ShopArea> findByParentIdAndIdInOrderBySortOrder(String parentId, List<String> shopAreas);
/**
* 通过父id和状态获取 升序
*
* @param parentId
* @param status
* @return
*/
List<ShopArea> findByParentIdAndStatusOrderBySortOrder(String parentId, Integer status);
/**
* 圈层名模糊搜索 升序
*
* @param title
* @return
*/
List<ShopArea> findByTitleLikeOrderBySortOrder(String title);
/**
* 圈层名模糊搜索 升序 数据权限
*
* @param title
* @param shopAreas
* @return
*/
List<ShopArea> findByTitleLikeAndIdInOrderBySortOrder(String title, List<String> shopAreas);
}

28
hiver-modules/hiver-app/src/main/java/cc/hiver/app/dao/ShopDao.java → 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<Shop, String> {
* @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<Shop> getShopInfoByUserid(String userId);
}

4
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<ShopUser, String> {
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);
}

2
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;

27
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<ShopArea> {
}

10
hiver-modules/hiver-app/src/main/java/cc/hiver/app/dao/mapper/ShopMapper.java → 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<Shop> {
/**
* 通过用户ID获得管理的所有店铺
@ -16,4 +16,4 @@ public interface ShopMapper extends BaseMapper<Shop> {
* @return
*/
List<Shop> findByUserId(@Param("userId") String userId);
}
}

19
hiver-modules/hiver-app/src/main/java/cc/hiver/app/entity/Shop.java → 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;

56
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;
}

2
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;

40
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<ShopArea, String> {
/**
* 通过父id获取 升序
*
* @param parentId
* @param openDataFilter 是否开启数据权限
* @return
*/
List<ShopArea> findByParentIdOrderBySortOrder(String parentId, Boolean openDataFilter);
/**
* 通过父id和状态获取
*
* @param parentId
* @param status
* @return
*/
List<ShopArea> findByParentIdAndStatusOrderBySortOrder(String parentId, Integer status);
/**
* 圈层名模糊搜索 升序
*
* @param title
* @param openDataFilter 是否开启数据权限
* @return
*/
List<ShopArea> findByTitleLikeOrderBySortOrder(String title, Boolean openDataFilter);
}

21
hiver-modules/hiver-app/src/main/java/cc/hiver/app/service/ShopService.java → 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<Shop, String> {
* @return
*/
Shop findByShopName(String shopName);
/**
* 更新圈层名称
*
* @param shopArea
* @param shopAreaTitle
*/
void updateShopAreaTitle(String shopArea, String shopAreaTitle);
/**
* 根据用户id获取店铺信息
*
* @param userId
*/
List<Shop> getShopInfoByUserid(String userId);
}

7
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<ShopUser, String> {
public interface
ShopUserService extends HiverBaseService<ShopUser, String> {
void deleteAllByShopId(String shopId);
ShopUser selectByUserIdAndShopId(String userId,String shopId);
}

2
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;

4
hiver-modules/hiver-app/src/main/java/cc/hiver/app/service/mybatis/IShopService.java → 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;

1
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<ProductAttribute> {

1
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;

58
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<ShopArea> findByParentIdOrderBySortOrder(String parentId, Boolean openDataFilter) {
// 数据权限
List<String> depIds = securityUtil.getDeparmentIds();
if (depIds != null && depIds.size() > 0 && openDataFilter) {
return shopAreaDao.findByParentIdAndIdInOrderBySortOrder(parentId, depIds);
}
return shopAreaDao.findByParentIdOrderBySortOrder(parentId);
}
@Override
public List<ShopArea> findByParentIdAndStatusOrderBySortOrder(String parentId, Integer status) {
return shopAreaDao.findByParentIdAndStatusOrderBySortOrder(parentId, status);
}
@Override
public List<ShopArea> findByTitleLikeOrderBySortOrder(String title, Boolean openDataFilter) {
// 数据权限
List<String> depIds = securityUtil.getDeparmentIds();
if (depIds != null && depIds.size() > 0 && openDataFilter) {
return shopAreaDao.findByTitleLikeAndIdInOrderBySortOrder(title, depIds);
}
return shopAreaDao.findByTitleLikeOrderBySortOrder(title);
}
}

19
hiver-modules/hiver-app/src/main/java/cc/hiver/app/serviceimpl/ShopServiceImpl.java → 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<Shop> getShopInfoByUserid(String userId) {
return shopDao.getShopInfoByUserid(userId);
}
}

5
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);
}
}

2
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;

8
hiver-modules/hiver-app/src/main/java/cc/hiver/app/serviceimpl/mybatis/IShopServiceImpl.java → 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;

4
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<ProductAttributeMapper, ProductAttribute> implements ProductAttributeService {
}

59
hiver-modules/hiver-mall/src/main/resources/generatorConfig.xml

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<!-- 数据库驱动:选择你的本地硬盘上面的数据库驱 动包-->
<classPathEntry location="D:\maven\LocalWareHouse\mysql\mysql-connector-java\5.1.46\mysql-connector-java-5.1.46.jar" />
<context id="infoGuardian" targetRuntime="MyBatis3">
<!--<plugin type="com.jetair.mybatis.generator.plugin.QueryAllPro" />-->
<!-- 注释 -->
<commentGenerator>
<property name="suppressAllComments" value="true" /><!-- 是否取消注释 -->
<property name="suppressDate" value="true" /> <!-- 是否生成注释代时间戳 -->
</commentGenerator>
<!-- 数据库连接 -->
<jdbcConnection
driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://154.8.162.157:3306/hiver_shop?useUnicode=true&amp;characterEncoding=utf-8&amp;useSSL=false&amp;serverTimezone=GMT%2B8&amp;allowPublicKeyRetrieval=true"
userId="reddoor"
password="reddoor168">
</jdbcConnection>
<!-- 只有一个属于forceBigDecimals,默认false。 如果字段精确超过0,生成BigDecimal 如果字段精确是0,总长度10-18生成Long;如果字段精确是0, 总长5-9生成Integer; 如果字段精确是0,总长小于5生成Short; 如果forceBigDecimals为true,统一生成BigDecimal -->
<javaTypeResolver>
<!-- 是否使用bigDecimal, false可自动转化以下类型(Long, Integer, Short, etc.) -->
<property name="forceBigDecimals" value="false" />
</javaTypeResolver>
<!-- 生成vo、model -->
<javaModelGenerator targetPackage="cc.hiver.mall.entity" targetProject="src/myBatis/java">
<property name="enableSubPackages" value="true" />
<!-- 是否针对string类型的字段在set的时候进行trim调用 -->
<property name="trimStrings" value="true" />
</javaModelGenerator>
<!-- 生成map.xml文件 -->
<sqlMapGenerator targetPackage="mapping" targetProject="src/myBatis/resources" />
<!-- 生成mapxml对应client,也就是接口dao -->
<javaClientGenerator type="XMLMAPPER" targetPackage="cc.hiver.mall.dao.mapper" targetProject="src/myBatis/java">
<property name="enableSubPackages" value="false" />
</javaClientGenerator>
<table tableName="t_shop_user" domainObjectName="ShopUser"
enableCountByExample="false"
enableDeleteByExample="false"
enableSelectByExample="false"
enableUpdateByExample="false">
</table>
</context>
</generatorConfiguration>

2
hiver-modules/hiver-mall/src/main/resources/mapper/MallMapper.xml

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cc.hiver.mall.dao.mapper.MallMapper">
<select id="findByUserId" resultType="cc.hiver.app.entity.Shop">
<select id="findByUserId" resultType="cc.hiver.mall.entity.Shop">
SELECT DISTINCT m.*
FROM t_shop m
LEFT JOIN t_shop_user um ON m.id = um.shop_id

164
hiver-modules/hiver-mall/src/main/resources/mapper/ShopAreaMapper.xml

@ -0,0 +1,164 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cc.hiver.mall.dao.mapper.ShopAreaMapper" >
<resultMap id="BaseResultMap" type="cc.hiver.mall.entity.ShopArea" >
<id column="id" property="id" jdbcType="VARCHAR" />
<result column="create_by" property="createBy" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="del_flag" property="delFlag" jdbcType="INTEGER" />
<result column="update_by" property="updateBy" jdbcType="VARCHAR" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
<result column="is_parent" property="isParent" jdbcType="BIT" />
<result column="parent_id" property="parentId" jdbcType="VARCHAR" />
<result column="sort_order" property="sortOrder" jdbcType="DECIMAL" />
<result column="status" property="status" jdbcType="INTEGER" />
<result column="title" property="title" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
id, create_by, create_time, del_flag, update_by, update_time, is_parent, parent_id,
sort_order, status, title
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from t_shop_area
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
delete from t_shop_area
where id = #{id,jdbcType=VARCHAR}
</delete>
<insert id="insert" parameterType="cc.hiver.mall.entity.ShopArea" >
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>
<insert id="insertSelective" parameterType="cc.hiver.mall.entity.ShopArea" >
insert into t_shop_area
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="createBy != null" >
create_by,
</if>
<if test="createTime != null" >
create_time,
</if>
<if test="delFlag != null" >
del_flag,
</if>
<if test="updateBy != null" >
update_by,
</if>
<if test="updateTime != null" >
update_time,
</if>
<if test="isParent != null" >
is_parent,
</if>
<if test="parentId != null" >
parent_id,
</if>
<if test="sortOrder != null" >
sort_order,
</if>
<if test="status != null" >
status,
</if>
<if test="title != null" >
title,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=VARCHAR},
</if>
<if test="createBy != null" >
#{createBy,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="delFlag != null" >
#{delFlag,jdbcType=INTEGER},
</if>
<if test="updateBy != null" >
#{updateBy,jdbcType=VARCHAR},
</if>
<if test="updateTime != null" >
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="isParent != null" >
#{isParent,jdbcType=BIT},
</if>
<if test="parentId != null" >
#{parentId,jdbcType=VARCHAR},
</if>
<if test="sortOrder != null" >
#{sortOrder,jdbcType=DECIMAL},
</if>
<if test="status != null" >
#{status,jdbcType=INTEGER},
</if>
<if test="title != null" >
#{title,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cc.hiver.mall.entity.ShopArea" >
update t_shop_area
<set >
<if test="createBy != null" >
create_by = #{createBy,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="delFlag != null" >
del_flag = #{delFlag,jdbcType=INTEGER},
</if>
<if test="updateBy != null" >
update_by = #{updateBy,jdbcType=VARCHAR},
</if>
<if test="updateTime != null" >
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="isParent != null" >
is_parent = #{isParent,jdbcType=BIT},
</if>
<if test="parentId != null" >
parent_id = #{parentId,jdbcType=VARCHAR},
</if>
<if test="sortOrder != null" >
sort_order = #{sortOrder,jdbcType=DECIMAL},
</if>
<if test="status != null" >
status = #{status,jdbcType=INTEGER},
</if>
<if test="title != null" >
title = #{title,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="cc.hiver.mall.entity.ShopArea" >
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}
</update>
</mapper>

344
hiver-modules/hiver-mall/src/main/resources/mapper/ShopMapper.xml

@ -0,0 +1,344 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cc.hiver.mall.dao.mapper.ShopMapper" >
<resultMap id="BaseResultMap" type="cc.hiver.mall.entity.Shop" >
<id column="id" property="id" jdbcType="VARCHAR" />
<result column="create_by" property="createBy" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="del_flag" property="delFlag" jdbcType="INTEGER" />
<result column="update_by" property="updateBy" jdbcType="VARCHAR" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
<result column="shop_name" property="shopName" jdbcType="VARCHAR" />
<result column="shop_owner_id" property="shopOwnerId" jdbcType="VARCHAR" />
<result column="shop_manger_id" property="shopMangerId" jdbcType="VARCHAR" />
<result column="shop_area" property="shopArea" jdbcType="VARCHAR" />
<result column="shop_address" property="shopAddress" jdbcType="VARCHAR" />
<result column="year_fee" property="yearFee" jdbcType="VARCHAR" />
<result column="charge_time" property="chargeTime" jdbcType="VARCHAR" />
<result column="start_time" property="startTime" jdbcType="VARCHAR" />
<result column="end_time" property="endTime" jdbcType="VARCHAR" />
<result column="status" property="status" jdbcType="INTEGER" />
<result column="business_district_level" property="businessDistrictLevel" jdbcType="VARCHAR" />
<result column="contact_phone" property="contactPhone" jdbcType="VARCHAR" />
<result column="shop_icon" property="shopIcon" jdbcType="VARCHAR" />
<result column="defaulted" property="defaulted" jdbcType="INTEGER" />
<result column="region" property="region" jdbcType="VARCHAR" />
<result column="shop_area_title" property="shopAreaTitle" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="ResultMapWithBLOBs" type="cc.hiver.mall.entity.Shop" extends="BaseResultMap" >
<result column="remark" property="remark" jdbcType="LONGVARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
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
</sql>
<sql id="Blob_Column_List" >
remark
</sql>
<select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from t_shop
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
delete from t_shop
where id = #{id,jdbcType=VARCHAR}
</delete>
<insert id="insert" parameterType="cc.hiver.mall.entity.Shop" >
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>
<insert id="insertSelective" parameterType="cc.hiver.mall.entity.Shop" >
insert into t_shop
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="createBy != null" >
create_by,
</if>
<if test="createTime != null" >
create_time,
</if>
<if test="delFlag != null" >
del_flag,
</if>
<if test="updateBy != null" >
update_by,
</if>
<if test="updateTime != null" >
update_time,
</if>
<if test="shopName != null" >
shop_name,
</if>
<if test="shopOwnerId != null" >
shop_owner_id,
</if>
<if test="shopMangerId != null" >
shop_manger_id,
</if>
<if test="shopArea != null" >
shop_area,
</if>
<if test="shopAddress != null" >
shop_address,
</if>
<if test="yearFee != null" >
year_fee,
</if>
<if test="chargeTime != null" >
charge_time,
</if>
<if test="startTime != null" >
start_time,
</if>
<if test="endTime != null" >
end_time,
</if>
<if test="status != null" >
status,
</if>
<if test="businessDistrictLevel != null" >
business_district_level,
</if>
<if test="contactPhone != null" >
contact_phone,
</if>
<if test="shopIcon != null" >
shop_icon,
</if>
<if test="defaulted != null" >
defaulted,
</if>
<if test="region != null" >
region,
</if>
<if test="shopAreaTitle != null" >
shop_area_title,
</if>
<if test="remark != null" >
remark,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=VARCHAR},
</if>
<if test="createBy != null" >
#{createBy,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="delFlag != null" >
#{delFlag,jdbcType=INTEGER},
</if>
<if test="updateBy != null" >
#{updateBy,jdbcType=VARCHAR},
</if>
<if test="updateTime != null" >
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="shopName != null" >
#{shopName,jdbcType=VARCHAR},
</if>
<if test="shopOwnerId != null" >
#{shopOwnerId,jdbcType=VARCHAR},
</if>
<if test="shopMangerId != null" >
#{shopMangerId,jdbcType=VARCHAR},
</if>
<if test="shopArea != null" >
#{shopArea,jdbcType=VARCHAR},
</if>
<if test="shopAddress != null" >
#{shopAddress,jdbcType=VARCHAR},
</if>
<if test="yearFee != null" >
#{yearFee,jdbcType=VARCHAR},
</if>
<if test="chargeTime != null" >
#{chargeTime,jdbcType=VARCHAR},
</if>
<if test="startTime != null" >
#{startTime,jdbcType=VARCHAR},
</if>
<if test="endTime != null" >
#{endTime,jdbcType=VARCHAR},
</if>
<if test="status != null" >
#{status,jdbcType=INTEGER},
</if>
<if test="businessDistrictLevel != null" >
#{businessDistrictLevel,jdbcType=VARCHAR},
</if>
<if test="contactPhone != null" >
#{contactPhone,jdbcType=VARCHAR},
</if>
<if test="shopIcon != null" >
#{shopIcon,jdbcType=VARCHAR},
</if>
<if test="defaulted != null" >
#{defaulted,jdbcType=INTEGER},
</if>
<if test="region != null" >
#{region,jdbcType=VARCHAR},
</if>
<if test="shopAreaTitle != null" >
#{shopAreaTitle,jdbcType=VARCHAR},
</if>
<if test="remark != null" >
#{remark,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cc.hiver.mall.entity.Shop" >
update t_shop
<set >
<if test="createBy != null" >
create_by = #{createBy,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="delFlag != null" >
del_flag = #{delFlag,jdbcType=INTEGER},
</if>
<if test="updateBy != null" >
update_by = #{updateBy,jdbcType=VARCHAR},
</if>
<if test="updateTime != null" >
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="shopName != null" >
shop_name = #{shopName,jdbcType=VARCHAR},
</if>
<if test="shopOwnerId != null" >
shop_owner_id = #{shopOwnerId,jdbcType=VARCHAR},
</if>
<if test="shopMangerId != null" >
shop_manger_id = #{shopMangerId,jdbcType=VARCHAR},
</if>
<if test="shopArea != null" >
shop_area = #{shopArea,jdbcType=VARCHAR},
</if>
<if test="shopAddress != null" >
shop_address = #{shopAddress,jdbcType=VARCHAR},
</if>
<if test="yearFee != null" >
year_fee = #{yearFee,jdbcType=VARCHAR},
</if>
<if test="chargeTime != null" >
charge_time = #{chargeTime,jdbcType=VARCHAR},
</if>
<if test="startTime != null" >
start_time = #{startTime,jdbcType=VARCHAR},
</if>
<if test="endTime != null" >
end_time = #{endTime,jdbcType=VARCHAR},
</if>
<if test="status != null" >
status = #{status,jdbcType=INTEGER},
</if>
<if test="businessDistrictLevel != null" >
business_district_level = #{businessDistrictLevel,jdbcType=VARCHAR},
</if>
<if test="contactPhone != null" >
contact_phone = #{contactPhone,jdbcType=VARCHAR},
</if>
<if test="shopIcon != null" >
shop_icon = #{shopIcon,jdbcType=VARCHAR},
</if>
<if test="defaulted != null" >
defaulted = #{defaulted,jdbcType=INTEGER},
</if>
<if test="region != null" >
region = #{region,jdbcType=VARCHAR},
</if>
<if test="shopAreaTitle != null" >
shop_area_title = #{shopAreaTitle,jdbcType=VARCHAR},
</if>
<if test="remark != null" >
remark = #{remark,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="cc.hiver.mall.entity.Shop" >
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>
<update id="updateByPrimaryKey" parameterType="cc.hiver.mall.entity.Shop" >
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}
</update>
<select id="findByUserId" resultType="cc.hiver.mall.entity.Shop">
SELECT DISTINCT m.*
FROM t_shop m
LEFT JOIN t_shop_user um ON m.id = um.shop_id
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
</select>
</mapper>

141
hiver-modules/hiver-mall/src/main/resources/mapper/ShopUserMapper.xml

@ -0,0 +1,141 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cc.hiver.mall.dao.mapper.ShopUserMapper" >
<resultMap id="BaseResultMap" type="cc.hiver.mall.entity.ShopUser" >
<id column="id" property="id" jdbcType="VARCHAR" />
<result column="create_by" property="createBy" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="del_flag" property="delFlag" jdbcType="INTEGER" />
<result column="update_by" property="updateBy" jdbcType="VARCHAR" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
<result column="shop_id" property="shopId" jdbcType="VARCHAR" />
<result column="type" property="type" jdbcType="INTEGER" />
<result column="user_id" property="userId" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
id, create_by, create_time, del_flag, update_by, update_time, shop_id, type, user_id
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from t_shop_user
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
delete from t_shop_user
where id = #{id,jdbcType=VARCHAR}
</delete>
<insert id="insert" parameterType="cc.hiver.mall.entity.ShopUser" >
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>
<insert id="insertSelective" parameterType="cc.hiver.mall.entity.ShopUser" >
insert into t_shop_user
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="createBy != null" >
create_by,
</if>
<if test="createTime != null" >
create_time,
</if>
<if test="delFlag != null" >
del_flag,
</if>
<if test="updateBy != null" >
update_by,
</if>
<if test="updateTime != null" >
update_time,
</if>
<if test="shopId != null" >
shop_id,
</if>
<if test="type != null" >
type,
</if>
<if test="userId != null" >
user_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=VARCHAR},
</if>
<if test="createBy != null" >
#{createBy,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="delFlag != null" >
#{delFlag,jdbcType=INTEGER},
</if>
<if test="updateBy != null" >
#{updateBy,jdbcType=VARCHAR},
</if>
<if test="updateTime != null" >
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="shopId != null" >
#{shopId,jdbcType=VARCHAR},
</if>
<if test="type != null" >
#{type,jdbcType=INTEGER},
</if>
<if test="userId != null" >
#{userId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cc.hiver.mall.entity.ShopUser" >
update t_shop_user
<set >
<if test="createBy != null" >
create_by = #{createBy,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="delFlag != null" >
del_flag = #{delFlag,jdbcType=INTEGER},
</if>
<if test="updateBy != null" >
update_by = #{updateBy,jdbcType=VARCHAR},
</if>
<if test="updateTime != null" >
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="shopId != null" >
shop_id = #{shopId,jdbcType=VARCHAR},
</if>
<if test="type != null" >
type = #{type,jdbcType=INTEGER},
</if>
<if test="userId != null" >
user_id = #{userId,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="cc.hiver.mall.entity.ShopUser" >
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}
</update>
</mapper>
Loading…
Cancel
Save