| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- <?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.system.mapper.ProductMapper">
-
- <resultMap type="Product" id="ProductResult">
- <id property="id" column="id"/>
- <result property="productId" column="product_id"/>
- <result property="deviceType" column="device_type"/>
- <result property="productTypeId" column="product_type_id"/>
- <result property="picture" column="picture"/>
- <result property="document" column="document"/>
- <result property="describe" column="describe"/>
- <result property="type" column="type"/>
- <result property="createBy" column="create_by"/>
- <result property="createTime" column="create_time"/>
- <result property="updateBy" column="update_by"/>
- <result property="updateTime" column="update_time"/>
- </resultMap>
-
- <sql id="selectProductVo">
- select id, product_id,device_type,product_type_id, picture, document, `describe`, type, create_by, create_time, update_by, update_time
- from product
- </sql>
-
- <select id="selectProductList" parameterType="Product" resultMap="ProductResult">
- <include refid="selectProductVo"/>
- <where>
- <if test="productId != null and productId != ''">
- AND product_id = #{productId}
- </if>
- <if test="deviceType != null and deviceType != ''">
- AND deviceType = #{device_type}
- </if>
- <if test="productTypeId != null">
- AND product_type_id = #{productTypeId}
- </if>
- <if test="type != null">
- AND type = #{type}
- </if>
- <if test="params.beginTime != null and params.beginTime != ''">
- and date_format(create_time,'%Y%m%d') >= date_format(#{params.beginTime},'%Y%m%d')
- </if>
- <if test="params.endTime != null and params.endTime != ''">
- and date_format(create_time,'%Y%m%d') <= date_format(#{params.endTime},'%Y%m%d')
- </if>
- </where>
- </select>
-
- <select id="selectProductById" parameterType="String" resultMap="ProductResult">
- <include refid="selectProductVo"/>
- where product_id = #{productId}
- </select>
- <select id="selectProductId" parameterType="Long" resultMap="ProductResult">
- <include refid="selectProductVo"/>
- where id = #{id}
- </select>
- <insert id="insertProduct" parameterType="Product">
- insert into product (
- <if test="productId != null and productId != ''">product_id,</if>
- <if test="deviceType != null and deviceType != ''">device_type,</if>
- <if test="productTypeId != null">product_type_id,</if>
- <if test="picture != null and picture != ''">picture,</if>
- <if test="document != null and document != ''">document,</if>
- <if test="describe != null and describe != ''">`describe`,</if>
- <if test="type != null">type,</if>
- <if test="createBy != null">create_by,</if>
- create_time
- )values(
- <if test="productId != null and productId != ''">#{productId},</if>
- <if test="deviceType != null and deviceType != ''">#{deviceType},</if>
- <if test="productTypeId != null">#{productTypeId},</if>
- <if test="picture != null and picture != ''">#{picture},</if>
- <if test="document != null and document != ''">#{document},</if>
- <if test="describe != null and describe != ''">#{describe},</if>
- <if test="type != null">#{type},</if>
- <if test="createBy != null">#{createBy},</if>
- sysdate()
- )
- </insert>
-
- <update id="updateProduct" parameterType="Product">
- update product
- <set>
- <if test="productId != null and productId != ''">product_id = #{productId},</if>
- <if test="deviceType != null and deviceType != ''">device_type = #{deviceType},</if>
- <if test="productTypeId != null">product_type_id = #{productTypeId},</if>
- <if test="picture != null and picture != ''">picture = #{picture},</if>
- <if test="document != null and document != ''">document = #{document},</if>
- <if test="describe != null and describe != ''">`describe` = #{describe},</if>
- <if test="type != null">type = #{type},</if>
- <if test="updateBy != null">update_by = #{updateBy},</if>
- update_time = sysdate()
- </set>
- where id = #{id}
- </update>
-
- <delete id="deleteProductById" parameterType="String">
- delete from product where product_id = #{productId}
- </delete>
-
- <delete id="deleteProductByIds" parameterType="Long">
- delete from product where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
-
-
-
- </mapper>
|