1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
| <?xml version="1.0" encoding="UTF-8"?>
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
| <mapper namespace="com.ruoyi.staff.mapper.SchemeApplicableStaffMapper">
|
| <!-- 基础字段查询 -->
| <sql id="schemeColumns">
| id, title, dept_ids, staff_names, staff_ids,
| insurance_types, remark, create_time, update_time,
| create_user, update_user
| </sql>
|
| <!-- 根据人员ID查询社保方案 -->
| <select id="selectSchemeByStaffId" resultType="com.ruoyi.staff.pojo.SchemeApplicableStaff">
| SELECT
| <include refid="schemeColumns"/>
| FROM
| scheme_applicable_staff
| WHERE
| 1 = 1
| <!-- 核心:匹配staff_ids中包含目标人员ID的记录 -->
| AND FIND_IN_SET(#{staffId}, staff_ids)
| <!-- 可选:增加有效状态过滤(如果表中有状态字段) -->
| <!-- AND status = 1 -->
| ORDER BY
| create_time DESC
| </select>
|
| <!-- 查询方案对应的明细 -->
| <select id="selectDetailBySchemeId" resultType="com.ruoyi.staff.pojo.SchemeInsuranceDetail">
| SELECT
| id, scheme_id, insurance_type, payment_base,
| use_basic_salary, personal_ratio, personal_fixed,
| create_time, update_time, create_user, update_user
| FROM
| scheme_insurance_detail
| WHERE
| scheme_id = #{schemeId}
| </select>
|
| </mapper>
|
|