GazelleEnterpriseMapper.xml 3.53 KB
<?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>