StatementMapper.xml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.web.work.mapper.StatementMapper">
  6. <sql id="selectStatementVo">
  7. SELECT
  8. s.id,
  9. s.num,
  10. s.state,
  11. s.audit,
  12. s.give,
  13. s.batch_name,
  14. s.file_name,
  15. s.msg,
  16. s.service_company,
  17. s.create_time,
  18. s.generate_time,
  19. s.submit_time,
  20. s.audit_time,
  21. s.give_time,
  22. ( SELECT COUNT( d.id ) FROM tb_statement_detail d WHERE d.statement_id = s.id ) AS peoples,
  23. ( SELECT SUM( d.money ) FROM tb_statement_detail d WHERE d.statement_id = s.id ) AS money,
  24. p.project_name
  25. FROM
  26. tb_statement s
  27. LEFT JOIN tb_project p ON p.id = s.project_id
  28. </sql>
  29. <select id="selectList" resultType="com.ruoyi.web.work.domain.Statement">
  30. <include refid="selectStatementVo"/>
  31. <where>
  32. <if test="companyId != null "> and s.company_id = #{companyId}</if>
  33. <if test="batchName != null and batchName != ''"> and s.batch_name like concat('%', #{batchName}, '%')</if>
  34. <if test="num != null and num != ''"> and s.num like concat('%', #{num}, '%')</if>
  35. <if test="projectId != null "> and s.project_id = #{projectId}</if>
  36. <if test="state != null "> and s.state = #{state}</if>
  37. <if test="give != null "> and s.give = #{give}</if>
  38. <choose>
  39. <when test="auditors">
  40. <if test="audit == null "> and s.audit <![CDATA[ >= ]]> 1</if>
  41. <if test="audit != null "> and s.audit=#{audit} and s.audit <![CDATA[ >= ]]> 1</if>
  42. </when>
  43. <otherwise>
  44. <if test="audit != null "> and s.audit = #{audit}</if>
  45. </otherwise>
  46. </choose>
  47. </where>
  48. </select>
  49. <!--结算单审核列表-->
  50. <select id="selectAuditList" resultType="com.ruoyi.web.work.domain.Statement">
  51. <include refid="selectStatementVo"/>
  52. <where>
  53. <if test="companyId != null "> and s.company_id = #{companyId}</if>
  54. <if test="batchName != null and batchName != ''"> and s.batch_name like concat('%', #{batchName}, '%')</if>
  55. <if test="num != null and num != ''"> and s.num like concat('%', #{num}, '%')</if>
  56. <if test="state != null "> and s.state = #{state}</if>
  57. <if test="projectId != null "> and s.project_id = #{projectId}</if>
  58. </where>
  59. </select>
  60. </mapper>