ProjectAccountMapper.xml 5.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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.cool.bang.modules.mysql.mapper.ProjectAccountMapper">
  4. <!-- 结果集 -->
  5. <resultMap id="projectAccountMap" type="com.cool.bang.modules.mysql.domain.ProjectAccount">
  6. <id property="id" column="id" jdbcType="BIGINT"/>
  7. <result property="bankCode" column="bank_code" jdbcType="VARCHAR"/>
  8. <result property="bankName" column="bank_name" jdbcType="VARCHAR"/>
  9. <result property="orgId" column="org_id" jdbcType="INTEGER"/>
  10. <result property="orgName" column="org_name" jdbcType="VARCHAR"/>
  11. <result property="projectId" column="project_id" jdbcType="BIGINT"/>
  12. <result property="projectNumber" column="project_number" jdbcType="VARCHAR"/>
  13. <result property="projectName" column="project_name" jdbcType="VARCHAR"/>
  14. <result property="projectAddress" column="project_address" jdbcType="VARCHAR"/>
  15. <result property="buildingTotal" column="building_total" jdbcType="INTEGER"/>
  16. <result property="buildArea" column="build_area" jdbcType="DECIMAL"/>
  17. <result property="superviseAmount" column="supervise_amount" jdbcType="DECIMAL"/>
  18. <result property="keepAmount" column="keep_amount" jdbcType="DECIMAL"/>
  19. <result property="accountId" column="account_id" jdbcType="INTEGER"/>
  20. <result property="trusteeshipBalance" column="trusteeship_balance" jdbcType="DECIMAL"/>
  21. <result property="superviseBalance" column="supervise_balance" jdbcType="DECIMAL"/>
  22. <result property="trusteeshipInTransitFund" column="trusteeship_in_transit_fund" jdbcType="DECIMAL"/>
  23. <result property="superviseInTransitFund" column="supervise_in_transit_fund" jdbcType="DECIMAL"/>
  24. <result property="buildCostId" column="build_cost_id" jdbcType="BIGINT"/>
  25. <result property="buildCostName" column="build_cost_name" jdbcType="VARCHAR"/>
  26. <result property="relieveDate" column="relieve_date" jdbcType="VARCHAR"/>
  27. <result property="isFrozen" column="is_frozen" jdbcType="INTEGER"/>
  28. <result property="accountType" column="account_type" jdbcType="INTEGER"/>
  29. <result property="state" column="state" jdbcType="INTEGER"/>
  30. <result property="delFlag" column="del_flag" jdbcType="TINYINT"/>
  31. </resultMap>
  32. <!-- 插入项目虚拟户表数据 -->
  33. <insert id="insertProjectAccount" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
  34. insert into
  35. fc_project_account (id, aregid, bank_code, bank_name, org_id, org_name, project_id, project_number, project_name, project_address, building_total, build_area, supervise_amount, keep_amount, account_id, trusteeship_balance, supervise_balance, trusteeship_in_transit_fund, supervise_in_transit_fund, build_cost_id, build_cost_name, relieve_date, is_frozen, account_type, state, create_time, del_flag)
  36. values
  37. (#{id}, #{aregid}, #{bankCode}, #{bankName}, #{orgId}, #{orgName}, #{projectId}, #{projectNumber}, #{projectName}, #{projectAddress}, #{buildingTotal}, #{buildArea}, #{superviseAmount}, #{keepAmount}, #{accountId}, #{trusteeshipBalance}, #{superviseBalance}, #{trusteeshipInTransitFund}, #{superviseInTransitFund}, #{buildCostId}, #{buildCostName}, #{relieveDate}, #{isFrozen}, #{accountType}, #{state}, #{createTime}, #{delFlag})
  38. </insert>
  39. <!-- 通过yszjjg-aregid查询 -->
  40. <select id="selectByAregid" resultMap="projectAccountMap">
  41. select
  42. id, bank_code, bank_name, org_id, org_name, project_id, project_number, project_name, project_address, building_total, build_area, supervise_amount, keep_amount, account_id, trusteeship_balance, supervise_balance, trusteeship_in_transit_fund, supervise_in_transit_fund, build_cost_id, build_cost_name, relieve_date, is_frozen, account_type, state, create_time
  43. from
  44. fc_project_account
  45. where
  46. aregid = #{aregid}
  47. </select>
  48. <!-- 更新留存金额 -->
  49. <update id="updateKeepAmount">
  50. update fc_project_account
  51. set
  52. keep_amount = (select sum(keep_amount) from fc_building_account where project_account_id = #{id})
  53. where id = #{id}
  54. </update>
  55. <!-- 更新留存金额 -->
  56. <update id="updateTrusteeshipInTransit">
  57. update fc_project_account
  58. set
  59. trusteeship_in_transit_fund = (select sum(in_transit_fund) from fc_building_account where project_account_id = #{id})
  60. where id = #{id}
  61. </update>
  62. <!-- 更新留存金额 -->
  63. <update id="updateSuperviseInTransit">
  64. update fc_project_account
  65. set
  66. supervise_in_transit_fund = (select sum(in_transit_fund) from fc_building_account where project_account_id = #{id})
  67. where id = #{id}
  68. </update>
  69. <select id="selectByAccount" resultMap="projectAccountMap">
  70. select * from fc_project_account where project_id = #{id}
  71. </select>
  72. </mapper>