40 changed files with 1701 additions and 14 deletions
-
29cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/shop/CereShopGroupLangInfoController.java
-
16cereshop-admin/src/main/java/com/shop/cereshop/admin/dao/shop/CereShopGroupLangInfoDAO.java
-
22cereshop-admin/src/main/java/com/shop/cereshop/admin/service/shop/CereShopGroupLangInfoService.java
-
28cereshop-admin/src/main/java/com/shop/cereshop/admin/service/shop/impl/CereShopGroupLangInfoServiceImpl.java
-
19cereshop-admin/src/main/resources/mybatis/mapper/shop/CereShopGroupLangInfoDAO.xml
-
19cereshop-app/src/main/java/com/shop/cereshop/app/controller/canvas/CanvasController.java
-
29cereshop-app/src/main/java/com/shop/cereshop/app/controller/shop/CereShopGroupLangInfoController.java
-
41cereshop-app/src/main/java/com/shop/cereshop/app/dao/shop/CereShopGroupDAO.java
-
16cereshop-app/src/main/java/com/shop/cereshop/app/dao/shop/CereShopGroupLangInfoDAO.java
-
107cereshop-app/src/main/java/com/shop/cereshop/app/page/group/Group.java
-
113cereshop-app/src/main/java/com/shop/cereshop/app/page/group/GroupDetail.java
-
112cereshop-app/src/main/java/com/shop/cereshop/app/page/group/GroupProduct.java
-
37cereshop-app/src/main/java/com/shop/cereshop/app/param/shop/GroupGetAllParam.java
-
24cereshop-app/src/main/java/com/shop/cereshop/app/param/shop/ProductGetGroupParam.java
-
22cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/CereShopGroupLangInfoService.java
-
24cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/CereShopGroupService.java
-
28cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/impl/CereShopGroupLangInfoServiceImpl.java
-
151cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/impl/CereShopGroupServiceImpl.java
-
2cereshop-app/src/main/resources/application.yml
-
158cereshop-app/src/main/resources/mybatis/mapper/shop/CereShopGroupDAO.xml
-
19cereshop-app/src/main/resources/mybatis/mapper/shop/CereShopGroupLangInfoDAO.xml
-
18cereshop-business/src/main/java/com/shop/cereshop/business/controller/CanvasController.java
-
2cereshop-business/src/main/java/com/shop/cereshop/business/controller/ShopGroupController.java
-
29cereshop-business/src/main/java/com/shop/cereshop/business/controller/shop/CereShopGroupLangInfoController.java
-
16cereshop-business/src/main/java/com/shop/cereshop/business/dao/shop/CereShopGroupLangInfoDAO.java
-
60cereshop-business/src/main/java/com/shop/cereshop/business/page/group/Group.java
-
58cereshop-business/src/main/java/com/shop/cereshop/business/page/group/GroupDetail.java
-
56cereshop-business/src/main/java/com/shop/cereshop/business/page/group/GroupProduct.java
-
55cereshop-business/src/main/java/com/shop/cereshop/business/page/order/Product.java
-
6cereshop-business/src/main/java/com/shop/cereshop/business/param/group/GroupProductParam.java
-
10cereshop-business/src/main/java/com/shop/cereshop/business/param/group/ShopGroupSaveParam.java
-
10cereshop-business/src/main/java/com/shop/cereshop/business/param/group/ShopGroupUpdateParam.java
-
16cereshop-business/src/main/java/com/shop/cereshop/business/service/product/impl/CereShopProductServiceImpl.java
-
22cereshop-business/src/main/java/com/shop/cereshop/business/service/shop/CereShopGroupLangInfoService.java
-
28cereshop-business/src/main/java/com/shop/cereshop/business/service/shop/impl/CereShopGroupLangInfoServiceImpl.java
-
132cereshop-business/src/main/java/com/shop/cereshop/business/service/shop/impl/CereShopGroupServiceImpl.java
-
9cereshop-business/src/main/resources/mybatis/mapper/shop/CereShopGroupDAO.xml
-
19cereshop-business/src/main/resources/mybatis/mapper/shop/CereShopGroupLangInfoDAO.xml
-
58cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/shop/CereShopGroup.java
-
93cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/shop/CereShopGroupLangInfo.java
@ -0,0 +1,29 @@ |
|||||
|
/* |
||||
|
* Copyright (C) 2017-2021 |
||||
|
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
||||
|
* Copyright authorization contact 18814114118 |
||||
|
*/ |
||||
|
package com.shop.cereshop.admin.controller.shop; |
||||
|
|
||||
|
import io.swagger.annotations.Api; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* <p> |
||||
|
* 前端控制器 |
||||
|
* |
||||
|
* </p> |
||||
|
* |
||||
|
* @author |
||||
|
* @date 2024-03-06 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@RestController |
||||
|
@RequestMapping("/cereShopGroupLangInfo") |
||||
|
@Api(value = "CereShopGroupLangInfo", tags = "") |
||||
|
public class CereShopGroupLangInfoController { |
||||
|
|
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
/* |
||||
|
* Copyright (C) 2017-2021 |
||||
|
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
||||
|
* Copyright authorization contact 18814114118 |
||||
|
*/ |
||||
|
package com.shop.cereshop.admin.dao.shop; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.shop.cereshop.commons.domain.shop.CereShopGroupLangInfo; |
||||
|
|
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
@Mapper |
||||
|
public interface CereShopGroupLangInfoDAO extends BaseMapper<CereShopGroupLangInfo> { |
||||
|
|
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
/* |
||||
|
* Copyright (C) 2017-2021 |
||||
|
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
||||
|
* Copyright authorization contact 18814114118 |
||||
|
*/ |
||||
|
package com.shop.cereshop.admin.service.shop; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.shop.cereshop.commons.domain.shop.CereShopGroupLangInfo; |
||||
|
|
||||
|
/** |
||||
|
* <p> |
||||
|
* 业务接口 |
||||
|
* |
||||
|
* </p> |
||||
|
* |
||||
|
* @author |
||||
|
* @date 2024-03-06 |
||||
|
*/ |
||||
|
public interface CereShopGroupLangInfoService extends IService<CereShopGroupLangInfo> { |
||||
|
|
||||
|
} |
@ -0,0 +1,28 @@ |
|||||
|
/* |
||||
|
* Copyright (C) 2017-2021 |
||||
|
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
||||
|
* Copyright authorization contact 18814114118 |
||||
|
*/ |
||||
|
package com.shop.cereshop.admin.service.shop.impl; |
||||
|
|
||||
|
import com.shop.cereshop.admin.dao.shop.CereShopGroupLangInfoDAO; |
||||
|
import com.shop.cereshop.commons.domain.shop.CereShopGroupLangInfo; |
||||
|
import com.shop.cereshop.admin.service.shop.CereShopGroupLangInfoService; |
||||
|
|
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
/** |
||||
|
* <p> |
||||
|
* 业务实现类 |
||||
|
* |
||||
|
* </p> |
||||
|
* |
||||
|
* @author |
||||
|
* @date 2024-03-06 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class CereShopGroupLangInfoServiceImpl extends ServiceImpl<CereShopGroupLangInfoDAO, CereShopGroupLangInfo> implements CereShopGroupLangInfoService { |
||||
|
} |
@ -0,0 +1,19 @@ |
|||||
|
<?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="com.shop.cereshop.admin.dao.shop.CereShopGroupLangInfoDAO"> |
||||
|
|
||||
|
<!-- 通用查询映射结果 --> |
||||
|
<resultMap id="BaseResultMap" type="com.shop.cereshop.commons.domain.shop.CereShopGroupLangInfo"> |
||||
|
<id column="id" jdbcType="BIGINT" property="id"/> |
||||
|
<result column="shop_group_id" jdbcType="BIGINT" property="shopGroupId"/> |
||||
|
<result column="group_name" jdbcType="VARCHAR" property="groupName"/> |
||||
|
<result column="group_describe" jdbcType="VARCHAR" property="groupDescribe"/> |
||||
|
<result column="language_type" jdbcType="VARCHAR" property="languageType"/> |
||||
|
</resultMap> |
||||
|
|
||||
|
<!-- 通用查询结果列 --> |
||||
|
<sql id="Base_Column_List"> |
||||
|
id, shop_group_id, group_name, group_describe, language_type |
||||
|
</sql> |
||||
|
|
||||
|
</mapper> |
@ -0,0 +1,29 @@ |
|||||
|
/* |
||||
|
* Copyright (C) 2017-2021 |
||||
|
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
||||
|
* Copyright authorization contact 18814114118 |
||||
|
*/ |
||||
|
package com.shop.cereshop.app.controller.shop; |
||||
|
|
||||
|
import io.swagger.annotations.Api; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* <p> |
||||
|
* 前端控制器 |
||||
|
* |
||||
|
* </p> |
||||
|
* |
||||
|
* @author |
||||
|
* @date 2024-03-06 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@RestController |
||||
|
@RequestMapping("/cereShopGroupLangInfo") |
||||
|
@Api(value = "CereShopGroupLangInfo", tags = "") |
||||
|
public class CereShopGroupLangInfoController { |
||||
|
|
||||
|
} |
@ -0,0 +1,41 @@ |
|||||
|
/* |
||||
|
* Copyright (C) 2017-2021 |
||||
|
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
||||
|
* Copyright authorization contact 18814114118 |
||||
|
*/ |
||||
|
package com.shop.cereshop.app.dao.shop; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.shop.cereshop.app.page.group.Group; |
||||
|
import com.shop.cereshop.app.page.group.GroupDetail; |
||||
|
import com.shop.cereshop.app.page.group.GroupProduct; |
||||
|
import com.shop.cereshop.app.param.shop.GroupGetAllParam; |
||||
|
import com.shop.cereshop.commons.domain.shop.CereShopGroup; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Mapper |
||||
|
public interface CereShopGroupDAO extends BaseMapper<CereShopGroup> { |
||||
|
int deleteByPrimaryKey(@Param("shopGroupId") Long shopGroupId); |
||||
|
|
||||
|
int insertSelective(CereShopGroup record); |
||||
|
|
||||
|
CereShopGroup selectByPrimaryKey(Long shopGroupId); |
||||
|
|
||||
|
int updateByPrimaryKeySelective(CereShopGroup record); |
||||
|
|
||||
|
int updateByPrimaryKey(CereShopGroup record); |
||||
|
|
||||
|
List<CereShopGroup> getGroupSelect(@Param("project") String project, @Param("shopId") Long shopId); |
||||
|
|
||||
|
void updateGroup(@Param("shopGroupId") Long shopGroupId); |
||||
|
|
||||
|
GroupDetail getById(@Param("shopGroupId") Long shopGroupId); |
||||
|
|
||||
|
List<Group> getAll(GroupGetAllParam param); |
||||
|
List<GroupProduct> findProducts(@Param("shopGroupId") Long shopGroupId); |
||||
|
|
||||
|
List<CereShopGroup> selectAll(@Param("project") String project); |
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
/* |
||||
|
* Copyright (C) 2017-2021 |
||||
|
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
||||
|
* Copyright authorization contact 18814114118 |
||||
|
*/ |
||||
|
package com.shop.cereshop.app.dao.shop; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.shop.cereshop.commons.domain.shop.CereShopGroupLangInfo; |
||||
|
|
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
@Mapper |
||||
|
public interface CereShopGroupLangInfoDAO extends BaseMapper<CereShopGroupLangInfo> { |
||||
|
|
||||
|
} |
@ -0,0 +1,107 @@ |
|||||
|
/* |
||||
|
* Copyright (C) 2017-2021 |
||||
|
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
||||
|
* Copyright authorization contact 18814114118 |
||||
|
*/ |
||||
|
package com.shop.cereshop.app.page.group; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableField; |
||||
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
||||
|
import com.shop.cereshop.commons.domain.shop.CereShopGroupLangInfo; |
||||
|
import com.shop.cereshop.commons.utils.LangUtil; |
||||
|
import com.shop.cereshop.commons.utils.StringUtils; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.HashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.Objects; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
/** |
||||
|
* 分组列表数据 |
||||
|
*/ |
||||
|
@Data |
||||
|
@ApiModel(value = "Group", description = "分组列表数据") |
||||
|
public class Group { |
||||
|
/** |
||||
|
* 商品分组id |
||||
|
*/ |
||||
|
@ApiModelProperty(value = "商品分组id") |
||||
|
private Long shopGroupId; |
||||
|
|
||||
|
/** |
||||
|
* 分组名称 |
||||
|
*/ |
||||
|
@ApiModelProperty(value = "分组名称") |
||||
|
private String groupName; |
||||
|
|
||||
|
/** |
||||
|
* 分组描述 |
||||
|
*/ |
||||
|
@ApiModelProperty(value = "分组描述") |
||||
|
private String groupDescribe; |
||||
|
|
||||
|
/** |
||||
|
* 商品数量 |
||||
|
*/ |
||||
|
@ApiModelProperty(value = "商品数量") |
||||
|
private Integer number; |
||||
|
|
||||
|
/** |
||||
|
* 修改时间 |
||||
|
*/ |
||||
|
@ApiModelProperty(value = "修改时间") |
||||
|
private String updateTime; |
||||
|
|
||||
|
/** |
||||
|
* 名称Map |
||||
|
*/ |
||||
|
@ApiModelProperty(value = "名称Map") |
||||
|
@TableField(exist = false) |
||||
|
private Map<String, CereShopGroupLangInfo> langInfoMap; |
||||
|
|
||||
|
public void initData(){ |
||||
|
initData(LangUtil.ZH); |
||||
|
} |
||||
|
public void initData(String defaultLangType){ |
||||
|
if(CollectionUtils.isNotEmpty(langInfoMap)) { |
||||
|
CereShopGroupLangInfo langInfo = langInfoMap.entrySet().stream().findFirst().get().getValue(); |
||||
|
if (StringUtils.isNotEmpty(defaultLangType) && langInfoMap.containsKey(defaultLangType)) { |
||||
|
langInfo = langInfoMap.get(defaultLangType); |
||||
|
}else if (langInfoMap.containsKey(LangUtil.ZH)) { |
||||
|
langInfo = langInfoMap.get(LangUtil.ZH); |
||||
|
} else if (langInfoMap.containsKey(LangUtil.EN)) { |
||||
|
langInfo = langInfoMap.get(LangUtil.EN); |
||||
|
} |
||||
|
if (Objects.nonNull(langInfo)) { |
||||
|
setGroupName(langInfo.getGroupName()); |
||||
|
setGroupDescribe(langInfo.getGroupDescribe()); |
||||
|
} |
||||
|
}else if(StringUtils.isNotEmpty(groupName)){ |
||||
|
langInfoMap = new HashMap<>(); |
||||
|
CereShopGroupLangInfo groupLangInfo = new CereShopGroupLangInfo(); |
||||
|
groupLangInfo.setGroupName(getGroupName()); |
||||
|
groupLangInfo.setGroupDescribe(getGroupDescribe()); |
||||
|
groupLangInfo.setLanguageType(LangUtil.ZH); |
||||
|
langInfoMap.put(LangUtil.ZH, groupLangInfo); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public void initMap(List<CereShopGroupLangInfo> groupLangInfoList){ |
||||
|
if (CollectionUtils.isNotEmpty(groupLangInfoList)) { |
||||
|
List<CereShopGroupLangInfo> langInfoList = |
||||
|
groupLangInfoList.stream().filter(item -> Objects.equals(item.getShopGroupId(), getShopGroupId())).collect(Collectors.toList()); |
||||
|
|
||||
|
Map<String, CereShopGroupLangInfo> groupLangInfoMap = new HashMap<>(); |
||||
|
if(CollectionUtils.isNotEmpty(langInfoList)){ |
||||
|
for (CereShopGroupLangInfo langInfo : langInfoList) { |
||||
|
groupLangInfoMap.put(langInfo.getLanguageType(), langInfo); |
||||
|
} |
||||
|
} |
||||
|
setLangInfoMap(groupLangInfoMap); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,113 @@ |
|||||
|
/* |
||||
|
* Copyright (C) 2017-2021 |
||||
|
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
||||
|
* Copyright authorization contact 18814114118 |
||||
|
*/ |
||||
|
package com.shop.cereshop.app.page.group; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableField; |
||||
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
||||
|
import com.shop.cereshop.commons.domain.shop.CereShopGroupLangInfo; |
||||
|
import com.shop.cereshop.commons.utils.LangUtil; |
||||
|
import com.shop.cereshop.commons.utils.StringUtils; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.HashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.Objects; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
/** |
||||
|
* 分组详情数据 |
||||
|
*/ |
||||
|
@Data |
||||
|
@ApiModel(value = "GroupDetail", description = "分组详情数据") |
||||
|
public class GroupDetail { |
||||
|
/** |
||||
|
* 商品分组id |
||||
|
*/ |
||||
|
@ApiModelProperty(value = "商品分组id") |
||||
|
private Long shopGroupId; |
||||
|
|
||||
|
/** |
||||
|
* 关联店铺id |
||||
|
*/ |
||||
|
@ApiModelProperty(value = "关联店铺id") |
||||
|
private Long shopId; |
||||
|
|
||||
|
/** |
||||
|
* 分组名称 |
||||
|
*/ |
||||
|
@ApiModelProperty(value = "分组名称") |
||||
|
private String groupName; |
||||
|
|
||||
|
/** |
||||
|
* 分组封面图片地址 |
||||
|
*/ |
||||
|
@ApiModelProperty(value = "分组封面图片地址") |
||||
|
private String groupImage; |
||||
|
|
||||
|
/** |
||||
|
* 分组描述 |
||||
|
*/ |
||||
|
@ApiModelProperty(value = "分组描述") |
||||
|
private String groupDescribe; |
||||
|
|
||||
|
/** |
||||
|
* 关联商品数据 |
||||
|
*/ |
||||
|
@ApiModelProperty(value = "关联商品数据") |
||||
|
private List<GroupProduct> products; |
||||
|
|
||||
|
/** |
||||
|
* 名称Map |
||||
|
*/ |
||||
|
@ApiModelProperty(value = "名称Map") |
||||
|
@TableField(exist = false) |
||||
|
private Map<String, CereShopGroupLangInfo> langInfoMap; |
||||
|
|
||||
|
public void initData(){ |
||||
|
initData(LangUtil.ZH); |
||||
|
} |
||||
|
public void initData(String defaultLangType){ |
||||
|
if(CollectionUtils.isNotEmpty(langInfoMap)) { |
||||
|
CereShopGroupLangInfo langInfo = langInfoMap.entrySet().stream().findFirst().get().getValue(); |
||||
|
if (StringUtils.isNotEmpty(defaultLangType) && langInfoMap.containsKey(defaultLangType)) { |
||||
|
langInfo = langInfoMap.get(defaultLangType); |
||||
|
}else if (langInfoMap.containsKey(LangUtil.ZH)) { |
||||
|
langInfo = langInfoMap.get(LangUtil.ZH); |
||||
|
} else if (langInfoMap.containsKey(LangUtil.EN)) { |
||||
|
langInfo = langInfoMap.get(LangUtil.EN); |
||||
|
} |
||||
|
if (Objects.nonNull(langInfo)) { |
||||
|
setGroupName(langInfo.getGroupName()); |
||||
|
setGroupDescribe(langInfo.getGroupDescribe()); |
||||
|
} |
||||
|
}else if(StringUtils.isNotEmpty(groupName)){ |
||||
|
langInfoMap = new HashMap<>(); |
||||
|
CereShopGroupLangInfo groupLangInfo = new CereShopGroupLangInfo(); |
||||
|
groupLangInfo.setGroupName(getGroupName()); |
||||
|
groupLangInfo.setGroupDescribe(getGroupDescribe()); |
||||
|
groupLangInfo.setLanguageType(LangUtil.ZH); |
||||
|
langInfoMap.put(LangUtil.ZH, groupLangInfo); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public void initMap(List<CereShopGroupLangInfo> groupLangInfoList){ |
||||
|
if (CollectionUtils.isNotEmpty(groupLangInfoList)) { |
||||
|
List<CereShopGroupLangInfo> langInfoList = |
||||
|
groupLangInfoList.stream().filter(item -> Objects.equals(item.getShopGroupId(), getShopGroupId())).collect(Collectors.toList()); |
||||
|
|
||||
|
Map<String, CereShopGroupLangInfo> groupLangInfoMap = new HashMap<>(); |
||||
|
if(CollectionUtils.isNotEmpty(langInfoList)){ |
||||
|
for (CereShopGroupLangInfo langInfo : langInfoList) { |
||||
|
groupLangInfoMap.put(langInfo.getLanguageType(), langInfo); |
||||
|
} |
||||
|
} |
||||
|
setLangInfoMap(groupLangInfoMap); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,112 @@ |
|||||
|
/* |
||||
|
* Copyright (C) 2017-2021 |
||||
|
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
||||
|
* Copyright authorization contact 18814114118 |
||||
|
*/ |
||||
|
package com.shop.cereshop.app.page.group; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableField; |
||||
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
||||
|
import com.shop.cereshop.commons.domain.product.CereShopProductLangInfo; |
||||
|
import com.shop.cereshop.commons.utils.LangUtil; |
||||
|
import com.shop.cereshop.commons.utils.StringUtils; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
import java.util.HashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.Objects; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
/** |
||||
|
* 分组商品数据 |
||||
|
*/ |
||||
|
@Data |
||||
|
@ApiModel(value = "GroupProduct", description = "分组商品数据") |
||||
|
public class GroupProduct { |
||||
|
|
||||
|
/** |
||||
|
* 商品id |
||||
|
*/ |
||||
|
@ApiModelProperty(value = "商品id") |
||||
|
private Long productId; |
||||
|
|
||||
|
/** |
||||
|
* 商品名称 |
||||
|
*/ |
||||
|
@ApiModelProperty(value = "商品名称") |
||||
|
private String productName; |
||||
|
|
||||
|
/** |
||||
|
* 上架状态 1-已上架 0-未上架 |
||||
|
*/ |
||||
|
@ApiModelProperty(value = "上架状态 1-已上架 0-未上架") |
||||
|
private Integer shelveState; |
||||
|
|
||||
|
/** |
||||
|
* 图片 |
||||
|
*/ |
||||
|
@ApiModelProperty(value = "图片") |
||||
|
private String image; |
||||
|
|
||||
|
/** |
||||
|
* 商品原价 |
||||
|
*/ |
||||
|
@ApiModelProperty(value = "商品原价") |
||||
|
private BigDecimal originalPrice; |
||||
|
|
||||
|
/** |
||||
|
* 库存数量 |
||||
|
*/ |
||||
|
@ApiModelProperty(value = "库存数量") |
||||
|
private Integer stockNumber; |
||||
|
|
||||
|
/** |
||||
|
* 名称Map |
||||
|
*/ |
||||
|
@ApiModelProperty(value = "名称Map") |
||||
|
@TableField(exist = false) |
||||
|
private Map<String, CereShopProductLangInfo> langInfoMap; |
||||
|
|
||||
|
public void initData(){ |
||||
|
initData(LangUtil.ZH); |
||||
|
} |
||||
|
public void initData(String defaultLangType){ |
||||
|
if(CollectionUtils.isNotEmpty(langInfoMap)) { |
||||
|
if (StringUtils.isNotEmpty(defaultLangType) && langInfoMap.containsKey(defaultLangType)) { |
||||
|
setProductName(langInfoMap.get(defaultLangType).getProductName()); |
||||
|
}else if (langInfoMap.containsKey(LangUtil.ZH)) { |
||||
|
setProductName(langInfoMap.get(LangUtil.ZH).getProductName()); |
||||
|
} else if (langInfoMap.containsKey(LangUtil.EN)) { |
||||
|
setProductName(langInfoMap.get(LangUtil.EN).getProductName()); |
||||
|
} else { |
||||
|
setProductName(langInfoMap.entrySet().stream().findFirst().get().getValue().getProductName()); |
||||
|
} |
||||
|
}else if(StringUtils.isNotEmpty(productName)){ |
||||
|
langInfoMap = new HashMap<>(); |
||||
|
CereShopProductLangInfo classifyLangInfo = new CereShopProductLangInfo(); |
||||
|
classifyLangInfo.setProductId(getProductId()); |
||||
|
classifyLangInfo.setProductName(getProductName()); |
||||
|
classifyLangInfo.setLanguageType(LangUtil.ZH); |
||||
|
langInfoMap.put(LangUtil.ZH, classifyLangInfo); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public void initMap(List<CereShopProductLangInfo> cereProductClassifyLangInfoList){ |
||||
|
if (CollectionUtils.isNotEmpty(cereProductClassifyLangInfoList)) { |
||||
|
List<CereShopProductLangInfo> productClassifyLangInfoList = |
||||
|
cereProductClassifyLangInfoList.stream().filter(item -> Objects.equals(item.getProductId(), getProductId())).collect(Collectors.toList()); |
||||
|
|
||||
|
Map<String, CereShopProductLangInfo> cereProductClassifyLangInfoMap = new HashMap<>(); |
||||
|
if(CollectionUtils.isNotEmpty(productClassifyLangInfoList)){ |
||||
|
for (CereShopProductLangInfo cereProductClassifyLangInfo : productClassifyLangInfoList) { |
||||
|
cereProductClassifyLangInfoMap.put(cereProductClassifyLangInfo.getLanguageType(), cereProductClassifyLangInfo); |
||||
|
} |
||||
|
} |
||||
|
setLangInfoMap(cereProductClassifyLangInfoMap); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,37 @@ |
|||||
|
/* |
||||
|
* Copyright (C) 2017-2021 |
||||
|
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
||||
|
* Copyright authorization contact 18814114118 |
||||
|
*/ |
||||
|
package com.shop.cereshop.app.param.shop; |
||||
|
|
||||
|
import com.shop.cereshop.commons.domain.common.PageParam; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* 获取分组列表请求 |
||||
|
*/ |
||||
|
@Data |
||||
|
@ApiModel(value = "GroupGetAllParam", description = "获取分组列表请求") |
||||
|
public class GroupGetAllParam extends PageParam { |
||||
|
|
||||
|
/** |
||||
|
* 店铺id |
||||
|
*/ |
||||
|
@ApiModelProperty(value = "店铺id") |
||||
|
private Long shopId; |
||||
|
|
||||
|
/** |
||||
|
* 搜索字段 |
||||
|
*/ |
||||
|
@ApiModelProperty(value = "搜索字段") |
||||
|
private String search; |
||||
|
|
||||
|
/** |
||||
|
* 平台号 |
||||
|
*/ |
||||
|
@ApiModelProperty(value = "平台号", hidden = true) |
||||
|
private String project; |
||||
|
} |
@ -0,0 +1,24 @@ |
|||||
|
/* |
||||
|
* Copyright (C) 2017-2021 |
||||
|
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
||||
|
* Copyright authorization contact 18814114118 |
||||
|
*/ |
||||
|
package com.shop.cereshop.app.param.shop; |
||||
|
|
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* 获取商品分组下拉请求 |
||||
|
*/ |
||||
|
@Data |
||||
|
@ApiModel(value = "ProductGetGroupParam", description = "获取商品分组下拉请求") |
||||
|
public class ProductGetGroupParam { |
||||
|
|
||||
|
/** |
||||
|
* 关联店铺id |
||||
|
*/ |
||||
|
@ApiModelProperty(value = "关联店铺id") |
||||
|
private Long shopId; |
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
/* |
||||
|
* Copyright (C) 2017-2021 |
||||
|
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
||||
|
* Copyright authorization contact 18814114118 |
||||
|
*/ |
||||
|
package com.shop.cereshop.app.service.shop; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.shop.cereshop.commons.domain.shop.CereShopGroupLangInfo; |
||||
|
|
||||
|
/** |
||||
|
* <p> |
||||
|
* 业务接口 |
||||
|
* |
||||
|
* </p> |
||||
|
* |
||||
|
* @author |
||||
|
* @date 2024-03-06 |
||||
|
*/ |
||||
|
public interface CereShopGroupLangInfoService extends IService<CereShopGroupLangInfo> { |
||||
|
|
||||
|
} |
@ -0,0 +1,24 @@ |
|||||
|
/* |
||||
|
* Copyright (C) 2017-2021 |
||||
|
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
||||
|
* Copyright authorization contact 18814114118 |
||||
|
*/ |
||||
|
package com.shop.cereshop.app.service.shop; |
||||
|
|
||||
|
import com.shop.cereshop.app.page.group.GroupDetail; |
||||
|
import com.shop.cereshop.app.param.shop.GroupGetAllParam; |
||||
|
import com.shop.cereshop.app.param.shop.ProductGetGroupParam; |
||||
|
import com.shop.cereshop.commons.domain.common.Page; |
||||
|
import com.shop.cereshop.commons.domain.shop.CereShopGroup; |
||||
|
import com.shop.cereshop.commons.exception.CoBusinessException; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface CereShopGroupService { |
||||
|
List<CereShopGroup> getGroupSelect(ProductGetGroupParam param) throws CoBusinessException; |
||||
|
GroupDetail getById(Long shopGroupId) throws CoBusinessException; |
||||
|
|
||||
|
Page getAll(GroupGetAllParam param) throws CoBusinessException; |
||||
|
|
||||
|
List<CereShopGroup> selectAll(); |
||||
|
} |
@ -0,0 +1,28 @@ |
|||||
|
/* |
||||
|
* Copyright (C) 2017-2021 |
||||
|
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
||||
|
* Copyright authorization contact 18814114118 |
||||
|
*/ |
||||
|
package com.shop.cereshop.app.service.shop.impl; |
||||
|
|
||||
|
import com.shop.cereshop.app.dao.shop.CereShopGroupLangInfoDAO; |
||||
|
import com.shop.cereshop.commons.domain.shop.CereShopGroupLangInfo; |
||||
|
import com.shop.cereshop.app.service.shop.CereShopGroupLangInfoService; |
||||
|
|
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
/** |
||||
|
* <p> |
||||
|
* 业务实现类 |
||||
|
* |
||||
|
* </p> |
||||
|
* |
||||
|
* @author |
||||
|
* @date 2024-03-06 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class CereShopGroupLangInfoServiceImpl extends ServiceImpl<CereShopGroupLangInfoDAO, CereShopGroupLangInfo> implements CereShopGroupLangInfoService { |
||||
|
} |
@ -0,0 +1,151 @@ |
|||||
|
/* |
||||
|
* Copyright (C) 2017-2021 |
||||
|
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
||||
|
* Copyright authorization contact 18814114118 |
||||
|
*/ |
||||
|
package com.shop.cereshop.app.service.shop.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||
|
import com.github.pagehelper.PageHelper; |
||||
|
import com.github.pagehelper.PageInfo; |
||||
|
import com.shop.cereshop.app.dao.product.CereShopProductLangInfoDAO; |
||||
|
import com.shop.cereshop.app.dao.shop.CereShopGroupDAO; |
||||
|
import com.shop.cereshop.app.dao.shop.CereShopGroupLangInfoDAO; |
||||
|
import com.shop.cereshop.app.page.group.Group; |
||||
|
import com.shop.cereshop.app.page.group.GroupDetail; |
||||
|
import com.shop.cereshop.app.page.group.GroupProduct; |
||||
|
import com.shop.cereshop.app.param.shop.GroupGetAllParam; |
||||
|
import com.shop.cereshop.app.param.shop.ProductGetGroupParam; |
||||
|
import com.shop.cereshop.app.service.shop.CereShopGroupService; |
||||
|
import com.shop.cereshop.app.utils.ContextUtil; |
||||
|
import com.shop.cereshop.commons.domain.common.Page; |
||||
|
import com.shop.cereshop.commons.domain.product.CereShopProductLangInfo; |
||||
|
import com.shop.cereshop.commons.domain.shop.CereShopGroup; |
||||
|
import com.shop.cereshop.commons.domain.shop.CereShopGroupLangInfo; |
||||
|
import com.shop.cereshop.commons.exception.CoBusinessException; |
||||
|
import com.shop.cereshop.commons.utils.ProjectUtil; |
||||
|
import org.apache.commons.collections4.CollectionUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
@Service |
||||
|
public class CereShopGroupServiceImpl implements CereShopGroupService { |
||||
|
|
||||
|
@Autowired |
||||
|
private CereShopGroupDAO cereShopGroupDAO; |
||||
|
|
||||
|
@Autowired |
||||
|
private CereShopGroupLangInfoDAO cereShopGroupLangInfoDAO; |
||||
|
|
||||
|
@Autowired |
||||
|
private CereShopProductLangInfoDAO cereShopProductLangInfoDAO; |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public List<CereShopGroup> getGroupSelect(ProductGetGroupParam param) throws CoBusinessException { |
||||
|
// ContextUtil.getProject() |
||||
|
List<CereShopGroup> shopGroupList = cereShopGroupDAO.getGroupSelect(ProjectUtil.DEFAULT_PROJECT, param.getShopId()); |
||||
|
setShopGroupLangInfo(shopGroupList); |
||||
|
return shopGroupList; |
||||
|
} |
||||
|
@Override |
||||
|
public GroupDetail getById(Long shopGroupId) throws CoBusinessException { |
||||
|
GroupDetail detail=cereShopGroupDAO.getById(shopGroupId); |
||||
|
if(detail!=null){ |
||||
|
//设置商品数据 |
||||
|
detail.setProducts(cereShopGroupDAO.findProducts(shopGroupId)); |
||||
|
setGroupProductLangInfo(detail.getProducts()); |
||||
|
} |
||||
|
setGroupDetailLangInfo(detail); |
||||
|
return detail; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Page getAll(GroupGetAllParam param) throws CoBusinessException { |
||||
|
param.setProject(ContextUtil.getProject()); |
||||
|
PageHelper.startPage(param.getPage(),param.getPageSize()); |
||||
|
List<Group> list = cereShopGroupDAO.getAll(param); |
||||
|
setGroupLangInfo(list); |
||||
|
PageInfo<Group> pageInfo=new PageInfo<>(list); |
||||
|
Page page=new Page(pageInfo.getList(),pageInfo.getTotal()); |
||||
|
return page; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public List<CereShopGroup> selectAll() { |
||||
|
List<CereShopGroup> groupList = cereShopGroupDAO.selectAll(ContextUtil.getProject()); |
||||
|
setShopGroupLangInfo(groupList); |
||||
|
return groupList; |
||||
|
} |
||||
|
|
||||
|
private void setGroupProductLangInfo(List<GroupProduct> groupProductList){ |
||||
|
if(CollectionUtils.isEmpty(groupProductList)){ |
||||
|
return; |
||||
|
} |
||||
|
List<Long> productIdList = new ArrayList<>(); |
||||
|
productIdList.addAll(groupProductList.stream().map(GroupProduct::getProductId).collect(Collectors.toList())); |
||||
|
productIdList = productIdList.stream().filter(item -> item != null && item > 0).distinct().collect(Collectors.toList()); |
||||
|
|
||||
|
if(CollectionUtils.isNotEmpty(productIdList)){ |
||||
|
List<CereShopProductLangInfo> productLangInfoList = cereShopProductLangInfoDAO.selectList(Wrappers.<CereShopProductLangInfo>lambdaQuery().in(CereShopProductLangInfo::getProductId,productIdList)); |
||||
|
if(CollectionUtils.isNotEmpty(groupProductList)){ |
||||
|
for (GroupProduct product : groupProductList) { |
||||
|
product.initMap(productLangInfoList); |
||||
|
product.initData(ContextUtil.getLanguage()); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private void setShopGroupLangInfo(List<CereShopGroup> shopGroupList){ |
||||
|
if(CollectionUtils.isEmpty(shopGroupList)){ |
||||
|
return; |
||||
|
} |
||||
|
List<Long> groupIdList = new ArrayList<>(); |
||||
|
groupIdList.addAll(shopGroupList.stream().map(CereShopGroup::getShopGroupId).collect(Collectors.toList())); |
||||
|
groupIdList = groupIdList.stream().filter(item -> item != null && item > 0).distinct().collect(Collectors.toList()); |
||||
|
|
||||
|
if(CollectionUtils.isNotEmpty(groupIdList)){ |
||||
|
List<CereShopGroupLangInfo> groupLangInfoList = cereShopGroupLangInfoDAO.selectList(Wrappers.<CereShopGroupLangInfo>lambdaQuery().in(CereShopGroupLangInfo::getShopGroupId,groupIdList)); |
||||
|
if(CollectionUtils.isNotEmpty(shopGroupList)){ |
||||
|
for (CereShopGroup shopGroup : shopGroupList) { |
||||
|
shopGroup.initMap(groupLangInfoList); |
||||
|
shopGroup.initData(ContextUtil.getLanguage()); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private void setGroupLangInfo(List<Group> groupList){ |
||||
|
if(CollectionUtils.isEmpty(groupList)){ |
||||
|
return; |
||||
|
} |
||||
|
List<Long> groupIdList = new ArrayList<>(); |
||||
|
groupIdList.addAll(groupList.stream().map(Group::getShopGroupId).collect(Collectors.toList())); |
||||
|
groupIdList = groupIdList.stream().filter(item -> item != null && item > 0).distinct().collect(Collectors.toList()); |
||||
|
|
||||
|
if(CollectionUtils.isNotEmpty(groupIdList)){ |
||||
|
List<CereShopGroupLangInfo> groupLangInfoList = cereShopGroupLangInfoDAO.selectList(Wrappers.<CereShopGroupLangInfo>lambdaQuery().in(CereShopGroupLangInfo::getShopGroupId,groupIdList)); |
||||
|
if(CollectionUtils.isNotEmpty(groupList)){ |
||||
|
for (Group group : groupList) { |
||||
|
group.initMap(groupLangInfoList); |
||||
|
group.initData(ContextUtil.getLanguage()); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private void setGroupDetailLangInfo(GroupDetail groupDetail){ |
||||
|
if(groupDetail == null){ |
||||
|
return; |
||||
|
} |
||||
|
List<CereShopGroupLangInfo> groupLangInfoList = cereShopGroupLangInfoDAO.selectList(Wrappers.<CereShopGroupLangInfo>lambdaQuery().eq(CereShopGroupLangInfo::getShopGroupId,groupDetail.getShopGroupId())); |
||||
|
groupDetail.initMap(groupLangInfoList); |
||||
|
groupDetail.initData(ContextUtil.getLanguage()); |
||||
|
} |
||||
|
} |
@ -0,0 +1,158 @@ |
|||||
|
<?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="com.shop.cereshop.app.dao.shop.CereShopGroupDAO"> |
||||
|
<resultMap id="BaseResultMap" type="com.shop.cereshop.commons.domain.shop.CereShopGroup"> |
||||
|
<id column="shop_group_id" jdbcType="BIGINT" property="shopGroupId" /> |
||||
|
<result column="shop_id" jdbcType="BIGINT" property="shopId" /> |
||||
|
<result column="project" jdbcType="VARCHAR" property="project" /> |
||||
|
<result column="group_name" jdbcType="VARCHAR" property="groupName" /> |
||||
|
<result column="group_describe" jdbcType="VARCHAR" property="groupDescribe" /> |
||||
|
<result column="group_image" jdbcType="VARCHAR" property="groupImage" /> |
||||
|
<result column="create_time" jdbcType="VARCHAR" property="createTime" /> |
||||
|
<result column="update_time" jdbcType="VARCHAR" property="updateTime" /> |
||||
|
</resultMap> |
||||
|
<sql id="Base_Column_List"> |
||||
|
shop_group_id, shop_id, project, group_name,group_describe, group_image, create_time, update_time |
||||
|
</sql> |
||||
|
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
||||
|
select |
||||
|
<include refid="Base_Column_List" /> |
||||
|
from cere_shop_group |
||||
|
where shop_group_id = #{shopGroupId,jdbcType=BIGINT} |
||||
|
</select> |
||||
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
||||
|
delete from cere_shop_group |
||||
|
where shop_group_id = #{shopGroupId,jdbcType=BIGINT} |
||||
|
</delete> |
||||
|
<insert id="insertSelective" keyColumn="shop_group_id" keyProperty="shopGroupId" parameterType="com.shop.cereshop.commons.domain.shop.CereShopGroup" useGeneratedKeys="true"> |
||||
|
insert into cere_shop_group |
||||
|
<trim prefix="(" suffix=")" suffixOverrides=","> |
||||
|
<if test="shopId != null"> |
||||
|
shop_id, |
||||
|
</if> |
||||
|
<if test="project != null and project!=''"> |
||||
|
project, |
||||
|
</if> |
||||
|
<if test="groupName != null and groupName!=''"> |
||||
|
group_name, |
||||
|
</if> |
||||
|
<if test="groupDescribe != null and groupDescribe!=''"> |
||||
|
group_describe, |
||||
|
</if> |
||||
|
<if test="groupImage != null and groupImage!=''"> |
||||
|
group_image, |
||||
|
</if> |
||||
|
<if test="createTime != null and createTime!=''"> |
||||
|
create_time, |
||||
|
</if> |
||||
|
<if test="updateTime != null and updateTime!=''"> |
||||
|
update_time, |
||||
|
</if> |
||||
|
</trim> |
||||
|
<trim prefix="values (" suffix=")" suffixOverrides=","> |
||||
|
<if test="shopId != null"> |
||||
|
#{shopId,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="project != null and project!=''"> |
||||
|
#{project,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="groupName != null and groupName!=''"> |
||||
|
#{groupName,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="groupDescribe != null and groupDescribe!=''"> |
||||
|
#{groupDescribe,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="groupImage != null and groupImage!=''"> |
||||
|
#{groupImage,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="createTime != null and createTime!=''"> |
||||
|
#{createTime,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="updateTime != null and updateTime!=''"> |
||||
|
#{updateTime,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
</trim> |
||||
|
</insert> |
||||
|
<update id="updateByPrimaryKeySelective" parameterType="com.shop.cereshop.commons.domain.shop.CereShopGroup"> |
||||
|
update cere_shop_group |
||||
|
<set> |
||||
|
<if test="shopId != null"> |
||||
|
shop_id = #{shopId,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="project != null and project!=''"> |
||||
|
project = #{groupName,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="groupName != null and groupName!=''"> |
||||
|
group_name = #{groupName,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="groupDescribe != null and groupDescribe!=''"> |
||||
|
group_describe = #{groupDescribe,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="groupImage != null and groupImage!=''"> |
||||
|
group_image = #{groupImage,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="createTime != null and createTime!=''"> |
||||
|
create_time = #{createTime,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="updateTime != null and updateTime!=''"> |
||||
|
update_time = #{updateTime,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
</set> |
||||
|
where shop_group_id = #{shopGroupId,jdbcType=BIGINT} |
||||
|
</update> |
||||
|
<update id="updateByPrimaryKey" parameterType="com.shop.cereshop.commons.domain.shop.CereShopGroup"> |
||||
|
update cere_shop_group |
||||
|
set shop_id = #{shopId,jdbcType=BIGINT}, |
||||
|
project = #{project,jdbcType=VARCHAR}, |
||||
|
group_name = #{groupName,jdbcType=VARCHAR}, |
||||
|
group_describe = #{groupDescribe,jdbcType=VARCHAR}, |
||||
|
group_image = #{groupImage,jdbcType=VARCHAR}, |
||||
|
create_time = #{createTime,jdbcType=VARCHAR}, |
||||
|
update_time = #{updateTime,jdbcType=VARCHAR} |
||||
|
where shop_group_id = #{shopGroupId,jdbcType=BIGINT} |
||||
|
</update> |
||||
|
|
||||
|
<select id="getGroupSelect" parameterType="java.lang.Object" resultType="com.shop.cereshop.commons.domain.shop.CereShopGroup"> |
||||
|
SELECT shop_group_id, shop_id, group_name FROM cere_shop_group where shop_id=#{shopId} AND project=#{project} |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectAll" resultType="com.shop.cereshop.commons.domain.shop.CereShopGroup"> |
||||
|
SELECT shop_group_id,group_name, shop_id FROM cere_shop_group WHERE project=#{project} |
||||
|
</select> |
||||
|
|
||||
|
<update id="updateGroup" parameterType="java.lang.Object"> |
||||
|
UPDATE cere_shop_product set shop_group_id=NULL where shop_group_id=#{shopGroupId} |
||||
|
</update> |
||||
|
|
||||
|
<select id="getById" parameterType="java.lang.Object" resultType="com.shop.cereshop.app.page.group.GroupDetail"> |
||||
|
SELECT shop_group_id,group_name,group_image,group_describe FROM cere_shop_group where shop_group_id=#{shopGroupId} |
||||
|
</select> |
||||
|
|
||||
|
<select id="getAll" parameterType="com.shop.cereshop.app.param.shop.GroupGetAllParam" resultType="com.shop.cereshop.app.page.group.Group"> |
||||
|
SELECT a.shop_group_id, a.group_name, a.group_image, |
||||
|
ifnull(b.number, 0) as number, a.group_describe, a.update_time |
||||
|
from cere_shop_group a |
||||
|
LEFT JOIN (SELECT COUNT(*) number, shop_group_id from cere_shop_product GROUP BY shop_group_id) b |
||||
|
ON a.shop_group_id = b.shop_group_id |
||||
|
where a.shop_id = #{shopId} |
||||
|
<if test="search!=null and search!=''"> |
||||
|
and a.group_name like concat('%', #{search}, '%') |
||||
|
</if> |
||||
|
<if test="project!=null and project!=''"> |
||||
|
and a.project = #{project} |
||||
|
</if> |
||||
|
ORDER BY a.update_time DESC, a.create_time DESC |
||||
|
</select> |
||||
|
|
||||
|
<select id="findProducts" parameterType="java.lang.Long" resultType="com.shop.cereshop.app.page.group.GroupProduct"> |
||||
|
SELECT a.product_id,a.product_name,d.product_image image,b.original_price,c.stock_number,a.shelve_state from cere_shop_product a |
||||
|
LEFT JOIN (SELECT MIN(original_price) original_price,product_id from cere_product_sku GROUP BY product_id) b |
||||
|
ON a.product_id=b.product_id |
||||
|
LEFT JOIN (SELECT SUM(stock_number) stock_number,product_id FROM cere_product_sku GROUP BY product_id) c |
||||
|
ON a.product_id=c.product_id |
||||
|
LEFT JOIN (SELECT a.product_id,a.product_image from cere_product_image a,cere_shop_product b where a.product_id=b.product_id |
||||
|
GROUP BY a.product_id) d ON a.product_id=d.product_id |
||||
|
where a.shop_group_id=#{shopGroupId} |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
@ -0,0 +1,19 @@ |
|||||
|
<?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="com.shop.cereshop.app.dao.shop.CereShopGroupLangInfoDAO"> |
||||
|
|
||||
|
<!-- 通用查询映射结果 --> |
||||
|
<resultMap id="BaseResultMap" type="com.shop.cereshop.commons.domain.shop.CereShopGroupLangInfo"> |
||||
|
<id column="id" jdbcType="BIGINT" property="id"/> |
||||
|
<result column="shop_group_id" jdbcType="BIGINT" property="shopGroupId"/> |
||||
|
<result column="group_name" jdbcType="VARCHAR" property="groupName"/> |
||||
|
<result column="group_describe" jdbcType="VARCHAR" property="groupDescribe"/> |
||||
|
<result column="language_type" jdbcType="VARCHAR" property="languageType"/> |
||||
|
</resultMap> |
||||
|
|
||||
|
<!-- 通用查询结果列 --> |
||||
|
<sql id="Base_Column_List"> |
||||
|
id, shop_group_id, group_name, group_describe, language_type |
||||
|
</sql> |
||||
|
|
||||
|
</mapper> |
@ -0,0 +1,29 @@ |
|||||
|
/* |
||||
|
* Copyright (C) 2017-2021 |
||||
|
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
||||
|
* Copyright authorization contact 18814114118 |
||||
|
*/ |
||||
|
package com.shop.cereshop.business.controller.shop; |
||||
|
|
||||
|
import io.swagger.annotations.Api; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* <p> |
||||
|
* 前端控制器 |
||||
|
* |
||||
|
* </p> |
||||
|
* |
||||
|
* @author |
||||
|
* @date 2024-03-06 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@RestController |
||||
|
@RequestMapping("/cereShopGroupLangInfo") |
||||
|
@Api(value = "CereShopGroupLangInfo", tags = "") |
||||
|
public class CereShopGroupLangInfoController { |
||||
|
|
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
/* |
||||
|
* Copyright (C) 2017-2021 |
||||
|
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
||||
|
* Copyright authorization contact 18814114118 |
||||
|
*/ |
||||
|
package com.shop.cereshop.business.dao.shop; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.shop.cereshop.commons.domain.shop.CereShopGroupLangInfo; |
||||
|
|
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
@Mapper |
||||
|
public interface CereShopGroupLangInfoDAO extends BaseMapper<CereShopGroupLangInfo> { |
||||
|
|
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
/* |
||||
|
* Copyright (C) 2017-2021 |
||||
|
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
||||
|
* Copyright authorization contact 18814114118 |
||||
|
*/ |
||||
|
package com.shop.cereshop.business.service.shop; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.shop.cereshop.commons.domain.shop.CereShopGroupLangInfo; |
||||
|
|
||||
|
/** |
||||
|
* <p> |
||||
|
* 业务接口 |
||||
|
* |
||||
|
* </p> |
||||
|
* |
||||
|
* @author |
||||
|
* @date 2024-03-06 |
||||
|
*/ |
||||
|
public interface CereShopGroupLangInfoService extends IService<CereShopGroupLangInfo> { |
||||
|
|
||||
|
} |
@ -0,0 +1,28 @@ |
|||||
|
/* |
||||
|
* Copyright (C) 2017-2021 |
||||
|
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
||||
|
* Copyright authorization contact 18814114118 |
||||
|
*/ |
||||
|
package com.shop.cereshop.business.service.shop.impl; |
||||
|
|
||||
|
import com.shop.cereshop.business.dao.shop.CereShopGroupLangInfoDAO; |
||||
|
import com.shop.cereshop.commons.domain.shop.CereShopGroupLangInfo; |
||||
|
import com.shop.cereshop.business.service.shop.CereShopGroupLangInfoService; |
||||
|
|
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
/** |
||||
|
* <p> |
||||
|
* 业务实现类 |
||||
|
* |
||||
|
* </p> |
||||
|
* |
||||
|
* @author |
||||
|
* @date 2024-03-06 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
public class CereShopGroupLangInfoServiceImpl extends ServiceImpl<CereShopGroupLangInfoDAO, CereShopGroupLangInfo> implements CereShopGroupLangInfoService { |
||||
|
} |
@ -0,0 +1,19 @@ |
|||||
|
<?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="com.shop.cereshop.business.dao.shop.CereShopGroupLangInfoDAO"> |
||||
|
|
||||
|
<!-- 通用查询映射结果 --> |
||||
|
<resultMap id="BaseResultMap" type="com.shop.cereshop.commons.domain.shop.CereShopGroupLangInfo"> |
||||
|
<id column="id" jdbcType="BIGINT" property="id"/> |
||||
|
<result column="shop_group_id" jdbcType="BIGINT" property="shopGroupId"/> |
||||
|
<result column="group_name" jdbcType="VARCHAR" property="groupName"/> |
||||
|
<result column="group_describe" jdbcType="VARCHAR" property="groupDescribe"/> |
||||
|
<result column="language_type" jdbcType="VARCHAR" property="languageType"/> |
||||
|
</resultMap> |
||||
|
|
||||
|
<!-- 通用查询结果列 --> |
||||
|
<sql id="Base_Column_List"> |
||||
|
id, shop_group_id, group_name, group_describe, language_type |
||||
|
</sql> |
||||
|
|
||||
|
</mapper> |
@ -0,0 +1,93 @@ |
|||||
|
/* |
||||
|
* Copyright (C) 2017-2021 |
||||
|
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
||||
|
* Copyright authorization contact 18814114118 |
||||
|
*/ |
||||
|
package com.shop.cereshop.commons.domain.shop; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.baomidou.mybatisplus.annotation.IdType; |
||||
|
import com.baomidou.mybatisplus.annotation.TableId; |
||||
|
import com.baomidou.mybatisplus.annotation.TableField; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import javax.validation.constraints.NotEmpty; |
||||
|
import javax.validation.constraints.NotNull; |
||||
|
import org.hibernate.validator.constraints.Length; |
||||
|
import org.hibernate.validator.constraints.Range; |
||||
|
import java.time.LocalDateTime; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
import lombok.ToString; |
||||
|
import lombok.experimental.Accessors; |
||||
|
|
||||
|
import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE; |
||||
|
|
||||
|
/** |
||||
|
* <p> |
||||
|
* 实体类 |
||||
|
* |
||||
|
* </p> |
||||
|
* |
||||
|
* @since 2024-03-06 |
||||
|
*/ |
||||
|
@Data |
||||
|
@NoArgsConstructor |
||||
|
@ToString(callSuper = true) |
||||
|
@TableName("cere_shop_group_lang_info") |
||||
|
@ApiModel(value = "CereShopGroupLangInfo", description = "") |
||||
|
@AllArgsConstructor |
||||
|
public class CereShopGroupLangInfo { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 主键Id |
||||
|
*/ |
||||
|
@ApiModelProperty(value = "主键Id") |
||||
|
@NotNull(message = "主键Id不能为空") |
||||
|
@TableId(value = "id", type = IdType.AUTO) |
||||
|
private Long id; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 分组主键 |
||||
|
*/ |
||||
|
@ApiModelProperty(value = "分组主键") |
||||
|
@TableField("shop_group_id") |
||||
|
private Long shopGroupId; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 分组名字 |
||||
|
*/ |
||||
|
@ApiModelProperty(value = "分组名字") |
||||
|
@Length(max = 255, message = "分组名字长度不能超过255") |
||||
|
@TableField(value = "group_name", condition = LIKE) |
||||
|
private String groupName; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 分组描述 |
||||
|
*/ |
||||
|
@ApiModelProperty(value = "分组描述") |
||||
|
@Length(max = 255, message = "分组描述长度不能超过255") |
||||
|
@TableField(value = "group_describe", condition = LIKE) |
||||
|
private String groupDescribe; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 语言类型 |
||||
|
*/ |
||||
|
@ApiModelProperty(value = "语言类型") |
||||
|
@Length(max = 32, message = "语言类型长度不能超过32") |
||||
|
@TableField(value = "language_type", condition = LIKE) |
||||
|
private String languageType; |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue