FksbExcelDataMapper.xml 14.5 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.chinagas.modules.fksb.mapper.FksbExcelDataMapper">
    
    <resultMap type="FksbExcelData" id="FksbExcelDataResult">
        <result property="id"    column="id"    />
        <result property="year"    column="year"    />
        <result property="month"    column="month"    />
        <result property="entity"    column="entity"    />
        <result property="colCv"    column="col_cv"    />
        <result property="colA"    column="col_a"    />
        <result property="colB"    column="col_b"    />
        <result property="colC"    column="col_c"    />
        <result property="colD"    column="col_d"    />
        <result property="colE"    column="col_e"    />
        <result property="colF"    column="col_f"    />
        <result property="colG"    column="col_g"    />
        <result property="colH"    column="col_h"    />
        <result property="colI"    column="col_i"    />
        <result property="colJ"    column="col_j"    />
        <result property="colK"    column="col_k"    />
        <result property="colL"    column="col_l"    />
        <result property="colM"    column="col_m"    />
        <result property="colN"    column="col_n"    />
        <result property="colO"    column="col_o"    />
        <result property="colP"    column="col_p"    />
        <result property="colQ"    column="col_q"    />
        <result property="colR"    column="col_r"    />
        <result property="colS"    column="col_s"    />
        <result property="colT"    column="col_t"    />
        <result property="colU"    column="col_u"    />
        <result property="colV"    column="col_v"    />
        <result property="colW"    column="col_w"    />
        <result property="colX"    column="col_x"    />
        <result property="colY"    column="col_y"    />
        <result property="colZ"    column="col_z"    />
        <result property="createTime"    column="create_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="recordId"    column="record_id"    />
        <result property="rowN"    column="row_n"    />
    </resultMap>

    <sql id="selectFksbExcelDataVo">
        select id, year, month, entity, col_cv, col_a, col_b, col_c, col_d, col_e, col_f,col_g,col_h,col_i,col_j,col_k,col_l,col_m,col_n,col_o,col_p,col_q,col_r,col_s,col_t,
               col_u,col_v,col_w,col_x,col_y,col_z, create_time, create_by, update_time, update_by,record_id,row_n from fksb_excel_data
    </sql>

    <select id="selectFksbExcelDataList" parameterType="FksbExcelData" resultMap="FksbExcelDataResult">
        <include refid="selectFksbExcelDataVo"/>
        <where>  
            <if test="year != null "> and year = #{year}</if>
            <if test="month != null "> and month = #{month}</if>
            <if test="entity != null  and entity != ''"> and entity = #{entity}</if>
            <if test="colCv != null "> and col_cv = #{colCv}</if>
            <if test="colA  != null  and colA  != ''"> and col_a  = #{colA }</if>
            <if test="colB  != null  and colB  != ''"> and col_b  = #{colB }</if>
            <if test="colC  != null  and colC  != ''"> and col_c  = #{colC }</if>
            <if test="colD  != null  and colD  != ''"> and col_d  = #{colD }</if>
            <if test="colE  != null  and colE  != ''"> and col_e  = #{colE }</if>
            <if test="colF  != null  and colF  != ''"> and col_f  = #{colF }</if>
            <if test="colG  != null  and colG  != ''"> and col_g  = #{colG }</if>
            <if test="colH  != null  and colH  != ''"> and col_h  = #{colH }</if>
            <if test="colI  != null  and colI  != ''"> and col_i  = #{colI }</if>
            <if test="colJ  != null  and colJ  != ''"> and col_j  = #{colJ }</if>
            <if test="colK  != null  and colK  != ''"> and col_k  = #{colK }</if>
            <if test="colL  != null  and colL  != ''"> and col_l  = #{colL }</if>
            <if test="colM  != null  and colM  != ''"> and col_m  = #{colM }</if>
            <if test="colN  != null  and colN  != ''"> and col_n  = #{colN }</if>
            <if test="colO  != null  and colO  != ''"> and col_o  = #{colO }</if>
            <if test="colP  != null  and colP  != ''"> and col_p  = #{colP }</if>
            <if test="colQ  != null  and colQ  != ''"> and col_q  = #{colQ }</if>
            <if test="colR  != null  and colR  != ''"> and col_r  = #{colR }</if>
            <if test="colS  != null  and colS  != ''"> and col_s  = #{colS }</if>
            <if test="colT  != null  and colT  != ''"> and col_t  = #{colT }</if>
            <if test="colU  != null  and colU  != ''"> and col_u  = #{colU }</if>
            <if test="colV  != null  and colV  != ''"> and col_v  = #{colV }</if>
            <if test="colW  != null  and colW  != ''"> and col_w  = #{colW }</if>
            <if test="colX  != null  and colX  != ''"> and col_x  = #{colX }</if>
            <if test="colY  != null  and colY  != ''"> and col_y  = #{colY }</if>
            <if test="colZ  != null  and colZ  != ''"> and col_z  = #{colZ }</if>
            <if test="recordId != null  and recordId != ''"> and record_id = #{recordId}</if>
        </where>
    </select>
    
    <select id="selectFksbExcelDataById" parameterType="Long" resultMap="FksbExcelDataResult">
        <include refid="selectFksbExcelDataVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertFksbExcelData" parameterType="FksbExcelData">
        insert into fksb_excel_data
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="year != null">year,</if>
            <if test="month != null">month,</if>
            <if test="entity != null">entity,</if>
            <if test="colCv != null">col_cv,</if>
            <if test="colA  != null">col_a ,</if>
            <if test="colB  != null">col_b ,</if>
            <if test="colC  != null">col_c ,</if>
            <if test="colD  != null">col_d ,</if>
            <if test="colE  != null">col_e ,</if>
            <if test="colF  != null">col_f ,</if>
            <if test="colG  != null">col_g ,</if>
            <if test="colH  != null">col_h ,</if>
            <if test="colI  != null">col_i ,</if>
            <if test="colJ  != null">col_j ,</if>
            <if test="colK  != null">col_k ,</if>
            <if test="colL  != null">col_l ,</if>
            <if test="colM  != null">col_m ,</if>
            <if test="colN  != null">col_n ,</if>
            <if test="colO  != null">col_o ,</if>
            <if test="colP  != null">col_p ,</if>
            <if test="colQ  != null">col_q ,</if>
            <if test="colR  != null">col_r ,</if>
            <if test="colS  != null">col_s ,</if>
            <if test="colT  != null">col_t ,</if>
            <if test="colU  != null">col_u ,</if>
            <if test="colV  != null">col_v ,</if>
            <if test="colW  != null">col_w ,</if>
            <if test="colX  != null">col_x ,</if>
            <if test="colY  != null">col_y ,</if>
            <if test="colZ  != null">col_z ,</if>
            <if test="createTime != null">create_time,</if>
            <if test="createBy != null">create_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="recordId != null">record_id,</if>
            <if test="rowN != null">row_n,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="year != null">#{year},</if>
            <if test="month != null">#{month},</if>
            <if test="entity != null">#{entity},</if>
            <if test="colCv != null">#{colCv},</if>

            <if test="colA  != null">#{col_a },</if>
            <if test="colB  != null">#{col_b },</if>
            <if test="colC  != null">#{col_c },</if>
            <if test="colD  != null">#{col_d },</if>
            <if test="colE  != null">#{col_e },</if>
            <if test="colF  != null">#{col_f },</if>
            <if test="colG  != null">#{col_g },</if>
            <if test="colH  != null">#{col_h },</if>
            <if test="colI  != null">#{col_i },</if>
            <if test="colJ  != null">#{col_j },</if>
            <if test="colK  != null">#{col_k },</if>
            <if test="colL  != null">#{col_l },</if>
            <if test="colM  != null">#{col_m },</if>
            <if test="colN  != null">#{col_n },</if>
            <if test="colO  != null">#{col_o },</if>
            <if test="colP  != null">#{col_p },</if>
            <if test="colQ  != null">#{col_q },</if>
            <if test="colR  != null">#{col_r },</if>
            <if test="colS  != null">#{col_s },</if>
            <if test="colT  != null">#{col_t },</if>
            <if test="colU  != null">#{col_u },</if>
            <if test="colV  != null">#{col_v },</if>
            <if test="colW  != null">#{col_w },</if>
            <if test="colX  != null">#{col_x },</if>
            <if test="colY  != null">#{col_y },</if>
            <if test="colZ  != null">#{col_z },</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="recordId != null">#{recordId},</if>
            <if test="rowN != null">#{rowN},</if>
         </trim>
    </insert>

    <update id="updateFksbExcelData" parameterType="FksbExcelData">
        update fksb_excel_data
        <trim prefix="SET" suffixOverrides=",">
            <if test="year != null">year = #{year},</if>
            <if test="month != null">month = #{month},</if>
            <if test="entity != null">entity = #{entity},</if>
            <if test="colCv != null">col_cv = #{colCv},</if>

            <if test="colA   != null">col_a  = #{colA },</if>
            <if test="colB   != null">col_b  = #{colB },</if>
            <if test="colC   != null">col_c  = #{colC },</if>
            <if test="colD   != null">col_d  = #{colD },</if>
            <if test="colE   != null">col_e  = #{colE },</if>
            <if test="colF   != null">col_f  = #{colF },</if>
            <if test="colG   != null">col_g  = #{colG },</if>
            <if test="colH   != null">col_h  = #{colH },</if>
            <if test="colI   != null">col_i  = #{colI },</if>
            <if test="colJ   != null">col_j  = #{colJ },</if>
            <if test="colK   != null">col_k  = #{colK },</if>
            <if test="colL   != null">col_l  = #{colL },</if>
            <if test="colM   != null">col_m  = #{colM },</if>
            <if test="colN   != null">col_n  = #{colN },</if>
            <if test="colO   != null">col_o  = #{colO },</if>
            <if test="colP   != null">col_p  = #{colP },</if>
            <if test="colQ   != null">col_q  = #{colQ },</if>
            <if test="colR   != null">col_r  = #{colR },</if>
            <if test="colS   != null">col_s  = #{colS },</if>
            <if test="colT   != null">col_t  = #{colT },</if>
            <if test="colU   != null">col_u  = #{colU },</if>
            <if test="colV   != null">col_v  = #{colV },</if>
            <if test="colW   != null">col_w  = #{colW },</if>
            <if test="colX   != null">col_x  = #{colX },</if>
            <if test="colY   != null">col_y  = #{colY },</if>
            <if test="colZ   != null">col_z  = #{colZ },</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            update_time = sysdate()
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteFksbExcelDataById" parameterType="Long">
        delete from fksb_excel_data where id = #{id}
    </delete>

    <delete id="deleteFksbExcelDataByIds" parameterType="String">
        delete from fksb_excel_data where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>

    <insert id="insertFksbExcelDatabatch" parameterType="List">
        insert into fksb_excel_data(year,month,entity,col_cv,
        col_a
,        col_b
,        col_c
,        col_d
,        col_e
,        col_f
,        col_g
,        col_h
,        col_i
,        col_j
,        col_k
,        col_l
,        col_m
,        col_n
,        col_o
,        col_p
,        col_q
,        col_r
,        col_s
,        col_t
,        col_u
,        col_v
,        col_w
,        col_x
,        col_y
,        col_z
,        record_id,create_time,row_n) values
        <foreach collection="list" item="item" separator=",">
                (#{item.year},
                #{item.month},
                #{item.entity},
                #{item.colCv},
            #{item.colA},
                 #{item.colB},
                 #{item.colC},
                 #{item.colD},
                 #{item.colE},
                 #{item.colF},
                 #{item.colG},
                 #{item.colH},
                 #{item.colI},
                 #{item.colJ},
                 #{item.colK},
                 #{item.colL},
                 #{item.colM},
                 #{item.colN},
                 #{item.colO},
                 #{item.colP},
                 #{item.colQ},
                 #{item.colR},
                 #{item.colS},
                 #{item.colT},
                 #{item.colU},
                 #{item.colV},
                 #{item.colW},
                 #{item.colX},
                 #{item.colY},
                 #{item.colZ},
                 #{item.recordId},
                 sysdate(),#{item.rowN})
        </foreach>
    </insert>

    <delete id="deleteByRecordId" parameterType="Long">
        delete from fksb_excel_data where record_id = #{recordId}
    </delete>

    <select id="getDataByRowNs" resultMap="FksbExcelDataResult" parameterType="java.util.List">
        SELECT * from `fksb_excel_data` WHERE row_n in
        <foreach collection="list" open="(" separator="," close=")" item="item">
            #{item}
        </foreach>
        GROUP BY col_cv ORDER BY row_n
    </select>

    <select id="selectDataByRecordId" parameterType="Long" resultMap="FksbExcelDataResult">
        <include refid="selectFksbExcelDataVo"/>
        where record_id = #{recordId}
    </select>
</mapper>