ExcelReportMapper.xml 3.59 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.huaheng.pc.report.excelReport.mapper.ExcelReportMapper" >
    <insert id="insert" parameterType="com.huaheng.pc.report.excelReport.domain.Excelreport" keyProperty="id" useGeneratedKeys="true">
        insert into excelreport
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="name != null">
                name,
            </if>
            <if test="warehouseId != null">
                warehouseId,
            </if>
            <if test="warehouseCode != null">
                warehouseCode,
            </if>
            <if test="sql != null">
                `sql`,
            </if>
            <if test="remark != null">
                remark,
            </if>
            <if test="created != null">
                created,
            </if>
            <if test="createdBy != null">
                createdBy,
            </if>
        </trim>
        <trim prefix=" values (" suffix=")" suffixOverrides=",">
            <if test="name != null">
                #{name, jdbcType=VARCHAR},
            </if>
            <if test="warehouseId != null">
                #{warehouseId, jdbcType=INTEGER},
            </if>
            <if test="warehouseCode != null">
                #{warehouseCode, jdbcType=VARCHAR},
            </if>
            <if test="sql != null">
                #{sql, jdbcType=VARCHAR},
            </if>
            <if test="remark != null">
                #{remark, jdbcType=VARCHAR},
            </if>
            <if test="created != null">
                #{created, jdbcType=TIMESTAMP},
            </if>
            <if test="createdBy != null">
                #{createdBy, jdbcType=VARCHAR},
            </if>
        </trim>
    </insert>

    <update id="updateByModel">
        UPDATE excelreport
        <set>
            <if test="name != null">
               name = #{name, jdbcType=VARCHAR},
            </if>
            <if test="warehouseId != null">
              warehouseId =  #{warehouseId, jdbcType=INTEGER},
            </if>
            <if test="warehouseCode != null">
              warehouseCode =  #{warehouseCode, jdbcType=VARCHAR},
            </if>
            <if test="sql != null">
              `sql` =  #{sql, jdbcType=VARCHAR},
            </if>
            <if test="remark != null">
              remark =  #{remark, jdbcType=VARCHAR},
            </if>
            <if test="created != null">
              created =  #{created, jdbcType=TIMESTAMP},
            </if>
            <if test="createdBy != null">
              createdBy  = #{createdBy, jdbcType=VARCHAR},
            </if>
            <if test="lastUpdated != null">
              lastUpdated = #{lastUpdated, jdbcType=TIMESTAMP},
            </if>
            <if test="lastUpdatedBy != null">
              lastUpdatedBy = #{lastUpdatedBy, jdbcType=VARCHAR},
            </if>
        </set>
        WHERE id = #{id,jdbcType=INTEGER}
    </update>
    <delete id="delete">
        delete  FROM  excelreport where id = #{id}
    </delete>


    <select id="selectCommon"  parameterType="String" resultType="java.util.LinkedHashMap">
        ${value}
    </select>
    <select id="selectById" resultType="com.huaheng.pc.report.excelReport.domain.Excelreport">
        select * from excelreport where id = #{id}
    </select>
    <select id="selectAll" resultType="com.huaheng.pc.report.excelReport.domain.Excelreport">
        select  * from excelreport where warehouseId = #{warehouseId}
    </select>
</mapper>