GazelleEnterpriseMapper.xml
3.53 KB
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
<?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.ruoyi.web.controller.business.mapper.GazelleEnterpriseMapper">
<resultMap type="GazelleEnterprise" id="GazelleEnterpriseResult">
<result property="id" column="id"/>
<result property="enterpiseName" column="enterpise_name"/>
<result property="creditCode" column="credit_code"/>
<result property="year" column="year"/>
<result property="num" column="num"/>
<result property="createTime" column="create_time"/>
</resultMap>
<sql id="selectGazelleEnterpriseVo">
select id, enterpise_name, credit_code, year, num, create_time from gazelle_enterprise
</sql>
<select id="selectGazelleEnterpriseById" parameterType="Long" resultMap="GazelleEnterpriseResult">
<include refid="selectGazelleEnterpriseVo"/>
where id = #{id}
</select>
<select id="selectGazelleEnterpriseList" parameterType="GazelleEnterprise" resultMap="GazelleEnterpriseResult">
<include refid="selectGazelleEnterpriseVo"/>
<where>
<if test="enterpiseName != null and enterpiseName != ''"> and enterpise_name like concat('%', #{enterpiseName}, '%')</if>
<if test="creditCode != null and creditCode != ''"> and credit_code = #{creditCode}</if>
<if test="year != null "> and year = #{year}</if>
<if test="num != null and num != ''"> and num = #{num}</if>
</where>
</select>
<insert id="insertGazelleEnterprise" parameterType="GazelleEnterprise" useGeneratedKeys="true" keyProperty="id">
insert into gazelle_enterprise
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="enterpiseName != null and enterpiseName != ''">enterpise_name,</if>
<if test="creditCode != null and creditCode != ''">credit_code,</if>
<if test="year != null">year,</if>
<if test="num != null and num != ''">num,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="enterpiseName != null and enterpiseName != ''">#{enterpiseName},</if>
<if test="creditCode != null and creditCode != ''">#{creditCode},</if>
<if test="year != null">#{year},</if>
<if test="num != null and num != ''">#{num},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateGazelleEnterprise" parameterType="GazelleEnterprise">
update gazelle_enterprise
<trim prefix="SET" suffixOverrides=",">
<if test="enterpiseName != null and enterpiseName != ''">enterpise_name = #{enterpiseName},</if>
<if test="creditCode != null and creditCode != ''">credit_code = #{creditCode},</if>
<if test="year != null">year = #{year},</if>
<if test="num != null and num != ''">num = #{num},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteGazelleEnterpriseById" parameterType="Long">
delete from gazelle_enterprise where id = #{id}
</delete>
<delete id="deleteGazelleEnterpriseByIds" parameterType="String">
delete from gazelle_enterprise where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>