BReportTableMapper.xml 4.99 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.lhcredit.project.business.bReportTable.mapper.BReportTableMapper">
    
    <resultMap type="BReportTable" id="BReportTableResult">
        <result property="id"    column="id"    />
        <result property="reportName"    column="report_name"    />
        <result property="notice"    column="notice"    />
        <result property="title"    column="title"    />
        <result property="imageUrl"    column="image_url"    />
        <result property="sample"    column="sample"    />
        <result property="isDel"    column="is_del"    />
        <result property="bizType"    column="biz_type"    />
    </resultMap>
	
	<sql id="selectBReportTableVo">
        select id, report_name, notice, title, image_url, sample, is_del, biz_type from b_report_table
    </sql>
	
    <select id="selectBReportTableList" parameterType="BReportTable" resultMap="BReportTableResult">
        <include refid="selectBReportTableVo"/>
        <where>  
            <if test="id != null  and id != '' "> and id = #{id}</if>
            <if test="reportName != null  and reportName != '' "> and report_name = #{reportName}</if>
            <if test="notice != null  and notice != '' "> and notice = #{notice}</if>
            <if test="title != null  and title != '' "> and title = #{title}</if>
            <if test="imageUrl != null  and imageUrl != '' "> and image_url = #{imageUrl}</if>
            <if test="sample != null  and sample != '' "> and sample = #{sample}</if>
            <if test="isDel != null "> and is_del = #{isDel}</if>
            <if test="bizType != null "> and biz_type = #{bizType}</if>
        </where>
    </select>
    <select id="selectTypes"  resultType="String">
        select biz_type from  b_report_table
    </select>


    <select id="selectBReportTableById" parameterType="String" resultMap="BReportTableResult">
        <include refid="selectBReportTableVo"/>
        where id = #{id}
    </select>

    <select id="selectBReportTableByReportType" parameterType="String" resultMap="BReportTableResult">
        <include refid="selectBReportTableVo"/>
        where biz_type = #{reportType}
    </select>

    <insert id="insertBReportTable" parameterType="BReportTable">
        insert into b_report_table
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="id != null   ">id,</if>
			<if test="reportName != null  and reportName != ''  ">report_name,</if>
			<if test="notice != null  and notice != ''  ">notice,</if>
			<if test="title != null  and title != ''  ">title,</if>
			<if test="imageUrl != null  and imageUrl != ''  ">image_url,</if>
			<if test="sample != null  and sample != ''  ">sample,</if>
			<if test="isDel != null  ">is_del,</if>
			<if test="bizType != null  ">biz_type,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="id != null   ">#{id},</if>
			<if test="reportName != null  and reportName != ''  ">#{reportName},</if>
			<if test="notice != null  and notice != ''  ">#{notice},</if>
			<if test="title != null  and title != ''  ">#{title},</if>
			<if test="imageUrl != null  and imageUrl != ''  ">#{imageUrl},</if>
			<if test="sample != null  and sample != ''  ">#{sample},</if>
			<if test="isDel != null  ">#{isDel},</if>
			<if test="bizType != null  ">#{bizType},</if>
         </trim>
    </insert>
	 
    <update id="updateBReportTable" parameterType="BReportTable">
        update b_report_table
        <trim prefix="SET" suffixOverrides=",">
            <if test="reportName != null  and reportName != ''  ">report_name = #{reportName},</if>
            <if test="notice != null  and notice != ''  ">notice = #{notice},</if>
            <if test="title != null  and title != ''  ">title = #{title},</if>
            <if test="imageUrl != null  and imageUrl != ''  ">image_url = #{imageUrl},</if>
            <if test="sample != null  and sample != ''  ">sample = #{sample},</if>
            <if test="isDel != null  ">is_del = #{isDel},</if>
            <if test="bizType != null  ">biz_type = #{bizType},</if>
        </trim>
        where id = #{id}
    </update>

	<delete id="deleteBReportTableById" parameterType="String">
        delete from b_report_table where id = #{id}
    </delete>
	
    <delete id="deleteBReportTableByIds" parameterType="String">
        delete from b_report_table where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    
    <select id="getReportTableList" resultMap="BReportTableResult">
        <include refid="selectBReportTableVo"/>
        <where>
            <if test="bizTypeArr != null and bizTypeArr.length > 0">
                and biz_type in
                <foreach item="string" index="index" collection="bizTypeArr" open="(" separator="," close=")">
                    #{string}
                </foreach>
            </if>
        </where>
    </select>
</mapper>