diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/app/customer/admin/CustomerMainAPI.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/app/customer/admin/CustomerMainAPI.java deleted file mode 100644 index 4aeed257..00000000 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/app/customer/admin/CustomerMainAPI.java +++ /dev/null @@ -1,18 +0,0 @@ -package cn.iocoder.yudao.module.app.customer.admin; - -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -/** - * 用于查看需要查dl_base_type的地方 - * 如维修预约需要选服务 - * - * @author 小李 - * @date 14:21 2024/9/23 -**/ -@RestController -@RequestMapping("/api/base/type") -public class CustomerMainAPI { - - -} diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/app/customer/admin/CustomerMainApi.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/app/customer/admin/CustomerMainApi.java new file mode 100644 index 00000000..37d9e98c --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/app/customer/admin/CustomerMainApi.java @@ -0,0 +1,50 @@ +package cn.iocoder.yudao.module.app.customer.admin; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import cn.iocoder.yudao.framework.security.core.LoginUser; +import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; +import cn.iocoder.yudao.module.conf.entity.BaseType; +import cn.iocoder.yudao.module.custom.entity.CustomerMain; +import cn.iocoder.yudao.module.custom.service.CustomerMainService; +import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +/** + * 用于查看需要查dl_base_type的地方 + * 如维修预约需要选服务 + * + * @author 小李 + * @date 14:21 2024/9/23 +**/ +@RestController +@RequestMapping("/api/base/type") +public class CustomerMainApi { + + @Resource + private CustomerMainService customerMainService; + + /** + * 查询当前登录客户信息 + * @author PQZ + * @date 17:24 2024/9/24 + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + **/ + @GetMapping("/get") + @Operation(summary = "获得客户管理") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + public CommonResult getCustomerMain() { + return success(customerMainService.getUserCustomer()); + } + +} diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/CustomerMainService.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/CustomerMainService.java index 0280ebff..a663a264 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/CustomerMainService.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/CustomerMainService.java @@ -50,6 +50,16 @@ public interface CustomerMainService extends IService { **/ CustomerMainRespVO getCustomerById(String id); + /** + * 获取当前登录用户的客户信息 + * @author PQZ + * @date 17:27 2024/9/24 + * @return cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO + **/ + CustomerMainRespVO getUserCustomer(); + + + /** * 根据经办人所属企业查询经办人信息 * diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CustomerMainServiceImpl.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CustomerMainServiceImpl.java index e2ae719d..4721df21 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CustomerMainServiceImpl.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CustomerMainServiceImpl.java @@ -6,6 +6,8 @@ import cn.iocoder.yudao.framework.common.exception.ServiceException; import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import cn.iocoder.yudao.framework.security.core.LoginUser; +import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.module.custom.entity.CustomerCar; import cn.iocoder.yudao.module.custom.entity.CustomerItem; import cn.iocoder.yudao.module.custom.entity.CustomerMain; @@ -190,6 +192,22 @@ public class CustomerMainServiceImpl extends ServiceImpl lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(CustomerMain::getUserId,loginUser.getId()).eq(BaseDO::getDeleted,'0'); + CustomerMain customerMain = getOne(lambdaQueryWrapper); + return getCustomerById(customerMain.getId()); + } + /** * 根据经办人所属企业查询经办人信息 *