BrokerageBaseAmountMapper.xml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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.BrokerageBaseAmountMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.dayou.vo.BaseAmountVO">
  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="user_id" property="userId" />
  11. <result column="base_amount" property="baseAmount" />
  12. <result column="name" property="name" />
  13. <result column="staff_no" property="staffNo"/>
  14. <collection property="departmentPostVOList" ofType="com.dayou.vo.DepartmentPostVO" select="selectDepartmentPostVO" column="user_id"/>
  15. </resultMap>
  16. <!-- 通用查询结果列 -->
  17. <sql id="Base_Column_List">
  18. id,
  19. deleted,
  20. created,
  21. modified,
  22. user_id, base_amount
  23. </sql>
  24. <select id="selectDepartmentPostVO" parameterType="java.lang.Long" resultType="com.dayou.vo.DepartmentPostVO">
  25. SELECT
  26. d.NAME AS departmentName,
  27. p.name as postName
  28. FROM
  29. user_post up
  30. left join
  31. post p
  32. on up.post_id = p.id
  33. LEFT JOIN department d ON p.department_id = d.id
  34. where up.user_id = #{user_id} and up.deleted = 0 and d.deleted=0 and p.deleted=0
  35. </select>
  36. <select id="xPage" resultMap="BaseResultMap" parameterType="com.dayou.vo.BaseAmountVO">
  37. SELECT
  38. ba.id,
  39. u.NAME,
  40. u.staff_no,
  41. ba.base_amount,
  42. u.id as user_id
  43. FROM
  44. user u
  45. LEFT JOIN brokerage_base_amount ba ON u.id = ba.user_id
  46. WHERE
  47. u.deleted = 0
  48. <if test="base!=null and base.staffNo!=null and base.staffNo!='' ">
  49. and u.staff_no like concat('%',#{base.staffNo},'%')
  50. </if>
  51. <if test="base!=null and base.name!=null and base.name!='' ">
  52. and u.name like concat('%',#{base.name},'%')
  53. </if>
  54. <if test="base!=null and base.keyword!=null and base.keyword!='' ">
  55. and u.name like concat('%',#{base.keyword},'%') or u.staff_no like concat('%',#{base.keyword},'%')
  56. </if>
  57. ORDER BY
  58. ba.id DESC
  59. </select>
  60. </mapper>