Нет описания

TLhzxFlowerFileUploadMapper.xml 3.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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.yt.zhylplat.moduleLhzx.flowerfileupload.mapper.TLhzxFlowerFileUploadMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.yt.zhylplat.moduleLhzx.flowerfileupload.entity.TLhzxFlowerFileUpload">
  6. <id column="id" property="id" />
  7. <result column="section_id" property="sectionId" />
  8. <result column="section_name" property="sectionName" />
  9. <result column="maintenance_company_id" property="maintenanceCompanyId" />
  10. <result column="maintenance_company_name" property="maintenanceCompanyName" />
  11. <result column="file_name" property="fileName" />
  12. <result column="file_url" property="fileUrl" />
  13. <result column="create_user_id" property="createUserId" />
  14. <result column="create_date" property="createDate" />
  15. <result column="update_user_id" property="updateUserId" />
  16. <result column="update_date" property="updateDate" />
  17. <result column="del_flg" property="delFlg" />
  18. <result column="remark" property="remark" />
  19. </resultMap>
  20. <!-- 通用查询结果列 -->
  21. <sql id="Base_Column_List">
  22. id, section_id, section_name, maintenance_company_id, maintenance_company_name, file_name, file_url, create_user_id, create_date, update_user_id, update_date, del_flg, remark
  23. </sql>
  24. <select id="selectFlowerFileUploadBySection"
  25. resultType="com.yt.zhylplat.moduleLhzx.flowerfileupload.entity.TLhzxFlowerFileUpload">
  26. select
  27. temp.*
  28. from
  29. (<include refid="selectFlowerFileUploadSql"/>) temp
  30. </select>
  31. <select id="selectFlowerFileUploadSumCount"
  32. resultType="com.yt.zhylplat.moduleLhzx.flowerfileupload.entity.TLhzxFlowerFileUpload">
  33. select
  34. sum(if(temp.sumCount is null, 0, temp.sumCount)) as sumCount
  35. from
  36. (<include refid="selectFlowerFileUploadSql"/>) temp
  37. </select>
  38. <sql id="selectFlowerFileUploadSql">
  39. SELECT
  40. section_id,
  41. section_name,
  42. maintenance_company_id,
  43. maintenance_company_name,
  44. COUNT(id) as sumCount
  45. FROM
  46. T_Lhzx_Flower_File_Upload
  47. WHERE
  48. del_flg = 0
  49. <if test="sectionId != null">
  50. AND section_id = #{sectionId}
  51. </if>
  52. <if test="maintenanceCompanyId != null">
  53. AND maintenance_company_id = #{maintenanceCompanyId}
  54. </if>
  55. <if test="fileType != null">
  56. AND file_type = #{fileType}
  57. </if>
  58. <if test="uploadMonth != null and uploadMonth != ''">
  59. and DATE_FORMAT(create_date, '%Y-%m') = #{uploadMonth}
  60. </if>
  61. GROUP BY
  62. section_id,
  63. section_name,
  64. maintenance_company_id,
  65. maintenance_company_name
  66. order by
  67. section_id,
  68. maintenance_company_id
  69. </sql>
  70. </mapper>