heheng
2024-11-20 2d27b24029adafdbfc5703b38a519d65beda6a68
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
127
<?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.gkhy.system.mapper.ProjectExpertDetailMapper">
    
    <resultMap type="ProjectExpertDetail" id="ProjectExpertDetailResult">
        <result property="id"    column="id"    />
        <result property="projectExpertId"    column="project_expert_id"    />
        <result property="content"    column="content"    />
        <result property="score"    column="score"    />
        <result property="scoreType"    column="score_type"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>
 
    <sql id="selectProjectExpertDetailVo">
        select id, project_expert_id, content, score, del_flag,score_type, create_by, create_time, update_by, update_time from project_expert_detail
    </sql>
 
    <select id="selectProjectExpertDetailList" parameterType="ProjectExpertDetail" resultMap="ProjectExpertDetailResult">
        <include refid="selectProjectExpertDetailVo"/>
        <where>
        and del_flag = 0
            <if test="projectExpertId != null "> and project_expert_id = #{projectExpertId}</if>
            <if test="content != null  and content != ''"> and content = #{content}</if>
            <if test="score != null "> and score = #{score}</if>
        </where>
        order by create_time desc
    </select>
    
    <select id="selectProjectExpertDetailById" parameterType="Long" resultMap="ProjectExpertDetailResult">
        <include refid="selectProjectExpertDetailVo"/>
        where id = #{id}
    </select>
 
    <insert id="insertProjectExpertDetail" parameterType="ProjectExpertDetail" useGeneratedKeys="true" keyProperty="id">
        insert into project_expert_detail
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="projectExpertId != null">project_expert_id,</if>
            <if test="content != null and content != ''">content,</if>
            <if test="score != null">score,</if>
            <if test="scoreType != null and  scoreType != ''">score_type,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="projectExpertId != null">#{projectExpertId},</if>
            <if test="content != null and content != ''">#{content},</if>
            <if test="score != null">#{score},</if>
            <if test="scoreType != null and scoreType != ''">#{scoreType},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
         </trim>
    </insert>
 
    <insert id="batchInsertProjectExpertDetail" parameterType="java.util.List" >
        insert into project_expert_detail
            ( project_expert_id, content, score, score_type,  create_by)
        values
        <foreach collection="list" item="item" separator=",">
            <trim prefix="(" suffix=")" suffixOverrides=",">
                <if test="item.projectExpertId != null">#{item.projectExpertId},</if>
                <if test="item.content != null and item.content != ''">#{item.content},</if>
                <if test="item.score != null">#{item.score},</if>
                <if test="item.scoreType != null and item.scoreType != ''">#{item.scoreType},</if>
                <if test="item.createBy != null">#{item.createBy},</if>
            </trim>
        </foreach>
    </insert>
 
 
 
    <update id="updateProjectExpertDetail" parameterType="ProjectExpertDetail">
        update project_expert_detail
        <trim prefix="SET" suffixOverrides=",">
            <if test="projectExpertId != null">project_expert_id = #{projectExpertId},</if>
            <if test="content != null and content != ''">content = #{content},</if>
            <if test="score != null">score = #{score},</if>
            <if test="scoreType != null and scoreType != ''">score_type = #{scoreType},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
        </trim>
        where id = #{id}
    </update>
 
    <update id="batchUpdateProjectExpertDetail" parameterType="java.util.List">
        <foreach collection="list" item="item" separator=";">
            update project_expert_detail
            <trim prefix="SET" suffixOverrides=",">
                <if test="item.projectExpertId != null">project_expert_id = #{item.projectExpertId},</if>
                <if test="item.content != null and item.content != ''">content = #{item.content},</if>
                <if test="item.score != null">score = #{item.score},</if>
                <if test="item.scoreType != null and item.scoreType != ''">score_type = #{item.scoreType},</if>
                <if test="item.delFlag != null">del_flag = #{item.delFlag},</if>
                <if test="item.createBy != null">create_by = #{item.createBy},</if>
                <if test="item.createTime != null">create_time = #{item.createTime},</if>
                <if test="item.updateBy != null">update_by = #{item.updateBy},</if>
                <if test="item.updateTime != null">update_time = #{item.updateTime},</if>
            </trim>
            where id = #{item.id}
        </foreach>
    </update>
 
    <update id="deleteProjectExpertDetailById" parameterType="Long">
        update project_expert_detail set del_flag = 1 where id = #{id}
    </update>
 
    <update id="deleteProjectExpertDetailByIds" parameterType="String">
        update project_expert_detail set del_flag = 1 where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </update>
</mapper>