| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "https://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.poyee.mapper.SpuCategoryMapper">
- <sql id="spuCategoryQuery">
- select id,category_name categoryName,is_cascade isCascade, sub_label subLabel,sort,parent_id parentId,icon_url iconUrl,status,create_time createTime,update_time updateTime from spu_category
- </sql>
- <select id="querySpuCategory" resultType="spuCategoryDto">
- <include refid="spuCategoryQuery"></include>
- </select>
- <select id="getSpuSubCategory" resultType="spuCategoryDto">
- <include refid="spuCategoryQuery"></include>
- <where>
- parent_id=#{id}
- </where>
- </select>
- <insert id="createCategory" parameterType="com.poyee.domain.SpuCategory">
- insert into spu_category (category_name,is_cascade,sub_label,sort,parent_id,icon_url,status,create_time,update_time)
- values (#{categoryName},#{isCascade},#{subLabel},#{sort},#{parentId},#{iconUrl},#{status},#{createTime},#{updateTime})
- </insert>
- <update id="updateCategory">
- update spu_category
- <trim prefix="set" suffixOverrides=",">
- <if test="categoryName!=null and categoryName!=''">
- category_name=#{categoryName},
- </if>
- <if test="isCascade!=null">
- is_cascade=#{isCascade},
- </if>
- <if test="subLabel!=null and subLabel!=''">
- sub_label=#{subLabel},
- </if>
- <if test="sort!=null">
- sort=#{sort},
- </if>
- <if test="parentId!=null">
- parent_id=#{parentId},
- </if>
- <if test="iconUrl!=null and iconUrl!=''">
- icon_url=#{iconUrl},
- </if>
- <if test="status!=null">
- status=#{status},
- </if>
- <if test="updateTime!=null">
- update_time=#{updateTime},
- </if>
- </trim>
- where id=#{id}
- </update>
- </mapper>
|