You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

483 lines
20 KiB

<?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="cc.hiver.mall.dao.mapper.ShopMapper" >
<resultMap id="BaseResultMap" type="cc.hiver.mall.entity.Shop" >
<id column="id" property="id" jdbcType="VARCHAR" />
<result column="create_by" property="createBy" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="del_flag" property="delFlag" jdbcType="INTEGER" />
<result column="update_by" property="updateBy" jdbcType="VARCHAR" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
<result column="shop_name" property="shopName" jdbcType="VARCHAR" />
<result column="shop_owner_id" property="shopOwnerId" jdbcType="VARCHAR" />
<result column="shop_manger_id" property="shopMangerId" jdbcType="VARCHAR" />
<result column="region" property="region" jdbcType="VARCHAR" />
<result column="region_id" property="regionId" jdbcType="VARCHAR" />
<result column="shop_area" property="shopArea" jdbcType="VARCHAR" />
<result column="shop_area_title" property="shopAreaTitle" jdbcType="VARCHAR" />
<result column="shop_type" property="shopType" jdbcType="VARCHAR" />
<result column="shop_type_title" property="shopTypeTitle" jdbcType="VARCHAR" />
<result column="shop_address" property="shopAddress" jdbcType="VARCHAR" />
<result column="year_fee" property="yearFee" jdbcType="VARCHAR" />
<result column="charge_time" property="chargeTime" jdbcType="VARCHAR" />
<result column="start_time" property="startTime" jdbcType="VARCHAR" />
<result column="end_time" property="endTime" jdbcType="VARCHAR" />
<result column="status" property="status" jdbcType="INTEGER" />
<result column="remark" property="remark" jdbcType="VARCHAR" />
<result column="business_district_level" property="businessDistrictLevel" jdbcType="VARCHAR" />
<result column="contact_phone" property="contactPhone" jdbcType="VARCHAR" />
<result column="shop_icon" property="shopIcon" jdbcType="VARCHAR" />
<result column="defaulted" property="defaulted" jdbcType="INTEGER" />
<result column="ali_account" property="aliAccount" jdbcType="VARCHAR" />
<result column="ali_name" property="aliName" jdbcType="VARCHAR" />
<result column="balance" property="balance" jdbcType="VARCHAR" />
<result column="attr_id" property="attrId" jdbcType="VARCHAR" />
<result column="printing_method" property="printingMethod" jdbcType="VARCHAR" />
<result column="shop_images" property="shopImages" jdbcType="VARCHAR" />
<result column="shop_lename" property="shopLename" jdbcType="VARCHAR" />
<result column="shop_lecard" property="shopLecard" jdbcType="VARCHAR" />
<result column="shop_score" property="shopScore" jdbcType="DECIMAL" />
<result column="isbrandflag" property="isbrandflag" jdbcType="INTEGER" />
<result column="subtitle" property="subtitle" jdbcType="VARCHAR" />
<result column="shoprank" property="shoprank" jdbcType="INTEGER" />
<result column="sale_count" property="saleCount" jdbcType="INTEGER" />
<result column="is_student" property="isStudent" jdbcType="INTEGER" />
<result column="client_id" property="clientId" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="ResultMapWithBLOBs" type="cc.hiver.mall.entity.Shop" extends="BaseResultMap" >
<result column="remark" property="remark" jdbcType="LONGVARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
id, create_by, create_time, del_flag, update_by, update_time, shop_name, shop_owner_id, shop_manger_id, region,
region_id, shop_area, shop_area_title, shop_type, shop_type_title, shop_address, year_fee, charge_time, start_time,
end_time, status, remark, business_district_level, contact_phone, shop_icon, defaulted, ali_account, ali_name,
balance, attr_id, printing_method,shop_images,shop_lename,shop_lecard,shop_score,isbrandflag,subtitle,shoprank,sale_count,is_student,client_id
</sql>
<sql id="Blob_Column_List" >
remark
</sql>
<select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from t_shop
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
delete from t_shop
where id = #{id,jdbcType=VARCHAR}
</delete>
<insert id="insert" parameterType="cc.hiver.mall.entity.Shop" >
insert into t_shop (id, create_by, create_time, del_flag, update_by, update_time, shop_name, shop_owner_id, shop_manger_id, region,
region_id, shop_area, shop_area_title, shop_type, shop_type_title, shop_address, year_fee, charge_time, start_time,
end_time, status, remark, business_district_level, contact_phone, shop_icon, defaulted, ali_account, ali_name,
balance, attr_id, printing_method, shop_images, shop_lename, shop_lecard, shop_score, isbrandflag, subtitle,shoprank, sale_count,is_student,client_id)
values (#{id,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{delFlag,jdbcType=INTEGER}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{shopName,jdbcType=VARCHAR}, #{shopOwnerId,jdbcType=VARCHAR}, #{shopMangerId,jdbcType=VARCHAR}, #{region,jdbcType=VARCHAR},
#{regionId,jdbcType=VARCHAR}, #{shopArea,jdbcType=VARCHAR}, #{shopAreaTitle,jdbcType=VARCHAR}, #{shopType,jdbcType=VARCHAR}, #{shopTypeTitle,jdbcType=VARCHAR}, #{shopAddress,jdbcType=VARCHAR}, #{yearFee,jdbcType=VARCHAR}, #{chargeTime,jdbcType=VARCHAR}, #{startTime,jdbcType=VARCHAR},
#{endTime,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{remark,jdbcType=LONGVARCHAR}, #{businessDistrictLevel,jdbcType=VARCHAR}, #{contactPhone,jdbcType=VARCHAR}, #{shopIcon,jdbcType=VARCHAR}, #{defaulted,jdbcType=INTEGER}, #{aliAccount,jdbcType=VARCHAR}, #{aliName,jdbcType=VARCHAR},
#{balance,jdbcType=VARCHAR}, #{attrId,jdbcType=VARCHAR}, #{printingMethod,jdbcType=VARCHAR}, #{shopImages,jdbcType=VARCHAR}, #{shopLename,jdbcType=VARCHAR}, #{shopLecard,jdbcType=VARCHAR}, #{shopScore,jdbcType=DECIMAL}, #{isbrandflag,jdbcType=INTEGER}, #{subtitle,jdbcType=VARCHAR}, #{shoprank,jdbcType=INTEGER}, #{saleCount,jdbcType=INTEGER}, #{isStudent,jdbcType=INTEGER},#{clientId,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="cc.hiver.mall.entity.Shop" >
insert into t_shop
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="createBy != null" >
create_by,
</if>
<if test="createTime != null" >
create_time,
</if>
<if test="delFlag != null" >
del_flag,
</if>
<if test="updateBy != null" >
update_by,
</if>
<if test="updateTime != null" >
update_time,
</if>
<if test="shopName != null" >
shop_name,
</if>
<if test="shopOwnerId != null" >
shop_owner_id,
</if>
<if test="shopMangerId != null" >
shop_manger_id,
</if>
<if test="shopArea != null" >
shop_area,
</if>
<if test="shopAddress != null" >
shop_address,
</if>
<if test="yearFee != null" >
year_fee,
</if>
<if test="chargeTime != null" >
charge_time,
</if>
<if test="startTime != null" >
start_time,
</if>
<if test="endTime != null" >
end_time,
</if>
<if test="status != null" >
status,
</if>
<if test="businessDistrictLevel != null" >
business_district_level,
</if>
<if test="contactPhone != null" >
contact_phone,
</if>
<if test="shopIcon != null" >
shop_icon,
</if>
<if test="defaulted != null" >
defaulted,
</if>
<if test="region != null" >
region,
</if>
<if test="shopAreaTitle != null" >
shop_area_title,
</if>
<if test="remark != null" >
remark,
</if>
<if test="shopImages != null" >
shop_images,
</if>
<if test="shopLename != null" >
shop_lename,
</if>
<if test="shopLecard != null" >
shop_lecard,
</if>
<if test="shopScore != null" >
shop_score,
</if>
<if test="isbrandflag != null" >
isbrandflag,
</if>
<if test="subtitle != null" >
subtitle,
</if>
<if test="shoprank != null" >
shoprank,
</if>
<if test="saleCount != null" >
sale_count,
</if>
<if test="isStudent != null" >
is_student
</if>
<if test="clientId != null" >
client_id
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=VARCHAR},
</if>
<if test="createBy != null" >
#{createBy,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="delFlag != null" >
#{delFlag,jdbcType=INTEGER},
</if>
<if test="updateBy != null" >
#{updateBy,jdbcType=VARCHAR},
</if>
<if test="updateTime != null" >
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="shopName != null" >
#{shopName,jdbcType=VARCHAR},
</if>
<if test="shopOwnerId != null" >
#{shopOwnerId,jdbcType=VARCHAR},
</if>
<if test="shopMangerId != null" >
#{shopMangerId,jdbcType=VARCHAR},
</if>
<if test="shopArea != null" >
#{shopArea,jdbcType=VARCHAR},
</if>
<if test="shopAddress != null" >
#{shopAddress,jdbcType=VARCHAR},
</if>
<if test="yearFee != null" >
#{yearFee,jdbcType=VARCHAR},
</if>
<if test="chargeTime != null" >
#{chargeTime,jdbcType=VARCHAR},
</if>
<if test="startTime != null" >
#{startTime,jdbcType=VARCHAR},
</if>
<if test="endTime != null" >
#{endTime,jdbcType=VARCHAR},
</if>
<if test="status != null" >
#{status,jdbcType=INTEGER},
</if>
<if test="businessDistrictLevel != null" >
#{businessDistrictLevel,jdbcType=VARCHAR},
</if>
<if test="contactPhone != null" >
#{contactPhone,jdbcType=VARCHAR},
</if>
<if test="shopIcon != null" >
#{shopIcon,jdbcType=VARCHAR},
</if>
<if test="defaulted != null" >
#{defaulted,jdbcType=INTEGER},
</if>
<if test="region != null" >
#{region,jdbcType=VARCHAR},
</if>
<if test="shopAreaTitle != null" >
#{shopAreaTitle,jdbcType=VARCHAR},
</if>
<if test="remark != null" >
#{remark,jdbcType=LONGVARCHAR},
</if>
<if test="shopImages != null" >
#{shopImages,jdbcType=VARCHAR},
</if>
<if test="shopLename != null" >
#{shopLename,jdbcType=VARCHAR},
</if>
<if test="shopLecard != null" >
#{shopLecard,jdbcType=VARCHAR},
</if>
<if test="shopScore != null" >
#{shopScore,jdbcType=DECIMAL},
</if>
<if test="isbrandflag != null" >
#{isbrandflag,jdbcType=INTEGER},
</if>
<if test="subtitle != null" >
#{subtitle,jdbcType=VARCHAR},
</if>
<if test="shoprank != null" >
#{shoprank,jdbcType=INTEGER},
</if>
<if test="saleCount != null" >
#{saleCount,jdbcType=INTEGER},
</if>
<if test="isStudent != null" >
#{isStudent,jdbcType=INTEGER},
</if>
<if test="clientId != null" >
#{clientId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cc.hiver.mall.entity.Shop" >
update t_shop
<set >
<if test="createBy != null" >
create_by = #{createBy,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="delFlag != null" >
del_flag = #{delFlag,jdbcType=INTEGER},
</if>
<if test="updateBy != null" >
update_by = #{updateBy,jdbcType=VARCHAR},
</if>
<if test="updateTime != null" >
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="shopName != null" >
shop_name = #{shopName,jdbcType=VARCHAR},
</if>
<if test="shopOwnerId != null" >
shop_owner_id = #{shopOwnerId,jdbcType=VARCHAR},
</if>
<if test="shopMangerId != null" >
shop_manger_id = #{shopMangerId,jdbcType=VARCHAR},
</if>
<if test="shopArea != null" >
shop_area = #{shopArea,jdbcType=VARCHAR},
</if>
<if test="shopAddress != null" >
shop_address = #{shopAddress,jdbcType=VARCHAR},
</if>
<if test="yearFee != null" >
year_fee = #{yearFee,jdbcType=VARCHAR},
</if>
<if test="chargeTime != null" >
charge_time = #{chargeTime,jdbcType=VARCHAR},
</if>
<if test="startTime != null" >
start_time = #{startTime,jdbcType=VARCHAR},
</if>
<if test="endTime != null" >
end_time = #{endTime,jdbcType=VARCHAR},
</if>
<if test="status != null" >
status = #{status,jdbcType=INTEGER},
</if>
<if test="businessDistrictLevel != null" >
business_district_level = #{businessDistrictLevel,jdbcType=VARCHAR},
</if>
<if test="contactPhone != null" >
contact_phone = #{contactPhone,jdbcType=VARCHAR},
</if>
<if test="shopIcon != null" >
shop_icon = #{shopIcon,jdbcType=VARCHAR},
</if>
<if test="defaulted != null" >
defaulted = #{defaulted,jdbcType=INTEGER},
</if>
<if test="region != null" >
region = #{region,jdbcType=VARCHAR},
</if>
<if test="shopAreaTitle != null" >
shop_area_title = #{shopAreaTitle,jdbcType=VARCHAR},
</if>
<if test="remark != null" >
remark = #{remark,jdbcType=LONGVARCHAR},
</if>
<if test="shopImages != null" >
shop_images = #{shopImages,jdbcType=VARCHAR},
</if>
<if test="shopLename != null" >
shop_lename = #{shopLename,jdbcType=VARCHAR},
</if>
<if test="shopLecard != null" >
shop_lecard = #{shopLecard,jdbcType=VARCHAR},
</if>
<if test="shopScore != null" >
shop_score = #{shopScore,jdbcType=DECIMAL},
</if>
<if test="isbrandflag != null" >
isbrandflag = #{isbrandflag,jdbcType=INTEGER},
</if>
<if test="subtitle != null" >
subtitle = #{subtitle,jdbcType=VARCHAR},
</if>
<if test="shoprank != null" >
shoprank = #{shoprank,jdbcType=INTEGER},
</if>
<if test="saleCount != null" >
sale_count = #{saleCount,jdbcType=INTEGER},
</if>
<if test="isStudent != null" >
is_student = #{isStudent,jdbcType=INTEGER},
</if>
<if test="clientId != null" >
client_id = #{clientId,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="cc.hiver.mall.entity.Shop" >
update t_shop
set create_by = #{createBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
del_flag = #{delFlag,jdbcType=INTEGER},
update_by = #{updateBy,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=TIMESTAMP},
shop_name = #{shopName,jdbcType=VARCHAR},
shop_owner_id = #{shopOwnerId,jdbcType=VARCHAR},
shop_manger_id = #{shopMangerId,jdbcType=VARCHAR},
shop_area = #{shopArea,jdbcType=VARCHAR},
shop_address = #{shopAddress,jdbcType=VARCHAR},
year_fee = #{yearFee,jdbcType=VARCHAR},
charge_time = #{chargeTime,jdbcType=VARCHAR},
start_time = #{startTime,jdbcType=VARCHAR},
end_time = #{endTime,jdbcType=VARCHAR},
status = #{status,jdbcType=INTEGER},
business_district_level = #{businessDistrictLevel,jdbcType=VARCHAR},
contact_phone = #{contactPhone,jdbcType=VARCHAR},
shop_icon = #{shopIcon,jdbcType=VARCHAR},
defaulted = #{defaulted,jdbcType=INTEGER},
region = #{region,jdbcType=VARCHAR},
shop_area_title = #{shopAreaTitle,jdbcType=VARCHAR},
remark = #{remark,jdbcType=LONGVARCHAR},
shop_images = #{shopImages,jdbcType=VARCHAR},
shop_lename = #{shopLename,jdbcType=VARCHAR},
shop_lecard = #{shopLecard,jdbcType=VARCHAR},
shop_score = #{shopScore,jdbcType=DECIMAL},
isbrandflag = #{isbrandflag,jdbcType=INTEGER},
subtitle = #{subtitle,jdbcType=VARCHAR},
shoprank = #{shoprank,jdbcType=INTEGER},
sale_count = #{saleCount,jdbcType=INTEGER},
is_student = #{isStudent,jdbcType=INTEGER},
client_id = #{clientId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="cc.hiver.mall.entity.Shop" >
update t_shop
set create_by = #{createBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
del_flag = #{delFlag,jdbcType=INTEGER},
update_by = #{updateBy,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=TIMESTAMP},
shop_name = #{shopName,jdbcType=VARCHAR},
shop_owner_id = #{shopOwnerId,jdbcType=VARCHAR},
shop_manger_id = #{shopMangerId,jdbcType=VARCHAR},
shop_area = #{shopArea,jdbcType=VARCHAR},
shop_address = #{shopAddress,jdbcType=VARCHAR},
year_fee = #{yearFee,jdbcType=VARCHAR},
charge_time = #{chargeTime,jdbcType=VARCHAR},
start_time = #{startTime,jdbcType=VARCHAR},
end_time = #{endTime,jdbcType=VARCHAR},
status = #{status,jdbcType=INTEGER},
business_district_level = #{businessDistrictLevel,jdbcType=VARCHAR},
contact_phone = #{contactPhone,jdbcType=VARCHAR},
shop_icon = #{shopIcon,jdbcType=VARCHAR},
defaulted = #{defaulted,jdbcType=INTEGER},
region = #{region,jdbcType=VARCHAR},
shop_area_title = #{shopAreaTitle,jdbcType=VARCHAR},
remark = #{remark,jdbcType=LONGVARCHAR},
region_id = #{regionId,jdbcType=VARCHAR},
shop_type = #{shopType,jdbcType=VARCHAR},
shop_type_title = #{shopTypeTitle,jdbcType=VARCHAR},
ali_account = #{aliAccount,jdbcType=VARCHAR},
ali_name = #{aliName,jdbcType=VARCHAR},
balance = #{balance,jdbcType=DECIMAL},
attr_id = #{attrId,jdbcType=VARCHAR},
printing_method = #{printingMethod,jdbcType=VARCHAR},
shop_images = #{shopImages,jdbcType=VARCHAR},
shop_lename = #{shopLename,jdbcType=VARCHAR},
shop_lecard = #{shopLecard,jdbcType=VARCHAR},
shop_score = #{shopScore,jdbcType=DECIMAL},
isbrandflag = #{isbrandflag,jdbcType=INTEGER},
subtitle = #{subtitle,jdbcType=VARCHAR},
shoprank = #{shoprank,jdbcType=INTEGER},
sale_count = #{saleCount,jdbcType=INTEGER},
is_student = #{isStudent,jdbcType=INTEGER},
client_id = #{clientId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<select id="findByUserId" resultType="cc.hiver.mall.entity.Shop">
SELECT DISTINCT m.*
FROM t_shop m
LEFT JOIN t_shop_user um ON m.id = um.shop_id
WHERE m.status = 1 AND (um.user_id = #{userId} OR m.shop_owner_id = #{userId} OR m.shop_manger_id = #{userId})
ORDER BY m.defaulted DESC
</select>
<select id="getShopSaleCounts" resultType="cc.hiver.mall.entity.Shop">
SELECT shop_id as id, count(*) as saleCounts FROM `t_sale` where del_flag = 0 and status = 4 and shop_id in
<foreach item="item" index="index" collection="shopIdList" open="(" close=")" separator=",">
#{item}
</foreach>
GROUP BY shop_id
</select>
</mapper>