zhangyuewww 2 yıl önce
ebeveyn
işleme
2bda966ea2

+ 0 - 3
unimall-admin-api/src/main/java/com/iotechn/unimall/admin/api/card/ICardClassifyInfoService.java

@@ -41,9 +41,6 @@ public interface ICardClassifyInfoService{
 	@HttpMethod(description = "置顶",  permissionName = "名片分类管理")
 	public Boolean top(@NotNull @HttpParam(name = "cardClassifyInfo", type = HttpParamType.COMMON, description = "名片分类") CardClassifyInfo cardClassifyInfo)throws ServiceException;
 
-	@HttpMethod(description = "置顶默认分类",  permissionName = "名片分类管理")
-	public Boolean topDefault(@NotNull @HttpParam(name = "cardClassifyInfo", type = HttpParamType.COMMON, description = "名片分类") CardClassifyInfo cardClassifyInfo)throws ServiceException;
-
 	@HttpMethod(description = "修改",  permissionName = "名片分类管理")
 	public Boolean update(@NotNull @HttpParam(name = "cardClassifyInfo", type = HttpParamType.COMMON, description = "名片分类") CardClassifyInfo cardClassifyInfo)throws ServiceException;
 

+ 4 - 19
unimall-admin-api/src/main/java/com/iotechn/unimall/admin/api/card/impl/CardClassifyInfoServiceImpl.java

@@ -98,32 +98,17 @@ public class CardClassifyInfoServiceImpl implements ICardClassifyInfoService {
         CardClassifyInfo cardClassifyInfo1 = cardClassifyInfoMapper.selectById(cardClassifyInfo.getId());
         List<CardClassifyInfo> cardClassifyInfoList = cardClassifyInfoMapper.selectList(new EntityWrapper<CardClassifyInfo>()
                 .eq("common_id", cardClassifyInfo1.getCommonId())
+                .orderBy("top_marking", false)
                 .eq("delete_flag", 0));
+        Integer sort=0;
         if (!CollectionUtils.isEmpty(cardClassifyInfoList)) {
-            for (CardClassifyInfo aa : cardClassifyInfoList) {
-                aa.setTopMarking(0l);
-                cardClassifyInfoMapper.updateById(aa);
-            }
+            sort=cardClassifyInfoList.get(0).getTopMarking()+1;
         }
-        cardClassifyInfo1.setTopMarking(1l);
+        cardClassifyInfo1.setTopMarking(sort);
         cardClassifyInfo1.setGmtUpdate(new Date());
         return cardClassifyInfoMapper.updateById(cardClassifyInfo1) > 0;
     }
 
-    @Override
-    public Boolean topDefault(CardClassifyInfo cardClassifyInfo) throws ServiceException {
-        List<CardClassifyInfo> cardClassifyInfoList = cardClassifyInfoMapper.selectList(new EntityWrapper<CardClassifyInfo>()
-                .eq("common_id", cardClassifyInfo.getCommonId())
-                .eq("delete_flag", 0));
-        if (!CollectionUtils.isEmpty(cardClassifyInfoList)) {
-            for (CardClassifyInfo aa : cardClassifyInfoList) {
-                aa.setTopMarking(0l);
-                cardClassifyInfoMapper.updateById(aa);
-            }
-        }
-        return true;
-    }
-
     @Override
     public Boolean update(CardClassifyInfo cardClassifyInfo) throws ServiceException {
         Date now = new Date();

+ 16 - 0
unimall-app-api/src/main/java/com/iotechn/unimall/app/api/commonUser/CommonUserServiceImpl.java

@@ -13,10 +13,12 @@ import com.iotechn.unimall.core.notify.SMSResult;
 import com.iotechn.unimall.core.util.GeneratorUtil;
 import com.iotechn.unimall.core.util.SHA1Util;
 import com.iotechn.unimall.data.component.CacheComponent;
+import com.iotechn.unimall.data.domain.CardClassifyInfo;
 import com.iotechn.unimall.data.domain.UserDO;
 import com.iotechn.unimall.data.domain.CommonUserInfo;
 import com.iotechn.unimall.data.dto.UserDTO;
 import com.iotechn.unimall.data.enums.UserLoginType;
+import com.iotechn.unimall.data.mapper.CardClassifyInfoMapper;
 import com.iotechn.unimall.data.mapper.UserMapper;
 import com.iotechn.unimall.data.util.SessionUtil;
 import okhttp3.OkHttpClient;
@@ -53,6 +55,8 @@ public class CommonUserServiceImpl implements CommonUserService {
 
     @Autowired
     private CommonUserInfoMapper commonUserInfoMapper;
+    @Autowired
+    private CardClassifyInfoMapper cardClassifyInfoMapper;
 
 
     @Autowired
@@ -90,6 +94,18 @@ public class CommonUserServiceImpl implements CommonUserService {
                 commonUserInfoMapper.insert(newUserDO);
                 //更新数据库默认值
                 newUserDO = commonUserInfoMapper.selectById(newUserDO.getId());
+                List<CardClassifyInfo> cardClassifyInfoList = cardClassifyInfoMapper.selectList(new EntityWrapper<CardClassifyInfo>()
+                        .eq("common_id", newUserDO.getId())
+                        .eq("delete_flag", 0));
+                //新创建的用户添加默认分类
+                if (CollectionUtils.isEmpty(cardClassifyInfoList)) {
+                    CardClassifyInfo cardClassifyInfo=new CardClassifyInfo();
+                    cardClassifyInfo.setGmtCreate(now);
+                    cardClassifyInfo.setGmtUpdate(now);
+                    cardClassifyInfo.setCommonId(newUserDO.getId());
+                    cardClassifyInfo.setCircleName("默认分类");
+                    cardClassifyInfoMapper.insert(cardClassifyInfo);
+                }
             } else {
                 newUserDO = list.get(0);
             }

+ 3 - 3
unimall-data/src/main/java/com/iotechn/unimall/data/domain/CardClassifyInfo.java

@@ -38,10 +38,10 @@ public class CardClassifyInfo extends SuperDO {
     @TableField("circle_name")
     private String circleName;
 
-    /** 置顶标识 */
-    @Excel(name = "置顶标识")
+    /** 排序 */
+    @Excel(name = "排序")
     @TableField("top_marking")
-    private Long topMarking;
+    private Integer topMarking;
 
     /**  */
     @Excel(name = "", width = 30, dateFormat = "yyyy-MM-dd")