OperationHistoryMapper.xml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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,namespace的值习惯上设置成包名+sql映射文件名,这样就能够保证namespace的值是唯一的,例如namespace="me.gacl.mapping.userMapper"就是me.gacl.mapping(包名)+userMapper(userMapper.xml文件去除后缀)
  4. -->
  5. <mapper namespace="com.fuzamei.mapperInterface.OperationHistoryMapper">
  6. <!-- 根据操作记录给的条件查询分页数据 -->
  7. <select id="queryOperationHistoryInformation" resultType="com.fuzamei.entity.OperationHistory">
  8. select
  9. oh.id,
  10. oh.operator_type_id,
  11. ot.operator_name,
  12. oh.operator_account,
  13. oh.operator_role,
  14. oh.operator_person,
  15. oh.operator_time,
  16. oh.hash
  17. from
  18. operation_history oh
  19. left join
  20. operation_type ot
  21. on
  22. oh.operator_type_id=ot.operator_type_id
  23. <where>
  24. <if test="account!='' and account!=null">
  25. oh.operator_account=#{account}
  26. </if>
  27. <if test="role!='' and role!=null">
  28. and oh.operator_role=#{role}
  29. </if>
  30. <if test="type!='' and type!=null">
  31. and ot.operator_name=#{type}
  32. </if>
  33. <if test="startTime!=null and endTime!=null">
  34. and oh.operator_time between #{startTime} and #{endTime}
  35. </if>
  36. </where>
  37. order by oh.id asc
  38. limit #{startPage},#{rowNum}
  39. </select>
  40. <!-- 返回总页数 -->
  41. <select id="findAllInformation" resultType="int">
  42. select
  43. count(*)
  44. from
  45. (select
  46. oh.id,
  47. oh.operator_type_id,
  48. ot.operator_name,
  49. oh.operator_account,
  50. oh.operator_role,
  51. oh.operator_person,
  52. oh.operator_time,
  53. oh.hash
  54. from
  55. operation_history oh
  56. left join
  57. operation_type ot
  58. on
  59. oh.operator_type_id=ot.operator_type_id
  60. <where>
  61. <if test="account!='' and account!=null">
  62. oh.operator_account=#{account}
  63. </if>
  64. <if test="role!='' and role!=null">
  65. and oh.operator_role=#{role}
  66. </if>
  67. <if test="type!='' and type!=null">
  68. and ot.operator_name=#{type}
  69. </if>
  70. <if test="startTime!=null and endTime!=null">
  71. and oh.operator_time between #{startTime} and #{endTime}
  72. </if>
  73. </where>) temp
  74. <where>
  75. <if test="Account!='' and Account!=null">
  76. temp.operator_account=#{Account}
  77. </if>
  78. </where>
  79. </select>
  80. <!-- 根据操作记录给的条件查询分页数据,但是还要根据用户的账号名来查询 -->
  81. <select id="queryOperationHistoryInformationByUser" resultType="com.fuzamei.entity.OperationHistory">
  82. select
  83. temp.id,
  84. temp.operator_type_id,
  85. temp.operator_name,
  86. temp.operator_account,
  87. temp.operator_role,
  88. temp.operator_person,
  89. temp.operator_time,
  90. temp.hash
  91. from
  92. (select
  93. oh.id,
  94. oh.operator_type_id,
  95. ot.operator_name,
  96. oh.operator_account,
  97. oh.operator_role,
  98. oh.operator_person,
  99. oh.operator_time,
  100. oh.hash
  101. from
  102. operation_history oh
  103. left join
  104. operation_type ot
  105. on
  106. oh.operator_type_id=ot.operator_type_id
  107. <where>
  108. <if test="account!='' and account!=null">
  109. oh.operator_account=#{account}
  110. </if>
  111. <if test="role!='' and role!=null">
  112. and oh.operator_role=#{role}
  113. </if>
  114. <if test="type!='' and type!=null">
  115. and ot.operator_name=#{type}
  116. </if>
  117. <if test="startTime!=null and endTime!=null">
  118. and oh.operator_time between #{startTime} and #{endTime}
  119. </if>
  120. </where>) temp
  121. where
  122. temp.operator_account=#{Account}
  123. order by
  124. temp.id asc
  125. limit #{startPage},#{rowNum}
  126. </select>
  127. </mapper>