FengChaoYu 2 тижнів тому
батько
коміт
26467e7a89

+ 9 - 0
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/controller/user/UserController.java

@@ -11,6 +11,7 @@ import com.gree.mall.miniapp.logic.common.CommonLogic;
 import com.gree.mall.miniapp.logic.common.SMSLogic;
 import com.gree.mall.miniapp.logic.common.outside.WechatLogic;
 import com.gree.mall.miniapp.logic.user.UserLogic;
+import com.gree.mall.miniapp.plus.entity.AmityUrl;
 import com.gree.mall.miniapp.plus.entity.SettleExpenseItem;
 import com.gree.mall.miniapp.plus.entity.User;
 import com.gree.mall.miniapp.plus.service.UserService;
@@ -273,4 +274,12 @@ public class UserController {
         userLogic.registerUser(companyWechatId, firstName, lastName, mobile, email);
         return ResponseHelper.success();
     }
+
+    @ApiNotAuth
+    @PostMapping("amity/list2")
+    @ApiOperation(value = "友情链接-列表")
+    public ResponseHelper<List<AmityUrl>> amityList(@ApiParam(value = "MALL=商城 MANAGE=管理后台")  @RequestParam(required = false, defaultValue = "MANAGE") String type) {
+        List<AmityUrl> amityUrls = userLogic.list2(type);
+        return ResponseHelper.success(amityUrls);
+    }
 }

+ 8 - 0
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/logic/user/UserLogic.java

@@ -108,6 +108,8 @@ public class UserLogic {
     SMSLogic smsLogic;
     @Resource
     StorageLogic storageLogic;
+    @Resource
+    AmityUrlService amityUrlService;
 
     /**
      * 微信小程序授权
@@ -886,4 +888,10 @@ public class UserLogic {
                 .setExamineStatus(ExamineStatusEnum.WAIT.getKey())
                 .insert();
     }
+
+    public List<AmityUrl> list2(String type) {
+        return amityUrlService.lambdaQuery()
+                .eq(AmityUrl::getAmityPositionType, type)
+                .list();
+    }
 }

+ 4 - 1
mall-server-api/src/main/java/com/gree/mall/manager/bean/common/AmityUrlVO.java

@@ -1,7 +1,7 @@
 package com.gree.mall.manager.bean.common;
 
 
-import com.gree.mall.manager.annotation.ZfireField;
+import com.gree.mall.manager.enums.AmityPositionTypeEnum;
 import com.gree.mall.manager.enums.StatusEnum;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -15,6 +15,9 @@ public class AmityUrlVO {
    @ApiModelProperty( "友情链接id")
     private String amityUrlId;
 
+    @ApiModelProperty( "友情链接类型")
+    private AmityPositionTypeEnum amityPositionType;
+
    @ApiModelProperty( "友情链接名称")
     private String amityUrlName;
 

+ 2 - 4
mall-server-api/src/main/java/com/gree/mall/manager/controller/common/CompanyRecordController.java

@@ -3,7 +3,6 @@ package com.gree.mall.manager.controller.common;
 
 import cn.hutool.core.lang.TypeReference;
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.beust.jcommander.Parameter;
 import com.gree.mall.manager.annotation.ApiNotAuth;
 import com.gree.mall.manager.annotation.ZfireList;
 import com.gree.mall.manager.bean.common.AmityUrlVO;
@@ -16,7 +15,6 @@ import com.gree.mall.manager.plus.entity.CompanyRecordManage;
 import com.gree.mall.manager.plus.entity.ImgCarouselManage;
 import com.gree.mall.manager.zfire.bean.ZfireParamBean;
 import io.swagger.annotations.Api;
-
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import lombok.extern.slf4j.Slf4j;
@@ -151,8 +149,8 @@ public class CompanyRecordController {
     @ApiNotAuth
     @PostMapping("amity/list2")
     @ApiOperation(value = "友情链接-列表")
-    public ResponseHelper<List<AmityUrl>> amityList() {
-        List<AmityUrl> amityUrls = companyRecordLogic.list2();
+    public ResponseHelper<List<AmityUrl>> amityList(@ApiParam(value = "MALL=商城 MANAGE=管理后台")  @RequestParam(required = false, defaultValue = "MANAGE") String type) {
+        List<AmityUrl> amityUrls = companyRecordLogic.list2(type);
         return ResponseHelper.success(amityUrls);
     }
 

+ 22 - 0
mall-server-api/src/main/java/com/gree/mall/manager/enums/AmityPositionTypeEnum.java

@@ -0,0 +1,22 @@
+package com.gree.mall.manager.enums;
+
+import com.baomidou.mybatisplus.annotation.EnumValue;
+import com.fasterxml.jackson.annotation.JsonValue;
+import com.gree.mall.manager.enums.base.BaseEnum;
+import lombok.AccessLevel;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+
+@Getter
+@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
+public enum AmityPositionTypeEnum implements BaseEnum {
+    MANAGE("MANAGE","管理后台"),
+    MALL("MALL","商城"),
+    ;
+
+    @EnumValue
+    @JsonValue
+    private final String key;
+    private final String remark;
+
+}

+ 10 - 3
mall-server-api/src/main/java/com/gree/mall/manager/logic/common/CompanyRecordLogic.java

@@ -7,7 +7,6 @@ import com.gree.mall.manager.bean.common.AmityUrlVO;
 import com.gree.mall.manager.bean.common.ImgCarouselManageBean;
 import com.gree.mall.manager.commonmapper.CommonMapper;
 import com.gree.mall.manager.enums.IsYesNoEnum;
-import com.gree.mall.manager.enums.StatusEnum;
 import com.gree.mall.manager.exception.RemoteServiceException;
 import com.gree.mall.manager.plus.entity.AmityUrl;
 import com.gree.mall.manager.plus.entity.CompanyRecordManage;
@@ -137,6 +136,9 @@ public class CompanyRecordLogic {
     }
 
     public void addAmity(AmityUrl amityUrl) {
+        if (StringUtils.isEmpty(amityUrl.getAmityPositionType())) {
+            throw new RemoteServiceException("请选择位置类型");
+        }
         if (StringUtils.isEmpty(amityUrl.getAmityUrlName())) {
             throw new RemoteServiceException("友链名称");
         }
@@ -147,6 +149,9 @@ public class CompanyRecordLogic {
     }
 
     public void updateAmity(AmityUrl amityUrl) {
+        if (StringUtils.isEmpty(amityUrl.getAmityPositionType())) {
+            throw new RemoteServiceException("请选择位置类型");
+        }
         if (StringUtils.isEmpty(amityUrl.getAmityUrlName())) {
             throw new RemoteServiceException("友链名称");
         }
@@ -165,8 +170,10 @@ public class CompanyRecordLogic {
         return commonMapper.amityList(new Page(zfireParamBean.getPageNum(),zfireParamBean.getPageSize()),zfireParamBean);
     }
 
-    public List<AmityUrl> list2(){
-        return amityUrlService.list();
+    public List<AmityUrl> list2(String type){
+        return amityUrlService.lambdaQuery()
+                .eq(AmityUrl::getAmityPositionType, type)
+                .list();
     }