TenantProxyDividendMapper.xml 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.ym.mec.biz.dal.dao.TenantProxyDividendDao">
  4. <resultMap id="BaseResultMap" type="com.ym.mec.biz.dal.entity.TenantProxyDividend">
  5. <id column="id_" jdbcType="INTEGER" property="id"/>
  6. <result column="proxy_id_" jdbcType="INTEGER" property="proxyId"/>
  7. <result column="tenant_id_" jdbcType="INTEGER" property="tenantId"/>
  8. <result column="total_month_" jdbcType="INTEGER" property="totalMonth"/>
  9. <result column="active_time_" jdbcType="TIMESTAMP" property="activeTime"/>
  10. <result column="order_id_" jdbcType="INTEGER" property="orderId"/>
  11. </resultMap>
  12. <sql id="Base_Column_List">
  13. id_
  14. , proxy_id_, tenant_id_, total_month_, active_time_, order_id_
  15. </sql>
  16. <insert id="insertBatch" keyColumn="id_" keyProperty="id" useGeneratedKeys="true"
  17. parameterType="com.ym.mec.biz.dal.entity.TenantProxyDividend">
  18. insert into tenant_proxy_dividend(proxy_id_, tenant_id_, total_month_, active_time_, order_id_)
  19. values
  20. <foreach collection="entities" item="entity" separator=",">
  21. (#{entity.proxyId}, #{entity.tenantId}, #{entity.totalMonth}, #{entity.activeTime}, #{entity.orderId})
  22. </foreach>
  23. </insert>
  24. <select id="queryProxyDividendInfo" parameterType="map" resultType="com.ym.mec.biz.dal.vo.ProxyDividendInfoVo">
  25. select a.proxy_id_ as proxyId,
  26. b.proxy_name_ as proxyName,
  27. c.id_ as tenantId,
  28. c.name_ as tenantName,
  29. a.active_time_ as activeDate,
  30. a.total_month_ as activeCount,
  31. d.real_name_ as recommenderName
  32. from tenant_proxy_dividend as a
  33. left join tenant_proxy_info as b on a.proxy_id_ = b.id_
  34. left join tenant_info as c on a.tenant_id_ = c.id_
  35. left join sys_user as d on c.recommender_ = d.id_
  36. <where>
  37. <if test="param.proxyId != null">
  38. AND a.proxy_id_ = #{param.proxyId}
  39. </if>
  40. <if test="param.recommenderId != null">
  41. AND c.recommender_ = #{param.recommenderId}
  42. </if>
  43. <if test="param.startData != null and param.startData != ''">
  44. AND a.active_time_ <![CDATA[ >= ]]> #{param.startData}
  45. </if>
  46. <if test="param.endData != null and param.endData != ''">
  47. AND a.active_time_ <![CDATA[ <= ]]> #{param.endData}
  48. </if>
  49. </where>
  50. </select>
  51. <select id="queryProxyDividendCount" parameterType="map" resultType="int">
  52. select IFNULL(SUM(a.total_month_), 0) as activeCount
  53. from tenant_proxy_dividend as a
  54. left join tenant_proxy_info as b on a.proxy_id_ = b.id_
  55. left join tenant_info as c on a.tenant_id_ = c.id_
  56. left join sys_user as d on c.recommender_ = d.id_
  57. <where>
  58. <if test="param.proxyId != null">
  59. AND a.proxy_id_ = #{param.proxyId}
  60. </if>
  61. </where>
  62. </select>
  63. </mapper>