SysDeptAccountHistoryMapper.xml 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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.ydtech.modules.admin.dao.SysDeptAccountHistoryMapper">
  4. <resultMap id="BaseResultMap" type="com.ydtech.modules.admin.model.dto.SysDeptAccountHistoryDto">
  5. <id column="id" jdbcType="VARCHAR" property="id"/>
  6. <result column="dept_id" jdbcType="VARCHAR" property="deptId"/>
  7. <result column="name" jdbcType="VARCHAR" property="deptName"/>
  8. <result column="amount" jdbcType="DECIMAL" property="amount"/>
  9. <result column="surplus_amount" jdbcType="DECIMAL" property="surplusAmount"/>
  10. <result column="documentary" jdbcType="VARCHAR" property="documentary"/>
  11. <result column="suborder" jdbcType="VARCHAR" property="suborder"/>
  12. <result column="user_id" jdbcType="VARCHAR" property="userId"/>
  13. <result column="remark" jdbcType="VARCHAR" property="remark"/>
  14. <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
  15. <result property="createTimeStart" column="createTimeStart" jdbcType="VARCHAR"/>
  16. <result property="createTimeEnd" column="createTimeEnd" jdbcType="VARCHAR"/>
  17. </resultMap>
  18. <select id="getDeptHistory" resultMap="BaseResultMap">
  19. SELECT
  20. a.id,
  21. a.dept_id,
  22. b.NAME,
  23. a.amount,
  24. a.surplus_amount,
  25. a.documentary,
  26. a.suborder,
  27. a.user_id,
  28. a.remark,
  29. a.create_time
  30. FROM
  31. sys_dept_account_history a
  32. LEFT JOIN sys_dept b ON a.dept_id = b.id
  33. where
  34. b.del_flag = 0
  35. <if test="sysDeptAccountHistoryDto.deptId != null and sysDeptAccountHistoryDto.deptId != ''">
  36. AND a.dept_id like concat(#{sysDeptAccountHistoryDto.deptId},'%')
  37. </if>
  38. <if test="sysDeptAccountHistoryDto.deptName != null and sysDeptAccountHistoryDto.deptName != ''">
  39. AND b.name = #{sysDeptAccountHistoryDto.deptName}
  40. </if>
  41. <if test="sysDeptAccountHistoryDto.suborder != null and sysDeptAccountHistoryDto.suborder != ''">
  42. AND a.suborder = #{sysDeptAccountHistoryDto.suborder}
  43. </if>
  44. <if test="sysDeptAccountHistoryDto.documentary != null and sysDeptAccountHistoryDto.documentary != ''">
  45. AND a.documentary = #{sysDeptAccountHistoryDto.documentary}
  46. </if>
  47. <if test="sysDeptAccountHistoryDto.createTimeStart != null and sysDeptAccountHistoryDto.createTimeStart != ''">
  48. and a.create_time &gt;= #{sysDeptAccountHistoryDto.createTimeStart}
  49. </if>
  50. <if test="sysDeptAccountHistoryDto.createTimeEnd != null and sysDeptAccountHistoryDto.createTimeEnd != ''">
  51. and a.create_time &lt;= #{sysDeptAccountHistoryDto.createTimeEnd}
  52. </if>
  53. </select>
  54. <select id="queryAdvanceAndActualDeptDataPage"
  55. resultType="com.ydtech.modules.admin.model.report.financeData.RevenueAndExpenditureDeptDataDto">
  56. SELECT
  57. his.id as id,
  58. his.amount as "amount",
  59. DATE_FORMAT(his.create_time, '%Y-%m-%d %H:%i:%s') as "createTime",
  60. his.dept_id as deptId,
  61. dept.name as deptName,
  62. his.auditing_id as auditiingId,
  63. CASE sda.status
  64. WHEN '0' THEN '提现中'
  65. WHEN '1' THEN '已提现'
  66. WHEN '2' THEN '已驳回'
  67. ELSE ''
  68. END AS auditingStatus,
  69. sda.auditing_time as auditingTime
  70. FROM
  71. sys_dept_account_history his
  72. LEFT JOIN ins_area_company ins ON his.suborder = ins.id
  73. left join sys_dept dept on dept.id =his.dept_id
  74. left join sys_dept_account_withdraw sda on sda.id =his.auditing_id
  75. WHERE
  76. his.documentary =1
  77. <if test="vo.deptId !=null and vo.deptId != '' ">
  78. and his.dept_id = #{vo.deptId}
  79. </if>
  80. <if test="vo.startDate !=null and vo.startDate != '' and vo.endDate !=null and vo.endDate != '' ">
  81. AND his.create_time BETWEEN #{vo.startDate} AND #{vo.endDate}
  82. </if>
  83. order by his.create_time desc
  84. </select>
  85. </mapper>