|
@@ -0,0 +1,151 @@
|
|
|
|
|
+<?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.base.mapper.ProductInfoMapper">
|
|
|
|
|
+
|
|
|
|
|
+ <resultMap type="ProductInfo" id="ProductInfoResult">
|
|
|
|
|
+ <result property="id" column="id" />
|
|
|
|
|
+ <result property="userId" column="user_id" />
|
|
|
|
|
+ <result property="categoryId" column="category_id" />
|
|
|
|
|
+ <result property="type" column="type" />
|
|
|
|
|
+ <result property="title" column="title" />
|
|
|
|
|
+ <result property="description" column="description" />
|
|
|
|
|
+ <result property="price" column="price" />
|
|
|
|
|
+ <result property="quantity" column="quantity" />
|
|
|
|
|
+ <result property="unit" column="unit" />
|
|
|
|
|
+ <result property="location" column="location" />
|
|
|
|
|
+ <result property="imageUrl" column="image_url" />
|
|
|
|
|
+ <result property="status" column="status" />
|
|
|
|
|
+ <result property="contactId" column="contact_id" />
|
|
|
|
|
+ <result property="contactName" column="contact_name" />
|
|
|
|
|
+ <result property="contactPhone" column="contact_phone" />
|
|
|
|
|
+ <result property="cityInfo" column="city_info" />
|
|
|
|
|
+ <result property="publishTime" column="publish_time" />
|
|
|
|
|
+ <result property="createBy" column="create_by" />
|
|
|
|
|
+ <result property="createTime" column="create_time" />
|
|
|
|
|
+ <result property="updateBy" column="update_by" />
|
|
|
|
|
+ <result property="updateTime" column="update_time" />
|
|
|
|
|
+ <result property="remark" column="remark" />
|
|
|
|
|
+ </resultMap>
|
|
|
|
|
+
|
|
|
|
|
+ <sql id="selectProductInfoVo">
|
|
|
|
|
+ select id, user_id, category_id, type, title, description, price, quantity, unit, location, image_url, status, contact_id, contact_name, contact_phone, city_info, publish_time, create_by, create_time, update_by, update_time,remark from product_info
|
|
|
|
|
+ </sql>
|
|
|
|
|
+
|
|
|
|
|
+ <select id="selectProductInfoList" parameterType="ProductInfo" resultMap="ProductInfoResult">
|
|
|
|
|
+ <include refid="selectProductInfoVo"/>
|
|
|
|
|
+ <where>
|
|
|
|
|
+ <if test="userId != null and userId != ''"> and user_id = #{userId}</if>
|
|
|
|
|
+ <if test="categoryId != null and categoryId != ''"> and category_id = #{categoryId}</if>
|
|
|
|
|
+ <if test="type != null "> and type = #{type}</if>
|
|
|
|
|
+ <if test="title != null and title != ''"> and title = #{title}</if>
|
|
|
|
|
+ <if test="description != null and description != ''"> and description = #{description}</if>
|
|
|
|
|
+ <if test="price != null and price != ''"> and price = #{price}</if>
|
|
|
|
|
+ <if test="quantity != null "> and quantity = #{quantity}</if>
|
|
|
|
|
+ <if test="unit != null "> and unit = #{unit}</if>
|
|
|
|
|
+ <if test="location != null and location != ''"> and location = #{location}</if>
|
|
|
|
|
+ <if test="imageUrl != null and imageUrl != ''"> and image_url = #{imageUrl}</if>
|
|
|
|
|
+ <if test="status != null "> and status = #{status}</if>
|
|
|
|
|
+ <if test="contactId != null and contactId != ''"> and contact_id = #{contactId}</if>
|
|
|
|
|
+ <if test="contactName != null and contactName != ''"> and contact_name like concat('%', #{contactName}, '%')</if>
|
|
|
|
|
+ <if test="contactPhone != null and contactPhone != ''"> and contact_phone = #{contactPhone}</if>
|
|
|
|
|
+ <if test="cityInfo != null and cityInfo != ''"> and city_info = #{cityInfo}</if>
|
|
|
|
|
+ <if test="publishTime != null "> and publish_time = #{publishTime}</if>
|
|
|
|
|
+ </where>
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <select id="selectProductInfoById" parameterType="String" resultMap="ProductInfoResult">
|
|
|
|
|
+ <include refid="selectProductInfoVo"/>
|
|
|
|
|
+ where id = #{id}
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <insert id="insertProductInfo" parameterType="ProductInfo" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
|
+ insert into product_info
|
|
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
+ <if test="userId != null and userId != ''">user_id,</if>
|
|
|
|
|
+ <if test="categoryId != null and categoryId != ''">category_id,</if>
|
|
|
|
|
+ <if test="type != null">type,</if>
|
|
|
|
|
+ <if test="title != null and title != ''">title,</if>
|
|
|
|
|
+ <if test="description != null">description,</if>
|
|
|
|
|
+ <if test="price != null and price != ''">price,</if>
|
|
|
|
|
+ <if test="quantity != null">quantity,</if>
|
|
|
|
|
+ <if test="unit != null">unit,</if>
|
|
|
|
|
+ <if test="location != null">location,</if>
|
|
|
|
|
+ <if test="imageUrl != null and imageUrl != ''">image_url,</if>
|
|
|
|
|
+ <if test="status != null">status,</if>
|
|
|
|
|
+ <if test="contactId != null and contactId != ''">contact_id,</if>
|
|
|
|
|
+ <if test="contactName != null and contactName != ''">contact_name,</if>
|
|
|
|
|
+ <if test="contactPhone != null and contactPhone != ''">contact_phone,</if>
|
|
|
|
|
+ <if test="cityInfo != null">city_info,</if>
|
|
|
|
|
+ <if test="publishTime != null">publish_time,</if>
|
|
|
|
|
+ <if test="createBy != null">create_by,</if>
|
|
|
|
|
+ <if test="createTime != null">create_time,</if>
|
|
|
|
|
+ <if test="updateBy != null">update_by,</if>
|
|
|
|
|
+ <if test="updateTime != null">update_time,</if>
|
|
|
|
|
+ <if test="remark != null">remark,</if>
|
|
|
|
|
+ </trim>
|
|
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
+ <if test="userId != null and userId != ''">#{userId},</if>
|
|
|
|
|
+ <if test="categoryId != null and categoryId != ''">#{categoryId},</if>
|
|
|
|
|
+ <if test="type != null">#{type},</if>
|
|
|
|
|
+ <if test="title != null and title != ''">#{title},</if>
|
|
|
|
|
+ <if test="description != null">#{description},</if>
|
|
|
|
|
+ <if test="price != null and price != ''">#{price},</if>
|
|
|
|
|
+ <if test="quantity != null">#{quantity},</if>
|
|
|
|
|
+ <if test="unit != null">#{unit},</if>
|
|
|
|
|
+ <if test="location != null">#{location},</if>
|
|
|
|
|
+ <if test="imageUrl != null and imageUrl != ''">#{imageUrl},</if>
|
|
|
|
|
+ <if test="status != null">#{status},</if>
|
|
|
|
|
+ <if test="contactId != null and contactId != ''">#{contactId},</if>
|
|
|
|
|
+ <if test="contactName != null and contactName != ''">#{contactName},</if>
|
|
|
|
|
+ <if test="contactPhone != null and contactPhone != ''">#{contactPhone},</if>
|
|
|
|
|
+ <if test="cityInfo != null">#{cityInfo},</if>
|
|
|
|
|
+ <if test="publishTime != null">#{publishTime},</if>
|
|
|
|
|
+ <if test="createBy != null">#{createBy},</if>
|
|
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
|
|
+ <if test="updateBy != null">#{updateBy},</if>
|
|
|
|
|
+ <if test="updateTime != null">#{updateTime},</if>
|
|
|
|
|
+ <if test="remark != null">#{remark},</if>
|
|
|
|
|
+ </trim>
|
|
|
|
|
+ </insert>
|
|
|
|
|
+
|
|
|
|
|
+ <update id="updateProductInfo" parameterType="ProductInfo">
|
|
|
|
|
+ update product_info
|
|
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
+ <if test="userId != null and userId != ''">user_id = #{userId},</if>
|
|
|
|
|
+ <if test="categoryId != null and categoryId != ''">category_id = #{categoryId},</if>
|
|
|
|
|
+ <if test="type != null">type = #{type},</if>
|
|
|
|
|
+ <if test="title != null and title != ''">title = #{title},</if>
|
|
|
|
|
+ <if test="description != null">description = #{description},</if>
|
|
|
|
|
+ <if test="price != null and price != ''">price = #{price},</if>
|
|
|
|
|
+ <if test="quantity != null">quantity = #{quantity},</if>
|
|
|
|
|
+ <if test="unit != null">unit = #{unit},</if>
|
|
|
|
|
+ <if test="location != null">location = #{location},</if>
|
|
|
|
|
+ <if test="imageUrl != null and imageUrl != ''">image_url = #{imageUrl},</if>
|
|
|
|
|
+ <if test="status != null">status = #{status},</if>
|
|
|
|
|
+ <if test="contactId != null and contactId != ''">contact_id = #{contactId},</if>
|
|
|
|
|
+ <if test="contactName != null and contactName != ''">contact_name = #{contactName},</if>
|
|
|
|
|
+ <if test="contactPhone != null and contactPhone != ''">contact_phone = #{contactPhone},</if>
|
|
|
|
|
+ <if test="cityInfo != null">city_info = #{cityInfo},</if>
|
|
|
|
|
+ <if test="publishTime != null">publish_time = #{publishTime},</if>
|
|
|
|
|
+ <if test="createBy != null">create_by = #{createBy},</if>
|
|
|
|
|
+ <if test="createTime != null">create_time = #{createTime},</if>
|
|
|
|
|
+ <if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
|
|
+ <if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
|
|
+ <if test="remark != null">remark = #{remark},</if>
|
|
|
|
|
+ </trim>
|
|
|
|
|
+ where id = #{id}
|
|
|
|
|
+ </update>
|
|
|
|
|
+
|
|
|
|
|
+ <delete id="deleteProductInfoById" parameterType="String">
|
|
|
|
|
+ delete from product_info where id = #{id}
|
|
|
|
|
+ </delete>
|
|
|
|
|
+
|
|
|
|
|
+ <delete id="deleteProductInfoByIds" parameterType="String">
|
|
|
|
|
+ delete from product_info where id in
|
|
|
|
|
+ <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
|
+ #{id}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ </delete>
|
|
|
|
|
+</mapper>
|