FaultDao.xml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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.zglc.fm.dao.master.FaultDao">
  4. <!-- 可根据自己的需求,是否要使用 -->
  5. <resultMap type="com.zglc.fm.entity.FaultEntity" id="faultMap">
  6. <result property="id" column="id"/>
  7. <result property="fault_name" column="fault_name"/>
  8. <result property="fault_number" column="fault_number"/>
  9. <result property="author" column="author"/>
  10. <result property="department" column="department"/>
  11. <result property="aircraft_type" column="aircraft_type"/>
  12. <result property="major_type" column="major_type"/>
  13. <result property="description" column="description"/>
  14. <result property="file_path" column="file_path"/>
  15. <result property="input_time" column="input_time"/>
  16. <result property="fault_time" column="fault_time"/>
  17. <result property="book_name" column="book_name"/>
  18. <result property="chapter" column="chapter"/>
  19. <result property="remarks" column="remarks"/>
  20. </resultMap>
  21. <resultMap type="com.zglc.fm.entity.aircraftStaEntity" id="staMap">
  22. <result property="aircraftType" column="aircraftType"/>
  23. <result property="num" column="num"/>
  24. </resultMap>
  25. <select id="listAll" resultMap="faultMap">
  26. select id,fault_name,fault_number,author,aircraft_type,major_type,description,file_path,input_time,fault_time,book_name,chapter,remarks
  27. from t_fault
  28. where id > 0
  29. </select>
  30. <select id="getCount" resultType="java.lang.Integer">
  31. select count(1)
  32. from t_fault
  33. </select>
  34. <select id="getCountByAircaft" parameterType="String" resultType="java.lang.Integer">
  35. select count(1)
  36. from t_fault
  37. where aircraft_type = #{aircraftType}
  38. </select>
  39. <select id="aircraftSta" parameterType="java.util.ArrayList" resultMap="staMap">
  40. select aircraft_type,count(aircraft_type) as num from t_fault group by aircraft_type
  41. </select>
  42. <!-- <insert id="batchAdd" parameterType="java.util.List">-->
  43. <!-- <foreach collection="list" item="equ" separator=";">-->
  44. <!-- insert into t_equipment (equipment_type)-->
  45. <!-- SELECT #{equ.equipment_type}-->
  46. <!-- FROM DUAL WHERE NOT EXISTS (SELECT equipment_type FROM t_equipment WHERE equipment_type = #{equ.equipment_type})-->
  47. <!-- </foreach>-->
  48. <!-- </insert>-->
  49. <select id="findByName" parameterType="String" resultMap="faultMap">
  50. select id,fault_name,fault_number,author,aircraft_type,major_type,description,file_path,input_time,fault_time,book_name,chapter,remarks from t_fault where fault_name
  51. like #{fault_name}
  52. </select>
  53. <select id="findByBookName" parameterType="String" resultMap="faultMap">
  54. select * from t_fault where book_name
  55. like #{name}
  56. and major_type = #{major}
  57. and aircraft_type = #{aircraftType}
  58. </select>
  59. <select id="findByFaultName" parameterType="String" resultMap="faultMap">
  60. select * from t_fault where fault_name
  61. like #{name}
  62. and major_type = #{major}
  63. and aircraft_type = #{aircraftType}
  64. </select>
  65. <select id="findByAuthor" parameterType="String" resultMap="faultMap">
  66. select * from t_fault where author
  67. like #{name}
  68. and major_type = #{major}
  69. and aircraft_type = #{aircraftType}
  70. </select>
  71. <select id="findByDepartment" parameterType="String" resultMap="faultMap">
  72. select * from t_fault where department
  73. like #{name}
  74. and major_type = #{major}
  75. and aircraft_type = #{aircraftType}
  76. </select>
  77. <select id="findByDescription" parameterType="String" resultMap="faultMap">
  78. select * from t_fault where description
  79. like #{name}
  80. and major_type = #{major}
  81. and aircraft_type = #{aircraftType}
  82. </select>
  83. <select id="findByMultiple" parameterType="String" resultMap="faultMap">
  84. select * from t_fault where (book_name like #{name} and major_type = #{major})
  85. or (fault_name like #{name} and major_type = #{major})
  86. </select>
  87. <select id="findByFaultTime" parameterType="com.zglc.fm.entity.FaultFind" resultMap="faultMap">
  88. select *
  89. from t_fault where 1=1
  90. <if test="major !=null">
  91. and major_type = #{major}
  92. </if>
  93. <if test="aircraftType !=null">
  94. and aircraft_type = #{aircraftType}
  95. </if>
  96. <if test="beginTime != null">
  97. and fault_time <![CDATA[>=]]> #{beginTime}
  98. </if>
  99. <if test="finishTime !=null">
  100. and fault_time <![CDATA[<=]]> #{finishTime}
  101. </if>
  102. </select>
  103. </mapper>