OaAttendancePlaceDao.xml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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.oa.dao.OaAttendancePlaceDao">
  4. <sql id="oaAttendancePlaceColumns">
  5. a.id AS "id",
  6. a.company_id AS "company.id",
  7. a.place_name AS "placeName",
  8. a.place_scope AS "placeScope",
  9. a.longitude AS "longitude",
  10. a.latitude AS "latitude",
  11. a.oa_attendance_rule_id AS "oaAttendanceRule.id",
  12. a.create_by AS "createBy.id",
  13. a.create_date AS "createDate",
  14. a.update_by AS "updateBy.id",
  15. a.update_date AS "updateDate",
  16. a.remarks AS "remarks",
  17. company.name AS "company.name",
  18. a.del_flag AS "delFlag"
  19. </sql>
  20. <sql id="oaAttendancePlaceJoins">
  21. LEFT JOIN sys_office company ON company.id = a.company_id
  22. </sql>
  23. <select id="get" resultType="OaAttendancePlace" >
  24. SELECT
  25. <include refid="oaAttendancePlaceColumns"/>
  26. FROM oa_attendance_place a
  27. <include refid="oaAttendancePlaceJoins"/>
  28. WHERE a.id = #{id}
  29. </select>
  30. <select id="findList" resultType="OaAttendancePlace" >
  31. SELECT
  32. <include refid="oaAttendancePlaceColumns"/>
  33. FROM oa_attendance_place a
  34. <include refid="oaAttendancePlaceJoins"/>
  35. <where>
  36. a.del_flag = #{DEL_FLAG_NORMAL}
  37. <if test="company != null and company.id != null and company.id != ''">
  38. AND a.company_id = #{company.id}
  39. </if>
  40. <if test="oaAttendanceRule != null and oaAttendanceRule != ''">
  41. AND a.oa_attendance_rule_id = #{oaAttendanceRule.id}
  42. </if>
  43. </where>
  44. <choose>
  45. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  46. ORDER BY ${page.orderBy}
  47. </when>
  48. <otherwise>
  49. ORDER BY a.create_date ASC
  50. </otherwise>
  51. </choose>
  52. </select>
  53. <select id="findAllList" resultType="OaAttendancePlace" >
  54. SELECT
  55. <include refid="oaAttendancePlaceColumns"/>
  56. FROM oa_attendance_place a
  57. <include refid="oaAttendancePlaceJoins"/>
  58. <where>
  59. a.del_flag = #{DEL_FLAG_NORMAL}
  60. </where>
  61. <choose>
  62. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  63. ORDER BY ${page.orderBy}
  64. </when>
  65. <otherwise>
  66. ORDER BY a.create_date ASC
  67. </otherwise>
  68. </choose>
  69. </select>
  70. <insert id="insert">
  71. INSERT INTO oa_attendance_place(
  72. id,
  73. company_id,
  74. place_name,
  75. place_scope,
  76. longitude,
  77. latitude,
  78. oa_attendance_rule_id,
  79. create_by,
  80. create_date,
  81. update_by,
  82. update_date,
  83. remarks,
  84. del_flag
  85. ) VALUES (
  86. #{id},
  87. #{company.id},
  88. #{placeName},
  89. #{placeScope},
  90. #{longitude},
  91. #{latitude},
  92. #{oaAttendanceRule.id},
  93. #{createBy.id},
  94. #{createDate},
  95. #{updateBy.id},
  96. #{updateDate},
  97. #{remarks},
  98. #{delFlag}
  99. )
  100. </insert>
  101. <update id="update">
  102. UPDATE oa_attendance_place SET
  103. company_id = #{company.id},
  104. place_name = #{placeName},
  105. place_scope = #{placeScope},
  106. longitude = #{longitude},
  107. latitude = #{latitude},
  108. oa_attendance_rule_id = #{oaAttendanceRule.id},
  109. update_by = #{updateBy.id},
  110. update_date = #{updateDate},
  111. remarks = #{remarks}
  112. WHERE id = #{id}
  113. </update>
  114. <!--物理删除-->
  115. <update id="delete">
  116. DELETE FROM oa_attendance_place
  117. <choose>
  118. <when test="id !=null and id != ''">
  119. WHERE id = #{id}
  120. </when>
  121. <otherwise>
  122. WHERE oa_attendance_rule_id = #{oaAttendanceRule.id}
  123. </otherwise>
  124. </choose>
  125. </update>
  126. <!--逻辑删除-->
  127. <update id="deleteByLogic">
  128. UPDATE oa_attendance_place SET
  129. del_flag = #{DEL_FLAG_DELETE}
  130. <choose>
  131. <when test="id !=null and id != ''">
  132. WHERE id = #{id}
  133. </when>
  134. <otherwise>
  135. WHERE oa_attendance_rule_id = #{oaAttendanceRule.id}
  136. </otherwise>
  137. </choose>
  138. </update>
  139. <!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
  140. <select id="findUniqueByProperty" resultType="OaAttendancePlace" statementType="STATEMENT">
  141. select * FROM oa_attendance_place where ${propertyName} = '${value}'
  142. </select>
  143. <select id="getPlaceNameById" resultType="string">
  144. SELECT place_name AS "placeName"
  145. FROM oa_attendance_place a
  146. where a.id = #{placeId}
  147. </select>
  148. </mapper>