zss
2025-03-07 12291480d592402398c3ba76e8de6006da5c2612
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?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.personnel.mapper.PersonRewardPunishmentRecordMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ruoyi.personnel.pojo.PersonRewardPunishmentRecord">
        <id column="id" property="id" />
        <result column="reward_punish_level" property="rewardPunishLevel" />
        <result column="reward_punish_name" property="rewardPunishName" />
        <result column="reward_punish_time" property="rewardPunishTime" />
        <result column="reward_punish_work_unit" property="rewardPunishWorkUnit" />
        <result column="reward_punish_content" property="rewardPunishContent" />
        <result column="user_id" property="userId" />
        <result column="create_user" property="createUser" />
    </resultMap>
 
    <select id="rewardPunishmentPage" resultType="com.ruoyi.personnel.dto.PersonRewardPunishmentRecordDto">
        select cprpr.*, us.name create_user_name, u.account account, u.name user_name
        from cnas_person_reward_punishment_record cprpr
        left join user u on cprpr.user_id = u.id
        left join user us on cprpr.create_user = us.id
        <where>
            <if test="userId != null and userId != ''">
                and cprpr.user_id = #{userId}
            </if>
            <if test="userName != null and userName != ''">
                and u.name like concat('%', #{userName}, '%')
            </if>
            <if test="startTime != null and endTime != null">
                AND DATE(cprpr.reward_punish_time) BETWEEN #{startTime} AND #{endTime}
            </if>
            <if test="departmentId != null and departmentId != ''">
                and FIND_IN_SET(#{departmentId}, u.depart_lims_id)
            </if>
        </where>
    </select>
 
    <select id="rewardPunishmentExport" resultType="com.ruoyi.personnel.excel.PersonRewardPunishmentRecordExcel">
        select cprpr.*, us.name create_user_name, u.account account, u.name user_name
        from cnas_person_reward_punishment_record cprpr
        left join user u on cprpr.user_id = u.id
        left join user us on cprpr.create_user = us.id
        <where>
            <if test="userId != null and userId != ''">
                and cprpr.user_id = #{userId}
            </if>
            <if test="departmentId != null and departmentId != ''">
                and FIND_IN_SET(#{departmentId},u.depart_lims_id)
            </if>
            <if test="userName != null and userName != ''">
                and u.name like concat('%', #{userName}, '%')
            </if>
            <if test="startTime != null and endTime != null">
                AND DATE(cprpr.reward_punish_time) BETWEEN #{startTime} AND #{endTime}
            </if>
        </where>
    </select>
</mapper>