| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- <?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="cn.hobbystocks.auc.mapper.SpuCategoryMapper">
- <resultMap type="cn.hobbystocks.auc.domain.SpuCategory" id="BaseResultMap">
- <id property="id" column="id" />
- <result property="categoryName" column="category_name" />
- <result property="isCascade" column="is_cascade" />
- <result property="subLabel" column="sub_label" />
- <result property="sort" column="sort" />
- <result property="parentId" column="parent_id" />
- <result property="iconUrl" column="icon_url" />
- <result property="status" column="status" />
- <result property="createTime" column="create_time" />
- <result property="updateTime" column="update_time" />
- </resultMap>
- <sql id="baseColumnList">
- select id,category_name,is_cascade, sub_label,sort,parent_id,icon_url,status,create_time,update_time from spu_category
- </sql>
- <select id="querySpuCategory" resultMap="BaseResultMap">
- <include refid="baseColumnList"/>
- </select>
- <select id="getSpuSubCategory" resultMap="BaseResultMap">
- <include refid="baseColumnList"/>
- <where>
- parent_id=#{id}
- </where>
- </select>
- <select id="selectAllMainCategory" resultMap="BaseResultMap">
- <include refid="baseColumnList"/>
- <where>
- AND parent_id = 0
- AND status = 1
- AND del_flag = 0
- </where>
- </select>
- <select id="listChildByParentId" resultType="java.lang.Long">
- SELECT id FROM lot_category
- WHERE parent_id = #{mainCategoryId}
- AND del_flag = 0
- AND status = 1
- </select>
- <select id="selectChildCategoryByParentIds" resultType="cn.hobbystocks.auc.domain.SpuCategory">
- <include refid="baseColumnList"/>
- <where>
- AND status = 1
- AND del_flag = 0
- AND parent_id IN
- <foreach collection="list" item="parentId" open="(" separator="," close=")">
- #{parentId}
- </foreach>
- </where>
- </select>
- <select id="listLotIdsByCategoryIds" resultType="java.lang.Long">
- SELECT DISTINCT lot_id
- FROM lot_category_relation
- <where>
- category_id IN
- <foreach collection="categoryIds" item="categoryId" open="(" separator="," close=")">
- #{categoryId}
- </foreach>
- AND del_flag = 0
- </where>
- </select>
- <insert id="createCategory" parameterType="cn.hobbystocks.auc.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>
|