liyong
2026-05-07 7dbe348fa7fd4c24d2111b7bd6c41ec76192a50a
feat(customer-contact): 修改客户联系人删除接口支持批量删除

- 将删除接口参数从单个CustomerContactDto改为List<Long> ids
- 调用service层removeByIds方法实现批量删除功能
- 在CustomerContactController中导入List类
- 修改查询SQL支持按客户ID筛选并优化模糊查询逻辑
已修改2个文件
22 ■■■■■ 文件已修改
src/main/java/com/ruoyi/basic/controller/CustomerContactController.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/basic/CustomerContactMapper.xml 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/basic/controller/CustomerContactController.java
@@ -9,6 +9,8 @@
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
 * <p>
 * 客户联系人表 前端控制器
@@ -58,7 +60,7 @@
    @DeleteMapping("/delete")
    @Operation(summary = "删除")
    public R delete(@RequestBody CustomerContactDto customerContact) {
        return R.ok(customerContactService.removeById(customerContact));
    public R delete(@RequestBody List<Long> ids) {
        return R.ok(customerContactService.removeByIds(ids));
    }
}
src/main/resources/mapper/basic/CustomerContactMapper.xml
@@ -17,22 +17,28 @@
        <result column="del_flag" property="delFlag" />
    </resultMap>
    <select id="listPage" resultType="com.ruoyi.basic.dto.CustomerContactDto">
        select * from (
        SELECT
        cc.*,
        c.*,
        (
        SELECT GROUP_CONCAT(ci.customer_name SEPARATOR ',')
        FROM customer ci
        WHERE FIND_IN_SET(ci.id, cc.customer_id)
        WHERE FIND_IN_SET(ci.id, c.customer_id)
        ) AS customer_names
        FROM customer_contact cc
        FROM customer_contact c
        ) as cc
        <where>
            cc.del_flag = 0
            <if test="customerContactDto.contactPerson != null and customerContactDto.contactPerson !=''">
                and cc.contact_person = #{customerContactDto.contactPerson}
                and cc.contact_person like concat('%',#{customerContactDto.contactPerson},'%')
            </if>
            <if test="customerContactDto.contactPhone != null and customerContactDto.contactPhone !=''">
                and cc.contact_phone = #{customerContactDto.contactPhone}
                and cc.contact_phone like concat('%',#{customerContactDto.contactPhone},'%')
            </if>
            <if test="customerContactDto.customerId != null and customerContactDto.customerId !=''">
                and FIND_IN_SET(#{customerContactDto.customerId}, cc.customer_id)
            </if>
        </where>
    </select>
</mapper>