xing
2023-02-23 c75e6f4696634d626c5569794c6349593853223a
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
<?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.yssh.dao.YsshSuYuanFeedbackMapper">
    <select id="query" resultType="com.yssh.entity.YsshSuYuanFeedback">
        select * from yssh_suyuan_feedback where 1=1
        <if test="suYuanId != null and suYuanId != ''">
            and suyuan_id = #{suYuanId}
        </if>
        <if test="name != null and name != ''">
            and name = #{name}
        </if>
        <if test="vocsName != null and vocsName != ''">
            and vocs_name = #{vocsName}
        </if>
    </select>
 
    <insert id="insert" parameterType="com.yssh.entity.YsshSuYuanFeedback">
        insert into yssh_suyuan_feedback (
            name, vocs_name, vocsvalue, correct, newid, newvocs_name, newvalue,time,suyuan_id
        )
        values (
            #{name},#{vocsName},#{vocsValue},#{correct},#{newid},#{newvocsName},#{newvalue},now(),#{suyuanId}
        )
    </insert>
    <update id="update">
        UPDATE yssh_suyuan_feedback
        <set>
            <if test="name != null and name != ''">
                name = #{name},
            </if>
            <if test="vocsName != null and vocsName != ''">
                vocs_name = #{vocsName},
            </if>
            <if test="vocsValue != null and vocsValue != ''">
                vocsvalue = #{vocsValue},
            </if>
            <if test="correct != null and correct != ''">
                correct = #{correct},
            </if>
            <if test="newid != null and newid != ''">
                newid = #{newid},
            </if>
            <if test="newvocsName != null and newvocsName != ''">
                newvocs_name = #{newvocsName},
            </if>
            <if test="newvalue != null and newvalue != ''">
                newvalue = #{newvalue},
            </if>
            <if test="suyuanId != null and suyuanId != ''">
                suyuan_id = #{suyuanId},
            </if>
        </set>
        where id = #{id}
    </update>
 
    <select id="statistics" resultType="java.lang.Double">
        SELECT
            sum( CASE WHEN correct = 1 THEN 1 ELSE 0 END )/ count( 1 )
            FROM yssh_suyuan_feedback
    </select>
</mapper>