liyong
2026-05-15 0578c6c76f13e367b5dc7d0882efe3c69ca4cb0e
feat(customer): 添加客户银行代码字段并实现批量删除功能

- 在Customer实体中添加bank_code字段映射
- 实现批量删除客户时同步清理关联的客户联系人关系
- 添加removeCustomerContactsByCustomerIds方法处理联系人关联删除逻辑
- 添加parseCustomerId辅助方法进行安全的ID解析
- 优化客户批量删除流程确保数据一致性
已修改17个文件
268 ■■■■■ 文件已修改
src/main/java/com/ruoyi/basic/mapper/ProductModelMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/basic/service/impl/ProductServiceImpl.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/common/utils/OrderUtils.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/production/pojo/Workshop.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/project/system/domain/SysRole.java 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/project/system/mapper/SysRoleMapper.java 33 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/project/system/mapper/SysUserMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/stock/pojo/StockInventoryCheckItem.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/stock/pojo/StockInventoryCheckProduct.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/stock/service/impl/StockUninventoryServiceImpl.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/basic/CustomerMapper.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/basic/ProductModelMapper.xml 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/stock/StockInventoryMapper.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/system/SysDeptMapper.xml 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/system/SysRoleMapper.xml 36 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/system/SysUserMapper.xml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/basic/mapper/ProductModelMapper.java
@@ -34,4 +34,6 @@
    IPage<ProductModelVo> pageModelAndQua(Page<ProductModelVo> page, @Param("c") ProductModel productModel);
    List<Map<String, Object>> selectBatchNoQtyByProductModelIds(@Param("list") List<Long> productModelIds);
    List<Map<String, Object>> selectUnqualifiedBatchNoQtyByProductModelIds(@Param("list") List<Long> productModelIds);
}
src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java
@@ -364,11 +364,55 @@
                    .eq(CustomerUser::getCustomerId, id)
            );
        }
        // 删除客户对应的联系人关联
        removeCustomerContactsByCustomerIds(idList);
        // 删除客户主表数据
        return customerMapper.deleteBatchIds(idList);
    }
    private void removeCustomerContactsByCustomerIds(List<Long> customerIds) {
        if (CollectionUtils.isEmpty(customerIds)) {
            return;
        }
        List<CustomerContact> customerContacts = customerContactMapper.selectList(new QueryWrapper<>());
        if (CollectionUtils.isEmpty(customerContacts)) {
            return;
        }
        Set<Long> customerIdSet = customerIds.stream()
                .filter(Objects::nonNull)
                .collect(Collectors.toSet());
        for (CustomerContact customerContact : customerContacts) {
            String contactCustomerIds = customerContact.getCustomerId();
            if (StringUtils.isEmpty(contactCustomerIds)) {
                continue;
            }
            String updatedCustomerIds = Arrays.stream(contactCustomerIds.split(","))
                    .map(String::trim)
                    .filter(StringUtils::isNotEmpty)
                    .filter(id -> {
                        Long parsedId = parseCustomerId(id);
                        return parsedId == null || !customerIdSet.contains(parsedId);
                    })
                    .distinct()
                    .collect(Collectors.joining(","));
            if (StringUtils.isEmpty(updatedCustomerIds)) {
                customerContactMapper.deleteById(customerContact.getId());
            } else if (!updatedCustomerIds.equals(contactCustomerIds)) {
                customerContact.setCustomerId(updatedCustomerIds);
                customerContactMapper.updateById(customerContact);
            }
        }
    }
    private Long parseCustomerId(String customerId) {
        try {
            return Long.valueOf(customerId);
        } catch (NumberFormatException e) {
            return null;
        }
    }
    @Override
    public List<Customer> selectCustomerListByIds(Long[] ids) {
        LambdaQueryWrapper<Customer> queryWrapper = new LambdaQueryWrapper<>();
src/main/java/com/ruoyi/basic/service/impl/ProductServiceImpl.java
@@ -42,9 +42,9 @@
        }
        // 浪潮用于区分成品和物料
        if (productDto.getProductType() != null && !productDto.getProductType().isEmpty()) {
            if (productDto.getProductType().equals("成品")){
            if (productDto.getProductType().equals("成品")) {
                queryWrapper.eq(Product::getProductName, productDto.getProductType());
            }else queryWrapper.ne(Product::getProductName, "成品");
            } else queryWrapper.ne(Product::getProductName, "成品");
        }
        // 查询根节点列表
