<?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="cn.com.countrygarden.bi.main.dao.wcx.WcxOriginalityMapper">
    <resultMap id="ResultMap" type="cn.com.countrygarden.bi.main.model.wcx.WcxOriginality">
        <id column="projectid" jdbcType="VARCHAR" property="projectid"/>
        <result column="title" jdbcType="VARCHAR" property="title"/>
        <result column="content" jdbcType="VARCHAR" property="content"/>
        <result column="createdate" jdbcType="TIMESTAMP" property="createdate"/>
        <result column="status" jdbcType="INTEGER" property="status"/>
        <result column="userid" jdbcType="VARCHAR" property="userid"/>
        <result column="teammembers" jdbcType="VARCHAR" property="teammembers"/>
        <result column="baselineid" jdbcType="INTEGER" property="baselineid"/>
        <result column="classification" jdbcType="INTEGER" property="classification"/>
        <result column="regionid" jdbcType="VARCHAR" property="regionid"/>
        <result column="projecttype" jdbcType="INTEGER" property="projecttype"/>
        <result column="audithaspassed" jdbcType="INTEGER" property="audithaspassed"/>
    </resultMap>

    <select id="percentcreateprojectdate"
            resultMap="ResultMap">
            SELECT   c.projectid,c.title, c.content, o.wechaturl,c.userid,o.username, c.baselineid,c.classification,c.userid
            FROM    wechat_createproject   AS   c   LEFT  OUTER   JOIN   wechat_user   AS  o   ON  o.openid = c.userid
            <if  test="startdate !=null  and  enddate!=null">
            WHERE  (c.createdate&gt; #{startdate,jdbcType=TIMESTAMP}  OR  c.createdate &lt; #{enddate,jdbcType=TIMESTAMP})
            </if>
            ORDER  BY  c.createdate   desc
             LIMIT #{offSet},#{size};
        </select>

    <select id="anchang" resultMap="ResultMap" parameterType="java.lang.String">
                SELECT  count(tt.projectid)  as  thumhs,tt.projectid,a.baselineid,d.wechaturl,d.username,a.classification,a.title,a.content
         FROM wechat_thumb  as   tt
         LEFT OUTER JOIN  wechat_createproject  as  a  on  tt.projectid =  a.projectid
         LEFT OUTER JOIN  wechat_user  as   d   ON   tt.userid = d.openid
         WHERE a.`status`=0  AND   a.baselineid=1
         GROUP BY tt.projectid,a.baselineid,d.wechaturl,d.username,a.classification,a.title,a.content
         ORDER BY count(tt.projectid) desc  LIMIT  0,3
    </select>

    <select id="kefuguanjia" resultMap="ResultMap" parameterType="java.lang.String">
                SELECT  count(tt.projectid)  as  thumhs,tt.projectid,a.baselineid,d.wechaturl,d.username,a.classification,a.title,a.content
         FROM wechat_thumb  as   tt
         LEFT OUTER JOIN  wechat_createproject  as  a  on  tt.projectid =  a.projectid
         LEFT OUTER JOIN  wechat_user  as   d   ON   tt.userid = d.openid
         WHERE a.`status`=0  AND   a.baselineid=2
         GROUP BY tt.projectid,a.baselineid,d.wechaturl,d.username,a.classification,a.title,a.content
         ORDER BY count(tt.projectid) desc  LIMIT  0,3
    </select>

    <select id="baoan" resultMap="ResultMap" parameterType="java.lang.String">
        SELECT  count(tt.projectid)  as  thumhs,tt.projectid,a.baselineid,d.wechaturl,d.username,a.classification,a.title,a.content
        FROM wechat_thumb  as   tt
        LEFT OUTER JOIN  wechat_createproject  as  a  on  tt.projectid =  a.projectid
        LEFT OUTER JOIN  wechat_user  as   d   ON   tt.userid = d.openid
        WHERE a.`status`=0  AND   a.baselineid=3
        GROUP BY tt.projectid,a.baselineid,d.wechaturl,d.username,a.classification,a.title,a.content
        ORDER BY count(tt.projectid) desc  LIMIT  0,3
    </select>


    <select id="baojie" resultMap="ResultMap" parameterType="java.lang.String">
        SELECT  count(tt.projectid)  as  thumhs,tt.projectid,a.baselineid,d.wechaturl,d.username,a.classification,a.title,a.content
        FROM wechat_thumb  as   tt
        LEFT OUTER JOIN  wechat_createproject  as  a  on  tt.projectid =  a.projectid
        LEFT OUTER JOIN  wechat_user  as   d   ON   tt.userid = d.openid
        WHERE a.`status`=0  AND   a.baselineid=4
        GROUP BY tt.projectid,a.baselineid,d.wechaturl,d.username,a.classification,a.title,a.content
        ORDER BY count(tt.projectid) desc  LIMIT  0,3
    </select>

    <select id="liuhua" resultMap="ResultMap" parameterType="java.lang.String">
        SELECT  count(tt.projectid)  as  thumhs,tt.projectid,a.baselineid,d.wechaturl,d.username,a.classification,a.title,a.content
        FROM wechat_thumb  as   tt
        LEFT OUTER JOIN  wechat_createproject  as  a  on  tt.projectid =  a.projectid
        LEFT OUTER JOIN  wechat_user  as   d   ON   tt.userid = d.openid
        WHERE a.`status`=0  AND   a.baselineid=5
        GROUP BY tt.projectid,a.baselineid,d.wechaturl,d.username,a.classification,a.title,a.content
        ORDER BY count(tt.projectid) desc  LIMIT  0,3
    </select>

    <select id="gongcheng" resultMap="ResultMap" parameterType="java.lang.String">
        SELECT  count(tt.projectid)  as  thumhs,tt.projectid,a.baselineid,d.wechaturl,d.username,a.classification,a.title,a.content
        FROM wechat_thumb  as   tt
        LEFT OUTER JOIN  wechat_createproject  as  a  on  tt.projectid =  a.projectid
        LEFT OUTER JOIN  wechat_user  as   d   ON   tt.userid = d.openid
        WHERE a.`status`=0  AND   a.baselineid=6
        GROUP BY tt.projectid,a.baselineid,d.wechaturl,d.username,a.classification,a.title,a.content
        ORDER BY count(tt.projectid) desc  LIMIT  0,3
    </select>

    <select id="findthumb" resultType="java.lang.Long" parameterType="java.lang.String">
      SELECT   COUNT(*)     FROM   wechat_thumb
             WHERE  projectid= #{projectid,jdbcType=VARCHAR}
    </select>

    <select id="findmement" resultType="java.lang.Long" parameterType="java.lang.String">
                      SELECT    COUNT(*)
                      FROM      wechat_reviewtable
                      WHERE     projectid  = #{projectid}
    </select>

    <select id="selectBestPutPointPageData" resultType="cn.com.countrygarden.bi.main.dto.wcx.WcxOriginalityDto">
      SELECT sum()
      FROM wechat_thumb
      WHERE createdate &lt;= #{endDate} AND createdate >= #{beginDate}

    </select>

    <select id="selectBestPutPointPageCount" resultType="int">


    </select>
</mapper>
