<?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.ltkj.mall.mapper.MallCategoryMapper">
|
|
<resultMap type="MallCategory" id="MallCategoryResult">
|
<result property="id" column="id"/>
|
<result property="name" column="name"/>
|
<result property="keywords" column="keywords"/>
|
<result property="description" column="description"/>
|
<result property="parentId" column="parent_id"/>
|
<result property="iconUrl" column="icon_url"/>
|
<result property="picUrl" column="pic_url"/>
|
<result property="level" column="level"/>
|
<result property="sortOrder" column="sort_order"/>
|
<result property="deptId" column="dept_id"/>
|
<result property="createTime" column="create_time"/>
|
<result property="createBy" column="create_by"/>
|
<result property="updateTime" column="update_time"/>
|
<result property="updateBy" column="update_by"/>
|
<result property="deleted" column="deleted"/>
|
</resultMap>
|
|
<sql id="selectMallCategoryVo">
|
select id, name, keywords, description, parent_id, icon_url, pic_url, level, sort_order, dept_id, create_time, create_by, update_time, update_by, deleted
|
from mall_category
|
</sql>
|
|
<select id="selectMallCategoryList" parameterType="MallCategory" resultMap="MallCategoryResult">
|
<include refid="selectMallCategoryVo"/>
|
<where>
|
<if test="name != null and name != ''">
|
and name like concat('%', #{name}, '%')
|
</if>
|
<if test="keywords != null and keywords != ''">
|
and keywords = #{keywords}
|
</if>
|
<if test="description != null and description != ''">
|
and description = #{description}
|
</if>
|
<if test="parentId != null ">
|
and parent_id = #{parentId}
|
</if>
|
<if test="iconUrl != null and iconUrl != ''">
|
and icon_url = #{iconUrl}
|
</if>
|
<if test="picUrl != null and picUrl != ''">
|
and pic_url = #{picUrl}
|
</if>
|
<if test="level != null and level != ''">
|
and level = #{level}
|
</if>
|
<if test="sortOrder != null ">
|
and sort_order = #{sortOrder}
|
</if>
|
<if test="deptId != null ">
|
and dept_id = #{deptId}
|
</if>
|
|
<if test="startTime != null and endTime !=null ">
|
create_time between #{startTime} and #{endTime}
|
</if>
|
</where>
|
</select>
|
|
<select id="selectMallCategoryById" parameterType="Long"
|
resultMap="MallCategoryResult">
|
<include refid="selectMallCategoryVo"/>
|
where id = #{id}
|
</select>
|
|
<insert id="insertMallCategory" parameterType="MallCategory" useGeneratedKeys="true"
|
keyProperty="id">
|
insert into mall_category
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="name != null">name,
|
</if>
|
<if test="keywords != null">keywords,
|
</if>
|
<if test="description != null">description,
|
</if>
|
<if test="parentId != null">parent_id,
|
</if>
|
<if test="iconUrl != null">icon_url,
|
</if>
|
<if test="picUrl != null">pic_url,
|
</if>
|
<if test="level != null">level,
|
</if>
|
<if test="sortOrder != null">sort_order,
|
</if>
|
<if test="deptId != null">dept_id,
|
</if>
|
<if test="createTime != null">create_time,
|
</if>
|
<if test="createBy != null">create_by,
|
</if>
|
<if test="updateTime != null">update_time,
|
</if>
|
<if test="updateBy != null">update_by,
|
</if>
|
<if test="deleted != null">deleted,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="name != null">#{name},
|
</if>
|
<if test="keywords != null">#{keywords},
|
</if>
|
<if test="description != null">#{description},
|
</if>
|
<if test="parentId != null">#{parentId},
|
</if>
|
<if test="iconUrl != null">#{iconUrl},
|
</if>
|
<if test="picUrl != null">#{picUrl},
|
</if>
|
<if test="level != null">#{level},
|
</if>
|
<if test="sortOrder != null">#{sortOrder},
|
</if>
|
<if test="deptId != null">#{deptId},
|
</if>
|
<if test="createTime != null">#{createTime},
|
</if>
|
<if test="createBy != null">#{createBy},
|
</if>
|
<if test="updateTime != null">#{updateTime},
|
</if>
|
<if test="updateBy != null">#{updateBy},
|
</if>
|
<if test="deleted != null">#{deleted},
|
</if>
|
</trim>
|
</insert>
|
|
<update id="updateMallCategory" parameterType="MallCategory">
|
update mall_category
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="name != null">name =
|
#{name},
|
</if>
|
<if test="keywords != null">keywords =
|
#{keywords},
|
</if>
|
<if test="description != null">description =
|
#{description},
|
</if>
|
<if test="parentId != null">parent_id =
|
#{parentId},
|
</if>
|
<if test="iconUrl != null">icon_url =
|
#{iconUrl},
|
</if>
|
<if test="picUrl != null">pic_url =
|
#{picUrl},
|
</if>
|
<if test="level != null">level =
|
#{level},
|
</if>
|
<if test="sortOrder != null">sort_order =
|
#{sortOrder},
|
</if>
|
<if test="deptId != null">dept_id =
|
#{deptId},
|
</if>
|
<if test="createTime != null">create_time =
|
#{createTime},
|
</if>
|
<if test="createBy != null">create_by =
|
#{createBy},
|
</if>
|
<if test="updateTime != null">update_time =
|
#{updateTime},
|
</if>
|
<if test="updateBy != null">update_by =
|
#{updateBy},
|
</if>
|
<if test="deleted != null">deleted =
|
#{deleted},
|
</if>
|
</trim>
|
where id = #{id}
|
</update>
|
|
<delete id="deleteMallCategoryById" parameterType="Long">
|
delete
|
from mall_category where id = #{id}
|
</delete>
|
|
<delete id="deleteMallCategoryByIds" parameterType="String">
|
delete from mall_category where id in
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</delete>
|
</mapper>
|