LhZdListMapper.xml 6.14 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.lhZdList.mapper.LhZdListMapper">

    <resultMap type="LhZdList" id="LhZdListResult">
        <result property="id"    column="id"    />
        <result property="ename"    column="ename"    />
        <result property="creditCode"    column="creditCode"    />
        <result property="busId"    column="busId"    />
        <result property="userId"    column="userId"    />
        <result property="creditTime"    column="creditTime"    />
        <result property="status"    column="status"    />
        <result property="reportId"    column="reportId"    />
        <result property="source"    column="source"    />
        <result property="excelUrl"    column="excelUrl"    />
        <result property="regCoode"    column="regCoode"    />
        <result property="updateTime"    column="updateTime"    />
    </resultMap>

    <sql id="selectLhZdListVo">
        select id, ename, creditCode, busId, userId, updateTime,creditTime, status, reportId, source, excelUrl, regCoode from lh_zd_list
    </sql>

    <select id="selectLhZdListList" parameterType="LhZdList" resultMap="LhZdListResult">
        <include refid="selectLhZdListVo"/>
        <where>
            <if test="id != null "> and id = #{id}</if>
            <if test="ename != null  and ename != '' "> and ename like concat('%',#{ename},'%')</if>
            <if test="creditCode != null  and creditCode != '' "> and creditCode = #{creditCode}</if>
            <if test="busId != null  and busId != '' "> and busId = #{busId}</if>
            <if test="userId != null "> and userId = #{userId}</if>
            <if test="creditTime != null "> and creditTime = #{creditTime}</if>
            <if test="status != null "> and status = #{status}</if>
            <if test="reportId != null  and reportId != '' "> and reportId = #{reportId}</if>
            <if test="source != null  and source != '' "> and source = #{source}</if>
            <if test="excelUrl != null  and excelUrl != '' "> and excelUrl = #{excelUrl}</if>
            <if test="regCoode != null  and regCoode != '' "> and regCoode = #{regCoode}</if>
            <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
                AND date_format(creditTime,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
            </if>
            <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
                AND date_format(creditTime,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
            </if>
        </where>
        order by creditTime desc
    </select>

    <select id="selectLhZdListById" parameterType="Integer" resultMap="LhZdListResult">
        <include refid="selectLhZdListVo"/>
        where id = #{id}
    </select>
    <select id="selectLhZdByBusId"  resultMap="LhZdListResult">
        <include refid="selectLhZdListVo"/>
        where busId = #{id}
    </select>

    <insert id="insertLhZdList" parameterType="LhZdList" useGeneratedKeys="true" keyProperty="id">
        insert into lh_zd_list
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="ename != null  and ename != ''  ">ename,</if>
            <if test="creditCode != null  and creditCode != ''  ">creditCode,</if>
            <if test="busId != null  and busId != ''  ">busId,</if>
            <if test="userId != null  ">userId,</if>
            <if test="creditTime != null  ">creditTime,</if>
            <if test="status != null  ">status,</if>
            <if test="reportId != null  and reportId != ''  ">reportId,</if>
            <if test="source != null  and source != ''  ">source,</if>
            <if test="excelUrl != null  and excelUrl != ''  ">excelUrl,</if>
            <if test="regCoode != null  and regCoode != ''  ">regCoode,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="ename != null  and ename != ''  ">#{ename},</if>
            <if test="creditCode != null  and creditCode != ''  ">#{creditCode},</if>
            <if test="busId != null  and busId != ''  ">#{busId},</if>
            <if test="userId != null  ">#{userId},</if>
            <if test="creditTime != null  ">#{creditTime},</if>
            <if test="status != null  ">#{status},</if>
            <if test="reportId != null  and reportId != ''  ">#{reportId},</if>
            <if test="source != null  and source != ''  ">#{source},</if>
            <if test="excelUrl != null  and excelUrl != ''  ">#{excelUrl},</if>
            <if test="regCoode != null  and regCoode != ''  ">#{regCoode},</if>
        </trim>
    </insert>

    <update id="updateLhZdList" parameterType="LhZdList">
        update lh_zd_list
        <trim prefix="SET" suffixOverrides=",">
            <if test="ename != null  and ename != ''  ">ename = #{ename},</if>
            <if test="creditCode != null  and creditCode != ''  ">creditCode = #{creditCode},</if>
            <if test="busId != null  and busId != ''  ">busId = #{busId},</if>
            <if test="userId != null  ">userId = #{userId},</if>
            <if test="creditTime != null  ">creditTime = #{creditTime},</if>
            <if test="updateTime != null  ">updateTime = #{updateTime},</if>
            <if test="status != null  ">status = #{status},</if>
            <if test="reportId != null  and reportId != ''  ">reportId = #{reportId},</if>
            <if test="source != null  and source != ''  ">source = #{source},</if>
            <if test="excelUrl != null  and excelUrl != ''  ">excelUrl = #{excelUrl},</if>
            <if test="regCoode != null  and regCoode != ''  ">regCoode = #{regCoode},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteLhZdListById" parameterType="Integer">
        delete from lh_zd_list where id = #{id}
    </delete>

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

</mapper>