All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mybatis-magic.1.0.5.source-code.MagicTemplate.xml Maven / Gradle / Ivy

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "https://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="magic_index_">
    <select id="selectAll" resultType="entityType_">
        select columns_ from table_
    </select>
    <select id="selectById" resultType="entityType_">
        select columns_ from table_ where id_= #{id_}
    </select>
    <select id="existsById" resultType="boolean">
        select count(*) from table_ where id_= #{id_}
    </select>
    <insert id="insert" parameterType="entityType_" useGeneratedKeys="true" keyProperty="id_">
        insert into table_(columns_) values
        <if test="id_!=null">
            (values_)
        </if>
        <if test="id_==null">
            (sequence_values)
        </if>
    </insert>
    <insert id="insertNotId" parameterType="entityType_">
        insert into table_(columns_) values (values_)
    </insert>
    <insert id="notInsertNull"  parameterType="map" useGeneratedKeys="true" keyProperty="e.id_">
        insert into table_(${columns}) values (${values})
    </insert>
    <insert id="notInsertNullNotId"  parameterType="map">
        insert into table_(${columns}) values (${values})
    </insert>
    <insert id="insertList" parameterType="entityType_" useGeneratedKeys="true" keyProperty="id_">
        insert into table_(columns_) values
        <foreach collection="list" index="" item="e" separator=","> (columnsE_) </foreach>
    </insert>
    <insert id="insertListNotId" parameterType="entityType_">
        insert into table_(columns_) values
        <foreach collection="list" index="" item="e" separator=","> (columnsE_) </foreach>
    </insert>
    <update id="updateById" parameterType="entityType_">
        update table_ set setColumns_ where id_=#{id_}
    </update>
    <update id="updateNotNullById" parameterType="map">
        update table_ set ${columns} where id_=#{e.id_}
    </update>
    <delete id="deleteById">
        delete from table_ where id_=#{id_}
    </delete>
    <delete id="deleteByIds" parameterType="list">
        delete from table_ where id_ in
        <foreach collection="list" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
    </delete>
</mapper>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy