“djh”
3 天以前 a0469a082320c33fc19d4e7239b7ddde67945227
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
<?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.exam.system.mapper.CompanyIndustryTemplateMapper">
    <insert id="insertIndustrys">
        INSERT INTO `company_industry_template` (
        `company_id`,`chapter`,`type`,`template_name`,`industry_type`,`create_by`,`create_time`
        )
        VALUES
        <foreach collection="companyIndustryTemplates" separator="," item="item">
            (#{item.companyId},#{item.chapter},#{item.type},#{item.templateName},#{item.industryType},
            #{item.createBy},#{item.createTime})
        </foreach>
    </insert>
    <update id="updateCompanyIndustryTemplateById" parameterType="com.gkhy.exam.system.domain.CompanyIndustryTemplate">
        UPDATE company_industry_template
        <set>
            <if test="companyId != null and companyId != ''" >
                company_id = #{companyId},
            </if>
            <if test="companyName != null and companyName != ''" >
                company_name = #{companyName},
            </if>
            <if test="chapter!=null and chapter!=''">
                chapter = #{chapter},
            </if>
            <if test="templateName != null and templateName !=''" >
                template_name = #{templateName},
            </if>
            <if test="industryType != null " >
                industry_type = #{industryType},
            </if>
            <if test="filePath != null and filePath !=''" >
                file_path = #{filePath},
            </if>
            <if test="fileName != null and fileName !=''" >
                file_name = #{fileName},
            </if>
            <if test="format != null and format !=''" >
                format = #{format},
            </if>
            <if test="delFlag != null and delFlag != ''" >
                del_flag = #{delFlag},
            </if>
            <if test="createBy != null" >
                create_by = #{createBy},
            </if>
            <if test="createTime != null" >
                create_time = #{createTime},
            </if>
            <if test="updateBy != null" >
                update_by = #{updateBy},
            </if>
            <if test="updateTime != null" >
                update_time = #{updateTime}
            </if>
        </set>
        where id = #{id}
    </update>
 
    <select id="selectCompanyIndustryTemplateList" resultType="com.gkhy.exam.system.domain.CompanyIndustryTemplate">
        SELECT
            ci.`id`,
            ci.`company_id`,
            ci.`company_name`,
            ci.chapter,
            ci.`type`,
            ci.`template_name`,
            ci.`industry_type`,
            cit.name as industry_name,
            ci.`file_path`,
            ci.`file_name`,
            ci.`format`,
            ci.`del_flag`,
            ci.`create_by`,
            ci.`create_time`,
            ci.`update_by`,
            ci.`update_time`
        FROM
        company_industry_template ci
        left join company_industry_type cit on ci.industry_type = cit.id
        WHERE
            ci.del_flag = 0
        <if test="companyId!=null and companyId!=''">
            and ci.company_id = #{companyId}
        </if>
        <if test="industryType!=null">
            and ci.industry_type = #{industryType}
        </if>
        <if test="type!=null and type!=''">
            and ci.type like concat('%',#{type},'%')
        </if>
        ORDER BY
            ci.create_time DESC
    </select>
</mapper>