41 changed files with 1419 additions and 80 deletions
@ -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> |
|
||||
@ -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("一级圈层"); |
||||
|
} |
||||
|
|
||||
|
}); |
||||
|
} |
||||
|
} |
||||
@ -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); |
||||
|
} |
||||
@ -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> { |
||||
|
} |
||||
@ -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 com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
import org.apache.ibatis.annotations.Param; |
import org.apache.ibatis.annotations.Param; |
||||
import org.springframework.stereotype.Repository; |
|
||||
|
|
||||
import java.util.List; |
import java.util.List; |
||||
|
|
||||
@Repository |
@Mapper |
||||
public interface ShopMapper extends BaseMapper<Shop> { |
public interface ShopMapper extends BaseMapper<Shop> { |
||||
/** |
/** |
||||
* 通过用户ID获得管理的所有店铺 |
* 通过用户ID获得管理的所有店铺 |
||||
@ -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; |
||||
|
|
||||
|
} |
||||
@ -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); |
||||
|
} |
||||
@ -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 com.baomidou.mybatisplus.extension.service.IService; |
||||
import org.apache.ibatis.annotations.Param; |
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
@ -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); |
||||
|
} |
||||
|
} |
||||
@ -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.mall.dao.mapper.ShopMapper; |
||||
import cc.hiver.app.entity.Shop; |
import cc.hiver.mall.entity.Shop; |
||||
import cc.hiver.app.service.mybatis.IShopService; |
import cc.hiver.mall.service.mybatis.IShopService; |
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
import org.springframework.stereotype.Service; |
||||
@ -1,14 +1,12 @@ |
|||||
package cc.hiver.mall.serviceimpl.mybatis; |
package cc.hiver.mall.serviceimpl.mybatis; |
||||
|
|
||||
import cc.hiver.mall.dao.mapper.ProductAttributeMapper; |
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.entity.ProductAttribute; |
||||
import cc.hiver.mall.service.mybatis.ProductAttributeService; |
import cc.hiver.mall.service.mybatis.ProductAttributeService; |
||||
import cc.hiver.mall.service.mybatis.ProductService; |
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import org.springframework.stereotype.Service; |
import org.springframework.stereotype.Service; |
||||
|
|
||||
@Service |
@Service |
||||
public class ProductAttributeServiceImpl extends ServiceImpl<ProductAttributeMapper, ProductAttribute> implements ProductAttributeService { |
public class ProductAttributeServiceImpl extends ServiceImpl<ProductAttributeMapper, ProductAttribute> implements ProductAttributeService { |
||||
|
|
||||
} |
} |
||||
|
|||||
@ -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&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8&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> |
||||
@ -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> |
||||
@ -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> |
||||
@ -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…
Reference in new issue