|
|
@@ -16,10 +16,15 @@
|
|
|
*/
|
|
|
package org.springblade.ldt.shop.wrapper;
|
|
|
|
|
|
+import org.apache.commons.lang3.ObjectUtils;
|
|
|
+import org.springblade.common.utils.SpringContextHolder;
|
|
|
import org.springblade.core.mp.support.BaseEntityWrapper;
|
|
|
import org.springblade.core.tool.utils.BeanUtil;
|
|
|
import org.springblade.ldt.shop.entity.Shop;
|
|
|
import org.springblade.ldt.shop.vo.ShopVO;
|
|
|
+import org.springblade.modules.system.entity.User;
|
|
|
+import org.springblade.modules.system.service.IUserService;
|
|
|
+
|
|
|
import java.util.Objects;
|
|
|
|
|
|
/**
|
|
|
@@ -28,21 +33,32 @@ import java.util.Objects;
|
|
|
* @author BladeX
|
|
|
* @since 2021-09-23
|
|
|
*/
|
|
|
-public class ShopWrapper extends BaseEntityWrapper<Shop, ShopVO> {
|
|
|
+public class ShopWrapper extends BaseEntityWrapper<Shop, ShopVO> {
|
|
|
+
|
|
|
+ private static final IUserService userService = SpringContextHolder.getBean(IUserService.class);
|
|
|
|
|
|
public static ShopWrapper build() {
|
|
|
return new ShopWrapper();
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
public ShopVO entityVO(Shop shop) {
|
|
|
ShopVO shopVO = Objects.requireNonNull(BeanUtil.copy(shop, ShopVO.class));
|
|
|
|
|
|
+
|
|
|
//User createUser = UserCache.getUser(shop.getCreateUser());
|
|
|
//User updateUser = UserCache.getUser(shop.getUpdateUser());
|
|
|
//shopVO.setCreateUserName(createUser.getName());
|
|
|
//shopVO.setUpdateUserName(updateUser.getName());
|
|
|
|
|
|
+ //查询业务员名字
|
|
|
+ if (ObjectUtils.isNotEmpty(shopVO.getSalesmanId())) {
|
|
|
+ User user = userService.getById(shopVO.getSalesmanId());
|
|
|
+ if (ObjectUtils.isNotEmpty(user)) {
|
|
|
+ shopVO.setSalesmanName(user.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return shopVO;
|
|
|
}
|
|
|
|