heheng
2025-03-27 5d2cfd4562f74496a5263db3451c1e78ff53aead
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
<?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.assess.system.mapper.AssProjectMaterialMapper">
    <resultMap type="com.gkhy.assess.system.domain.AssProjectMaterial" id="projectMaterialResult">
        <id     property="id"        column="id"         />
        <result property="name"     column="name"      />
        <result property="type"     column="type"      />
        <result property="projectId"     column="project_id"      />
        <result property="fileId"     column="file_id"      />
        <result property="delFlag"     column="del_flag"      />
        <result property="version"     column="version"      />
        <result property="createBy"     column="create_by"      />
        <result property="createTime"     column="create_time"      />
        <result property="updateBy"     column="update_by"      />
        <result property="updateTime"     column="update_time"      />
        <result property="remark"     column="remark"      />
        <association property="accessoryFile" javaType="com.gkhy.assess.system.domain.AssAccessoryFile" resultMap="fileResult" />
 
    </resultMap>
 
    <resultMap id="fileResult" type="com.gkhy.assess.system.domain.AssAccessoryFile">
        <id     property="id"       column="file_id"        />
        <result property="originName"     column="origin_name"      />
        <result property="fileName"      column="file_name"       />
        <result property="path"      column="path"       />
    </resultMap>
 
 
    <sql id="selectProjectMaterialVo">
        select p.id,p.name,p.type,p.project_id,p.file_id,
               p.version,p.del_flag,p.create_by,p.create_time,p.update_by,p.update_time,p.remark,a.origin_name,a.file_name,a.path
        from ass_project_material p
        left join ass_accessory_file a on a.id=p.file_id
    </sql>
 
 
    <select id="getCountByProjectId" resultType="java.lang.Integer" parameterType="java.lang.Long">
        select count(1) from ass_project_material where project_id=#{projectId} and del_flag=0
    </select>
 
    <select id="getProjectMaterialByProjectId" resultMap="projectMaterialResult">
        <include refid="selectProjectMaterialVo"/>
        where p.project_id=#{projectId} and p.del_flag=0
    </select>
 
    <select id="getProjectMaterialById" resultMap="projectMaterialResult">
        <include refid="selectProjectMaterialVo"/>
        where p.id=#{projectMaterialId}
    </select>
</mapper>