yujian
2020-06-09 554de444b87aab5f93cb1593a8095612cf9479a7
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>
@@ -47,7 +72,7 @@
   <select id="computeCompensateByUid" resultType="java.math.BigDecimal"
      parameterType="java.lang.Long">
      select
      ecc_money
      sum(ecc_money)
      from yeshi_ec_extract_check_compensate
      where ecc_uid=#{0}
   </select>
@@ -74,7 +99,7 @@
      #{state,jdbcType=INTEGER},
      #{type,jdbcType=INTEGER},
      #{userInfo.id,jdbcType=BIGINT},
      #{system.id,jdbcType=BIGINT}
      #{system.id,jdbcType=BIGINT},
      #{adminId,jdbcType=BIGINT},
      #{receiveTime,jdbcType=TIMESTAMP}
      )
@@ -408,5 +433,37 @@
      AND <![CDATA[TO_DAYS( FROM_UNIXTIME(t.extractTime/1000)) = TO_DAYS(NOW())]]>
   </select>
   <select id="sumToadyApplyByUid" resultType="java.math.BigDecimal">
      SELECT IFNULL(SUM(t.`money`),0) FROM yeshi_ec_extract t
      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>