123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226 |
- <?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="storeId" column="store_id"/>
- <result property="merchSn" column="merch_sn"/>
- <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"/>
- <result property="storeName" column="storeName"/>
- <result column="merchName" property="merchName" />
- <result column="category_id" property="categoryId" />
- <result column="categoryName" property="categoryName" />
- </resultMap>
- <select id="queryObject" resultType="com.kmall.admin.entity.BrandEntity">
- select
- `id`,
- `name`,
- `store_id`,
- `merch_sn`,
- `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`,
- category_id
- from mall_brand
- where id = #{id}
- </select>
- <select id="queryObjectByName" resultType="com.kmall.admin.entity.BrandEntity">
- select
- `id`,
- `name`,
- `store_id`,
- `merch_sn`,
- `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`,
- b.category_id
- s.store_name storeName,
- m.merch_name merchName
- from mall_brand b
- left join mall_store s on b.store_id = s.id
- left join mall_merch m on b.merch_sn = m.merch_sn
- where `name` = #{brandName}
- <if test="merchSn != null and merchSn.trim() != ''">
- AND b.merch_sn = #{merchSn}
- </if>
- <if test="categoryId != null">
- AND b.category_id = #{categoryId}
- </if>
- </select>
- <select id="queryObjectByStoreId" resultType="com.kmall.admin.entity.BrandEntity">
- select *
- from mall_brand
- where store_id = #{storeId}
- </select>
- <select id="queryList" resultType="com.kmall.admin.entity.BrandEntity">
- select
- b.id,
- b.name,
- b.store_id,
- b.merch_sn,
- `list_pic_url`,
- `simple_desc`,
- `pic_url`,
- b.sort_order,
- b.is_show,
- `floor_price`,
- `app_list_pic_url`,
- b.is_new,
- `new_pic_url`,
- b.new_sort_order,
- s.store_name storeName,
- m.merch_name merchName,
- cg.name categoryName,
- b.category_id
- from mall_brand b
- left join mall_store s on b.store_id = s.id
- left join mall_merch m on b.merch_sn = m.merch_sn
- LEFT JOIN mall_category cg ON b.category_id = cg.id
- WHERE 1=1
- <if test="categoryId != null and categoryId != ''">
- AND b.category_id = #{categoryId}
- </if>
- <if test="storeId != null and storeId != ''">
- AND b.store_id = #{storeId}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND b.merch_sn = #{merchSn}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND s.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- <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 b.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 b
- left join mall_store s on b.store_id = s.id
- left join mall_merch m on b.merch_sn = m.merch_sn
- LEFT JOIN mall_category cg ON b.category_id = cg.id
- WHERE 1=1
- <if test="categoryId != null and categoryId != ''">
- AND b.category_id = #{categoryId}
- </if>
- <if test="storeId != null and storeId != ''">
- AND b.store_id = #{storeId}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND b.merch_sn = #{merchSn}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND s.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- <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`,
- `store_id`,
- `merch_sn`,
- `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`,
- category_id)
- values(
- #{name},
- #{storeId},
- #{merchSn},
- #{listPicUrl},
- #{simpleDesc},
- #{picUrl},
- #{sortOrder},
- #{isShow},
- #{floorPrice},
- #{appListPicUrl},
- #{isNew},
- #{newPicUrl},
- #{newSortOrder},
- #{categoryId})
- </insert>
- <update id="update" parameterType="com.kmall.admin.entity.BrandEntity">
- update mall_brand
- <set>
- <if test="name != null">`name` = #{name},</if>
- <if test="storeId != null">`store_id` = #{storeId}, </if>
- <if test="merchSn != null">`merch_sn` = #{merchSn}, </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="categoryId != null">`category_id` = #{categoryId},</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>
|