加销售数据权限控制
This commit is contained in:
+2
@@ -2,6 +2,7 @@ package com.ruoyi.customer.customerinfo.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.annotation.DataScope;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
@@ -64,6 +65,7 @@ public class BmsCustomerServiceImpl implements IBmsCustomerService
|
||||
* @return 客户主
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "su", deptField = "dept_id", userAlias = "c", userField = "sales_user_id")
|
||||
public List<BmsCustomer> selectBmsCustomerList(BmsCustomer bmsCustomer)
|
||||
{
|
||||
return bmsCustomerMapper.selectBmsCustomerList(bmsCustomer);
|
||||
|
||||
+2
@@ -2,6 +2,7 @@ package com.ruoyi.customer.supplierinfo.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.annotation.DataScope;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
@@ -47,6 +48,7 @@ public class BmsSupplierServiceImpl implements IBmsSupplierService
|
||||
}
|
||||
|
||||
@Override
|
||||
@DataScope(deptAlias = "su", deptField = "dept_id", userAlias = "s", userField = "purchaser_user_id")
|
||||
public List<BmsSupplier> selectBmsSupplierList(BmsSupplier bmsSupplier)
|
||||
{
|
||||
return bmsSupplierMapper.selectBmsSupplierList(bmsSupplier);
|
||||
|
||||
@@ -20,6 +20,13 @@ public interface SysUserMapper
|
||||
*/
|
||||
public List<SysUser> selectUserList(SysUser sysUser);
|
||||
|
||||
/**
|
||||
* 查询全部未删除用户(下拉选项用,不带数据权限过滤)
|
||||
*
|
||||
* @return 用户信息集合
|
||||
*/
|
||||
public List<SysUser> selectUserOptions();
|
||||
|
||||
/**
|
||||
* 根据条件分页查询已配用户角色列表
|
||||
*
|
||||
|
||||
@@ -19,6 +19,13 @@ public interface ISysUserService
|
||||
*/
|
||||
public List<SysUser> selectUserList(SysUser user);
|
||||
|
||||
/**
|
||||
* 查询全部未删除用户(下拉选项用,不带数据权限过滤)
|
||||
*
|
||||
* @return 用户信息集合
|
||||
*/
|
||||
public List<SysUser> selectUserOptions();
|
||||
|
||||
/**
|
||||
* 根据条件分页查询已分配用户角色列表
|
||||
*
|
||||
|
||||
+9
@@ -79,6 +79,15 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
return userMapper.selectUserList(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下拉选项专用:故意不加 @DataScope,任何角色都能拿到完整用户名单用于人员选择/回显
|
||||
*/
|
||||
@Override
|
||||
public List<SysUser> selectUserOptions()
|
||||
{
|
||||
return userMapper.selectUserOptions();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件分页查询已分配用户角色列表
|
||||
*
|
||||
|
||||
@@ -54,6 +54,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
c.product_ids, c.remark,
|
||||
c.create_by, c.create_time, c.update_by, c.update_time, c.del_flag
|
||||
from bms_customer c
|
||||
<!-- 数据权限:销售(仅本人 c.sales_user_id)/销售经理(本部门 su.dept_id);
|
||||
历史迁移数据 sales_user_id 为非数字工号,+0 后不匹配任何 sys_user,仅管理员可见 -->
|
||||
left join sys_user su on su.user_id = c.sales_user_id + 0
|
||||
</sql>
|
||||
|
||||
<select id="selectBmsCustomerList" parameterType="BmsCustomer" resultMap="BmsCustomerResult">
|
||||
@@ -80,6 +83,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="throwRatio != null "> and c.throw_ratio = #{throwRatio}</if>
|
||||
<if test="creditEd != null "> and c.credit_ed = #{creditEd}</if>
|
||||
<if test="productIds != null and productIds != ''"> and c.product_ids = #{productIds}</if>
|
||||
<!-- 数据权限过滤(@DataScope 生成:仅本人= c.sales_user_id=当前用户;本部门= su.dept_id=当前用户部门) -->
|
||||
${params.dataScope}
|
||||
</where>
|
||||
order by c.customer_id desc
|
||||
</select>
|
||||
|
||||
@@ -39,31 +39,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBmsSupplierVo">
|
||||
select supplier_id, supplier_code, supplier_name, supplier_code_dw, credit_code, supplier_type, is_enable, purchaser_user_id, purchaser_user, settlement_user_id, settlement_user, service_user_id, service_user, ed, zq, settlement_type, temp_ed, account_balance, foreign_currency_balance, credit_ed, weight_threshold, throw_ratio, cooperation_start_date, cooperation_status, channel_ids, remark, create_by, create_time, update_by, update_time, del_flag from bms_supplier
|
||||
select s.supplier_id, s.supplier_code, s.supplier_name, s.supplier_code_dw, s.credit_code, s.supplier_type,
|
||||
s.is_enable, s.purchaser_user_id, s.purchaser_user, s.settlement_user_id, s.settlement_user,
|
||||
s.service_user_id, s.service_user, s.ed, s.zq, s.settlement_type, s.temp_ed, s.account_balance,
|
||||
s.foreign_currency_balance, s.credit_ed, s.weight_threshold, s.throw_ratio, s.cooperation_start_date,
|
||||
s.cooperation_status, s.channel_ids, s.remark, s.create_by, s.create_time, s.update_by, s.update_time, s.del_flag
|
||||
from bms_supplier s
|
||||
<!-- 数据权限:采购/销售(仅本人 s.purchaser_user_id)/部门经理(本部门 su.dept_id);
|
||||
非数字历史工号 +0 后不匹配任何 sys_user,仅管理员可见 -->
|
||||
left join sys_user su on su.user_id = s.purchaser_user_id + 0
|
||||
</sql>
|
||||
|
||||
<select id="selectBmsSupplierList" parameterType="BmsSupplier" resultMap="BmsSupplierResult">
|
||||
<include refid="selectBmsSupplierVo"/>
|
||||
<where>
|
||||
<if test="supplierCode != null and supplierCode != ''"> and supplier_code = #{supplierCode}</if>
|
||||
<if test="supplierName != null and supplierName != ''"> and supplier_name like concat('%', #{supplierName}, '%')</if>
|
||||
<if test="supplierCodeDw != null and supplierCodeDw != ''"> and supplier_code_dw = #{supplierCodeDw}</if>
|
||||
<if test="creditCode != null and creditCode != ''"> and credit_code = #{creditCode}</if>
|
||||
<if test="supplierType != null and supplierType != ''"> and supplier_type = #{supplierType}</if>
|
||||
<if test="isEnable != null and isEnable != ''"> and is_enable = #{isEnable}</if>
|
||||
<if test="purchaserUserId != null and purchaserUserId != ''"> and purchaser_user_id = #{purchaserUserId}</if>
|
||||
<if test="purchaserUser != null and purchaserUser != ''"> and purchaser_user = #{purchaserUser}</if>
|
||||
<if test="settlementUserId != null and settlementUserId != ''"> and settlement_user_id = #{settlementUserId}</if>
|
||||
<if test="settlementUser != null and settlementUser != ''"> and settlement_user = #{settlementUser}</if>
|
||||
<if test="serviceUserId != null and serviceUserId != ''"> and service_user_id = #{serviceUserId}</if>
|
||||
<if test="serviceUser != null and serviceUser != ''"> and service_user = #{serviceUser}</if>
|
||||
<if test="cooperationStatus != null and cooperationStatus != ''"> and cooperation_status = #{cooperationStatus}</if>
|
||||
s.del_flag = '0'
|
||||
<if test="supplierCode != null and supplierCode != ''"> and s.supplier_code = #{supplierCode}</if>
|
||||
<if test="supplierName != null and supplierName != ''"> and s.supplier_name like concat('%', #{supplierName}, '%')</if>
|
||||
<if test="supplierCodeDw != null and supplierCodeDw != ''"> and s.supplier_code_dw = #{supplierCodeDw}</if>
|
||||
<if test="creditCode != null and creditCode != ''"> and s.credit_code = #{creditCode}</if>
|
||||
<if test="supplierType != null and supplierType != ''"> and s.supplier_type = #{supplierType}</if>
|
||||
<if test="isEnable != null and isEnable != ''"> and s.is_enable = #{isEnable}</if>
|
||||
<if test="purchaserUserId != null and purchaserUserId != ''"> and s.purchaser_user_id = #{purchaserUserId}</if>
|
||||
<if test="purchaserUser != null and purchaserUser != ''"> and s.purchaser_user = #{purchaserUser}</if>
|
||||
<if test="settlementUserId != null and settlementUserId != ''"> and s.settlement_user_id = #{settlementUserId}</if>
|
||||
<if test="settlementUser != null and settlementUser != ''"> and s.settlement_user = #{settlementUser}</if>
|
||||
<if test="serviceUserId != null and serviceUserId != ''"> and s.service_user_id = #{serviceUserId}</if>
|
||||
<if test="serviceUser != null and serviceUser != ''"> and s.service_user = #{serviceUser}</if>
|
||||
<if test="cooperationStatus != null and cooperationStatus != ''"> and s.cooperation_status = #{cooperationStatus}</if>
|
||||
<!-- 数据权限过滤(@DataScope 生成:仅本人= s.purchaser_user_id=当前用户;本部门= su.dept_id=当前用户部门) -->
|
||||
${params.dataScope}
|
||||
</where>
|
||||
order by s.supplier_id desc
|
||||
</select>
|
||||
|
||||
<select id="selectBmsSupplierBySupplierId" parameterType="Long" resultMap="BmsSupplierResult">
|
||||
<include refid="selectBmsSupplierVo"/>
|
||||
where supplier_id = #{supplierId}
|
||||
where s.supplier_id = #{supplierId} and s.del_flag = '0'
|
||||
</select>
|
||||
|
||||
<insert id="insertBmsSupplier" parameterType="BmsSupplier" useGeneratedKeys="true" keyProperty="supplierId">
|
||||
|
||||
@@ -85,6 +85,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
</select>
|
||||
|
||||
<!-- 下拉选项专用:不带数据权限,仅返回展示所需字段 -->
|
||||
<select id="selectUserOptions" resultMap="SysUserResult">
|
||||
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.status, d.dept_name
|
||||
from sys_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
where u.del_flag = '0'
|
||||
order by u.dept_id, u.user_id
|
||||
</select>
|
||||
|
||||
<select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">
|
||||
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
|
||||
|
||||
Reference in New Issue
Block a user