BizFinancialKeepAccountDetailMapper.xml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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="cn.ezhizao.project.business.keepAccounts.mapper.BizFinancialKeepAccountDetailMapper">
  4. <!-- 基础的返回map 多表复杂的 自行组合 -->
  5. <resultMap id="BaseResultMap" type="cn.ezhizao.project.business.keepAccounts.domain.BizFinancialKeepAccountDetail" />
  6. <!--带条件的List查询-->
  7. <select id="getList" resultMap="BaseResultMap">
  8. <include refid="getListSql" />
  9. </select>
  10. <!--带条件的List查询 数据总条数-->
  11. <select id="getTotal" resultType="java.lang.Integer">
  12. SELECT COUNT(1) FROM (<include refid="getListSql" />) AS t
  13. </select>
  14. <sql id="getListSql">
  15. SELECT
  16. t1.*, t2.name as company_name
  17. from
  18. biz_financial_keep_account_detail t1
  19. left join biz_company t2 on t2.id = t1.company_id
  20. WHERE
  21. t1.deleted = 0
  22. <if test="id != null">
  23. AND t1.id = #{id}
  24. </if>
  25. <if test="financialKeepAccountId != null">
  26. AND t1.financial_keep_account_id = ${financialKeepAccountId}
  27. </if>
  28. <if test="year != null and year != ''">
  29. AND t1.year = #{year}
  30. </if>
  31. <if test="month != null and month != ''">
  32. AND t1.month = #{month}
  33. </if>
  34. <if test="mainIds != null and mainIds.size > 0">
  35. AND t1.financial_keep_account_id in
  36. <foreach collection="mainIds" index="index" item="item" separator="," open="(" close=")">
  37. #{item,jdbcType=BIGINT}
  38. </foreach>
  39. </if>
  40. </sql>
  41. </mapper>