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

com.enterprisemath.dao.big.MyBatisBigEntityMapper.xml Maven / Gradle / Ivy

There is a newer version: 4.3.2
Show newest version
<?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.enterprisemath.dao.big.MyBatisBigEntityMapper">

    <insert id="insertBigEntity">
        insert into ${table} <foreach item="field" collection="fields" open="(" separator="," close=")">${field}</foreach> values
        <foreach item="value" collection="values" open="(" separator="," close=")">#{value}</foreach>
    </insert>

    <insert id="insertBigEntities">
        insert into ${table} <foreach item="field" collection="fields" open="(" separator="," close=")">${field}</foreach> values
        <foreach item="rowValues" collection="values" open=" " separator="," close=";">
            <foreach item="value" collection="rowValues" open="(" separator="," close=")">#{value}</foreach>
        </foreach>
    </insert>

    <select id="selectBigEntities" resultType="map">
        select <foreach item="field" collection="fields" open="" separator="," close="">${field}</foreach>
        from
        ${table}
        <if test="filter.criteria.size() > 0">
            where
            <foreach item="criterium" collection="filter.criteria" open="" separator=" and " close="">
                ${criterium.column}
                <if test="criterium.operator.toString() == 'EQUAL'">
                    <if test="criterium.value == null"> is null </if>
                    <if test="criterium.value != null"> = #{criterium.value} </if>
                </if>
                <if test="criterium.operator.toString() == 'NOT_EQUAL'">
                    <if test="criterium.value == null"> is not null </if>
                    <if test="criterium.value != null"> != #{criterium.value} </if>
                </if>
                <if test="criterium.operator.toString() == 'LIKE'"> like #{criterium.value}</if>
                <if test="criterium.operator.toString() == 'IN'">
                    in (
                    <foreach item="value" collection="criterium.value" open="" separator=", " close="">
                        #{value}
                    </foreach>
                    )
                </if>
                <if test="criterium.operator.toString() == 'LESS'"> &lt; #{criterium.value}</if>
                <if test="criterium.operator.toString() == 'LESS_OR_EQUAL'"> &lt;= #{criterium.value}</if>
                <if test="criterium.operator.toString() == 'GREATER'"> &gt; #{criterium.value}</if>
                <if test="criterium.operator.toString() == 'GREATER_OR_EQUAL'"> &gt;= #{criterium.value}</if>
            </foreach>
        </if>
        <if test="filter.orders.size() > 0">
            order by
            <foreach item="order" collection="filter.orders" open="" separator="," close="">
                ${order.column}
                <if test="order.direction.toString() == 'ASCENDANT'"> asc</if>
                <if test="order.direction.toString() == 'DESCENDANT'"> desc</if>
            </foreach>
        </if>
        offset #{filter.from}
        <if test="filter.limit != null">
            limit #{filter.limit}
        </if>
    </select>

    <select id="countBigEntities" resultType="long">
        select count(*) from
        ${table}
        <if test="criteria.size() > 0">
            where
            <foreach item="criterium" collection="criteria" open="" separator=" and " close="">
                ${criterium.column}
                <if test="criterium.operator.toString() == 'EQUAL'">
                    <if test="criterium.value == null"> is null </if>
                    <if test="criterium.value != null"> = #{criterium.value} </if>
                </if>
                <if test="criterium.operator.toString() == 'NOT_EQUAL'">
                    <if test="criterium.value == null"> is not null </if>
                    <if test="criterium.value != null"> != #{criterium.value} </if>
                </if>
                <if test="criterium.operator.toString() == 'LIKE'"> like #{criterium.value}</if>
                <if test="criterium.operator.toString() == 'IN'">
                    in (
                    <foreach item="value" collection="criterium.value" open="" separator=", " close="">
                        #{value}
                    </foreach>
                    )
                </if>
                <if test="criterium.operator.toString() == 'LESS'"> &lt; #{criterium.value}</if>
                <if test="criterium.operator.toString() == 'LESS_OR_EQUAL'"> &lt;= #{criterium.value}</if>
                <if test="criterium.operator.toString() == 'GREATER'"> &gt; #{criterium.value}</if>
                <if test="criterium.operator.toString() == 'GREATER_OR_EQUAL'"> &gt;= #{criterium.value}</if>
            </foreach>
        </if>
    </select>

    <delete id="deleteBigEntity">
        delete from ${table} where code = #{code}
    </delete>

    <update id="updateBigEntityField">
        update ${table} set ${field} = #{value} where code = #{code}
    </update>

</mapper>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy