| | |
| | | <!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"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.staff.pojo.SchemeApplicableStaff"> |
| | | <id column="id" property="id" /> |
| | | <result column="title" property="title" /> |
| | | <result column="dept_ids" property="deptIds" /> |
| | | <result column="staff_names" property="staffNames" /> |
| | | <result column="staff_ids" property="staffIds" /> |
| | | <result column="insurance_types" property="insuranceTypes" /> |
| | | <result column="remark" property="remark" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="create_user" property="createUser" /> |
| | | <result column="update_user" property="updateUser" /> |
| | | </resultMap> |
| | | <!-- 基础字段查询 --> |
| | | <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> |