This commit is contained in:
PQZ 2024-09-24 18:05:37 +08:00
parent d04b16a64e
commit aeae65bc6d
4 changed files with 78 additions and 18 deletions

View File

@ -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 {
}

View File

@ -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<cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO>
**/
@GetMapping("/get")
@Operation(summary = "获得客户管理")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
public CommonResult<CustomerMainRespVO> getCustomerMain() {
return success(customerMainService.getUserCustomer());
}
}

View File

@ -50,6 +50,16 @@ public interface CustomerMainService extends IService<CustomerMain> {
**/
CustomerMainRespVO getCustomerById(String id);
/**
* 获取当前登录用户的客户信息
* @author PQZ
* @date 17:27 2024/9/24
* @return cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO
**/
CustomerMainRespVO getUserCustomer();
/**
* 根据经办人所属企业查询经办人信息
*

View File

@ -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<CustomerMainMapper, Cus
return result;
}
/**
* 获取当前登录用户的客户信息
*
* @return cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO
* @author PQZ
* @date 17:27 2024/9/24
**/
@Override
public CustomerMainRespVO getUserCustomer() {
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
LambdaQueryWrapper<CustomerMain> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(CustomerMain::getUserId,loginUser.getId()).eq(BaseDO::getDeleted,'0');
CustomerMain customerMain = getOne(lambdaQueryWrapper);
return getCustomerById(customerMain.getId());
}
/**
* 根据经办人所属企业查询经办人信息
*