|
|
@@ -3,9 +3,42 @@
|
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
"https://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.poyee.mapper.SpuMapper">
|
|
|
+
|
|
|
+ <resultMap id="spuMap" type="com.poyee.dto.SpuDTO">
|
|
|
+ <id column="id" property="id"/>
|
|
|
+ <result column="category" property="category"/>
|
|
|
+ <result column="sub_category" property="subCategory"/>
|
|
|
+ <result column="spu_name" property="spuName"/>
|
|
|
+ <result column="num" property="num"/>
|
|
|
+ <result column="main_image" property="mainImage" />
|
|
|
+ <result column="carousel_image" property="carouselImage"/>
|
|
|
+ <result column="status" property="status" />
|
|
|
+ <result column="create_time" property="createTime"/>
|
|
|
+ <result column="create_by" property="createBy"/>
|
|
|
+ <result column="properties" property="properties" jdbcType="OTHER" typeHandler="com.poyee.mapper.handler.JsonNodeTypeHandler"/>
|
|
|
+ <result column="update_time" property="updateTime"/>
|
|
|
+ <result column="update_by" property="updateBy"/>
|
|
|
+ </resultMap>
|
|
|
+ <select id="selectList" parameterType="com.poyee.domain.Spu" resultMap="spuMap">
|
|
|
+ select id,category,sub_category,spu_name,num,main_image,carousel_image,status,create_time,create_by,properties from spu
|
|
|
+ <where>
|
|
|
+ <if test="spu.name!=null and spu.name!=''">
|
|
|
+ name like concat('%'+#{spu.name}+'%')
|
|
|
+ </if>
|
|
|
+ <if test="spu.status!=null">
|
|
|
+ status=#{spu.status}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+ <insert id="insertSpu" parameterType="com.poyee.dto.SpuDTO">
|
|
|
+ insert into spu (category,sub_category,spu_name,num,main_image,carousel_image,status,create_time,create_by,properties)
|
|
|
+ values (#{category},#{subCategory},#{spuName},#{num},#{mainImage},#{carouselImage},#{status},#{createTime},#{createBy},
|
|
|
+ #{properties,jdbcType=OTHER,typeHandler=com.poyee.mapper.handler.JsonNodeTypeHandler}::json)
|
|
|
+ </insert>
|
|
|
+
|
|
|
<update id="editSpu" parameterType="com.poyee.dto.SpuDTO">
|
|
|
update spu
|
|
|
- <trim prefix="set " suffixOverrides=",">
|
|
|
+ <trim prefix="set" suffixOverrides=",">
|
|
|
<if test="category!=null and category!=''">category=#{category},</if>
|
|
|
<if test="spuName!=null and spuName!=''">spu_name=#{spuName},</if>
|
|
|
<if test="num!=null">num=#{num},</if>
|
|
|
@@ -15,6 +48,7 @@
|
|
|
<if test="updateBy!=null and updateBy!=''">update_by=#{updateBy},</if>
|
|
|
<if test="createBy!=null and createBy!=''">create_by=#{createBy},</if>
|
|
|
<if test="updateTime!=null">update_time=#{updateTime},</if>
|
|
|
+ <if test="properties!=null">properties=#{porperties,jdbcType=OTHER,typeHandler=com.poyee.mapper.handler.JsonNodeTypeHandler}::json</if>
|
|
|
</trim>
|
|
|
</update>
|
|
|
</mapper>
|