ExpenseItemMapper.xml 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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.management.platform.mapper.ExpenseItemMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.management.platform.entity.ExpenseItem">
  6. <id column="id" property="id" />
  7. <result column="expense_id" property="expenseId" />
  8. <result column="project_id" property="projectId" />
  9. <result column="happen_date" property="happenDate" />
  10. <result column="invoice_type" property="invoiceType" />
  11. <result column="invoice_no" property="invoiceNo" />
  12. <result column="tax_percent" property="taxPercent" />
  13. <result column="tax_value" property="taxValue" />
  14. <result column="amount" property="amount" />
  15. <result column="remark" property="remark" />
  16. <result column="expense_type" property="expenseType" />
  17. <result column="pic" property="pic" />
  18. </resultMap>
  19. <resultMap id="UserBaseResultMap" type="com.management.platform.entity.vo.ExpenseItemVO">
  20. <id column="id" property="id" />
  21. <result column="expense_id" property="expenseId" />
  22. <result column="project_id" property="projectId" />
  23. <result column="happen_date" property="happenDate" />
  24. <result column="invoice_type" property="invoiceType" />
  25. <result column="invoice_no" property="invoiceNo" />
  26. <result column="tax_percent" property="taxPercent" />
  27. <result column="tax_value" property="taxValue" />
  28. <result column="amount" property="amount" />
  29. <result column="remark" property="remark" />
  30. <result column="expense_type" property="expenseType" />
  31. <result column="pic" property="pic" />
  32. <result column="username" property="username" />
  33. <result column="department_name" property="departmentName" />
  34. </resultMap>
  35. <!-- 通用查询结果列 -->
  36. <sql id="Base_Column_List">
  37. id, expense_id, project_id, happen_date, invoice_type, invoice_no, tax_percent, tax_value, amount, remark, expense_type, pic
  38. </sql>
  39. <select id="getUserExpenseDetail" resultMap="UserBaseResultMap">
  40. select a.id, a.expense_id, a.project_id, a.happen_date, a.invoice_type, a.tax_percent, a.tax_value, a.amount, a.remark, a.expense_type, a.pic,
  41. user.name as username, department.department_name
  42. from expense_item a left join expense_sheet b on a.expense_id = b.id
  43. left join user on user.id = b.owner_id
  44. left join department on department.department_id = user.department_id
  45. where a.project_id = #{projectId}
  46. </select>
  47. </mapper>