BizEntrustPriceMapper.xml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="cn.ezhizao.project.business.reconciliation.priceList.mapper.BizEntrustPriceMapper">
  6. <resultMap type="cn.ezhizao.project.business.reconciliation.priceList.domain.BizEntrustPrice"
  7. id="BizEntrustPriceResult">
  8. <id column="id" property="id"/>
  9. <result property="taskTypeId" column="task_type_id"/>
  10. <result property="fromTenantId" column="from_tenant_id"/>
  11. <result property="alterType" column="alter_type"/>
  12. <result property="toTenantId" column="to_tenant_id"/>
  13. <collection property="fromAccountName" ofType="java.lang.String" select="getFromAccountName"
  14. column="from_tenant_id"/>
  15. <collection property="toAccountName" ofType="java.lang.String" select="getToAccountName" column="to_tenant_id"/>
  16. <collection property="taskTypeName" ofType="java.lang.String" select="getTaskTypeName" column="task_type_id"/>
  17. <collection property="taskTypeDetailName" ofType="java.lang.String" select="getTaskTypeDetailName"
  18. column="task_type_detail_id"/>
  19. </resultMap>
  20. <resultMap type="cn.ezhizao.project.business.reconciliation.priceList.domain.BizTaskType" id="BizTaskTypeResult">
  21. <id column="id" property="id"/>
  22. </resultMap>
  23. <resultMap type="cn.ezhizao.project.tenant.domain.Tenant" id="TenantResult">
  24. <id column="id" property="id"/>
  25. </resultMap>
  26. <resultMap type="cn.ezhizao.project.business.reconciliation.priceList.domain.BizTaskTypeDetail"
  27. id="BizTaskTypeDetailResult">
  28. <id column="id" property="id"/>
  29. </resultMap>
  30. <select id="getList" parameterType="BizEntrustPrice" resultMap="BizEntrustPriceResult">
  31. SELECT * FROM biz_entrust_price e
  32. LEFT JOIN biz_task_type t ON e.task_type_id = t.id
  33. <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
  34. e.deleted = 0
  35. AND exists (select 1 from biz_task_type ts
  36. where ts.deleted = 0
  37. and ts.id=e.task_type_id
  38. and ts.type=1)
  39. <if test="alterType != null and alterType != ''">AND e.alter_type = #{alterType}</if>
  40. <if test="annualIncome != null and annualIncome != ''">AND e.annual_income = #{annualIncome}</if>
  41. <if test="fromTenantId != null ">AND e.from_tenant_id = #{fromTenantId}</if>
  42. <if test="taskTypeId != null ">AND e.task_type_id = #{taskTypeId}</if>
  43. <if test="isChanged != null ">AND e.is_changed = #{isChanged}</if>
  44. <if test="isZero != null and isZero!=''">AND e.is_zero = #{isZero}</if>
  45. <if test="fromAccountName != null and fromAccountName!=''">
  46. AND exists (select t.id from biz_tenant t
  47. where t.deleted = 0
  48. and e.from_tenant_id=t.id
  49. and t.account_name like concat('%', #{fromAccountName}, '%')
  50. )
  51. </if>
  52. <if test="toAccountName != null and toAccountName!=''">
  53. AND exists (select t.id from biz_tenant t
  54. where t.deleted = 0
  55. and e.to_tenant_id=t.id
  56. and t.account_name like concat('%', #{toAccountName}, '%')
  57. )
  58. </if>
  59. <if test="toTenantId != null ">AND e.to_tenant_id = #{toTenantId}</if>
  60. </trim>
  61. </select>
  62. <select id="getOnceList" parameterType="BizEntrustPrice" resultMap="BizEntrustPriceResult">
  63. SELECT * FROM biz_entrust_price e
  64. LEFT JOIN biz_task_type t ON e.task_type_id = t.id
  65. <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
  66. e.deleted = 0
  67. AND exists (select 1 from biz_task_type ts
  68. where ts.deleted = 0
  69. and ts.id=e.task_type_id
  70. and ts.type=2)
  71. <if test="taskTypeId != null ">AND e.task_type_id = #{taskTypeId}</if>
  72. <if test="taskTypeDetailId != null ">AND e.task_type_detail_id = #{taskTypeDetailId}</if>
  73. <if test="provinceCode != null ">AND e.province_code = #{provinceCode}</if>
  74. <if test="cityCode != null ">AND e.city_code = #{cityCode}</if>
  75. <if test="districtCode != null ">AND e.district_code = #{districtCode}</if>
  76. <if test="toTenantId != null ">AND e.to_tenant_id = #{toTenantId}</if>
  77. </trim>
  78. </select>
  79. <select id="getTenantList" parameterType="Tenant" resultMap="TenantResult">
  80. SELECT * FROM biz_tenant
  81. <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
  82. deleted = 0
  83. <if test="accountName != null">
  84. AND account_name like concat('%', #{accountName}, '%')
  85. </if>
  86. </trim>
  87. </select>
  88. <select id="getTaskTypeName" resultType="java.lang.String">
  89. SELECT name
  90. FROM biz_task_type
  91. WHERE id = #{task_type_id}
  92. AND deleted = 0
  93. </select>
  94. <select id="getTaskTypeDetailName" resultType="java.lang.String">
  95. SELECT name
  96. FROM biz_task_type_detail
  97. WHERE id = #{task_type_detail_id}
  98. AND deleted = 0
  99. </select>
  100. <select id="getTaskTypeDetailList" parameterType="BizTaskTypeDetail" resultMap="BizTaskTypeDetailResult">
  101. SELECT *
  102. FROM biz_task_type_detail
  103. WHERE deleted = 0
  104. AND task_type_id = #{id}
  105. </select>
  106. <select id="getTaskType" parameterType="BizTaskType" resultMap="BizTaskTypeResult">
  107. SELECT *
  108. FROM biz_task_type
  109. WHERE deleted = 0
  110. AND type = #{type}
  111. </select>
  112. <select id="getFromAccountName" resultType="java.lang.String">
  113. SELECT account_name
  114. FROM biz_tenant
  115. WHERE id = #{from_tenant_id}
  116. </select>
  117. <select id="getToAccountName" resultType="java.lang.String">
  118. SELECT account_name
  119. FROM biz_tenant
  120. WHERE id = #{to_tenant_id}
  121. </select>
  122. <delete id="physicalDelete">
  123. DELETE FROM biz_entrust_price
  124. <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
  125. <if test="id != null">
  126. id = #{id} AND
  127. </if>
  128. <!-- 删除条件为其他外键可以在这里加 -->
  129. </trim>
  130. </delete>
  131. </mapper>