whyclxw
2024-07-23 12d9277646a5eeafc20f18c6bb4ea8a855d4e2c1
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
<?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.whyc.mapper.DefectiveProductsMapper">
    <resultMap id="defectiveList" type="defectiveProducts">
        <id property="id" column="id"></id>
        <result property="startTime" column="start_time"></result>
        <result property="provideName" column="provide_name"></result>
        <result property="productName" column="product_name"></result>
        <result property="content" column="content"></result>
        <result property="fileUrl" column="file_url"></result>
        <result property="type" column="type"></result>
        <result property="senderId" column="sender_id"></result>
        <result property="receiverIds" column="receiver_ids"></result>
        <result property="receiverNames" column="receiver_names"></result>
        <result property="confirmStatus" column="confirm_status"></result>
        <result property="sumProduct" column="sum_product"></result>
        <result property="badProduct" column="bad_product"></result>
        <result property="note" column="note"></result>
        <collection property="hisList" javaType="java.util.ArrayList" ofType="com.whyc.pojo.DefectiveProductsHistory" column="{deftId=id}" select="selectDefectiveHis">
        </collection>
    </resultMap>
    <select id="getDefectiveLimit" resultMap="defectiveList">
        select * from tb_defective_products
        <where>
            <if test="dto.startTime!=null">
                and start_time>=#{dto.startTime}
            </if>
 
            <if test="dto.endTime!=null">
                and start_time&lt;=#{dto.endTime}
            </if>
 
            <if test="dto.senderId!=null">
                and sender_id=#{dto.senderId}
            </if>
 
            <if test="dto.confirmStatus!=null">
                and confirm_status=#{dto.confirmStatus}
            </if>
        </where>
           order by start_time desc
    </select>
 
    <select id="selectDefectiveHis">
        select * from tb_defective_products_history
        where deft_id=#{deftId}
        order by record_time desc
    </select>
</mapper>