<?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">
<!--  Copyright (c) 京北方信息技术股份有限公司 Corporation 2021 . All rights reserved. -->
<!--  Mybatis数据库持久层（业务层映射文件）：叶子节点当日新增用例数据 -->
<!--  version: 1.0  -->
<!--  author:  maven-cctp-plugin    -->
<!--  date:  2021-12-21 16:29:21  -->
<mapper namespace="net.northking.cctp.dw.db.dao.MtLeafDesignDao">


  <!-- 请在本文件内添加自定义SQL语句 -->

  <resultMap id="DetailMap" type="net.northking.cctp.dw.dto.MtLeafDesignDetailDto">
      <!--  -->
    <id column="id" jdbcType="VARCHAR" property="id"/>
                      <!-- 创建时间 -->
    <result column="created_time" jdbcType="VARCHAR" property="createdTime"/>
        <!-- 设计中 -->
    <result column="design" jdbcType="INTEGER" property="design"/>
        <!-- 已完成 -->
    <result column="finish" jdbcType="INTEGER" property="finish"/>
        <!-- 目录名称 -->
    <result column="tree_name" jdbcType="VARCHAR" property="treeName"/>
        <!-- 系统id -->
    <result column="pro_id" jdbcType="VARCHAR" property="proId"/>
    </resultMap>

  <select id="pagingQuery" resultMap="DetailMap" parameterType="net.northking.cctp.dw.db.entity.MtLeafDesign">
    select
    id
    ,created_time
    ,design
    ,finish
    ,tree_name
    ,pro_id
    from
    <include refid="Table_Name"/>
    <trim prefix="WHERE" prefixOverrides="AND" >
      <if test="id != null">
        AND id = #{id,jdbcType=VARCHAR}
      </if>
      <if test="createdTime != null">
        AND created_time = #{createdTime,jdbcType=VARCHAR}
      </if>
      <if test="design != null">
        AND design = #{design,jdbcType=INTEGER}
      </if>
      <if test="finish != null">
        AND finish = #{finish,jdbcType=INTEGER}
      </if>
      <if test="treeName != null">
        AND tree_name = #{treeName,jdbcType=VARCHAR}
      </if>
      <if test="proId != null">
        AND pro_id = #{proId,jdbcType=VARCHAR}
      </if>
    </trim>
  </select>

  <select id="listQuery" resultType="net.northking.cctp.dw.dto.MtLeafDesignDetailDto">
    select
     design
    ,finish
    ,tree_name treeName
    from
    <include refid="Table_Name"/>
    <trim prefix="WHERE" prefixOverrides="AND" >
      <if test="proId != null">
        AND pro_id = #{proId,jdbcType=VARCHAR}
      </if>
      AND created_time = date_format(curdate(),'%Y-%m-%d')
    </trim>
  </select>
</mapper>