whyclxw
2025-03-13 90f2637328f765b3db59333b8c615e61e3365afc
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
<?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.SoftwareMapper">
    <resultMap id="softwares" type="softDto">
        <result column="file_url" property="fileUrl" />
        <result column="lock_flag" property="lockFlag"/>
        <result column="file_name" property="fileName"/>
        <collection property="softwares" javaType="java.util.ArrayList" ofType="com.whyc.pojo.Software" column="{fileUrl = file_url,lockFlag = lock_flag}" select="selectSoftWare">
        </collection>
    </resultMap>
 
    <select id="getFileUrl" resultMap="softwares">
        select  distinct file_url,lock_flag,file_name from tb_software
        <where>
            1=1
            <choose>
                <when test="lockFlag == 0">
                    and lock_flag = 0
                </when>
                <when test="lockFlag == 12">
                    and lock_flag != 0
                </when>
                <when test="lockFlag == -1">
                    and lock_flag = -1
                </when>
            </choose>
            <if test="fileName!=null&amp;&amp;fileName!=''">
            and file_name like '%${fileName}%'
            </if>
            <if test="applyMaterialCode!=null&amp;&amp;applyMaterialCode!=''">
                and apply_material_code like '%${applyMaterialCode}%'
            </if>
            <if test="applyModel!=null&amp;&amp;applyModel!=''">
                and apply_model like '%${applyModel}%'
            </if>
            <if test="owner!=null&amp;&amp;owner!=''">
                and owner like '%${owner}%'
            </if>
            <if test="boardNumber!=null&amp;&amp;boardNumber!=''">
                and board_number like '%${boardNumber}%'
            </if>
            <if test="version!=null&amp;&amp;version!=''">
                and version = #{version}
            </if>
        </where>
        order by font_update_time desc
    </select>
    <select id="selectSoftWare" resultType="software">
        select * from tb_software where file_url=#{fileUrl} and lock_flag = #{lockFlag}
    </select>
    <select id="getFileNameByOwnerWithCode" resultType="com.whyc.pojo.Software">
        SELECT distinct w.file_name,based_version,owner
        FROM tb_software w
        LEFT JOIN tb_softcode c ON w.file_name = c.file_name
        WHERE c.file_name IS NULL
        and w.owner = #{owner};
    </select>
</mapper>