TbFaultReportMapper.xml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.asset.mapper.TbFaultReportMapper">
  6. <resultMap type="TbFaultReport" id="TbFaultReportResult">
  7. <result property="id" column="id" />
  8. <result property="assetBarCode" column="asset_bar_code" />
  9. <result property="userId" column="user_id" />
  10. <result property="reportDate" column="report_date" />
  11. <result property="faultPhenomenon" column="fault_phenomenon" />
  12. <result property="tel" column="tel" />
  13. <result property="processState" column="process_state" />
  14. <result property="processResult" column="process_result" />
  15. </resultMap>
  16. <sql id="selectTbFaultReportVo">
  17. select id, asset_bar_code, user_id, report_date, fault_phenomenon, tel, process_state, process_result from tb_fault_report
  18. </sql>
  19. <select id="selectTbFaultReportList" parameterType="TbFaultReport" resultMap="TbFaultReportResult">
  20. <include refid="selectTbFaultReportVo"/>
  21. <where>
  22. <if test="assetBarCode != null and assetBarCode != ''"> and asset_bar_code = #{assetBarCode}</if>
  23. <if test="userId != null "> and user_id = #{userId}</if>
  24. <if test="reportDate != null "> and report_date = #{reportDate}</if>
  25. <if test="faultPhenomenon != null and faultPhenomenon != ''"> and fault_phenomenon = #{faultPhenomenon}</if>
  26. <if test="processState != null "> and process_state = #{processState}</if>
  27. </where>
  28. </select>
  29. <select id="selectTbFaultReportById" parameterType="Long" resultMap="TbFaultReportResult">
  30. <include refid="selectTbFaultReportVo"/>
  31. where id = #{id}
  32. </select>
  33. <insert id="insertTbFaultReport" parameterType="TbFaultReport" useGeneratedKeys="true" keyProperty="id">
  34. insert into tb_fault_report
  35. <trim prefix="(" suffix=")" suffixOverrides=",">
  36. <if test="assetBarCode != null and assetBarCode != ''">asset_bar_code,</if>
  37. <if test="userId != null">user_id,</if>
  38. <if test="reportDate != null">report_date,</if>
  39. <if test="faultPhenomenon != null and faultPhenomenon != ''">fault_phenomenon,</if>
  40. <if test="tel != null and tel != ''">tel,</if>
  41. <if test="processState != null">process_state,</if>
  42. <if test="processResult != null">process_result,</if>
  43. </trim>
  44. <trim prefix="values (" suffix=")" suffixOverrides=",">
  45. <if test="assetBarCode != null and assetBarCode != ''">#{assetBarCode},</if>
  46. <if test="userId != null">#{userId},</if>
  47. <if test="reportDate != null">#{reportDate},</if>
  48. <if test="faultPhenomenon != null and faultPhenomenon != ''">#{faultPhenomenon},</if>
  49. <if test="tel != null and tel != ''">#{tel},</if>
  50. <if test="processState != null">#{processState},</if>
  51. <if test="processResult != null">#{processResult},</if>
  52. </trim>
  53. </insert>
  54. <update id="updateTbFaultReport" parameterType="TbFaultReport">
  55. update tb_fault_report
  56. <trim prefix="SET" suffixOverrides=",">
  57. <if test="assetBarCode != null and assetBarCode != ''">asset_bar_code = #{assetBarCode},</if>
  58. <if test="userId != null">user_id = #{userId},</if>
  59. <if test="reportDate != null">report_date = #{reportDate},</if>
  60. <if test="faultPhenomenon != null and faultPhenomenon != ''">fault_phenomenon = #{faultPhenomenon},</if>
  61. <if test="tel != null and tel != ''">tel = #{tel},</if>
  62. <if test="processState != null">process_state = #{processState},</if>
  63. <if test="processResult != null">process_result = #{processResult},</if>
  64. </trim>
  65. where id = #{id}
  66. </update>
  67. <delete id="deleteTbFaultReportById" parameterType="Long">
  68. delete from tb_fault_report where id = #{id}
  69. </delete>
  70. <delete id="deleteTbFaultReportByIds" parameterType="String">
  71. delete from tb_fault_report where id in
  72. <foreach item="id" collection="array" open="(" separator="," close=")">
  73. #{id}
  74. </foreach>
  75. </delete>
  76. </mapper>