123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.ruoyi.oa.mapper.CmcMaterialMapper">
-
- <resultMap type="CmcMaterial" id="CmcMaterialResult">
- <result property="materialId" column="material_id" />
- <result property="name" column="name" />
- <result property="type" column="type" />
- <result property="series" column="series" />
- <result property="brand" column="brand" />
- <result property="place" column="place" />
- <result property="remain" column="remain" />
- <result property="unit" column="unit" />
- <result property="remark" column="remark" />
- </resultMap>
-
- <sql id="selectCmcMaterialVo">
- select material_id, name, type, series, brand, place, remain, unit, remark from cmc_material
- </sql>
-
- <select id="selectCmcMaterialList" parameterType="CmcMaterial" resultMap="CmcMaterialResult">
- <include refid="selectCmcMaterialVo"/>
- <where>
- <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
- <if test="type != null and type != ''"> and type = #{type}</if>
- <if test="series != null and series != ''"> and series = #{series}</if>
- <if test="brand != null and brand != ''"> and brand = #{brand}</if>
- <if test="place != null and place != ''"> and place = #{place}</if>
- <if test="remain != null "> and remain = #{remain}</if>
- <if test="unit != null and unit != ''"> and unit = #{unit}</if>
- </where>
- </select>
-
- <select id="selectCmcMaterialByMaterialId" parameterType="Integer" resultMap="CmcMaterialResult">
- <include refid="selectCmcMaterialVo"/>
- where material_id = #{materialId}
- </select>
-
- <insert id="insertCmcMaterial" parameterType="CmcMaterial" useGeneratedKeys="true" keyProperty="materialId">
- insert into cmc_material
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="name != null">name,</if>
- <if test="type != null">type,</if>
- <if test="series != null">series,</if>
- <if test="brand != null">brand,</if>
- <if test="place != null">place,</if>
- <if test="remain != null">remain,</if>
- <if test="unit != null">unit,</if>
- <if test="remark != null">remark,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="name != null">#{name},</if>
- <if test="type != null">#{type},</if>
- <if test="series != null">#{series},</if>
- <if test="brand != null">#{brand},</if>
- <if test="place != null">#{place},</if>
- <if test="remain != null">#{remain},</if>
- <if test="unit != null">#{unit},</if>
- <if test="remark != null">#{remark},</if>
- </trim>
- </insert>
-
- <update id="updateCmcMaterial" parameterType="CmcMaterial">
- update cmc_material
- <trim prefix="SET" suffixOverrides=",">
- <if test="name != null">name = #{name},</if>
- <if test="type != null">type = #{type},</if>
- <if test="series != null">series = #{series},</if>
- <if test="brand != null">brand = #{brand},</if>
- <if test="place != null">place = #{place},</if>
- <if test="remain != null">remain = #{remain},</if>
- <if test="unit != null">unit = #{unit},</if>
- <if test="remark != null">remark = #{remark},</if>
- </trim>
- where material_id = #{materialId}
- </update>
-
- <delete id="deleteCmcMaterialByMaterialId" parameterType="Integer">
- delete from cmc_material where material_id = #{materialId}
- </delete>
-
- <delete id="deleteCmcMaterialByMaterialIds" parameterType="String">
- delete from cmc_material where material_id in
- <foreach item="materialId" collection="array" open="(" separator="," close=")">
- #{materialId}
- </foreach>
- </delete>
- </mapper>
|