@@ -86,6 +86,19 @@
        }
        List<Map<String, Object>> batchRows = productModelMapper.selectBatchNoQtyByProductModelIds(productModelIds);
        List<Map<String, Object>> unqualifiedBatchRows =
                productModelMapper.selectUnqualifiedBatchNoQtyByProductModelIds(productModelIds);
        batchRows.addAll(unqualifiedBatchRows);
        Map<Long, HashMap<String, HashMap<String, BigDecimal>>> batchNoQtyMapsByProductModelId =
                buildBatchNoQtyMaps(batchRows);
        for (ProductModelVo record : records) {
            record.setBatchNoMaps(toBatchNoMaps(
                    batchNoQtyMapsByProductModelId.getOrDefault(record.getId(), new HashMap<>())));
        }
    }
    private Map<Long, HashMap<String, HashMap<String, BigDecimal>>> buildBatchNoQtyMaps(
            List<Map<String, Object>> batchRows) {
        Map<Long, HashMap<String, HashMap<String, BigDecimal>>> batchNoQtyMapsByProductModelId = new HashMap<>();
        for (Map<String, Object> batchRow : batchRows) {
            Long productModelId = toLong(batchRow.get("productModelId"));
@@ -100,24 +113,22 @@
                    .computeIfAbsent(String.valueOf(warehouseId), key -> new HashMap<>())
                    .merge(batchNo, toBigDecimal(batchRow.get("qty")), BigDecimal::add);
        }
        return batchNoQtyMapsByProductModelId;
    }
        for (ProductModelVo record : records) {
            HashMap<String, List<Map<String, BigDecimal>>> batchNoMaps = new HashMap<>();
            HashMap<String, HashMap<String, BigDecimal>> stockBatchNoQtyMaps =
                    batchNoQtyMapsByProductModelId.getOrDefault(record.getId(), new HashMap<>());
            for (Map.Entry<String, HashMap<String, BigDecimal>> entry : stockBatchNoQtyMaps.entrySet()) {
                List<Map<String, BigDecimal>> batchList = new ArrayList<>();
                for (Map.Entry<String, BigDecimal> batchEntry : entry.getValue().entrySet()) {
                    Map<String, BigDecimal> batchItem = new HashMap<>();
                    batchItem.put(batchEntry.getKey(), batchEntry.getValue());
                    batchList.add(batchItem);
                }
                batchNoMaps.put(entry.getKey(), batchList);
    private HashMap<String, List<Map<String, BigDecimal>>> toBatchNoMaps(
            HashMap<String, HashMap<String, BigDecimal>> stockBatchNoQtyMaps) {
        HashMap<String, List<Map<String, BigDecimal>>> batchNoMaps = new HashMap<>();
        for (Map.Entry<String, HashMap<String, BigDecimal>> entry : stockBatchNoQtyMaps.entrySet()) {
            List<Map<String, BigDecimal>> batchList = new ArrayList<>();
            for (Map.Entry<String, BigDecimal> batchEntry : entry.getValue().entrySet()) {
                Map<String, BigDecimal> batchItem = new HashMap<>();
                batchItem.put(batchEntry.getKey(), batchEntry.getValue());
                batchList.add(batchItem);
            }
            record.setBatchNoMaps(batchNoMaps);
            batchNoMaps.put(entry.getKey(), batchList);
        }
        return batchNoMaps;
    }
    private Long toLong(Object value) {
src/main/java/com/ruoyi/common/utils/OrderUtils.java
@@ -78,6 +78,7 @@
        long nextSeq = 1;
        List<Map<String, Object>> records = mapper.selectMaps(wrapper);
        if (!records.isEmpty()) {
            Object lastCode = records.get(0).get(code);
            if (lastCode != null) {
src/main/java/com/ruoyi/production/pojo/Workshop.java
@@ -1,10 +1,10 @@
package com.ruoyi.production.pojo;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.Data;
/**
 * 车间表
@@ -85,6 +85,9 @@
    @TableField(value = "update_user_name",fill = FieldFill.INSERT_UPDATE)
    private String updateUserName;
    @TableField(value = "dept_id",fill = FieldFill.INSERT)
    private Long deptId;
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
}
src/main/java/com/ruoyi/project/system/domain/SysRole.java
@@ -1,18 +1,21 @@
package com.ruoyi.project.system.domain;
import java.util.Set;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import com.ruoyi.framework.aspectj.lang.annotation.Excel.ColumnType;
import com.ruoyi.framework.web.domain.BaseEntity;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import com.ruoyi.framework.aspectj.lang.annotation.Excel.ColumnType;
import com.ruoyi.framework.web.domain.BaseEntity;
import java.util.Set;
/**
 * 角色表 sys_role
 *
 *
 * @author ruoyi
 */
public class SysRole extends BaseEntity
@@ -64,6 +67,8 @@
    /** 角色菜单权限 */
    private Set<String> permissions;
    @TableField(fill = FieldFill.INSERT)
    private Long deptId;
    public SysRole()
    {
@@ -169,6 +174,16 @@
        this.status = status;
    }
    public Long getDeptId()
    {
        return deptId;
    }
    public void setDeptId(Long deptId)
    {
        this.deptId = deptId;
    }
    public String getDelFlag()
    {
        return delFlag;
src/main/java/com/ruoyi/project/system/mapper/SysRoleMapper.java
@@ -1,28 +1,29 @@
package com.ruoyi.project.system.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.framework.aspectj.lang.annotation.DataScope;
import com.ruoyi.project.system.domain.SysRole;
import java.util.List;
/**
 * 角色表 数据层
 *
 *
 * @author ruoyi
 */
public interface SysRoleMapper
{
    /**
     * 根据条件分页查询角色数据
     *
     *
     * @param role 角色信息
     * @return 角色数据集合信息
     */
    @DataScope(deptAlias = "r")
    public List<SysRole> selectRoleList(SysRole role);
    /**
     * 根据用户ID查询角色
     *
     *
     * @param userId 用户ID
     * @return 角色列表
     */
@@ -30,14 +31,14 @@
    /**
     * 查询所有角色
     *
     *
     * @return 角色列表
     */
    public List<SysRole> selectRoleAll();
    /**
     * 根据用户ID获取角色选择框列表
     *
     *
     * @param userId 用户ID
     * @return 选中角色ID列表
     */
@@ -45,7 +46,7 @@
    /**
     * 通过角色ID查询角色
     *
     *
     * @param roleId 角色ID
     * @return 角色对象信息
     */
@@ -53,7 +54,7 @@
    /**
     * 根据用户ID查询角色
     *
     *
     * @param userName 用户名
     * @return 角色列表
     */
@@ -61,7 +62,7 @@
    /**
     * 校验角色名称是否唯一
     *
     *
     * @param roleName 角色名称
     * @return 角色信息
     */
@@ -69,7 +70,7 @@
    /**
     * 校验角色权限是否唯一
     *
     *
     * @param roleKey 角色权限
     * @return 角色信息
     */
@@ -77,7 +78,7 @@
    /**
     * 修改角色信息
     *
     *
     * @param role 角色信息
     * @return 结果
     */
@@ -85,7 +86,7 @@
    /**
     * 新增角色信息
     *
     *
     * @param role 角色信息
     * @return 结果
     */
@@ -93,7 +94,7 @@
    /**
     * 通过角色ID删除角色
     *
     *
     * @param roleId 角色ID
     * @return 结果
     */
@@ -101,7 +102,7 @@
    /**
     * 批量删除角色信息
     *
     *
     * @param roleIds 需要删除的角色ID
     * @return 结果
     */
src/main/java/com/ruoyi/project/system/mapper/SysUserMapper.java
@@ -1,6 +1,7 @@
package com.ruoyi.project.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.framework.aspectj.lang.annotation.DataScope;
import com.ruoyi.project.system.domain.SysUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -21,6 +22,7 @@
     * @param sysUser 用户信息
     * @return 用户信息集合信息
     */
    @DataScope(deptAlias = "u", userAlias = "u")
    public List<SysUser> selectUserList(SysUser sysUser);
    /**
src/main/java/com/ruoyi/stock/pojo/StockInventoryCheckItem.java
@@ -103,8 +103,6 @@
    /**
     * 备注
     */
@@ -127,5 +125,6 @@
    @TableField(exist = false)
    private String warehouseName;
    @TableField(fill = FieldFill.INSERT)
    private Long deptId;
}
src/main/java/com/ruoyi/stock/pojo/StockInventoryCheckProduct.java
@@ -71,5 +71,5 @@
    @TableField(fill = FieldFill.INSERT)
    private int createUser;
    @TableField(fill = FieldFill.INSERT)
    private int deptId;
    private Long deptId;
}
src/main/java/com/ruoyi/stock/service/impl/StockUninventoryServiceImpl.java
@@ -25,7 +25,10 @@
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
/**
 * <p>
@@ -60,6 +63,11 @@
        } else {
            wrapper.eq(StockUninventory::getBatchNo, stockUninventoryDto.getBatchNo());
        }
        if (ObjectUtils.isEmpty(stockUninventoryDto.getBatchNo())) {
            String time = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyMMddHHmm"));
            int suffix = ThreadLocalRandom.current().nextInt(100, 1000);
            stockUninventoryDto.setBatchNo("PY" + time + suffix);
        }
        //新增入库记录再添加库存
        StockInRecordDto stockInRecordDto = new StockInRecordDto();
        stockInRecordDto.setRecordId(stockUninventoryDto.getRecordId());
src/main/resources/mapper/basic/CustomerMapper.xml
@@ -28,6 +28,7 @@
        c.maintenance_time,
        c.tenant_id,
        c.type,
        c.bank_code,
        c.is_assigned,
        c.usage_user,
        c.basic_bank_account,
src/main/resources/mapper/basic/ProductModelMapper.xml
@@ -203,4 +203,20 @@
        order by si.product_model_id, si.warehouse_info_id, si.batch_no, si.id
    </select>
    <select id="selectUnqualifiedBatchNoQtyByProductModelIds" resultType="java.util.Map">
        select su.product_model_id as productModelId,
               su.warehouse_info_id as warehouseId,
               su.batch_no as batchNo,
               su.qualitity as qty
        from stock_uninventory su
        where su.product_model_id in
        <foreach collection="list" item="productModelId" separator="," open="(" close=")">
            #{productModelId}
        </foreach>
          and su.warehouse_info_id is not null
          and su.batch_no is not null
          and su.batch_no != ''
        order by su.product_model_id, su.warehouse_info_id, su.batch_no, su.id
    </select>
</mapper>
src/main/resources/mapper/stock/StockInventoryMapper.xml
@@ -203,8 +203,8 @@
            0 as qualifiedLockedQuantity,
            COALESCE(su.locked_quantity, 0) as unQualifiedLockedQuantity,
            su.product_model_id,
            null as warehouse_info_id,
            null as warehouse_name,
            su.warehouse_info_id,
            siw.warehouse_name,
            su.create_time,
            su.update_time,
            0 as warn_num,
@@ -227,6 +227,7 @@
            from stock_uninventory su
            left join product_model pm on su.product_model_id = pm.id
            left join product p on pm.product_id = p.id
            left join stock_warehouse_info siw on su.warehouse_info_id = siw.id
        ) as combined
        <where>
            <if test="ew.productName != null and ew.productName !=''">
src/main/resources/mapper/system/SysDeptMapper.xml
@@ -22,9 +22,9 @@
        <result property="updateTime" column="update_time" />
        <result property="staffCount" column="staff_count" />
    </resultMap>
    <sql id="selectDeptVo">
        select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
        select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
        from sys_dept d
    </sql>
@@ -47,11 +47,11 @@
            AND d.status = #{status}
        </if>
        <!-- 数据范围过滤 -->
        ${params.dataScope}
--         ${params.dataScope}
        group by d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
        order by d.parent_id, d.order_num
    </select>
    <select id="selectDeptListByRoleId" resultType="java.lang.Long">
        select d.dept_id
        from sys_dept d
@@ -62,7 +62,7 @@
            </if>
        order by d.parent_id, d.order_num
    </select>
    <select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
        select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,
            (select dept_name from sys_dept where dept_id = d.parent_id) parent_name,
@@ -70,29 +70,29 @@
        from sys_dept d
        where d.dept_id = #{deptId}
    </select>
    <select id="checkDeptExistUser" parameterType="Long" resultType="int">
        select count(1) from sys_user_dept where dept_id = #{deptId}
    </select>
    <select id="hasChildByDeptId" parameterType="Long" resultType="int">
        select count(1) from sys_dept
        where del_flag = '0' and parent_id = #{deptId} limit 1
    </select>
    <select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
        select * from sys_dept where find_in_set(#{deptId}, ancestors)
    </select>
    <select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
        select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors)
    </select>
    <select id="checkDeptNameUnique" resultMap="SysDeptResult">
        <include refid="selectDeptVo"/>
        where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
    </select>
    <insert id="insertDept" parameterType="com.ruoyi.project.system.domain.SysDept">
         insert into sys_dept(
             <if test="deptId != null and deptId != 0">dept_id,</if>
@@ -122,7 +122,7 @@
             sysdate()
         )
    </insert>
    <update id="updateDept" parameterType="com.ruoyi.project.system.domain.SysDept">
         update sys_dept
         <set>
@@ -140,7 +140,7 @@
         </set>
         where dept_id = #{deptId}
    </update>
    <update id="updateDeptChildren" parameterType="java.util.List">
        update sys_dept set ancestors =
        <foreach collection="depts" item="item" index="index"
@@ -153,14 +153,14 @@
            #{item.deptId}
        </foreach>
    </update>
    <update id="updateDeptStatusNormal" parameterType="Long">
         update sys_dept set status = '0' where dept_id in
         update sys_dept set status = '0' where dept_id in
         <foreach collection="array" item="deptId" open="(" separator="," close=")">
            #{deptId}
        </foreach>
    </update>
    <delete id="deleteDeptById" parameterType="Long">
        update sys_dept set del_flag = '2' where dept_id = #{deptId}
    </delete>
@@ -184,4 +184,4 @@
        WHERE parent_id = 100;
    </select>
</mapper>
</mapper>
src/main/resources/mapper/system/SysRoleMapper.xml
@@ -20,15 +20,15 @@
        <result property="updateTime"         column="update_time"           />
        <result property="remark"             column="remark"                />
    </resultMap>
    <sql id="selectRoleVo">
        select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly,
            r.status, r.del_flag, r.create_time, r.remark
            r.status, r.del_flag, r.create_time, r.remark
        from sys_role r
            left join sys_user_role ur on ur.role_id = r.role_id
            left join sys_user u on u.user_id = ur.user_id
    </sql>
    <select id="selectRoleList" parameterType="com.ruoyi.project.system.domain.SysRole" resultMap="SysRoleResult">
        <include refid="selectRoleVo"/>
        where r.del_flag = '0'
@@ -51,20 +51,20 @@
            and date_format(r.create_time,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
        </if>
        <!-- 数据范围过滤 -->
        ${params.dataScope}
--         ${params.dataScope}
        order by r.role_sort
    </select>
    <select id="selectRolePermissionByUserId" parameterType="Long" resultMap="SysRoleResult">
        <include refid="selectRoleVo"/>
        WHERE r.del_flag = '0' and ur.user_id = #{userId}
    </select>
    <select id="selectRoleAll" resultMap="SysRoleResult">
        <include refid="selectRoleVo"/>
        WHERE r.del_flag = '0'
    </select>
    <select id="selectRoleListByUserId" parameterType="Long" resultType="Long">
        select r.role_id
        from sys_role r
@@ -72,27 +72,27 @@
            left join sys_user u on u.user_id = ur.user_id
        where u.user_id = #{userId}
    </select>
    <select id="selectRoleById" parameterType="Long" resultMap="SysRoleResult">
        <include refid="selectRoleVo"/>
        where r.role_id = #{roleId}
    </select>
    <select id="selectRolesByUserName" parameterType="String" resultMap="SysRoleResult">
        <include refid="selectRoleVo"/>
        WHERE r.del_flag = '0' and u.user_name = #{userName}
    </select>
    <select id="checkRoleNameUnique" parameterType="String" resultMap="SysRoleResult">
        <include refid="selectRoleVo"/>
         where r.role_name=#{roleName} and r.del_flag = '0' limit 1
    </select>
    <select id="checkRoleKeyUnique" parameterType="String" resultMap="SysRoleResult">
        <include refid="selectRoleVo"/>
         where r.role_key=#{roleKey} and r.del_flag = '0' limit 1
    </select>
     <insert id="insertRole" parameterType="com.ruoyi.project.system.domain.SysRole" useGeneratedKeys="true" keyProperty="roleId">
         insert into sys_role(
             <if test="roleId != null and roleId != 0">role_id,</if>
@@ -120,7 +120,7 @@
             sysdate()
         )
    </insert>
    <update id="updateRole" parameterType="com.ruoyi.project.system.domain.SysRole">
         update sys_role
         <set>
@@ -137,16 +137,16 @@
         </set>
         where role_id = #{roleId}
    </update>
    <delete id="deleteRoleById" parameterType="Long">
         update sys_role set del_flag = '2' where role_id = #{roleId}
     </delete>
     <delete id="deleteRoleByIds" parameterType="Long">
         update sys_role set del_flag = '2' where role_id in
         <foreach collection="array" item="roleId" open="(" separator="," close=")">
             #{roleId}
        </foreach>
        </foreach>
     </delete>
</mapper>
</mapper>
src/main/resources/mapper/system/SysUserMapper.xml
@@ -96,7 +96,7 @@
            )
        </if>
        <!-- 数据范围过滤 -->
        ${params.dataScope}
--         ${params.dataScope}
    </select>
    <select id="selectAllocatedList" parameterType="com.ruoyi.project.system.domain.SysUser" resultMap="SysUserResult">
@@ -112,7 +112,7 @@
            AND u.phonenumber like concat('%', #{phonenumber}, '%')
        </if>
        <!-- 数据范围过滤 -->
        ${params.dataScope}
--         ${params.dataScope}
    </select>
    <select id="selectUnallocatedList" parameterType="com.ruoyi.project.system.domain.SysUser" resultMap="SysUserResult">
@@ -129,7 +129,7 @@
            AND u.phonenumber like concat('%', #{phonenumber}, '%')
        </if>
        <!-- 数据范围过滤 -->
        ${params.dataScope}
--         ${params.dataScope}
    </select>
    <select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">