<?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.nantian.cloud.jljc.mapper.DeleteDataRecordMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.nantian.cloud.jljc.entity.DeleteDataRecord">
        <id column="id" property="id" />
        <result column="cmpName" property="cmp_name" />
        <result column="content" property="content" />
        <result column="completeTime" property="complete_time" />
        <result column="requestTime" property="request_time" />
        <result column="imgUrl" property="img_url" />
        <result column="userid" property="userid"/>
        <result column="update_time" property="updateTime"/>
        <result column="del_flag" property="delFlag"/>
        <result column="dept_id" property="deptId"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, cmp_name, content, complete_time, request_time, img_url, userid, update_time, del_flag, dept_id
    </sql>


    <select id="getPage" resultType="com.nantian.cloud.jljc.entity.DeleteDataRecord">
        select <include refid="Base_Column_List"></include>
        from delete_data_record
        <trim prefix="where" prefixOverrides="and">
            <if test="query.completeTime != null and query.completeTime != ''">
                and complete_time=#{query.completeTime}
            </if>
            <if test="query.cmpName != null and query.cmpName != ''">
                and cmp_name like concat("%",#{query.cmpName},"%")
            </if>
            <if test="query.requestTime != null and query.requestTime != ''">
                and request_time= #{query.requestTime}
            </if>
            <if test="query.delFlag != null and query.delFlag != ''">
                and del_flag= #{query.delFlag}
            </if>
        </trim>
     order by update_time desc
    </select>
    <select id="getTotal" resultType="java.lang.Integer">
        SELECT IFNULL(count(*),0)
        FROM delete_data_record
        <trim prefix="where" prefixOverrides="and">
            <if test="query.completeTime != null and query.completeTime != ''">
                and complete_time=#{query.completeTime}
            </if>
            <if test="query.cmpName != null and query.cmpName != ''">
                and cmp_name like concat("%",#{query.cmpName},"%")
            </if>
            <if test="query.requestTime != null and query.requestTime != ''">
                and request_time= #{query.requestTime}
            </if>
            <if test="query.delFlag != null and query.delFlag != ''">
                and del_flag= #{query.delFlag}
            </if>
        </trim>
    </select>

</mapper>