店员,商品导入,sql

This commit is contained in:
chc
2022-09-01 18:53:12 +08:00
parent b873ec2095
commit 2648a0b57e
7 changed files with 299 additions and 14 deletions

View File

@@ -2,6 +2,7 @@ package cn.lili.modules.member.entity.dos;
import cn.hutool.core.text.CharSequenceUtil;
import cn.lili.modules.member.entity.dto.ClerkAddDTO;
import cn.lili.modules.store.entity.dos.Store;
import cn.lili.mybatis.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
@@ -67,4 +68,14 @@ public class Clerk extends BaseEntity {
this.clerkName = clerkAddDTO.getUsername();
}
public Clerk(Store store){
this.memberId = store.getMemberId();
this.storeId = store.getId();
this.clerkName = store.getMemberName();
this.setShopkeeper(true);
this.setIsSuper(true);
this.setStatus(true);
}
}

View File

@@ -116,4 +116,6 @@ public interface StoreService extends IService<Store> {
* @param collectionDTO 收藏信息
*/
void updateStoreCollectionNum(CollectionDTO collectionDTO);
void storeToClerk();
}

View File

@@ -11,6 +11,7 @@ import cn.lili.common.security.context.UserContext;
import cn.lili.common.utils.BeanUtil;
import cn.lili.common.vo.PageVO;
import cn.lili.modules.goods.service.GoodsService;
import cn.lili.modules.member.entity.dos.Clerk;
import cn.lili.modules.member.entity.dos.Member;
import cn.lili.modules.member.entity.dto.ClerkAddDTO;
import cn.lili.modules.member.entity.dto.CollectionDTO;
@@ -36,6 +37,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
@@ -70,7 +73,6 @@ public class StoreServiceImpl extends ServiceImpl<StoreMapper, Store> implements
@Autowired
private StoreDetailService storeDetailService;
@Autowired
private Cache cache;
@@ -313,6 +315,18 @@ public class StoreServiceImpl extends ServiceImpl<StoreMapper, Store> implements
baseMapper.updateCollection(collectionDTO.getId(), collectionDTO.getNum());
}
@Override
public void storeToClerk() {
//清空店铺信息方便重新导入不会有重复数据
clerkService.remove(new LambdaQueryWrapper<Clerk>().eq(Clerk::getShopkeeper,true));
List<Clerk> clerkList = new ArrayList<>();
//遍历已开启的店铺
for (Store store : this.list(new LambdaQueryWrapper<Store>().eq(Store::getDeleteFlag,false).eq(Store::getStoreDisable,StoreStatusEnum.OPEN.name()))) {
clerkList.add(new Clerk(store));
}
clerkService.saveBatch(clerkList);
}
/**
* 获取当前登录操作的店铺
*