ArchivedirectoryDao.xml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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.jeeplus.modules.project.dao.ArchivedirectoryDao">
  4. <sql id="archivedirectoryColumns">
  5. a.id AS "id",
  6. a.create_by AS "createBy.id",
  7. a.create_date AS "createDate",
  8. a.update_by AS "updateBy.id",
  9. a.update_date AS "updateDate",
  10. a.remarks AS "remarks",
  11. a.del_flag AS "delFlag",
  12. a.name AS "name",
  13. a.number AS "number",
  14. a.page_number AS "pageNumber",
  15. a.bid_information_id AS "bidInformationId"
  16. </sql>
  17. <sql id="archivedirectoryJoins">
  18. </sql>
  19. <select id="get" resultType="Archivedirectory" >
  20. SELECT
  21. <include refid="archivedirectoryColumns"/>
  22. FROM archive_directory a
  23. <include refid="archivedirectoryJoins"/>
  24. WHERE a.id = #{id}
  25. </select>
  26. <select id="getbidInformationById" resultType="Archivedirectory" >
  27. SELECT (SELECT COUNT(id) FROM archive_directory AS tbl1 WHERE tbl1.id &lt;= tbl2.id and bid_information_id = #{id}) as seq,
  28. id,create_by,create_date,update_by,update_date,remarks,del_flag,name,number,page_number,bid_information_id
  29. FROM archive_directory AS tbl2 where bid_information_id = #{id}
  30. </select>
  31. <select id="findList" resultType="Archivedirectory" >
  32. SELECT
  33. <include refid="archivedirectoryColumns"/>
  34. FROM archive_directory a
  35. <include refid="archivedirectoryJoins"/>
  36. <where>
  37. a.del_flag = #{DEL_FLAG_NORMAL}
  38. </where>
  39. <choose>
  40. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  41. ORDER BY ${page.orderBy}
  42. </when>
  43. <otherwise>
  44. ORDER BY a.update_date DESC
  45. </otherwise>
  46. </choose>
  47. </select>
  48. <select id="findAllList" resultType="Archivedirectory" >
  49. SELECT
  50. <include refid="archivedirectoryColumns"/>
  51. FROM archive_directory a
  52. <include refid="archivedirectoryJoins"/>
  53. <where>
  54. a.del_flag = #{DEL_FLAG_NORMAL}
  55. </where>
  56. <choose>
  57. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  58. ORDER BY ${page.orderBy}
  59. </when>
  60. <otherwise>
  61. ORDER BY a.update_date DESC
  62. </otherwise>
  63. </choose>
  64. </select>
  65. <insert id="insert">
  66. INSERT INTO archive_directory(
  67. id,
  68. create_by,
  69. create_date,
  70. update_by,
  71. update_date,
  72. remarks,
  73. del_flag,
  74. name,
  75. number,
  76. page_number,
  77. bid_information_id
  78. ) VALUES (
  79. #{id},
  80. #{createBy.id},
  81. #{createDate},
  82. #{updateBy.id},
  83. #{updateDate},
  84. #{remarks},
  85. #{delFlag},
  86. #{name},
  87. #{number},
  88. #{pageNumber},
  89. #{bidInformationId}
  90. )
  91. </insert>
  92. <update id="update">
  93. UPDATE archive_directory SET
  94. update_by = #{updateBy.id},
  95. update_date = #{updateDate},
  96. remarks = #{remarks},
  97. name = #{name},
  98. number = #{number},
  99. page_number = #{pageNumber},
  100. bid_information_id = #{bidInformationId}
  101. WHERE id = #{id}
  102. </update>
  103. <!--物理删除-->
  104. <update id="delete">
  105. DELETE FROM archive_directory
  106. WHERE id = #{id}
  107. </update>
  108. <!--逻辑删除-->
  109. <update id="deleteByLogic">
  110. UPDATE archive_directory SET
  111. del_flag = #{DEL_FLAG_DELETE}
  112. WHERE id = #{id}
  113. </update>
  114. <!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
  115. <select id="findUniqueByProperty" resultType="Archivedirectory" statementType="STATEMENT">
  116. select * FROM archive_directory where ${propertyName} = '${value}'
  117. </select>
  118. </mapper>