PdmParMapper.xml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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.powerdistribution.mapper.PdmParMapper">
  6. <resultMap type="PdmPar" id="PdmParResult">
  7. <result property="id" column="id" />
  8. <result property="parCode" column="par_code" />
  9. <result property="parName" column="par_name" />
  10. <result property="parValue" column="par_value" />
  11. <result property="parUnit" column="par_unit" />
  12. <result property="parUnitCn" column="par_unit_cn" />
  13. <result property="parType" column="par_Type" />
  14. <result property="parField" column="par_field" />
  15. <result property="status" column="status" />
  16. <result property="remark" column="remark" />
  17. <result property="createBy" column="create_by" />
  18. <result property="createTime" column="create_time" />
  19. <result property="updateBy" column="update_by" />
  20. <result property="updateTime" column="update_time" />
  21. </resultMap>
  22. <sql id="selectPdmParVo">
  23. select id, par_code, par_name, par_value, par_unit,par_Type,par_field,p.status, p.remark, p.create_by, p.create_time, p.update_by, p.update_time from pdm_par p
  24. </sql>
  25. <sql id="selectPdmParVo2">
  26. select id, par_code, par_name, par_value, par_unit, dict_label par_unit_cn,par_Type,par_field,p.status, p.remark, p.create_by, p.create_time, p.update_by, p.update_time from pdm_par p
  27. </sql>
  28. <select id="selectPdmParList" parameterType="PdmPar" resultMap="PdmParResult">
  29. <include refid="selectPdmParVo2"/> LEFT JOIN sys_dict_data on dict_value=par_unit and dict_type in('pdm_maintenance_time','repeat_power_failure')
  30. <where>
  31. <if test="parCode != null and parCode != ''"> and par_code = #{parCode}</if>
  32. <if test="parName != null and parName != ''"> and par_name like concat('%', #{parName}, '%')</if>
  33. <if test="parValue != null and parValue != ''"> and par_value = #{parValue}</if>
  34. <if test="parUnit != null and parUnit != ''"> and par_unit = #{parUnit}</if>
  35. <if test="parType != null and parType != ''"> and par_type = #{parType}</if>
  36. </where>
  37. </select>
  38. <select id="selectPdmParById" parameterType="Long" resultMap="PdmParResult">
  39. <include refid="selectPdmParVo"/>
  40. where id = #{id}
  41. </select>
  42. <insert id="insertPdmPar" parameterType="PdmPar" useGeneratedKeys="true" keyProperty="id">
  43. insert into pdm_par
  44. <trim prefix="(" suffix=")" suffixOverrides=",">
  45. <if test="parCode != null">par_code,</if>
  46. <if test="parName != null">par_name,</if>
  47. <if test="parValue != null">par_value,</if>
  48. <if test="parUnit != null">par_unit,</if>
  49. <if test="parType != null">par_type,</if>
  50. <if test="parField != null">par_field,</if>
  51. <if test="status != null">status,</if>
  52. <if test="remark != null">remark,</if>
  53. <if test="createBy != null">create_by,</if>
  54. <if test="createTime != null">create_time,</if>
  55. <if test="updateBy != null">update_by,</if>
  56. <if test="updateTime != null">update_time,</if>
  57. </trim>
  58. <trim prefix="values (" suffix=")" suffixOverrides=",">
  59. <if test="parCode != null">#{parCode},</if>
  60. <if test="parName != null">#{parName},</if>
  61. <if test="parValue != null">#{parValue},</if>
  62. <if test="parUnit != null">#{parUnit},</if>
  63. <if test="parType != null">#{parType},</if>
  64. <if test="parField != null">#{parField},</if>
  65. <if test="status != null">#{status},</if>
  66. <if test="remark != null">#{remark},</if>
  67. <if test="createBy != null">#{createBy},</if>
  68. <if test="createTime != null">#{createTime},</if>
  69. <if test="updateBy != null">#{updateBy},</if>
  70. <if test="updateTime != null">#{updateTime},</if>
  71. </trim>
  72. </insert>
  73. <update id="updatePdmPar" parameterType="PdmPar">
  74. update pdm_par
  75. <trim prefix="SET" suffixOverrides=",">
  76. <if test="parCode != null">par_code = #{parCode},</if>
  77. <if test="parName != null">par_name = #{parName},</if>
  78. <if test="parValue != null">par_value = #{parValue},</if>
  79. <if test="parUnit != null">par_unit = #{parUnit},</if>
  80. <if test="parType != null">par_type = #{parType},</if>
  81. <if test="parField != null">par_field=#{parField},</if>
  82. <if test="status != null">status = #{status},</if>
  83. <if test="remark != null">remark = #{remark},</if>
  84. <if test="createBy != null">create_by = #{createBy},</if>
  85. <if test="createTime != null">create_time = #{createTime},</if>
  86. <if test="updateBy != null">update_by = #{updateBy},</if>
  87. <if test="updateTime != null">update_time = #{updateTime},</if>
  88. </trim>
  89. where id = #{id}
  90. </update>
  91. <delete id="deletePdmParById" parameterType="Long">
  92. delete from pdm_par where id = #{id}
  93. </delete>
  94. <delete id="deletePdmParByIds" parameterType="String">
  95. delete from pdm_par where id in
  96. <foreach item="id" collection="array" open="(" separator="," close=")">
  97. #{id}
  98. </foreach>
  99. </delete>
  100. </mapper>