123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- <?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.kmall.admin.dao.BrandDao">
- <resultMap type="com.kmall.admin.entity.BrandEntity" id="brandMap">
- <result property="id" column="id"/>
- <result property="name" column="name"/>
- <result property="listPicUrl" column="list_pic_url"/>
- <result property="simpleDesc" column="simple_desc"/>
- <result property="picUrl" column="pic_url"/>
- <result property="sortOrder" column="sort_order"/>
- <result property="isShow" column="is_show"/>
- <result property="floorPrice" column="floor_price"/>
- <result property="appListPicUrl" column="app_list_pic_url"/>
- <result property="isNew" column="is_new"/>
- <result property="newPicUrl" column="new_pic_url"/>
- <result property="newSortOrder" column="new_sort_order"/>
- </resultMap>
- <select id="queryObject" resultType="com.kmall.admin.entity.BrandEntity">
- select
- `id`,
- `name`,
- `list_pic_url`,
- `simple_desc`,
- `pic_url`,
- `sort_order`,
- `is_show`,
- `floor_price`,
- `app_list_pic_url`,
- `is_new`,
- `new_pic_url`,
- `new_sort_order`
- from mall_brand
- where id = #{id}
- </select>
- <select id="queryObjectByName" resultType="com.kmall.admin.entity.BrandEntity">
- select
- `id`,
- `name`,
- `list_pic_url`,
- `simple_desc`,
- `pic_url`,
- `sort_order`,
- `is_show`,
- `floor_price`,
- `app_list_pic_url`,
- `is_new`,
- `new_pic_url`,
- `new_sort_order`
- from mall_brand
- where `name` = #{brandName}
- </select>
- <select id="queryList" resultType="com.kmall.admin.entity.BrandEntity">
- select
- `id`,
- `name`,
- `list_pic_url`,
- `simple_desc`,
- `pic_url`,
- `sort_order`,
- `is_show`,
- `floor_price`,
- `app_list_pic_url`,
- `is_new`,
- `new_pic_url`,
- `new_sort_order`
- from mall_brand
- WHERE 1=1
- <if test="name != null and name.trim() != ''">
- AND name LIKE concat('%',#{name},'%')
- </if>
- <choose>
- <when test="sidx != null and sidx.trim() != ''">
- order by ${sidx} ${order}
- </when>
- <otherwise>
- order by id desc
- </otherwise>
- </choose>
- <if test="offset != null and limit != null">
- limit #{offset}, #{limit}
- </if>
- </select>
- <select id="queryTotal" resultType="int">
- select count(*) from mall_brand
- WHERE 1=1
- <if test="name != null and name.trim() != ''">
- AND name LIKE concat('%',#{name},'%')
- </if>
- </select>
- <insert id="save" parameterType="com.kmall.admin.entity.BrandEntity" useGeneratedKeys="true" keyProperty="id">
- insert into mall_brand(
- `name`,
- `list_pic_url`,
- `simple_desc`,
- `pic_url`,
- `sort_order`,
- `is_show`,
- `floor_price`,
- `app_list_pic_url`,
- `is_new`,
- `new_pic_url`,
- `new_sort_order`)
- values(
- #{name},
- #{listPicUrl},
- #{simpleDesc},
- #{picUrl},
- #{sortOrder},
- #{isShow},
- #{floorPrice},
- #{appListPicUrl},
- #{isNew},
- #{newPicUrl},
- #{newSortOrder})
- </insert>
- <update id="update" parameterType="com.kmall.admin.entity.BrandEntity">
- update mall_brand
- <set>
- <if test="name != null">`name` = #{name},</if>
- <if test="listPicUrl != null">`list_pic_url` = #{listPicUrl},</if>
- <if test="simpleDesc != null">`simple_desc` = #{simpleDesc},</if>
- <if test="picUrl != null">`pic_url` = #{picUrl},</if>
- <if test="sortOrder != null">`sort_order` = #{sortOrder},</if>
- <if test="isShow != null">`is_show` = #{isShow},</if>
- <if test="floorPrice != null">`floor_price` = #{floorPrice},</if>
- <if test="appListPicUrl != null">`app_list_pic_url` = #{appListPicUrl},</if>
- <if test="isNew != null">`is_new` = #{isNew},</if>
- <if test="newPicUrl != null">`new_pic_url` = #{newPicUrl},</if>
- <if test="newSortOrder != null">`new_sort_order` = #{newSortOrder}</if>
- </set>
- where id = #{id}
- </update>
- <delete id="delete">
- delete from mall_brand where id = #{value}
- </delete>
- <delete id="deleteBatch">
- delete from mall_brand where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|