综合办公系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CmcMaterialMapper.xml 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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.oa.mapper.CmcMaterialMapper">
  6. <resultMap type="CmcMaterial" id="CmcMaterialResult">
  7. <result property="materialId" column="material_id" />
  8. <result property="name" column="name" />
  9. <result property="type" column="type" />
  10. <result property="series" column="series" />
  11. <result property="brand" column="brand" />
  12. <result property="place" column="place" />
  13. <result property="remain" column="remain" />
  14. <result property="unit" column="unit" />
  15. <result property="remark" column="remark" />
  16. </resultMap>
  17. <sql id="selectCmcMaterialVo">
  18. select material_id, name, type, series, brand, place, remain, unit, remark from cmc_material
  19. </sql>
  20. <select id="selectCmcMaterialList" parameterType="CmcMaterial" resultMap="CmcMaterialResult">
  21. <include refid="selectCmcMaterialVo"/>
  22. <where>
  23. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  24. <if test="type != null and type != ''"> and type = #{type}</if>
  25. <if test="series != null and series != ''"> and series = #{series}</if>
  26. <if test="brand != null and brand != ''"> and brand = #{brand}</if>
  27. <if test="place != null and place != ''"> and place = #{place}</if>
  28. <if test="remain != null "> and remain = #{remain}</if>
  29. <if test="unit != null and unit != ''"> and unit = #{unit}</if>
  30. </where>
  31. </select>
  32. <select id="selectCmcMaterialByMaterialId" parameterType="Integer" resultMap="CmcMaterialResult">
  33. <include refid="selectCmcMaterialVo"/>
  34. where material_id = #{materialId}
  35. </select>
  36. <insert id="insertCmcMaterial" parameterType="CmcMaterial" useGeneratedKeys="true" keyProperty="materialId">
  37. insert into cmc_material
  38. <trim prefix="(" suffix=")" suffixOverrides=",">
  39. <if test="name != null">name,</if>
  40. <if test="type != null">type,</if>
  41. <if test="series != null">series,</if>
  42. <if test="brand != null">brand,</if>
  43. <if test="place != null">place,</if>
  44. <if test="remain != null">remain,</if>
  45. <if test="unit != null">unit,</if>
  46. <if test="remark != null">remark,</if>
  47. </trim>
  48. <trim prefix="values (" suffix=")" suffixOverrides=",">
  49. <if test="name != null">#{name},</if>
  50. <if test="type != null">#{type},</if>
  51. <if test="series != null">#{series},</if>
  52. <if test="brand != null">#{brand},</if>
  53. <if test="place != null">#{place},</if>
  54. <if test="remain != null">#{remain},</if>
  55. <if test="unit != null">#{unit},</if>
  56. <if test="remark != null">#{remark},</if>
  57. </trim>
  58. </insert>
  59. <update id="updateCmcMaterial" parameterType="CmcMaterial">
  60. update cmc_material
  61. <trim prefix="SET" suffixOverrides=",">
  62. <if test="name != null">name = #{name},</if>
  63. <if test="type != null">type = #{type},</if>
  64. <if test="series != null">series = #{series},</if>
  65. <if test="brand != null">brand = #{brand},</if>
  66. <if test="place != null">place = #{place},</if>
  67. <if test="remain != null">remain = #{remain},</if>
  68. <if test="unit != null">unit = #{unit},</if>
  69. <if test="remark != null">remark = #{remark},</if>
  70. </trim>
  71. where material_id = #{materialId}
  72. </update>
  73. <delete id="deleteCmcMaterialByMaterialId" parameterType="Integer">
  74. delete from cmc_material where material_id = #{materialId}
  75. </delete>
  76. <delete id="deleteCmcMaterialByMaterialIds" parameterType="String">
  77. delete from cmc_material where material_id in
  78. <foreach item="materialId" collection="array" open="(" separator="," close=")">
  79. #{materialId}
  80. </foreach>
  81. </delete>
  82. </mapper>