fuliqi
2024-03-26 2090500dab57f9c898b3d8f0d580046d311fd0eb
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
<?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.ycl.platform.mapper.TExamineScoreMapper">
    
    <resultMap type="com.ycl.platform.domain.entity.TExamineScore" id="TExamineScoreResult">
        <result property="id"    column="id"    />
        <result property="score"    column="score"    />
        <result property="unitId"    column="unit_id"    />
        <result property="examineId"    column="examine_id"    />
        <result property="examineCategory"    column="examine_category"    />
        <result property="ruleCategory"    column="rule_category"    />
        <result property="createTime"    column="create_time"    />
        <result property="createBy"    column="create_by"    />
    </resultMap>
 
    <sql id="selectTExamineScoreVo">
        select id, score, unit_id, examine_id, examine_category, rule_category, create_time, create_by from t_examine_score
    </sql>
 
    <select id="selectTExamineScoreList" resultType="com.ycl.platform.domain.vo.TExamineScoreVO">
        select tes.id, tes.score, tyu.unit_name, tcp.examine_name, tes.examine_category,tes.rule_category,tes.create_time, tes.create_by
        from t_examine_score tes
        left join t_check_publish tcp on tes.examine_id = tcp.id
        left join t_yw_unit tyu on tes.unit_id = tyu.id
        <where>
            <if test="score != null "> and score = #{score}</if>
            <if test="unitId != null "> and unit_id = #{unitId}</if>
            <if test="examineId != null "> and examine_id = #{examineId}</if>
            <if test="examineCategory != null "> and examine_category = #{examineCategory}</if>
            <if test="ruleCategory != null "> and rule_category = #{ruleCategory</if>
        </where>
    </select>
    
    <select id="selectTExamineScoreById" parameterType="Long" resultMap="TExamineScoreResult">
        <include refid="selectTExamineScoreVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertTExamineScore" useGeneratedKeys="true" keyProperty="id">
        insert into t_examine_score
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="score != null">score,</if>
            <if test="unitId != null">unit_id,</if>
            <if test="examineId != null">examine_id,</if>
            <if test="examineCategory != null">examine_category,</if>
            <if test="ruleCategory != null">rule_category,</if>
            <if test="createTime != null">create_time,</if>
            <if test="createBy != null">create_by,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="score != null">#{score},</if>
            <if test="unitId != null">#{unitId},</if>
            <if test="examineId != null">#{examineId},</if>
            <if test="examineCategory != null">#{examineCategory},</if>
            <if test="ruleCategory != null">#{ruleCategory},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="createBy != null">#{createBy},</if>
         </trim>
    </insert>
 
    <update id="updateTExamineScore">
        update t_examine_score
        <trim prefix="SET" suffixOverrides=",">
            <if test="score != null">score = #{score},</if>
            <if test="unitId != null">unit_id = #{unitId},</if>
            <if test="examineId != null">examine_id = #{examineId},</if>
            <if test="examineCategory != null">examine_category = #{examineCategory},</if>
            <if test="ruleCategory != null">rule_category = #{ruleCategory},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteTExamineScoreById" parameterType="Long">
        delete from t_examine_score where id = #{id}
    </delete>
 
    <delete id="deleteTExamineScoreByIds" parameterType="String">
        delete from t_examine_score where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>