CustomerCheckViewMapper.xml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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.usoftchina.saas.money.mapper.CustomerCheckViewMapper" >
  4. <resultMap id="BaseResultMap" type="com.usoftchina.saas.money.po.CustomerCheckView" >
  5. <result column="pi_inoutno" property="pi_inoutno" jdbcType="VARCHAR" />
  6. <result column="pi_class" property="pi_class" jdbcType="VARCHAR" />
  7. <result column="pi_custcode" property="pi_custcode" jdbcType="VARCHAR" />
  8. <result column="pi_custname" property="pi_custname" jdbcType="VARCHAR" />
  9. <result column="pi_date" property="pi_date" jdbcType="TIMESTAMP" />
  10. <result column="pd_pdno" property="pd_pdno" jdbcType="INTEGER" />
  11. <result column="pr_code" property="pr_code" jdbcType="VARCHAR" />
  12. <result column="pr_detail" property="pr_detail" jdbcType="VARCHAR" />
  13. <result column="pr_spec" property="pr_spec" jdbcType="VARCHAR" />
  14. <result column="pd_unit" property="pd_unit" jdbcType="VARCHAR" />
  15. <result column="qty" property="qty" jdbcType="DOUBLE" />
  16. <result column="pd_orderprice" property="pd_orderprice" jdbcType="DOUBLE" />
  17. <result column="pd_taxrate" property="pd_taxrate" jdbcType="DOUBLE" />
  18. <result column="pd_total" property="pd_total" jdbcType="DOUBLE" />
  19. <result column="pd_netprice" property="pd_netprice" jdbcType="DOUBLE" />
  20. <result column="pd_nettotal" property="pd_nettotal" jdbcType="DOUBLE" />
  21. </resultMap>
  22. <select id="selectByCondition" resultMap="BaseResultMap">
  23. select * from customer_amount_view
  24. <where>
  25. <if test="con != null">
  26. ${con}
  27. </if>
  28. <if test="companyId != null">
  29. and companyId = #{companyId}
  30. </if>
  31. </where>
  32. order by pi_custname asc, pi_date desc, pi_custcode desc
  33. </select>
  34. <select id="selectCalculateFields" resultType="string">
  35. select ${fields} from customer_amount_view
  36. <where>
  37. <if test="con != null">
  38. ${con}
  39. </if>
  40. <if test="companyId != null">
  41. and companyId = #{companyId}
  42. </if>
  43. </where>
  44. </select>
  45. <resultMap id="BaseAddMap" type="com.usoftchina.saas.money.po.VendOrCustAdd" >
  46. <result column="beginamount" property="beginamount" jdbcType="DOUBLE" />
  47. <result column="nowamount" property="nowamount" jdbcType="DOUBLE" />
  48. <result column="nowpay" property="beginamount" jdbcType="DOUBLE" />
  49. </resultMap>
  50. <select id="selectCustAdd" resultMap="BaseAddMap">
  51. select a.sl_orderamount as beginamount, b.nowamount, b.nowpay,(a.sl_orderamount +b.nowamount-b.nowpay) as nowbalance FROM
  52. (select sl_orderamount,sl_custid,sl_date, companyid from subledger where sl_kind = '期初余额') a
  53. left join (select sum(sl_amount) as nowamount,sum(sl_preamount) as nowpay,sl_custid,sl_date from subledger where sl_kind !='期初余额'
  54. group by sl_custid,sl_date) b
  55. on a.sl_custid=b.sl_custid
  56. where a.sl_custid=#{sl_custid} and a.sl_date ${cons} and a.companyid = #{companyId} limit 1
  57. </select>
  58. <select id="getId" resultType="java.lang.Integer">
  59. select cu_id from customer where cu_code = #{code} and companyId = #{companyId}
  60. </select>
  61. </mapper>