BrokerageMarketerRatioMapper.xml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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.BrokerageMarketerRatioMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.dayou.entity.BrokerageMarketerRatio">
  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="item_cate" property="itemCate" />
  11. <result column="item_source" property="itemSource" />
  12. <result column="ratio" property="ratio" />
  13. <result column="remark" property="remark" />
  14. </resultMap>
  15. <!-- 通用查询结果列 -->
  16. <sql id="Base_Column_List">
  17. id,
  18. deleted,
  19. created,
  20. modified,
  21. item_cate, item_source, ratio, remark
  22. </sql>
  23. <select id="xPage" resultType="com.dayou.vo.MarketerRatioVO" parameterType="com.dayou.entity.BrokerageMarketerRatio">
  24. SELECT
  25. *
  26. FROM
  27. (
  28. SELECT
  29. id AS itemCate,
  30. NAME AS itemCateName
  31. FROM
  32. dict_data
  33. WHERE
  34. dict_type_id = ( SELECT id FROM dict_type WHERE NAME = '项目类型' )
  35. AND deleted = 0
  36. ) cate
  37. JOIN (
  38. SELECT
  39. id AS itemSource,
  40. NAME AS itemSourceName
  41. FROM
  42. dict_data
  43. WHERE
  44. dict_type_id = ( SELECT id FROM dict_type WHERE NAME = '业务来源' )
  45. AND deleted = 0
  46. ) source
  47. LEFT JOIN brokerage_marketer_ratio br ON br.item_cate = itemCate
  48. AND br.item_source = itemSource
  49. <where>
  50. <if test="ratio!=null and ratio.itemCate!=null">
  51. and itemCate = #{ratio.itemCate}
  52. </if>
  53. <if test="ratio!=null and ratio.itemSource!=null">
  54. and itemSource = #{ratio.itemSource}
  55. </if>
  56. </where>
  57. order by br.id desc
  58. </select>
  59. </mapper>