<?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.SaleMapper" >
<resultMap id= "BaseResultMap" type= "cc.hiver.mall.entity.Sale" >
<id column= "id" jdbcType= "VARCHAR" property= "id" />
<result column= "create_by" jdbcType= "VARCHAR" property= "createBy" />
<result column= "create_by_name" jdbcType= "VARCHAR" property= "createByName" />
<result column= "create_time" jdbcType= "TIMESTAMP" property= "createTime" />
<result column= "del_flag" jdbcType= "INTEGER" property= "delFlag" />
<result column= "update_by" jdbcType= "VARCHAR" property= "updateBy" />
<result column= "update_by_name" jdbcType= "VARCHAR" property= "updateByName" />
<result column= "update_time" jdbcType= "TIMESTAMP" property= "updateTime" />
<result column= "user_id" jdbcType= "VARCHAR" property= "userId" />
<result column= "user_name" jdbcType= "VARCHAR" property= "userName" />
<result column= "shop_id" jdbcType= "VARCHAR" property= "shopId" />
<result column= "shop_name" jdbcType= "VARCHAR" property= "shopName" />
<result column= "total_amount" jdbcType= "DECIMAL" property= "totalAmount" />
<result column= "discount" jdbcType= "DECIMAL" property= "discount" />
<result column= "discount_amount" jdbcType= "DECIMAL" property= "discountAmount" />
<result column= "real_amount" jdbcType= "DECIMAL" property= "realAmount" />
<result column= "already_earn" jdbcType= "DECIMAL" property= "alreadyEarn" />
<result column= "no_earn" jdbcType= "DECIMAL" property= "noEarn" />
<result column= "pay_status" jdbcType= "VARCHAR" property= "payStatus" />
<result column= "status" jdbcType= "VARCHAR" property= "status" />
<result column= "transport_type" jdbcType= "VARCHAR" property= "transportType" />
<result column= "share_address" jdbcType= "VARCHAR" property= "shareAddress" />
<result column= "receive_address" jdbcType= "VARCHAR" property= "receiveAddress" />
<result column= "province" jdbcType= "VARCHAR" property= "province" />
<result column= "city" jdbcType= "VARCHAR" property= "city" />
<result column= "area" jdbcType= "VARCHAR" property= "area" />
<result column= "sale_name" jdbcType= "VARCHAR" property= "saleName" />
<result column= "remark" jdbcType= "VARCHAR" property= "remark" />
<result column= "other_expense" jdbcType= "VARCHAR" property= "otherExpense" />
<result column= "trans_company" jdbcType= "VARCHAR" property= "transCompany" />
<result column= "company_name" jdbcType= "VARCHAR" property= "companyName" />
<result column= "company_phone" jdbcType= "VARCHAR" property= "companyPhone" />
<result column= "product_count" jdbcType= "INTEGER" property= "productCount" />
<result column= "create_by_phone" jdbcType= "VARCHAR" property= "createByPhone" />
<result column= "mode_of_service" jdbcType= "VARCHAR" property= "modeOfService" />
<result column= "ai_flag" jdbcType= "INTEGER" property= "aiFlag" />
<result column= "ai_result" jdbcType= "VARCHAR" property= "aiResult" />
<result column= "ai_not_recognition" jdbcType= "VARCHAR" property= "aiNotRecognition" />
</resultMap>
<sql id= "Example_Where_Clause" >
<where >
<foreach collection= "oredCriteria" item= "criteria" separator= "or" >
<if test= "criteria.valid" >
<trim prefix= "(" prefixOverrides= "and" suffix= ")" >
<foreach collection= "criteria.criteria" item= "criterion" >
<choose >
<when test= "criterion.noValue" >
and ${criterion.condition}
</when>
<when test= "criterion.singleValue" >
and ${criterion.condition} #{criterion.value}
</when>
<when test= "criterion.betweenValue" >
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test= "criterion.listValue" >
and ${criterion.condition}
<foreach close= ")" collection= "criterion.value" item= "listItem" open= "(" separator= "," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id= "Update_By_Example_Where_Clause" >
<where >
<foreach collection= "example.oredCriteria" item= "criteria" separator= "or" >
<if test= "criteria.valid" >
<trim prefix= "(" prefixOverrides= "and" suffix= ")" >
<foreach collection= "criteria.criteria" item= "criterion" >
<choose >
<when test= "criterion.noValue" >
and ${criterion.condition}
</when>
<when test= "criterion.singleValue" >
and ${criterion.condition} #{criterion.value}
</when>
<when test= "criterion.betweenValue" >
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test= "criterion.listValue" >
and ${criterion.condition}
<foreach close= ")" collection= "criterion.value" item= "listItem" open= "(" separator= "," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id= "Base_Column_List" >
id, create_by, create_by_name, create_time, del_flag, update_by, update_by_name, update_time, user_id, user_name, shop_id, shop_name, total_amount, discount,
discount_amount, real_amount, already_earn, no_earn, pay_status, status, other_expense, transport_type, share_address, receive_address, province, city, area,
trans_company, company_name, product_count, remark, sale_name, company_phone, create_by_phone,mode_of_service,ai_flag,ai_result,ai_not_recognition
</sql>
<select id= "selectByExample" parameterType= "cc.hiver.mall.entity.SaleExample" resultMap= "BaseResultMap" >
select
<if test= "distinct" >
distinct
</if>
<include refid= "Base_Column_List" />
from t_sale
<if test= "_parameter != null" >
<include refid= "Example_Where_Clause" />
</if>
<if test= "orderByClause != null" >
order by ${orderByClause}
</if>
</select>
<select id= "selectByPrimaryKey" parameterType= "java.lang.String" resultMap= "BaseResultMap" >
select
<include refid= "Base_Column_List" />
from t_sale
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id= "deleteByPrimaryKey" parameterType= "java.lang.String" >
delete from t_sale
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id= "deleteByExample" parameterType= "cc.hiver.mall.entity.SaleExample" >
delete from t_sale
<if test= "_parameter != null" >
<include refid= "Example_Where_Clause" />
</if>
</delete>
<insert id= "insert" parameterType= "cc.hiver.mall.entity.Sale" >
insert into t_sale (id, create_by,create_by_name, create_time,
del_flag, update_by,update_by_name, update_time,
user_id,user_name, shop_id,shop_name, total_amount,
discount, discount_amount, real_amount,
already_earn, no_earn, pay_status,
status, transport_type, share_address,
receive_address, province, city,
area,sale_name,remark,other_expense,trans_company,company_name,company_phone,product_count,create_by_phone,mode_of_service,ai_flag,ai_result,ai_not_recognition)
values (#{id,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR},#{createByName,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{delFlag,jdbcType=INTEGER}, #{updateBy,jdbcType=VARCHAR},#{updateByName,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
#{userId,jdbcType=VARCHAR},#{userName,jdbcType=VARCHAR}, #{shopId,jdbcType=VARCHAR},#{shopName,jdbcType=VARCHAR}, #{totalAmount,jdbcType=DECIMAL},
#{discount,jdbcType=DECIMAL}, #{discountAmount,jdbcType=DECIMAL}, #{realAmount,jdbcType=DECIMAL},
#{alreadyEarn,jdbcType=DECIMAL}, #{noEarn,jdbcType=DECIMAL}, #{payStatus,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR}, #{transportType,jdbcType=VARCHAR}, #{shareAddress,jdbcType=VARCHAR},
#{receiveAddress,jdbcType=VARCHAR}, #{province,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR},
#{area,jdbcType=VARCHAR}, #{saleName,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
#{otherExpense,jdbcType=VARCHAR},#{transCompany,jdbcType=VARCHAR},#{companyName,jdbcType=VARCHAR},#{companyPhone,jdbcType=VARCHAR},
#{productCount,jdbcType=INTEGER},#{createByPhone,jdbcType=VARCHAR},#{modeOfService,jdbcType=VARCHAR},
#{aiFlag,jdbcType=VARCHAR},#{aiResult,jdbcType=VARCHAR},#{aiNotRecognition,jdbcType=VARCHAR})
</insert>
<insert id= "insertSelective" parameterType= "cc.hiver.mall.entity.Sale" >
insert into t_sale
<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= "userId != null" >
user_id,
</if>
<if test= "userName != null" >
user_name,
</if>
<if test= "shopId != null" >
shop_id,
</if>
<if test= "totalAmount != null" >
total_amount,
</if>
<if test= "discount != null" >
discount,
</if>
<if test= "discountAmount != null" >
discount_amount,
</if>
<if test= "realAmount != null" >
real_amount,
</if>
<if test= "alreadyEarn != null" >
already_earn,
</if>
<if test= "noEarn != null" >
no_earn,
</if>
<if test= "payStatus != null" >
pay_status,
</if>
<if test= "status != null" >
status,
</if>
<if test= "transportType != null" >
transport_type,
</if>
<if test= "shareAddress != null" >
share_address,
</if>
<if test= "receiveAddress != null" >
receive_address,
</if>
<if test= "province != null" >
province,
</if>
<if test= "city != null" >
city,
</if>
<if test= "area != null" >
area,
</if>
<if test= "otherExpense != null" >
other_expense,
</if>
<if test= "transCompany != null" >
trans_company,
</if>
<if test= "companyName != null" >
company_name,
</if>
<if test= "companyPhone != null" >
company_phone,
</if>
<if test= "productCount != null" >
product_count,
</if>
<if test= "createByPhone != null" >
create_by_phone,
</if>
<if test= "modeOfService != null" >
mode_of_service,
</if>
<if test= "aiFlag != null" >
ai_flag,
</if>
<if test= "aiResult != null" >
ai_result,
</if>
<if test= "aiNotRecognition != null" >
ai_not_recognition,
</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= "userId != null" >
#{userId,jdbcType=VARCHAR},
</if>
<if test= "userName != null" >
#{userName,jdbcType=VARCHAR},
</if>
<if test= "shopId != null" >
#{shopId,jdbcType=VARCHAR},
</if>
<if test= "totalAmount != null" >
#{totalAmount,jdbcType=DECIMAL},
</if>
<if test= "discount != null" >
#{discount,jdbcType=DECIMAL},
</if>
<if test= "discountAmount != null" >
#{discountAmount,jdbcType=DECIMAL},
</if>
<if test= "realAmount != null" >
#{realAmount,jdbcType=DECIMAL},
</if>
<if test= "alreadyEarn != null" >
#{alreadyEarn,jdbcType=DECIMAL},
</if>
<if test= "noEarn != null" >
#{noEarn,jdbcType=DECIMAL},
</if>
<if test= "payStatus != null" >
#{payStatus,jdbcType=VARCHAR},
</if>
<if test= "status != null" >
#{status,jdbcType=VARCHAR},
</if>
<if test= "transportType != null" >
#{transportType,jdbcType=VARCHAR},
</if>
<if test= "shareAddress != null" >
#{shareAddress,jdbcType=VARCHAR},
</if>
<if test= "receiveAddress != null" >
#{receiveAddress,jdbcType=VARCHAR},
</if>
<if test= "province != null" >
#{province,jdbcType=VARCHAR},
</if>
<if test= "city != null" >
#{city,jdbcType=VARCHAR},
</if>
<if test= "area != null" >
#{area,jdbcType=VARCHAR},
</if>
<if test= "otherExpense != null" >
#{otherExpense,jdbcType=VARCHAR},
</if>
<if test= "transCompany != null" >
#{transCompany,jdbcType=VARCHAR},
</if>
<if test= "companyName != null" >
#{companyName,jdbcType=VARCHAR},
</if>
<if test= "companyPhone != null" >
#{companyPhone,jdbcType=VARCHAR},
</if>
<if test= "productCount != null" >
#{productCount,jdbcType=INTEGER},
</if>
<if test= "createByPhone != null" >
#{createByPhone,jdbcType=VARCHAR},
</if>
<if test= "modeOfService != null" >
#{modeOfService,jdbcType=VARCHAR},
</if>
<if test= "aiFlag != null" >
#{aiFlag,jdbcType=INTEGER},
</if>
<if test= "aiResult != null" >
#{aiResult,jdbcType=VARCHAR},
</if>
<if test= "aiNotRecognition != null" >
#{aiNotRecognition,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id= "countByExample" parameterType= "cc.hiver.mall.entity.SaleExample" resultType= "java.lang.Long" >
select count(*) from t_sale
<if test= "_parameter != null" >
<include refid= "Example_Where_Clause" />
</if>
</select>
<update id= "updateByExampleSelective" parameterType= "map" >
update t_sale
<set >
<if test= "record.id != null" >
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test= "record.createBy != null" >
create_by = #{record.createBy,jdbcType=VARCHAR},
</if>
<if test= "record.createTime != null" >
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test= "record.delFlag != null" >
del_flag = #{record.delFlag,jdbcType=INTEGER},
</if>
<if test= "record.updateBy != null" >
update_by = #{record.updateBy,jdbcType=VARCHAR},
</if>
<if test= "record.updateTime != null" >
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
<if test= "record.userId != null" >
user_id = #{record.userId,jdbcType=VARCHAR},
</if>
<if test= "record.userName != null" >
user_name = #{record.userName,jdbcType=VARCHAR},
</if>
<if test= "record.shopId != null" >
shop_id = #{record.shopId,jdbcType=VARCHAR},
</if>
<if test= "record.totalAmount != null" >
total_amount = #{record.totalAmount,jdbcType=DECIMAL},
</if>
<if test= "record.discount != null" >
discount = #{record.discount,jdbcType=DECIMAL},
</if>
<if test= "record.discountAmount != null" >
discount_amount = #{record.discountAmount,jdbcType=DECIMAL},
</if>
<if test= "record.realAmount != null" >
real_amount = #{record.realAmount,jdbcType=DECIMAL},
</if>
<if test= "record.alreadyEarn != null" >
already_earn = #{record.alreadyEarn,jdbcType=DECIMAL},
</if>
<if test= "record.noEarn != null" >
no_earn = #{record.noEarn,jdbcType=DECIMAL},
</if>
<if test= "record.payStatus != null" >
pay_status = #{record.payStatus,jdbcType=VARCHAR},
</if>
<if test= "record.status != null" >
status = #{record.status,jdbcType=VARCHAR},
</if>
<if test= "record.transportType != null" >
transport_type = #{record.transportType,jdbcType=VARCHAR},
</if>
<if test= "record.shareAddress != null" >
share_address = #{record.shareAddress,jdbcType=VARCHAR},
</if>
<if test= "record.receiveAddress != null" >
receive_address = #{record.receiveAddress,jdbcType=VARCHAR},
</if>
<if test= "record.province != null" >
province = #{record.province,jdbcType=VARCHAR},
</if>
<if test= "record.city != null" >
city = #{record.city,jdbcType=VARCHAR},
</if>
<if test= "record.area != null" >
area = #{record.area,jdbcType=VARCHAR},
</if>
<if test= "record.otherExpense != null" >
other_expense = #{record.otherExpense,jdbcType=VARCHAR},
</if>
<if test= "record.transCompany != null" >
trans_company = #{record.transCompany,jdbcType=VARCHAR},
</if>
<if test= "record.companyName != null" >
company_name = #{record.companyName,jdbcType=VARCHAR},
</if>
<if test= "record.companyPhone != null" >
company_phone = #{record.companyPhone,jdbcType=VARCHAR},
</if>
<if test= "record.productCount != null" >
product_count = #{record.productCount,jdbcType=INTEGER},
</if>
<if test= "record.createByPhone != null" >
create_by_phone = #{record.createByPhone,jdbcType=VARCHAR},
</if>
<if test= "record.modeOfService != null" >
mode_of_service = #{record.modeOfService,jdbcType=VARCHAR},
</if>
<if test= "record.aiFlag != null" >
ai_flag = #{record.aiFlag,jdbcType=INTEGER},
</if>
<if test= "record.aiResult != null" >
ai_result = #{record.aiResult,jdbcType=VARCHAR},
</if>
<if test= "record.aiNotRecognition != null" >
ai_not_recognition = #{record.aiNotRecognition,jdbcType=VARCHAR},
</if>
</set>
<if test= "_parameter != null" >
<include refid= "Update_By_Example_Where_Clause" />
</if>
</update>
<update id= "updateByExample" parameterType= "map" >
update t_sale
set id = #{record.id,jdbcType=VARCHAR},
create_by = #{record.createBy,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
del_flag = #{record.delFlag,jdbcType=INTEGER},
update_by = #{record.updateBy,jdbcType=VARCHAR},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
user_id = #{record.userId,jdbcType=VARCHAR},
user_name = #{record.userName,jdbcType=VARCHAR},
shop_id = #{record.shopId,jdbcType=VARCHAR},
total_amount = #{record.totalAmount,jdbcType=DECIMAL},
discount = #{record.discount,jdbcType=DECIMAL},
discount_amount = #{record.discountAmount,jdbcType=DECIMAL},
real_amount = #{record.realAmount,jdbcType=DECIMAL},
already_earn = #{record.alreadyEarn,jdbcType=DECIMAL},
no_earn = #{record.noEarn,jdbcType=DECIMAL},
pay_status = #{record.payStatus,jdbcType=VARCHAR},
status = #{record.status,jdbcType=VARCHAR},
transport_type = #{record.transportType,jdbcType=VARCHAR},
share_address = #{record.shareAddress,jdbcType=VARCHAR},
receive_address = #{record.receiveAddress,jdbcType=VARCHAR},
province = #{record.province,jdbcType=VARCHAR},
city = #{record.city,jdbcType=VARCHAR},
area = #{record.area,jdbcType=VARCHAR},
other_expense = #{record.otherExpense,jdbcType=VARCHAR},
trans_company = #{record.transCompany,jdbcType=VARCHAR},
company_name = #{record.companyName,jdbcType=VARCHAR},
company_phone = #{record.companyPhone,jdbcType=VARCHAR},
product_count = #{record.productCount,jdbcType=INTEGER},
create_by_phone = #{record.createByPhone,jdbcType=VARCHAR},
mode_of_service = #{record.modeOfService,jdbcType=VARCHAR},
ai_flag = #{record.aiFlag,jdbcType=INTEGER},
ai_result = #{record.aiResult,jdbcType=VARCHAR},
ai_not_recognition = #{record.aiNotRecognition,jdbcType=VARCHAR}
<if test= "_parameter != null" >
<include refid= "Update_By_Example_Where_Clause" />
</if>
</update>
<update id= "updateByPrimaryKeySelective" parameterType= "cc.hiver.mall.entity.Sale" >
update t_sale
<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= "userId != null" >
user_id = #{userId,jdbcType=VARCHAR},
</if>
<if test= "userName != null" >
user_name = #{userName,jdbcType=VARCHAR},
</if>
<if test= "shopId != null" >
shop_id = #{shopId,jdbcType=VARCHAR},
</if>
<if test= "totalAmount != null" >
total_amount = #{totalAmount,jdbcType=DECIMAL},
</if>
<if test= "discount != null" >
discount = #{discount,jdbcType=DECIMAL},
</if>
<if test= "discountAmount != null" >
discount_amount = #{discountAmount,jdbcType=DECIMAL},
</if>
<if test= "realAmount != null" >
real_amount = #{realAmount,jdbcType=DECIMAL},
</if>
<if test= "alreadyEarn != null" >
already_earn = #{alreadyEarn,jdbcType=DECIMAL},
</if>
<if test= "noEarn != null" >
no_earn = #{noEarn,jdbcType=DECIMAL},
</if>
<if test= "payStatus != null" >
pay_status = #{payStatus,jdbcType=VARCHAR},
</if>
<if test= "status != null" >
status = #{status,jdbcType=VARCHAR},
</if>
<if test= "transportType != null" >
transport_type = #{transportType,jdbcType=VARCHAR},
</if>
<if test= "shareAddress != null" >
share_address = #{shareAddress,jdbcType=VARCHAR},
</if>
<if test= "receiveAddress != null" >
receive_address = #{receiveAddress,jdbcType=VARCHAR},
</if>
<if test= "province != null" >
province = #{province,jdbcType=VARCHAR},
</if>
<if test= "city != null" >
city = #{city,jdbcType=VARCHAR},
</if>
<if test= "area != null" >
area = #{area,jdbcType=VARCHAR},
</if>
<if test= "otherExpense != null" >
other_expense = #{otherExpense,jdbcType=VARCHAR},
</if>
<if test= "transCompany != null" >
trans_company = #{transCompany,jdbcType=VARCHAR},
</if>
<if test= "companyName != null" >
company_name = #{companyName,jdbcType=VARCHAR},
</if>
<if test= "companyPhone != null" >
company_phone = #{companyPhone,jdbcType=VARCHAR},
</if>
<if test= "productCount != null" >
product_count = #{productCount,jdbcType=INTEGER},
</if>
<if test= "createByPhone != null" >
create_by_phone = #{createByPhone,jdbcType=VARCHAR},
</if>
<if test= "modeOfService != null" >
mode_of_service = #{modeOfService,jdbcType=VARCHAR},
</if>
<if test= "aiFlag != null" >
ai_flag = #{aiFlag,jdbcType=INTEGER},
</if>
<if test= "aiResult != null" >
ai_result = #{aiResult,jdbcType=VARCHAR},
</if>
<if test= "aiNotRecognition != null" >
ai_not_recognition = #{aiNotRecognition,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id= "updateByPrimaryKey" parameterType= "cc.hiver.mall.entity.Sale" >
update t_sale
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},
user_id = #{userId,jdbcType=VARCHAR},
user_name = #{userName,jdbcType=VARCHAR},
shop_id = #{shopId,jdbcType=VARCHAR},
total_amount = #{totalAmount,jdbcType=DECIMAL},
discount = #{discount,jdbcType=DECIMAL},
discount_amount = #{discountAmount,jdbcType=DECIMAL},
real_amount = #{realAmount,jdbcType=DECIMAL},
already_earn = #{alreadyEarn,jdbcType=DECIMAL},
no_earn = #{noEarn,jdbcType=DECIMAL},
pay_status = #{payStatus,jdbcType=VARCHAR},
status = #{status,jdbcType=VARCHAR},
transport_type = #{transportType,jdbcType=VARCHAR},
share_address = #{shareAddress,jdbcType=VARCHAR},
receive_address = #{receiveAddress,jdbcType=VARCHAR},
province = #{province,jdbcType=VARCHAR},
city = #{city,jdbcType=VARCHAR},
area = #{area,jdbcType=VARCHAR},
other_expense = #{otherExpense,jdbcType=VARCHAR},
trans_company = #{transCompany,jdbcType=VARCHAR},
company_name = #{companyName,jdbcType=VARCHAR},
company_phone = #{companyPhone,jdbcType=VARCHAR},
product_count = #{productCount,jdbcType=INTEGER},
create_by_phone = #{createByPhone,jdbcType=VARCHAR},
mode_of_service = #{modeOfService,jdbcType=VARCHAR},
ai_flag = #{aiFlag,jdbcType=INTEGER},
ai_result = #{aiResult,jdbcType=VARCHAR},
ai_not_recognition = #{aiNotRecognition,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<select id= "saleSumAndCount" parameterType= "cc.hiver.mall.entity.SaleExample" resultType= "cc.hiver.mall.pojo.vo.SaleAllVO" >
select IFNULL(Sum(real_amount),0) as totalAmount,count(1) as totalCount,IFNULL(SUM(product_count),0) as totalJCount from t_sale
<if test= "_parameter != null" >
<include refid= "Example_Where_Clause" />
</if>
</select>
<select id= "saleMaxAmount" parameterType= "cc.hiver.mall.entity.SaleExample" resultType= "cc.hiver.mall.pojo.vo.SaleAllVO" >
select max(IFNULL(t.real_amount,0)-IFNULL(t1.real_amount,0)) as oneHighPrice from t_sale t left join t_return_sale t1 on t.id =t1.sale_id
<if test= "_parameter != null" >
<include refid= "Example_Where_Clause" />
</if>
</select>
<select id= "saleSumProfit" parameterType= "cc.hiver.mall.entity.SaleExample" resultType= "cc.hiver.mall.pojo.vo.SaleAllVO" >
select IFNULL(purchasePrice,0)* IFNULL(real_amount,0) as oneHighPrice from t_sale
<if test= "_parameter != null" >
<include refid= "Example_Where_Clause" />
</if>
</select>
<select id= "getShopRevenue" parameterType= "cc.hiver.mall.pojo.vo.QueryShopRevenueVO" resultType= "cc.hiver.mall.pojo.dto.ShopRevenue" >
select DATE_FORMAT(create_time, '%Y-%m-%d') dt,sum(real_amount) real_amount
from t_sale
where 1=1
and create_time > = #{startDate,jdbcType=TIMESTAMP}
and create_time < = #{endDate,jdbcType=TIMESTAMP}
and shop_id = #{shopId,jdbcType=VARCHAR}
group by DATE_FORMAT(create_time, '%Y-%m-%d')
</select>
<!-- 获取当前的销售单 -->
<select id= "getSaleId" parameterType= "java.lang.String" resultType= "java.lang.String" >
select
sale_id
from t_sale
where sale_id = #{id,jdbcType=VARCHAR}
</select>
<select id= "getSaleListByProductId" resultMap= "BaseResultMap" >
select
<include refid= "Base_Column_List" />
from t_sale
where id in (select sale_id from t_sale_detail where product_id =#{productId})
order by create_time desc
</select>
<select id= "getSalesRankingByShopId" resultType= "cc.hiver.mall.pojo.vo.SalesRankingVo" >
SELECT
create_by_name,count(*) as totalCount,sum( real_amount ) as totalPrice
FROM
t_sale
<where >
and shop_id = #{salesRankingQueryCriteria.shopId}
<!-- 不包含挂单及待配货的 -->
and status = '4'
<!-- 时间查询 -->
<if test= 'salesRankingQueryCriteria.startTime!=null' >
and create_time BETWEEN #{salesRankingQueryCriteria.startTime} AND #{salesRankingQueryCriteria.endTime}
</if>
</where>
GROUP BY
create_by_name
order by totalPrice desc
</select>
<select id= "getShopMonthData" parameterType= "cc.hiver.mall.pojo.vo.SaleMonthQueryVo" resultType= "cc.hiver.mall.pojo.vo.SaleMonthVo" >
SELECT
DATE_FORMAT( create_time, '%Y-%m-%d' ) as day,
count(*) as totalCount,
sum( real_amount ) as price
FROM
t_sale
WHERE
shop_id = #{searchVo.shopId}
and status !='2'
and status !='6'
and status !='7'
and create_time between #{searchVo.startDate} and #{searchVo.endDate}
GROUP BY
DATE_FORMAT( create_time, '%Y-%m-%d' )
ORDER BY
DATE_FORMAT( create_time, '%Y-%m-%d' ) DESC
</select>
<select id= "queryPage" parameterType= "cc.hiver.mall.pojo.vo.SaleVO" resultMap= "BaseResultMap" >
SELECT
<include refid= "Base_Column_List" />
FROM
t_sale
<where >
and shop_id = #{saleVO.shopId}
<if test= 'saleVO.payStatus!=null' >
and pay_status = #{saleVO.payStatus}
</if>
<if test= 'saleVO.status!=null' >
and status = #{saleVO.status}
</if>
<if test= 'saleVO.transportType!=null' >
and transport_type = #{saleVO.transportType}
</if>
<if test= 'saleVO.userId!=null' >
and user_id = #{saleVO.userId}
</if>
<!-- 时间查询 -->
<if test= 'saleVO.startTime!=null' >
and create_time BETWEEN #{saleVO.startTime} AND #{saleVO.endTime}
</if>
<if test= 'saleVO.searchStr!=null' >
and (user_name like concat('%',#{saleVO.searchStr},'%') or create_by_name like concat('%',#{saleVO.searchStr},'%'))
</if>
</where>
order by create_time desc
</select>
<select id= "getCustomerBuyProductLog" resultType= "cc.hiver.mall.pojo.vo.CustomerBuyProductLogVo" >
SELECT
product_id,product_name
FROM
t_sale_detail
WHERE
shop_id = #{shopId}
and sale_id IN ( SELECT id FROM t_sale WHERE user_id = #{userId} and status not in ('2','6','7'))
GROUP BY
product_id, product_name
order by product_name desc
</select>
<select id= "getCustomerBuyProductLogDetailLog" resultType= "cc.hiver.mall.pojo.vo.CustomerBuyProductDetailLogVo" >
SELECT
create_time,sale_id, product_id,attribute_list, discount_amount as real_price,product_count
FROM
t_sale_detail
WHERE
shop_id = #{shopId}
and sale_id in ( SELECT id FROM t_sale WHERE user_id = #{userId} and status not in ('2','6','7'))
and product_id in
<foreach close= ")" collection= "productIds" item= "listItem" open= "(" separator= "," >
#{listItem}
</foreach>
</select>
<select id= "getByUserId" resultType= "cc.hiver.mall.pojo.vo.CustomerBuySaleVo" >
SELECT
id,create_time
FROM t_sale
WHERE
user_id = #{userId}
and status not in ('2','6','7')
</select>
<select id= "queryTotalAlreadyEarn" resultType= "java.math.BigDecimal" >
select IFNULL(Sum(already_earn),0.00) as totalAlreadyEarn
from t_sale
where shop_id = #{shopId}
and status not in ('2','6','7')
and create_time BETWEEN #{startTime} AND #{endTime}
</select>
<select id= "getSupplierBuyProductLog" resultType= "cc.hiver.mall.pojo.vo.SupplierBuyProductLogVo" >
SELECT
t.product_id,t.product_name
FROM
t_purchase_detail t
LEFT JOIN t_stock_log s ON t.purchase_id = s.order_id
AND t.product_id = s.product_id
WHERE
t.shop_id = #{shopId}
AND purchase_id IN ( SELECT id FROM t_purchase WHERE supplier_id = #{supplierId} )
GROUP BY
product_id, product_name
order by product_name desc
</select>
<select id= "getSupplierBuyProductLogDetailLog" resultType= "cc.hiver.mall.pojo.vo.SupplierBuyProductDetailLogVo" >
SELECT
t.create_time, t.purchase_id, t.product_id, s.attribute_list, t.purchase_price, s.product_count
FROM
t_purchase_detail t
LEFT JOIN t_stock_log s ON t.purchase_id = s.order_id
AND t.product_id = s.product_id
WHERE
t.shop_id = #{shopId}
AND purchase_id IN ( SELECT id FROM t_purchase WHERE supplier_id = #{supplierId} )
and t.product_id in
<foreach close= ")" collection= "productIds" item= "listItem" open= "(" separator= "," >
#{listItem}
</foreach>
</select>
<select id= "getBySupplierId" resultType= "cc.hiver.mall.pojo.vo.SupplierBuyPurchaseVo" >
SELECT
id,create_time
FROM t_purchase
WHERE
supplier_id = #{supplierId}
</select>
<select id= "getSaleByCompanyId" resultType= "cc.hiver.mall.pojo.vo.SaleNoWorkerVO" >
SELECT
t.id as sale_id,t.shop_name,concat(m.region,m.shop_area_title,m.shop_address) as shop_address,t.create_by_name,t.create_by_phone,t.create_time,t.user_name,s.phone as user_phone,t.receive_address,t.province,t.city,t.area
FROM t_sale t left join t_customer s
on t.user_id = s.id
left join t_shop m
on t.shop_id = m.id
WHERE
t.trans_company = #{salePageQuery.companyId}
<if test= 'salePageQuery.status !=null and salePageQuery.status != ""' >
and t.status = #{salePageQuery.status}
</if>
<if test= 'salePageQuery.transportType !=null and salePageQuery.transportType != ""' >
and t.transport_type = #{salePageQuery.transportType}
</if>
<if test= 'salePageQuery.modeOfService !=null and salePageQuery.modeOfService != ""' >
and t.mode_of_service = #{salePageQuery.modeOfService}
</if>
<if test= 'salePageQuery.startDate !=null and salePageQuery.endDate !=null' >
and t.create_time BETWEEN #{salePageQuery.startDate} AND #{salePageQuery.endDate}
</if>
</select>
<update id= "companyGetSale" >
update t_sale
set
status = '4'
where id = #{saleId,jdbcType=VARCHAR}
</update>
<update id= "updateAiMsg" >
update t_sale
set
remark = #{aiMsg,jdbcType=VARCHAR}
where id = #{saleId,jdbcType=VARCHAR}
</update>
<update id= "updateAiFlag" >
update t_sale
set
ai_flag = #{status,jdbcType=INTEGER}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id= "updateStatus" >
update t_sale
set
status = #{status,jdbcType=INTEGER}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>