FengChaoYu před 3 týdny
rodič
revize
37093f4f1a

+ 4 - 4
src/main/java/com/gree/mall/contest/bean/common/ImgCarouselManageBean.java

@@ -9,16 +9,16 @@ public class ImgCarouselManageBean {
 
     private String id;
 
-    @Schema(name = "轮播图名称")
+    @Schema(description = "轮播图名称")
     private String imgCarouselName;
 
-    @Schema(name = "轮播图")
+    @Schema(description = "轮播图")
     private String imgCarouselUrl;
 
-    @Schema(name = "顺序")
+    @Schema(description = "顺序")
     private Integer imgCarouselOrder;
 
-    @Schema(name = "状态:显示,隐藏")
+    @Schema(description = "状态:显示,隐藏")
     private String status;
     //状态  1:显示  0:隐藏
     public final static String STATUS_SHOW = "1";

+ 16 - 0
src/main/java/com/gree/mall/contest/bean/goods/GoodsCategoryBean.java

@@ -0,0 +1,16 @@
+package com.gree.mall.contest.bean.goods;
+
+import com.gree.mall.contest.plus.entity.GoodsCategory;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class GoodsCategoryBean extends GoodsCategory {
+
+    @Schema(description = "子类别")
+    private List<GoodsCategoryBean> children;
+}

+ 14 - 0
src/main/java/com/gree/mall/contest/commonmapper/CustomGoodsCategoryMapper.java

@@ -0,0 +1,14 @@
+package com.gree.mall.contest.commonmapper;
+
+import com.gree.mall.contest.bean.goods.GoodsCategoryBean;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface CustomGoodsCategoryMapper {
+
+
+    List<GoodsCategoryBean> list(@Param("level") Integer level, @Param("status") Boolean status,
+                                 @Param("name") String name, @Param("companyWechatIds") List<String> companyWechatIds);
+
+}

+ 72 - 0
src/main/java/com/gree/mall/contest/controller/pc/goods/GoodsCategoryController.java

@@ -0,0 +1,72 @@
+package com.gree.mall.contest.controller.pc.goods;
+
+import com.gree.mall.contest.bean.goods.GoodsCategoryBean;
+import com.gree.mall.contest.exception.RemoteServiceException;
+import com.gree.mall.contest.helper.ResponseHelper;
+import com.gree.mall.contest.logic.goods.GoodsCategoryLogic;
+import com.gree.mall.contest.plus.entity.GoodsCategory;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+
+@Slf4j
+@RestController
+@Tag(name = "分类管理", description = "分类管理")
+@RequestMapping(value = "/goods/category", produces = "application/json; charset=utf-8")
+@RequiredArgsConstructor
+public class GoodsCategoryController {
+
+    private final GoodsCategoryLogic goodsCategoryLogic;
+
+    @GetMapping("/list")
+    @Operation(summary = "分类管理列表")
+    public ResponseHelper<List<GoodsCategoryBean>> page(
+            @Parameter(name = "层级",required = false) @RequestParam(required = false, defaultValue = "1") Integer categoryLevel,
+            @Parameter(name = "分类名称",required = false) @RequestParam(required = false) String name,
+            @Parameter(name = "状态(true:显示 false:隐藏",required = false) @RequestParam(required = false) Boolean status,
+            HttpServletRequest request
+    ) throws RemoteServiceException {
+        List<GoodsCategoryBean> list = goodsCategoryLogic.list(categoryLevel,name,status,request);
+        return ResponseHelper.success(list);
+    }
+
+    @PostMapping("/add")
+    @Operation(summary = "新增分类")
+    public ResponseHelper add(
+            @Parameter(description = "object",required = true) @RequestBody GoodsCategoryBean goodsCategoryBean,HttpServletRequest request) {
+        goodsCategoryLogic.add(goodsCategoryBean,request);
+        return ResponseHelper.success();
+    }
+
+    @PostMapping("/update")
+    @Operation(summary = "修改分类")
+    public ResponseHelper update(
+            @Parameter(description = "object",required = true) @RequestBody GoodsCategory goodsCategory) {
+        goodsCategoryLogic.update(goodsCategory);
+        return ResponseHelper.success();
+    }
+
+    @PostMapping("/delete")
+    @Operation(summary = "删除分类")
+    public ResponseHelper delete(
+            @Parameter(description = "分类id",required = true) @RequestParam String categoryId
+    ) {
+        goodsCategoryLogic.delete(categoryId);
+        return ResponseHelper.success();
+    }
+
+    @GetMapping("/detail")
+    @Operation(summary = "详情")
+    public ResponseHelper<GoodsCategory> detail(
+            @Parameter(description = "分类id",required = true) @RequestParam String categoryId
+    ){
+        GoodsCategory detail = goodsCategoryLogic.detail(categoryId);
+        return ResponseHelper.success(detail);
+    }
+}

+ 43 - 40
src/main/java/com/gree/mall/contest/logic/common/CommonLogic.java

@@ -43,7 +43,7 @@ public class CommonLogic {
     AdminCompanyWechatService AdminCompanyWechatService;
     @Autowired
     CommonFileService commonFileService;
-//    @Autowired
+    //    @Autowired
 //    RegionService regionService;
     @Autowired
     AdminUserService adminUserService;
@@ -69,9 +69,9 @@ public class CommonLogic {
         return ossUtil.getConfig();
     }
 
-    public SysConfig getSysConfig(){
+    public SysConfig getSysConfig() {
         SysConfig sysConfig = sysConfigService.lambdaQuery().last("limit 1").one();
-        if(sysConfig == null){
+        if (sysConfig == null) {
             throw new RemoteServiceException("系统缺少必要配置,请联系相关人员");
         }
         return sysConfig;
@@ -79,12 +79,13 @@ public class CommonLogic {
 
     /**
      * 查询服务商的所有账号
+     *
      * @param serviceProviderId
      * @return
      */
-    public List<AdminUser> getAdminUserByServiceProviderId(String serviceProviderId){
+    public List<AdminUser> getAdminUserByServiceProviderId(String serviceProviderId) {
         List<AdminUser> list = adminUserService.lambdaQuery()
-                .eq(AdminUser::getStatus,true)
+                .eq(AdminUser::getStatus, true)
                 .eq(AdminUser::getServiceProviderId, serviceProviderId).list();
         return list;
     }
@@ -92,25 +93,27 @@ public class CommonLogic {
 
     /**
      * 获取用户信息
+     *
      * @param mobile
      * @param flag
      * @return
      */
-    public User getUserByMobile(String mobile,Integer flag){
-        if(StringUtils.isBlank(mobile) || flag == null){
+    public User getUserByMobile(String mobile, Integer flag) {
+        if (StringUtils.isBlank(mobile) || flag == null) {
             throw new RemoteServiceException("获取用户信息失败,缺少必要的参数");
         }
         return userService.lambdaQuery()
-                .eq(User::getMobile,mobile)
-                .eq(User::getFlag,flag)
+                .eq(User::getMobile, mobile)
+                .eq(User::getFlag, flag)
                 .one();
     }
 
     /**
      * 查询当前PC用户
+     *
      * @return
      */
-    public AdminUserCom getAdminUser(){
+    public AdminUserCom getAdminUser() {
         HttpServletRequest request = ApplicationContextUtils.getHttpServletRequest();
         return this.getAdminUser(request);
     }
@@ -118,47 +121,46 @@ public class CommonLogic {
     /**
      * 获取帐号以及部门id集合
      */
-    public AdminUserCom getAdminUser(HttpServletRequest request){
+    public AdminUserCom getAdminUser(HttpServletRequest request) {
         String userId = CommonUtils.getUserId(request);
         //方便测试用
-        if(StringUtils.isBlank(userId) && !active.equals("prd")){
+        if (StringUtils.isBlank(userId) && !active.equals("prd")) {
             AdminUser admin = adminUserService.lambdaQuery().eq(AdminUser::getUserName, "admin").one();
             AdminUserCom adminUserCom = new AdminUserCom();
-            BeanUtils.copyProperties(admin,adminUserCom);
+            BeanUtils.copyProperties(admin, adminUserCom);
             AdminCompanyWechat adminCompanyWechat = adminCompanyWechatService.getById("1");
             adminUserCom.setAdminCompanyWechat(adminCompanyWechat);
             return adminUserCom;
         }
         AdminUser adminUser = adminUserService.getById(userId);
-        if(adminUser == null){
+        if (adminUser == null) {
             return null;
         }
-        if(!adminUser.getStatus()){
+        if (!adminUser.getStatus()) {
             throw new RemoteServiceException("帐号已被禁用");
         }
         AdminUserCom adminUserCom = new AdminUserCom();
-        BeanUtils.copyProperties(adminUser,adminUserCom);
+        BeanUtils.copyProperties(adminUser, adminUserCom);
 
         //所有帐号
-        AdminUserCom account2 = this.websitAccount(adminUserCom,request);
+        AdminUserCom account2 = this.websitAccount(adminUserCom, request);
 
-        if(account2 != null){
+        if (account2 != null) {
             return account2;
         }
         adminUserCom.setCompanyWechatIds(ListUtil.toList("1"));
         //暂不过滤权限
-        //adminUserCom.setAdminWebsitIds(null);
         return adminUserCom;
     }
 
     /**
      * 部门帐号
      */
-    public AdminUserCom websitAccount(AdminUserCom adminUserCom,HttpServletRequest request){
+    public AdminUserCom websitAccount(AdminUserCom adminUserCom, HttpServletRequest request) {
         AdminWebsit adminWebsit = adminWebsitService.getById(adminUserCom.getAdminWebsitId());
         adminUserCom.setAdminWebsit(adminWebsit);
         //非平台账号
-        if(!adminUserCom.getUserName().equals("admin")){
+        if (!adminUserCom.getUserName().equals("admin")) {
             List<AdminWebsit> list = new ArrayList<>();
             list.addAll(this.queryAllChild(list, adminUserCom.getAdminWebsitId()));
             List<String> websitIds = list.stream().map(AdminWebsit::getWebsitId).distinct().collect(Collectors.toList());
@@ -166,7 +168,7 @@ public class CommonLogic {
             adminUserCom.setAdminWebsitIds(websitIds.stream().distinct().collect(Collectors.toList()));
 
             //平台业务员的区id
-            if(StringUtils.equals(adminUserCom.getType(), RoleTypeEnum.A.getCode())) {
+            if (StringUtils.equals(adminUserCom.getType(), RoleTypeEnum.A.getCode())) {
                 //区域id
                 List<AdminWebsitRegion> adminWebsitRegions = adminWebsitRegionService.lambdaQuery().in(AdminWebsitRegion::getAdminWebsitId, adminUserCom.getAdminWebsitIds()).list();
                 adminUserCom.setAreaIds(adminWebsitRegions.stream().map(AdminWebsitRegion::getAreaId).distinct().collect(Collectors.toList()));
@@ -177,7 +179,7 @@ public class CommonLogic {
         return adminUserCom;
     }
 
-    public User getUser(){
+    public User getUser() {
         HttpServletRequest request = ApplicationContextUtils.getHttpServletRequest();
         String userId = CommonUtils.getUserId(request);
         User user = userService.getById(userId);
@@ -187,16 +189,16 @@ public class CommonLogic {
     /**
      * 递归查询所有数据
      */
-    public List<AdminWebsit> queryAllChild(List<AdminWebsit> list,String id){
-        if(id == null || id.equals("0")){
+    public List<AdminWebsit> queryAllChild(List<AdminWebsit> list, String id) {
+        if (id == null || id.equals("0")) {
             return list;
         }
         List<AdminWebsit> adminWebsits = adminWebsitService.lambdaQuery().eq(AdminWebsit::getParentId, id).list();
-        if(adminWebsits.size() == 0){
+        if (adminWebsits.size() == 0) {
             return list;
         }
-        for(AdminWebsit adminWebsit:adminWebsits){
-            this.queryAllChild(list,adminWebsit.getWebsitId());
+        for (AdminWebsit adminWebsit : adminWebsits) {
+            this.queryAllChild(list, adminWebsit.getWebsitId());
         }
         list.addAll(adminWebsits);
         return list;
@@ -204,6 +206,7 @@ public class CommonLogic {
 
     /**
      * 上传附件
+     *
      * @param file
      * @return
      * @throws IOException
@@ -257,7 +260,7 @@ public class CommonLogic {
         return url;
     }
 
-    public List<LbsAmap> city2(String city){
+    public List<LbsAmap> city2(String city) {
         List<LbsAmap> citys = lbsAmapService.lambdaQuery()
                 .eq(LbsAmap::getStatus, StateEnum.ON.getKey())
                 .like(LbsAmap::getName, city)
@@ -267,7 +270,7 @@ public class CommonLogic {
     }
 
 
-    public AdminCompanyWechat getAdminCompanyWechat(String subAppId){
+    public AdminCompanyWechat getAdminCompanyWechat(String subAppId) {
         AdminCompanyWechat one = adminCompanyWechatService.lambdaQuery().eq(AdminCompanyWechat::getSubAppId, subAppId).last("limit 1").one();
         return one;
     }
@@ -275,16 +278,16 @@ public class CommonLogic {
     /**
      * 附件归属绑定
      */
-    public void bindFileFile(String objId,String objType,List<CommonFile> fileIds){
-        if(CollectionUtil.isEmpty(fileIds)){
+    public void bindFileFile(String objId, String objType, List<CommonFile> fileIds) {
+        if (CollectionUtil.isEmpty(fileIds)) {
             return;
         }
         //先删除后绑定
         commonFileService.lambdaUpdate()
-                .eq(CommonFile::getObjId,objId)
-                .eq(CommonFile::getObjType,objType).remove();
+                .eq(CommonFile::getObjId, objId)
+                .eq(CommonFile::getObjType, objType).remove();
 
-        for(CommonFile file : fileIds) {
+        for (CommonFile file : fileIds) {
             file.setId(null);
             file.setObjId(objId);
             file.setObjType(objType);
@@ -295,10 +298,10 @@ public class CommonLogic {
     /**
      * 查询附件列表
      */
-    public List<CommonFile> queryFileByObjId(String objId,String objType){
+    public List<CommonFile> queryFileByObjId(String objId, String objType) {
         return commonFileService.lambdaQuery()
-                .eq(CommonFile::getObjId,objId)
-                .eq(CommonFile::getObjType,objType)
+                .eq(CommonFile::getObjId, objId)
+                .eq(CommonFile::getObjType, objType)
                 .orderByAsc(CommonFile::getCreateTime)
                 .list();
     }
@@ -306,9 +309,9 @@ public class CommonLogic {
     /**
      * 查询附件列表
      */
-    public List<String> queryFileUrlsByObjId(String objId,String objType){
+    public List<String> queryFileUrlsByObjId(String objId, String objType) {
         List<CommonFile> commonFiles = this.queryFileByObjId(objId, objType);
-        if(commonFiles.size() == 0){
+        if (commonFiles.size() == 0) {
             return null;
         }
         return commonFiles.stream().map(CommonFile::getUrl).collect(Collectors.toList());

+ 115 - 0
src/main/java/com/gree/mall/contest/logic/goods/GoodsCategoryLogic.java

@@ -0,0 +1,115 @@
+package com.gree.mall.contest.logic.goods;
+
+import com.gree.mall.contest.bean.admin.AdminUserCom;
+import com.gree.mall.contest.bean.goods.GoodsCategoryBean;
+import com.gree.mall.contest.commonmapper.CustomGoodsCategoryMapper;
+import com.gree.mall.contest.exception.RemoteServiceException;
+import com.gree.mall.contest.logic.common.CommonLogic;
+import com.gree.mall.contest.plus.entity.GoodsCategory;
+import com.gree.mall.contest.plus.service.GoodsCategoryService;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Date;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Service
+@Slf4j
+@RequiredArgsConstructor
+public class GoodsCategoryLogic {
+
+    private static final Logger operationLogger = LoggerFactory.getLogger("OPERATION_LOGGER");
+
+    private final CustomGoodsCategoryMapper customGoodsCategoryMapper;
+    private final GoodsCategoryService goodsCategoryService;
+    private final CommonLogic commonLogic;
+
+    /**
+     * 分类管理列表
+     *
+     * @param level
+     * @param status
+     * @return
+     */
+    public List<GoodsCategoryBean> list(Integer level, String name, Boolean status, HttpServletRequest request) {
+        //获取当前登录企业微信id
+        AdminUserCom adminUser = commonLogic.getAdminUser(request);
+        List<String> companyWechatIds = adminUser.getCompanyWechatIds();
+
+
+        return customGoodsCategoryMapper.list(level, status, name, companyWechatIds);
+    }
+
+    /**
+     * 新增分类
+     *
+     * @param goodsCategoryBean
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public void add(GoodsCategoryBean goodsCategoryBean, HttpServletRequest request) {
+        AdminUserCom adminUser = commonLogic.getAdminUser(request);
+        if (StringUtils.isEmpty(adminUser.getAdminCompanyWechat().getCompanyWechatId())) {
+            throw new RemoteServiceException("无效微信企业id");
+        }
+
+        Date createDate = new Date();
+        if (goodsCategoryBean.getChildren() != null) {
+            List<GoodsCategory> goodsCategoryList = goodsCategoryBean.getChildren()
+                    .stream()
+                    .map(c -> c.setCreateTime(createDate))
+                    .collect(Collectors.toList());
+            for (GoodsCategory goodsCategory : goodsCategoryList) {
+                goodsCategory.setLevel(2);
+                goodsCategory.setCreateTime(new Date());
+                goodsCategory.setCompanyWechatId(adminUser.getAdminCompanyWechat().getCompanyWechatId());
+                goodsCategory.setCompanyName(adminUser.getAdminCompanyWechat().getCompanyName());
+            }
+            goodsCategoryService.saveBatch(goodsCategoryList);
+        } else {
+            goodsCategoryBean.setCreateTime(createDate);
+            goodsCategoryBean.setCompanyWechatId(adminUser.getAdminCompanyWechat().getCompanyWechatId());
+            goodsCategoryBean.setCompanyName(adminUser.getAdminCompanyWechat().getCompanyName());
+            goodsCategoryService.save(goodsCategoryBean);
+        }
+    }
+
+    /**
+     * 修改分类
+     *
+     * @param goodsCategory
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public void update(GoodsCategory goodsCategory) {
+        goodsCategoryService.updateById(goodsCategory);
+    }
+
+    /**
+     * 删除分类
+     *
+     * @param categoryId
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public void delete(String categoryId) {
+        // 删除子类别
+        goodsCategoryService.lambdaUpdate()
+                .eq(GoodsCategory::getCategoryId, categoryId)
+                .or()
+                .eq(GoodsCategory::getParentId, categoryId)
+                .remove();
+    }
+
+    /**
+     * 分类详情
+     */
+    public GoodsCategory detail(String goodsCategoryId) {
+        return goodsCategoryService.getById(goodsCategoryId);
+    }
+
+}

+ 9 - 0
src/main/java/com/gree/mall/contest/utils/JwtUtils.java

@@ -4,6 +4,7 @@ import com.gree.mall.contest.constant.Constant;
 import io.jsonwebtoken.Claims;
 import io.jsonwebtoken.ExpiredJwtException;
 import io.jsonwebtoken.Jwts;
+import io.jsonwebtoken.io.Encoders;
 import io.jsonwebtoken.security.Keys;
 import io.jsonwebtoken.security.SignatureException;
 
@@ -25,6 +26,14 @@ public class JwtUtils {
     private static final Long expiration = 7200L;
     private static final SecretKey secretKey = Keys.hmacShaKeyFor(secret.getBytes());
 
+    // 1. 生成安全的随机密钥(自动满足长度要求)
+    public static void generateAndSaveKey() {
+        SecretKey key = Jwts.SIG.HS512.key().build(); // 自动生成 512-bit 密钥
+        String base64Key = Encoders.BASE64.encode(key.getEncoded());
+        System.out.println("安全密钥 (Base64): " + base64Key);
+        // 将 base64Key 存储到安全配置中(如环境变量、配置中心)
+    }
+
     /**
      * 生成JWT令牌
      * @param userId    用户ID

+ 18 - 0
src/main/resources/logback.xml

@@ -1,6 +1,8 @@
 <!-- Logback configuration. See http://logback.qos.ch/manual/index.html -->
 <configuration scan="true" scanPeriod="2 seconds">
+    <!-- 通用属性 -->
     <property name="LOG_PATH" value="../logs" />
+    <property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n"/>
 
     <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
         <!-- 日志输出编码 -->
@@ -47,6 +49,18 @@
         </layout>
     </appender>
 
+    <!-- 操作日志文件 -->
+    <appender name="OPERATION_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <file>${LOG_PATH}/operation.log</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <fileNamePattern>${LOG_PATH}/operation.%d{yyyy-MM-dd}.log</fileNamePattern>
+            <maxHistory>30</maxHistory>
+        </rollingPolicy>
+        <encoder>
+            <pattern>${LOG_PATTERN}</pattern>
+        </encoder>
+    </appender>
+
     <logger name="com.ibatis" level="INFO" />
     <logger name="com.ibatis.common.jdbc.SimpleDataSource" level="INFO" />
     <logger name="com.ibatis.common.jdbc.ScriptRunner" level="INFO" />
@@ -57,6 +71,10 @@
     <logger name="me.chanjar.weixin.cp.api.impl.BaseWxCpServiceImpl" level="OFF" />
     <logger name="me.chanjar.weixin.common.error.WxErrorException" level="OFF" />
 
+    <!-- 操作日志记录器 -->
+    <logger name="OPERATION_LOGGER" level="INFO" additivity="false">
+        <appender-ref ref="OPERATION_FILE"/>
+    </logger>
 
     <root level="INFO">
         <appender-ref ref="INFO_FILE" />

+ 52 - 0
src/main/resources/mapper/CustomGoodsCategoryMapper.xml

@@ -0,0 +1,52 @@
+<?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.gree.mall.contest.commonmapper.CustomGoodsCategoryMapper">
+
+    <resultMap id="listResultMap" type="com.gree.mall.contest.bean.goods.GoodsCategoryBean">
+        <id column="categoryId" property="categoryId"/>
+        <collection property="children" column="{categoryId=categoryId}"
+                    select="com.gree.mall.manager.commonmapper.CustomGoodsCategoryMapper.findChildrenByCategoryId">
+        </collection>
+    </resultMap>
+
+    <select id="list" resultMap="listResultMap">
+        SELECT
+            category_id AS categoryId,
+            name AS name,
+            status AS status,
+            img_url AS imgUrl,
+            goods_num AS goodsNum,
+            level AS level,
+            parent_id AS parentId,
+            sort_num AS sortNum,
+            create_time AS createTime
+        FROM goods_category
+        <where>
+            del = 0
+            <if test='level != null'>
+                AND level = #{level}
+            </if>
+            <if test='status != null'>
+                AND status = #{status}
+            </if>
+            <if test='name != null'>
+                AND name like concat('%',#{name,jdbcType=VARCHAR},'%')
+            </if>
+            <if test=' companyWechatIds != null and companyWechatIds.size > 0' >
+                AND company_wechat_id in
+                <foreach collection="companyWechatIds" open="(" close=")" item="companyWechatId" separator=",">
+                     #{companyWechatId}
+                </foreach>
+            </if>
+        </where>
+        order by sort_num desc
+
+    </select>
+
+    <select id="findChildrenByCategoryId" resultType="com.gree.mall.contest.bean.goods.GoodsCategoryBean">
+        SELECT * FROM goods_category
+        WHERE parent_id = #{categoryId} AND del = 0
+        order by sort_num desc
+    </select>
+
+</mapper>