ItemBrokerageDetailMapper.xml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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.dayou.mapper.ItemBrokerageDetailMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.dayou.entity.ItemBrokerageDetail">
  6. <result column="id" property="id" />
  7. <result column="deleted" property="deleted" />
  8. <result column="created" property="created" />
  9. <result column="modified" property="modified" />
  10. <result column="general_id" property="generalId" />
  11. <result column="user_id" property="userId" />
  12. <result column="predict_amount" property="predictAmount" />
  13. <result column="actual_amount" property="actualAmount" />
  14. <result column="advance_amount" property="advanceAmount" />
  15. <result column="brokerage_rule" property="brokerageRule" />
  16. <result column="brokerage_mode" property="brokerageMode" />
  17. <result column="brokerage_stage_id" property="brokerageStageId" />
  18. </resultMap>
  19. <!-- 通用查询结果列 -->
  20. <sql id="Base_Column_List">
  21. id,
  22. deleted,
  23. created,
  24. modified,
  25. general_id, user_id, predict_amount, actual_amount, advance_amount, brokerage_rule, brokerage_mode,brokerage_stage_id
  26. </sql>
  27. <select id="getPage" parameterType="com.dayou.vo.BrokerageDetailVO" resultType="com.dayou.vo.BrokerageDetailVO">
  28. SELECT
  29. ibd.*,
  30. u.name as userName,
  31. i.name as itemName,
  32. i.amount,
  33. s.name as stageName,
  34. (case ibd.brokerage_rule when 'LAND_MARKETER_RULE' then '市场人员'
  35. when 'LAND_SUPERVISOR_RULE' then '营销主管'
  36. when 'LAND_MANAGER_RULE' then '营销经理'
  37. when 'LAND_OTHER_RULE' then '参与人员' end) as userType
  38. FROM
  39. item_brokerage_detail ibd
  40. LEFT JOIN item_brokerage_general ibg ON ibg.id = ibd.general_id
  41. LEFT JOIN item i ON i.id = ibg.item_id
  42. LEFT JOIN user u ON u.id = ibd.user_id
  43. LEFT JOIN item_stage s on s.id = ibd.brokerage_stage_id
  44. where ibd.deleted = 0 and ibg.deleted = 0 and i.deleted = 0
  45. <if test="vo!=null and vo.generalId!=null">
  46. and ibd.general_id = #{vo.generalId}
  47. </if>
  48. <if test="vo!=null and vo.userName!=null and vo.userName!='' ">
  49. and u.name like concat ('%',#{vo.userName},'%')
  50. </if>
  51. <if test="vo!=null and vo.itemName!=null and vo.itemName!='' ">
  52. and i.name like concat ('%',#{vo.itemName},'%')
  53. </if>
  54. <if test="vo!=null and vo.brokerageRule!=null and vo.brokerageRule!='' ">
  55. and ibd.brokerage_rule = #{vo.brokerageRule}
  56. </if>
  57. <if test="vo!=null and vo.brokerageMode!=null and vo.brokerageMode!='' ">
  58. and ibd.brokerage_mode = #{vo.brokerageMode}
  59. </if>
  60. <if test="vo!=null and vo.userIds!=null and vo.userIds.size!=0">
  61. and ibd.user_id in
  62. <foreach collection="vo.userIds" open="(" close=")" separator="," item="userId">
  63. #{userId}
  64. </foreach>
  65. </if>
  66. order by ibd.id DESC
  67. </select>
  68. <select id="xList" parameterType="com.dayou.vo.BrokerageDetailVO" resultType="com.dayou.vo.BrokerageDetailVO">
  69. SELECT
  70. ibd.*,
  71. u.name as userName,
  72. i.name as itemName,
  73. i.amount,
  74. s.name as stageName,
  75. (case ibd.brokerage_rule when 'LAND_MARKETER_RULE' then '市场人员'
  76. when 'LAND_SUPERVISOR_RULE' then '营销主管'
  77. when 'LAND_MANAGER_RULE' then '营销经理'
  78. when 'LAND_OTHER_RULE' then '参与人员' end) as userType
  79. FROM
  80. item_brokerage_detail ibd
  81. LEFT JOIN item_brokerage_general ibg ON ibg.id = ibd.general_id
  82. LEFT JOIN item i ON i.id = ibg.item_id
  83. LEFT JOIN user u ON u.id = ibd.user_id
  84. LEFT JOIN item_stage s on s.id = ibd.brokerage_stage_id
  85. where ibd.deleted = 0 and ibg.deleted = 0 and i.deleted = 0
  86. <if test="vo!=null and vo.generalId!=null">
  87. and ibd.general_id = #{vo.generalId}
  88. </if>
  89. <if test="vo!=null and vo.userName!=null and vo.userName!='' ">
  90. and u.name like concat ('%',#{vo.userName},'%')
  91. </if>
  92. <if test="vo!=null and vo.itemName!=null and vo.itemName!='' ">
  93. and i.name like concat ('%',#{vo.itemName},'%')
  94. </if>
  95. <if test="vo!=null and vo.brokerageRule!=null and vo.brokerageRule!='' ">
  96. and ibd.brokerage_rule = #{vo.brokerageRule}
  97. </if>
  98. <if test="vo!=null and vo.brokerageMode!=null and vo.brokerageMode!='' ">
  99. and ibd.brokerage_mode = #{vo.brokerageMode}
  100. </if>
  101. <if test="vo!=null and vo.userIds!=null and vo.userIds.size!=0">
  102. and ibd.user_id in
  103. <foreach collection="vo.userIds" open="(" close=")" separator="," item="userId">
  104. #{userId}
  105. </foreach>
  106. </if>
  107. order by ibd.id DESC
  108. </select>
  109. </mapper>