From 5ba50d43ea3384a606ab16501633797297a78de3 Mon Sep 17 00:00:00 2001 From: liujie <1793218484@qq.com> Date: 星期五, 12 九月 2025 10:31:08 +0800 Subject: [PATCH] 供应商erp --- ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TCrmSalespersonController.java | 33 +++++++++++++++++++++++++++++---- 1 files changed, 29 insertions(+), 4 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TCrmSalespersonController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TCrmSalespersonController.java index b24a239..a09d5e5 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TCrmSalespersonController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TCrmSalespersonController.java @@ -1,12 +1,14 @@ package com.ruoyi.web.controller.api; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.basic.PageInfo; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.framework.web.service.TokenService; import com.ruoyi.system.dto.TCrmSalespersonDTO; import com.ruoyi.system.model.TCrmBranch; import com.ruoyi.system.model.TCrmChangePoints; @@ -45,12 +47,14 @@ private final ISysUserService sysUserService; private final TCrmChangePointsService crmChangePointsService; private final TCrmBranchService crmBranchService; + private final TokenService tokenService; @Autowired - public TCrmSalespersonController(TCrmSalespersonService crmSalespersonService, ISysUserService sysUserService, TCrmChangePointsService crmChangePointsService, TCrmBranchService crmBranchService) { + public TCrmSalespersonController(TCrmSalespersonService crmSalespersonService, ISysUserService sysUserService, TCrmChangePointsService crmChangePointsService, TCrmBranchService crmBranchService, TokenService tokenService) { this.crmSalespersonService = crmSalespersonService; this.sysUserService = sysUserService; this.crmChangePointsService = crmChangePointsService; this.crmBranchService = crmBranchService; + this.tokenService = tokenService; } /** @@ -59,6 +63,15 @@ @ApiOperation(value = "获取crm业务员管理分页列表") @PostMapping(value = "/pageList") public R<PageInfo<TCrmSalespersonVO>> pageList(@RequestBody TCrmSalespersonQuery query) { + Long userId = tokenService.getLoginUser().getUser().getUserId(); + Integer roleType = tokenService.getLoginUser().getUser().getRoleType(); + if(roleType == 2){ + // 查询分公司信息 + TCrmBranch crmBranch = crmBranchService.getOne(Wrappers.lambdaQuery(TCrmBranch.class) + .eq(TCrmBranch::getUserId, userId) + .last("LIMIT 1")); + query.setBranchId(crmBranch.getId()); + } return R.ok(crmSalespersonService.pageList(query)); } @@ -68,7 +81,19 @@ @ApiOperation(value = "获取crm业务员管理列表") @PostMapping(value = "/list") public R<List<TCrmSalesperson>> list() { - return R.ok(crmSalespersonService.list(Wrappers.lambdaQuery(TCrmSalesperson.class).orderByDesc(TCrmSalesperson::getCreateTime))); + Long userId = tokenService.getLoginUser().getUser().getUserId(); + Integer roleType = tokenService.getLoginUser().getUser().getRoleType(); + LambdaQueryWrapper<TCrmSalesperson> wrapper = new LambdaQueryWrapper<>(); + if(roleType == 2){ + // 查询分公司信息 + TCrmBranch crmBranch = crmBranchService.getOne(Wrappers.lambdaQuery(TCrmBranch.class) + .eq(TCrmBranch::getUserId, userId) + .last("LIMIT 1")); + wrapper.eq(TCrmSalesperson::getBranchId,crmBranch.getId()); + } + wrapper.eq(TCrmSalesperson::getStatus,1) + .orderByDesc(TCrmSalesperson::getCreateTime); + return R.ok(crmSalespersonService.list(wrapper)); } /** @@ -138,8 +163,8 @@ /** * 批量删除crm业务员管理 */ - @Log(title = "crm业务员管理信息-业务员管理解冻冻结", businessType = BusinessType.DELETE) - @ApiOperation(value = "业务员管理解冻冻结") + @Log(title = "crm业务员管理信息-业务员管理解冻冻结", businessType = BusinessType.UPDATE) + @ApiOperation(value = "业务员管理解冻冻结",notes = "状态 1=使用中 2=冻结") @PutMapping(value = "/thawOrFreeze") public R<Boolean> thawOrFreeze(@RequestParam(value = "id")String id, @RequestParam(value = "status")Integer status) { -- Gitblit v1.7.1