ソースを参照

增加客户地址信息接口--修复关联CustomerID

bai 1 週間 前
コミット
8d6f8eaec4

+ 17 - 4
blade-service/blade-factory/src/main/java/org/springblade/factory/controller/ZcrmViewCustomeraddressSelController.java

@@ -6,8 +6,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import io.swagger.annotations.ApiOperation;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
+import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.factory.service.ZcrmViewCustomeraddressSelService;
+import org.springblade.system.feign.ISysClient;
+import org.springblade.system.user.entity.User;
+import org.springblade.system.user.feign.IUserClient;
 import org.springblade.u9cloud.entity.ZcrmViewCustomerAddressSel;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -28,6 +32,8 @@ public class ZcrmViewCustomeraddressSelController {
 	@Autowired
 	private ZcrmViewCustomeraddressSelService zcrmViewCustomeraddressSelService;
 
+	@Autowired
+	private IUserClient userClient;
 
 	/**
 	 * 客户地址档案列表
@@ -40,10 +46,17 @@ public class ZcrmViewCustomeraddressSelController {
 		ZcrmViewCustomerAddressSel zcrmViewCustomerAddressSel) {
 		// 1. 构建基础查询条件
 		QueryWrapper<ZcrmViewCustomerAddressSel> queryWrapper = Condition.getQueryWrapper(params, ZcrmViewCustomerAddressSel.class);
-		// 2. 执行分页查询
-		IPage<ZcrmViewCustomerAddressSel> pages = zcrmViewCustomeraddressSelService.page(Condition.getPage(query), queryWrapper);
-		// 3. 返回结果
-		return R.data(pages);
+		Long userId = AuthUtil.getUserId();
+		R<User> userInfo = userClient.userInfoById(userId);
+		if (userInfo.getData() != null && userInfo.getData().getCustomerId() != null) {
+			queryWrapper.eq("Customer_ID", userInfo.getData().getCustomerId());
+			// 2. 执行分页查询
+			IPage<ZcrmViewCustomerAddressSel> pages = zcrmViewCustomeraddressSelService.page(Condition.getPage(query), queryWrapper);
+			// 3. 返回结果
+			return R.data(pages);
+		} else {
+			return R.data(null);
+		}
 	}
 
 	/**