heheng
2025-01-16 92ac1754c713d206ebdafa3da8ec817c1d1e120d
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<?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.pay.mapper.NonCoalCategoryMapper">
 
    <resultMap type="NonCoalCategory" id="NonCoalCategoryResult">
        <result property="id" column="id"/>
        <result property="districtCode" column="district_code"/>
        <result property="categoryType" column="category_type"/>
        <result property="subjectName" column="subject_name"/>
        <result property="operateTypeId" column="operate_type_id"/>
        <result property="amount" column="amount"/>
        <result property="businessCode" column="business_code"/>
        <result property="companyCode" column="company_code"/>
        <result property="drawer" column="drawer"/>
        <result property="reviewer" column="reviewer"/>
        <result property="invoicingCompanyCode" column="invoicing_company_code"/>
        <result property="describe" column="describe"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
    </resultMap>
 
    <sql id="selectNonCoalCategoryVo">
        select id,
               district_code,
               category_type,
               subject_name,
               operate_type_id,
               amount,
               bussiness_code,
               company_code,
               drawer,
               reviewer,
               invoicing_company_code, describe, update_by, update_time, create_by, create_time
        from non_coal_category
    </sql>
 
    <select id="selectNonCoalCategoryList" parameterType="NonCoalCategory" resultMap="NonCoalCategoryResult">
        <include refid="selectNonCoalCategoryVo"/>
        <where>
            <if test="districtCode != null  and districtCode != ''">and district_code = #{districtCode}</if>
            <if test="categoryType != null ">and category_type = #{categoryType}</if>
            <if test="subjectName != null  and subjectName != ''">and subject_name like concat('%', #{subjectName},
                '%')
            </if>
            <if test="operateTypeId != null ">and operate_type_id = #{operateTypeId}</if>
            <if test="amount != null ">and amount = #{amount}</if>
            <if test="bussinessCode != null  and bussinessCode != ''">and bussiness_code = #{bussinessCode}</if>
            <if test="companyCode != null  and companyCode != ''">and company_code = #{companyCode}</if>
            <if test="drawer != null  and drawer != ''">and drawer = #{drawer}</if>
            <if test="reviewer != null  and reviewer != ''">and reviewer = #{reviewer}</if>
            <if test="invoicingCompanyCode != null  and invoicingCompanyCode != ''">and invoicing_company_code =
                #{invoicingCompanyCode}
            </if>
            <if test="describe != null  and describe != ''">and describe = #{describe}</if>
        </where>
    </select>
 
    <select id="selectNonCoalCategoryById" parameterType="Long" resultMap="NonCoalCategoryResult">
        <include refid="selectNonCoalCategoryVo"/>
        where id = #{id}
    </select>
 
    <insert id="insertNonCoalCategory" parameterType="NonCoalCategory" useGeneratedKeys="true" keyProperty="id">
        insert into non_coal_category
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="districtCode != null and districtCode != ''">district_code,</if>
            <if test="categoryType != null">category_type,</if>
            <if test="subjectName != null and subjectName != ''">subject_name,</if>
            <if test="operateTypeId != null">operate_type_id,</if>
            <if test="amount != null">amount,</if>
            <if test="bussinessCode != null and bussinessCode != ''">bussiness_code,</if>
            <if test="companyCode != null and companyCode != ''">company_code,</if>
            <if test="drawer != null and drawer != ''">drawer,</if>
            <if test="reviewer != null and reviewer != ''">reviewer,</if>
            <if test="invoicingCompanyCode != null and invoicingCompanyCode != ''">invoicing_company_code,</if>
            <if test="describe != null">describe,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="delFlag != null">del_flag,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="districtCode != null and districtCode != ''">#{districtCode},</if>
            <if test="categoryType != null">#{categoryType},</if>
            <if test="subjectName != null and subjectName != ''">#{subjectName},</if>
            <if test="operateTypeId != null">#{operateTypeId},</if>
            <if test="amount != null">#{amount},</if>
            <if test="bussinessCode != null and bussinessCode != ''">#{bussinessCode},</if>
            <if test="companyCode != null and companyCode != ''">#{companyCode},</if>
            <if test="drawer != null and drawer != ''">#{drawer},</if>
            <if test="reviewer != null and reviewer != ''">#{reviewer},</if>
            <if test="invoicingCompanyCode != null and invoicingCompanyCode != ''">#{invoicingCompanyCode},</if>
            <if test="describe != null">#{describe},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="delFlag != null">#{delFlag},</if>
        </trim>
    </insert>
 
    <update id="updateNonCoalCategory" parameterType="NonCoalCategory">
        update non_coal_category
        <trim prefix="SET" suffixOverrides=",">
            <if test="districtCode != null and districtCode != ''">district_code = #{districtCode},</if>
            <if test="categoryType != null">category_type = #{categoryType},</if>
            <if test="subjectName != null and subjectName != ''">subject_name = #{subjectName},</if>
            <if test="operateTypeId != null">operate_type_id = #{operateTypeId},</if>
            <if test="amount != null">amount = #{amount},</if>
            <if test="bussinessCode != null and bussinessCode != ''">bussiness_code = #{bussinessCode},</if>
            <if test="companyCode != null and companyCode != ''">company_code = #{companyCode},</if>
            <if test="drawer != null and drawer != ''">drawer = #{drawer},</if>
            <if test="reviewer != null and reviewer != ''">reviewer = #{reviewer},</if>
            <if test="invoicingCompanyCode != null and invoicingCompanyCode != ''">invoicing_company_code =
                #{invoicingCompanyCode},
            </if>
            <if test="describe != null">describe = #{describe},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
        </trim>
        where id = #{id}
    </update>
 
    <select id="checkUnite" parameterType="NonCoalCategory" resultType="int">
        select count(id)
        from non_coal_category
        where del_flag = 0
        and district_code = #{districtCode}
        and category_type = #{categoryType}
        and subject_name = #{subjectName}
        <if test="id != null ">and id != #{id}</if>
    </select>
 
    <update id="deleteNonCoalCategoryById" parameterType="Long">
        update non_coal_category
        set del_flag = 2
        where id = #{id}
    </update>
 
    <update id="deleteNonCoalCategoryByIds" parameterType="String">
        update non_coal_category set del_flag = 2 where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </update>
</mapper>