智慧保安后台管理-外网项目备份
zhongrj
2023-09-17 8853292babb2ad94de4a3207966f1e83b767cd2d
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?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="org.springblade.modules.exam.mapper.ScoreAuditRecordsMapper">
 
    <!--考试成绩修改申请记录分页信息-->
    <select id="selectScoreAuditRecordsPage" resultType="org.springblade.modules.exam.vo.ScoreAuditRecordsVO">
        SELECT
            ssar.*,
            bt.dept_name AS deptName,
            bu.real_name realName,
            bu.sex,bu.cardid idCardNo,
            ifnull(DATE_FORMAT(NOW(), '%Y') - SUBSTRING( bu.cardid,7,4),0) age,
            bu1.real_name applyRealName,
            ke.exam_name examName,date_format(ke.start_time,'%Y-%m-%d') examTime,
            bt1.dept_name applyUnitName
        FROM
            sys_score_audit_records ssar
        left join
            blade_user bu
        on
            ssar.user_id = bu.id
        LEFT JOIN
            blade_dept bt
        ON
            bu.dept_id = bt.id
        left join
            blade_user bu1
        on
            ssar.create_user = bu1.id
        left join
            blade_dept bt1
        on
            bu1.dept_id = bt1.id
        left join
            exam_score es
        on
            es.id = ssar.exam_score_id
        left join
            ksxt_exam ke
        on
            ke.id = es.exam_id
        left join
            sys_information si
        on
            si.departmentid = bt.id
        left join
            sys_jurisdiction sj
        on
            sj.id = si.jurisdiction
        WHERE
            1=1
        and bu.status = 1
        and bu.is_deleted = 0
        and es.is_deleted = 0
        <if test="scoreAuditRecords.jurisdiction!=null and scoreAuditRecords.jurisdiction!='' and scoreAuditRecords.jurisdiction!='1372091709474910209'">
            and (sj.id=#{scoreAuditRecords.jurisdiction} or sj.parent_id=#{scoreAuditRecords.jurisdiction})
        </if>
        <if test="scoreAuditRecords.deptName!=null and  scoreAuditRecords.deptName!=''">
            and bt.dept_name like concat('%', #{scoreAuditRecords.deptName},'%')
        </if>
        <if test="scoreAuditRecords.realName!=null and  scoreAuditRecords.realName!=''">
            and bu.real_name like concat('%', #{scoreAuditRecords.realName},'%')
        </if>
        <if test="scoreAuditRecords.idCardNo!=null and  scoreAuditRecords.idCardNo!=''">
            and bu.cardid like concat('%', #{scoreAuditRecords.idCardNo},'%')
        </if>
        <if test="scoreAuditRecords.applyRealName!=null and  scoreAuditRecords.applyRealName!=''">
            and bu1.real_name like concat('%', #{scoreAuditRecords.applyRealName},'%')
        </if>
        <if test="scoreAuditRecords.examName!=null and  scoreAuditRecords.examName!=''">
            and ke.exam_name like concat('%', #{scoreAuditRecords.examName},'%')
        </if>
        <if test="scoreAuditRecords.examTime!=null and  scoreAuditRecords.examTime!=''">
            and date_format(ke.start_time,'%Y-%m-%d') = #{scoreAuditRecords.examTime}
        </if>
        <if test="scoreAuditRecords.trainUnitId!=null and  scoreAuditRecords.trainUnitId!=''">
            and bt1.id = #{scoreAuditRecords.trainUnitId}
        </if>
        <if test="scoreAuditRecords.applyUnitName!=null and  scoreAuditRecords.applyUnitName!=''">
            and bt1.dept_name like concat('%',#{scoreAuditRecords.applyUnitName},'%')
        </if>
        <if test="scoreAuditRecords.status!=null">
            and ssar.status = #{scoreAuditRecords.status}
        </if>
        <if test="scoreAuditRecords.startTime!=null and scoreAuditRecords.startTime!='' and scoreAuditRecords.startTime!='undefined'">
            and ssar.create_time &gt;= #{scoreAuditRecords.startTime}
        </if>
        <if test="scoreAuditRecords.createTime!=null and scoreAuditRecords.createTime!='' and scoreAuditRecords.createTime!='undefined'">
            and ssar.create_time = #{scoreAuditRecords.createTime}
        </if>
        <if test="scoreAuditRecords.endTime!=null and scoreAuditRecords.endTime!='' and scoreAuditRecords.endTime!='undefined'">
            and ssar.create_time &lt;= #{scoreAuditRecords.endTime}
        </if>
        order by ssar.create_time desc
    </select>
 
    <!--自定义详情信息-->
    <select id="getScoreAuditRecordsDetails" resultType="org.springblade.modules.exam.vo.ScoreAuditRecordsVO">
        SELECT
            ssar.*,
            bt.dept_name AS deptName,
            bu.real_name realName,
            bu.sex,bu.cardid idCardNo,
            ifnull(DATE_FORMAT(NOW(), '%Y') - SUBSTRING( bu.cardid,7,4),0) age,
            bu1.real_name applyRealName
        FROM
            sys_score_audit_records ssar
        left join
            blade_user bu
        on
            ssar.user_id = bu.id
        LEFT JOIN
            blade_dept bt
        ON
            bu.dept_id = bt.id
        left join
            blade_user bu1
        on
            ssar.create_user = bu1.id
        WHERE
            1=1
        and bu.status = 1
        and bu.is_deleted = 0
        and ssar.id = #{scoreAuditRecords.id}
    </select>
</mapper>