SysDeptAccountHistoryMapper.xml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. </mapper>