双重预防项目-国泰新华二开定制版
SZH
2022-08-20 f9f0687195e0fe349185437d22c495d74c8d4a20
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
<?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.project.dc.thirdPartyTesting.mapper.ThirdPartyTestingMapper">
    
    <resultMap type="com.ruoyi.project.dc.thirdPartyTesting.domain.ThirdPartyTesting" id="ThirdPartyTestingResult">
        <result property="testingId"    column="testing_id"    />
        <result property="companyId" column="company_id"/>
        <result property="createBy"    column="create_by"    />
        <result property="createUserId"    column="create_user_id"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateUserId"    column="update_user_id"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
        <result property="testingName"    column="testing_name"    />
        <result property="testingDetectionTime"    column="testing_detection_time"    />
        <result property="testingTestConclusion"    column="testing_test_conclusion"    />
        <result property="testingOwnedFile"    column="testing_owned_file"    />
        <result property="testingOwnedPicture"    column="testing_owned_picture"    />
        <result property="testingReportValidityPeriod"    column="testing_report_validity_period"    />
    </resultMap>
 
    <sql id="selectThirdPartyTestingVo">
        select testing_id, company_id, create_by, create_user_id, create_time,
        update_by, update_user_id, update_time, remark,
        testing_name,
        testing_detection_time, testing_test_conclusion, testing_owned_file,
        testing_owned_picture, testing_report_validity_period
        from dc_third_party_testing
    </sql>
 
    <select id="selectThirdPartyTestingList" parameterType="ThirdPartyTesting" resultMap="ThirdPartyTestingResult">
        <include refid="selectThirdPartyTestingVo"/>
        <where>
            <if test="companyId != null "> and company_id = #{companyId}</if>
            <if test="createUserId != null "> and create_user_id = #{createUserId}</if>
            <if test="updateUserId != null "> and update_user_id = #{updateUserId}</if>
            <if test="params.beginTestingDetectionTime != null and params.beginTestingDetectionTime != '' and params.endTestingDetectionTime != null and params.endTestingDetectionTime != ''"> and testing_detection_time between #{params.beginTestingDetectionTime} and #{params.endTestingDetectionTime}</if>
            <if test="testingTestConclusion != null  and testingTestConclusion != ''"> and testing_test_conclusion like concat('%', #{testingTestConclusion}, '%')</if>
            <if test="testingOwnedFile != null  and testingOwnedFile != ''"> and testing_owned_file = #{testingOwnedFile}</if>
            <if test="testingOwnedPicture != null  and testingOwnedPicture != ''"> and testing_owned_picture = #{testingOwnedPicture}</if>
            <if test="testingReportValidityPeriod != null "> and testing_report_validity_period = #{testingReportValidityPeriod}</if>
        </where>
    </select>
    
    <select id="selectThirdPartyTestingById" parameterType="Long" resultMap="ThirdPartyTestingResult">
        <include refid="selectThirdPartyTestingVo"/>
        where testing_id = #{testingId}
    </select>
        
    <insert id="insertThirdPartyTesting" parameterType="ThirdPartyTesting" useGeneratedKeys="true" keyProperty="testingId">
        insert into dc_third_party_testing
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="testingName != null  and testingName != ''">testing_name,</if>
            <if test="companyId != null ">company_id,</if>
            <if test="createBy != null  and createBy != ''">create_by,</if>
            <if test="createUserId != null ">create_user_id,</if>
            <if test="createTime != null ">create_time,</if>
            <if test="updateBy != null  and updateBy != ''">update_by,</if>
            <if test="updateUserId != null ">update_user_id,</if>
            <if test="updateTime != null ">update_time,</if>
            <if test="remark != null  and remark != ''">remark,</if>
            <if test="testingDetectionTime != null ">testing_detection_time,</if>
            <if test="testingTestConclusion != null  and testingTestConclusion != ''">testing_test_conclusion,</if>
            <if test="testingOwnedFile != null  and testingOwnedFile != ''">testing_owned_file,</if>
            <if test="testingOwnedPicture != null  and testingOwnedPicture != ''">testing_owned_picture,</if>
            <if test="testingReportValidityPeriod != null ">testing_report_validity_period,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="testingName != null  and testingName != ''">#{testingName},</if>
            <if test="companyId != null ">#{companyId},</if>
            <if test="createBy != null  and createBy != ''">#{createBy},</if>
            <if test="createUserId != null ">#{createUserId},</if>
            <if test="createTime != null ">#{createTime},</if>
            <if test="updateBy != null  and updateBy != ''">#{updateBy},</if>
            <if test="updateUserId != null ">#{updateUserId},</if>
            <if test="updateTime != null ">#{updateTime},</if>
            <if test="remark != null  and remark != ''">#{remark},</if>
            <if test="testingDetectionTime != null ">#{testingDetectionTime},</if>
            <if test="testingTestConclusion != null  and testingTestConclusion != ''">#{testingTestConclusion},</if>
            <if test="testingOwnedFile != null  and testingOwnedFile != ''">#{testingOwnedFile},</if>
            <if test="testingOwnedPicture != null  and testingOwnedPicture != ''">#{testingOwnedPicture},</if>
            <if test="testingReportValidityPeriod != null ">#{testingReportValidityPeriod},</if>
         </trim>
    </insert>
 
    <update id="updateThirdPartyTesting" parameterType="ThirdPartyTesting">
        update dc_third_party_testing
        <trim prefix="SET" suffixOverrides=",">
            <if test="testingName != null  and testingName != ''">testing_name = #{testingName},</if>
            <if test="companyId != null ">company_id = #{companyId},</if>
            <if test="createBy != null  and createBy != ''">create_by = #{createBy},</if>
            <if test="createUserId != null ">create_user_id = #{createUserId},</if>
            <if test="createTime != null ">create_time = #{createTime},</if>
            <if test="updateBy != null  and updateBy != ''">update_by = #{updateBy},</if>
            <if test="updateUserId != null ">update_user_id = #{updateUserId},</if>
            <if test="updateTime != null ">update_time = #{updateTime},</if>
            <if test="remark != null  and remark != ''">remark = #{remark},</if>
            <if test="testingDetectionTime != null ">testing_detection_time = #{testingDetectionTime},</if>
            <if test="testingTestConclusion != null  and testingTestConclusion != ''">testing_test_conclusion = #{testingTestConclusion},</if>
            <if test="testingOwnedFile != null  and testingOwnedFile != ''">testing_owned_file = #{testingOwnedFile},</if>
            <if test="testingOwnedPicture != null  and testingOwnedPicture != ''">testing_owned_picture = #{testingOwnedPicture},</if>
            <if test="testingReportValidityPeriod != null ">testing_report_validity_period = #{testingReportValidityPeriod},</if>
        </trim>
        where testing_id = #{testingId}
    </update>
 
    <delete id="deleteThirdPartyTestingById" parameterType="Long">
        delete from dc_third_party_testing where testing_id = #{testingId}
    </delete>
 
    <delete id="deleteThirdPartyTestingByIds" parameterType="String">
        delete from dc_third_party_testing where testing_id in 
        <foreach item="testingId" collection="array" open="(" separator="," close=")">
            #{testingId}
        </foreach>
    </delete>
    
</mapper>