From 554de444b87aab5f93cb1593a8095612cf9479a7 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期二, 09 六月 2020 17:34:30 +0800
Subject: [PATCH] 订单

---
 fanli/src/main/java/com/yeshi/fanli/mapping/ExtractMapper.xml |   58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 54 insertions(+), 4 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/mapping/ExtractMapper.xml b/fanli/src/main/java/com/yeshi/fanli/mapping/ExtractMapper.xml
index 4ddba9d..997a86d 100644
--- a/fanli/src/main/java/com/yeshi/fanli/mapping/ExtractMapper.xml
+++ b/fanli/src/main/java/com/yeshi/fanli/mapping/ExtractMapper.xml
@@ -16,14 +16,39 @@
 		<result column="adminId" property="adminId" jdbcType="BIGINT" />
 
 		<association property="userInfo" column="uid"
-			select="com.yeshi.fanli.dao.mybatis.UserInfoMapper.selectByPKey">
+			select="com.yeshi.fanli.dao.mybatis.UserInfoMapper.selectByPrimaryKey">
 		</association>
 
 		<association property="system" column="sid"
 			select="com.yeshi.fanli.dao.mybatis.BusinessSystemMapper.selectByPrimaryKey">
 		</association>
-
 	</resultMap>
+	
+	
+	<resultMap id="SimplMap" type="com.yeshi.fanli.entity.bus.user.Extract">
+		<id column="id" property="id" jdbcType="BIGINT" />
+		<result column="account" property="account" jdbcType="VARCHAR" />
+		<result column="extractTime" property="extractTime" jdbcType="BIGINT" />
+		<result column="receiveTime" property="receiveTime" jdbcType="TIMESTAMP" />
+		<result column="ip" property="ip" jdbcType="VARCHAR" />
+		<result column="money" property="money" jdbcType="DECIMAL" />
+		<result column="name" property="name" jdbcType="VARCHAR" />
+		<result column="reason" property="reason" jdbcType="VARCHAR" />
+		<result column="state" property="state" jdbcType="INTEGER" />
+		<result column="type" property="type" jdbcType="INTEGER" />
+		<result column="adminId" property="adminId" jdbcType="BIGINT" />
+
+	    <association column="uid" property="userInfo" javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
+			<id column="uid" property="id" jdbcType="BIGINT" />	
+	    </association>
+	    
+	    <association column="sid" property="system" javaType="com.yeshi.fanli.entity.system.BusinessSystem">
+			<id column="sid" property="id" jdbcType="BIGINT" />	
+	    </association>
+	</resultMap>
+	
+	
+	
 	<sql id="Base_Column_List">
 		id,account,extractTime,ip,money,name,reason,state,type,uid,sid,adminId,receiveTime
 	</sql>
@@ -412,8 +437,33 @@
 	
 	<select id="sumToadyApplyByUid" resultType="java.math.BigDecimal">
 		SELECT IFNULL(SUM(t.`money`),0) FROM yeshi_ec_extract t
-		WHERE t.`uid` = #{0}
-		AND <![CDATA[TO_DAYS( FROM_UNIXTIME(t.extractTime/1000)) = TO_DAYS(NOW())]]>
+		WHERE t.`uid` = #{uid}
+		AND  FROM_UNIXTIME(t.extractTime/1000,'%Y-%m-%d') = #{day}
+	</select>
+	
+	
+	<select id="sumMoneyByUidAndState" resultType="java.math.BigDecimal">
+		SELECT IFNULL(SUM(t.`money`),0) FROM yeshi_ec_extract t
+		WHERE t.`uid` = #{uid}
+		<if test="stateList!=null">
+		<foreach collection="stateList" item="state" open="and (" close=")" separator=" or ">
+		`state`=#{state}
+		</foreach>
+		</if>
+	</select>
+	
+	
+	<select id="getExtractSucceedRecord" resultMap="SimplMap">
+		 SELECT * FROM yeshi_ec_extract t
+		 WHERE t.`uid` = #{uid} AND t.`state` = 1
+		 ORDER BY t.`id` DESC
+		 LIMIT #{start},#{count}
+	</select>
+	
+	
+	<select id="countExtractSucceedRecord" resultType="Long">
+		SELECT COUNT(t.`id`) FROM yeshi_ec_extract t
+		WHERE t.`uid` = #{uid} AND t.`state` = 1
 	</select>
 	
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0