AutomobileEnterpriseMapper.xml 5.42 KB
Newer Older
1 2 3 4
<?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">
盖献康's avatar
盖献康 committed
5
<mapper namespace="com.ruoyi.mapper.AutomobileEnterpriseMapper">
6

盖献康's avatar
盖献康 committed
7
    <resultMap type="com.ruoyi.domain.AutomobileEnterprise" id="AutomobileEnterpriseResult">
8 9 10 11 12 13 14 15 16 17
        <result property="id" column="id"/>
        <result property="enterpriseName" column="enterprise_name"/>
        <result property="address" column="address"/>
        <result property="postcode" column="postcode"/>
        <result property="enterpriseContact" column="enterprise_contact"/>
        <result property="contactNumber" column="contact_number"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
18
        <result property="deleted" column="deleted"/>
19 20
    </resultMap>

盖献康's avatar
盖献康 committed
21
    <sql id="selectAutomobileEnterpriseVo">
22 23 24 25 26 27 28 29 30
        select id,
               enterprise_name,
               address,
               postcode,
               enterprise_contact,
               contact_number,
               create_by,
               create_time,
               update_by,
31 32
               update_time,
               deleted
33 34 35
        from t_automobile_enterprise
    </sql>

36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
    <sql id="selectAutomobileEnterpriseListSQL">
        select ae.id,
               ae.enterprise_name,
               ae.address,
               ae.postcode,
               ae.enterprise_contact,
               ae.contact_number,
               su.nick_name create_by,
               ae.create_time,
               ae.update_by,
               ae.update_time,
               ae.deleted
        from t_automobile_enterprise ae
        left join sys_user su on ae.create_by = su.user_id
    </sql>

盖献康's avatar
盖献康 committed
52 53
    <select id="selectAutomobileEnterpriseList" parameterType="com.ruoyi.domain.AutomobileEnterprise"
            resultMap="AutomobileEnterpriseResult">
54
        <include refid="selectAutomobileEnterpriseListSQL"/>
55
        <where>
56
            deleted = 0
57 58 59
            <if test="enterpriseName != null  and enterpriseName != ''">and enterprise_name like concat('%',
                #{enterpriseName}, '%')
            </if>
盖献康's avatar
盖献康 committed
60 61 62 63
            <if test="address != null  and address != ''">and address like concat('%', #{address}, '%')</if>
            <if test="postcode != null  and postcode != ''">and postcode like concat('%', #{postcode}, '%')</if>
            <if test="enterpriseContact != null  and enterpriseContact != ''">
                and enterprise_contact like concat('%', #{enterpriseContact}, '%')
64
            </if>
盖献康's avatar
盖献康 committed
65
            <if test="contactNumber != null  and contactNumber != ''">and contact_number like concat('%', #{contactNumber}, '%')</if>
66 67 68
        </where>
    </select>

盖献康's avatar
盖献康 committed
69 70
    <select id="selectAutomobileEnterpriseById" parameterType="Long" resultMap="AutomobileEnterpriseResult">
        <include refid="selectAutomobileEnterpriseVo"/>
71 72 73
        where id = #{id}
    </select>

盖献康's avatar
盖献康 committed
74
    <insert id="insertAutomobileEnterprise" parameterType="com.ruoyi.domain.AutomobileEnterprise">
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
        insert into t_automobile_enterprise
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="enterpriseName != null">enterprise_name,</if>
            <if test="address != null">address,</if>
            <if test="postcode != null">postcode,</if>
            <if test="enterpriseContact != null">enterprise_contact,</if>
            <if test="contactNumber != null">contact_number,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="enterpriseName != null">#{enterpriseName},</if>
            <if test="address != null">#{address},</if>
            <if test="postcode != null">#{postcode},</if>
            <if test="enterpriseContact != null">#{enterpriseContact},</if>
            <if test="contactNumber != null">#{contactNumber},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
        </trim>
    </insert>

盖献康's avatar
盖献康 committed
102
    <update id="updateAutomobileEnterprise" parameterType="com.ruoyi.domain.AutomobileEnterprise">
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
        update t_automobile_enterprise
        <trim prefix="SET" suffixOverrides=",">
            <if test="enterpriseName != null">enterprise_name = #{enterpriseName},</if>
            <if test="address != null">address = #{address},</if>
            <if test="postcode != null">postcode = #{postcode},</if>
            <if test="enterpriseContact != null">enterprise_contact = #{enterpriseContact},</if>
            <if test="contactNumber != null">contact_number = #{contactNumber},</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>
        </trim>
        where id = #{id}
    </update>
</mapper>