|
|
@@ -110,3 +110,74 @@ select Id as id, CreateDate as create_time, UpdateDate as update_time, Sort as
|
|
|
ParentId as pid, ColDetail as col_detail, ColPicPath as col_pic_path, ColName as col_name, ColId as col_id
|
|
|
FROM Col where id in(21,22,23,25,26,27,30)
|
|
|
|
|
|
+//市场活动
|
|
|
+select Id as id, CreateDate as create_time, UpdateDate as update_time, Sort as sort,
|
|
|
+Title as title, case ColId when '007001' then 2 when '007002' then 1 end menu_id, PicPath as pic_path, Contents as contents, Url as url, Status as status
|
|
|
+FROM Advertisment where ColId in ('007001', '007002')
|
|
|
+
|
|
|
+//服务中心
|
|
|
+select Id as id, CreateDate as create_time, UpdateDate as update_time, Sort as sort,
|
|
|
+Title as title, Content as content, CategoryId as menu_id, CreateMan as create_by
|
|
|
+from ServiceCenter
|
|
|
+ where `Status` > -1
|
|
|
+
|
|
|
+select Id as id, CreateDate as create_time, UpdateDate as update_time, Sort as sort,
|
|
|
+ColName as title
|
|
|
+FROM Col where id in (3,4,5,6,32,33,34,35,36,38)
|
|
|
+
|
|
|
+//品牌表
|
|
|
+SELECT a.Id as id, a.CreateDate as create_time, a.UpdateDate as update_time, a.Sort as sort,
|
|
|
+a.Name as name, case a.Kind when 1 then 0 when 2 then 1 end brand_type, a.PosPrice as pos_price, a.DefaultDeposit as default_pledge, a.CountOfBox as count_of_box,ActTradeAmount as act_amount,FluxAmount as flux_amount, FluxProfit as flux_profit,
|
|
|
+ c.ColPicPath
|
|
|
+from KqProducts a
|
|
|
+left join KxsBsServer.Col c on a.AdColId = c.ColId
|
|
|
+where a.`Status` > 0
|
|
|
+//机具表
|
|
|
+select a.Id as id, a.UserId as user_id,a.CreateDate as create_time, a.UpdateDate as update_time,
|
|
|
+a.PosSn as pos_sn, a.StoreId as warehouse_id, a.BindMerchantId as merchant_id, a.BrandId as brand_id,
|
|
|
+a.IsPurchase as recycle_status, a.RecycEndDate as recycle_end_time,
|
|
|
+a.PosSnType as machine_type, ifnull(a.PrizeParams, 299) as cash_pledge, case when a.SeoKeyword > 1000 then a.SeoKeyword / 100 ELSE a.SeoKeyword end as source_pledge,
|
|
|
+a.BindingTime as bind_time, a.ActivationTime as act_time, a.DownFee as machine_ratio, a.ActivationState as is_act, a.BindingState as bind_status,
|
|
|
+a.IsFirst as is_first, a.LeaderUserId as leader_id, a.OpId as partner_id, TransferTime as delivery_time, UpFeeFlag as up_fee_flag, DownFeeFlag as down_fee_flag,
|
|
|
+IsSupplement as is_supply, IsOpAct as is_op_act, case when a.UserId = 0 then 0 ELSE 1 end status, RecycStatus,
|
|
|
+case when a.RecycEndDate < NOW() && a.BindingState = 0 then 1 ELSE 0 end return_status,
|
|
|
+b.StoreName as warehouse_name
|
|
|
+FROM PosMachinesTwo a LEFT JOIN StoreHouse b on a.StoreId = b.id
|
|
|
+//仓库表
|
|
|
+select a.Id as id, a.UserId as user_id,a.CreateDate as create_time, a.UpdateDate as update_time,
|
|
|
+StoreNo as warehouse_no, StoreName as warehouse_name, BrandId as brand_id, ProductName as brand_name,a.Address as warehouse_address,
|
|
|
+ManageUserId as warehouse_admin_id, ManagerEmail as admin_email, ParentStoreId as pid,
|
|
|
+SUBSTRING_INDEX(a.Areas, ',', 1) AS province,
|
|
|
+SUBSTRING_INDEX(SUBSTRING_INDEX(a.Areas, ',', -2), ',', 1) AS city,
|
|
|
+SUBSTRING_INDEX(a.Areas, ',', -1) AS area,
|
|
|
+StoreStatus as status, case a.StoreKind when 0 then 1 when 1 then 0 when 2 then 2 end warehouse_type, FilePath as file_url, ManageMobile as warehouse_phone,
|
|
|
+a.CreateMan as create_by ,Deposit as pledge_amount, a.Remark as remark, a.UpdateMan as update_by, u.RealName as contacts
|
|
|
+from StoreHouse a
|
|
|
+LEFT JOIN Users u on a.UserId = u.Id
|
|
|
+-- 仓库库存统计表
|
|
|
+SELECT a.Id as id, a.UserId as user_id,a.CreateDate as create_time, a.UpdateDate as update_time,
|
|
|
+TotalNum as stock_total, LaveNum as stock_num, OutNum as delivery_num, a.Id as warehouse_id
|
|
|
+from StoreHouse a
|
|
|
+-- 仓库额度表
|
|
|
+SELECT s.Id as id, s.UserId as user_id, s.CreateDate as create_time, s.UpdateDate as update_time,
|
|
|
+a.ValidAmount as valid_amount, a.FixedAmount as fixed_amount, a.TempAmount as for_amount, ifnull(b.PromissAmount,0) as credit_amount
|
|
|
+from StoreHouse s
|
|
|
+left join UserAccount a on a.UserId = s.UserId
|
|
|
+left JOIN StoreHouseAmountPromiss b on s.UserId = b.ToUserId and b.status = 1
|
|
|
+GROUP BY s.UserId
|
|
|
+
|
|
|
+//机具回收表
|
|
|
+SELECT a.Id as id, a.UserId as user_id,a.CreateDate as create_time, a.UpdateDate as update_time,
|
|
|
+case a.PostType when 2 then 0 ELSE 1 end get_mode, a.RecycOrderNo as order_sn, a.RecycStoreId as warehouse_id,
|
|
|
+a.ErpCode as track_no, a.BrandId as brand_id, b.`Name` as brand_name,
|
|
|
+u.RealName as username, u.Mobile as phone, u.MakerCode as user_code,
|
|
|
+s.UserId as warehouse_user_id
|
|
|
+FROM RecycMachineOrder a
|
|
|
+LEFT JOIN KqProducts b on a.BrandId = b.Id
|
|
|
+left JOIN Users u on a.UserId = u.id
|
|
|
+LEFT JOIN StoreHouse s on s.id = a.RecycStoreId
|
|
|
+-------
|
|
|
+SELECT a.Id as id, a.CreateDate as create_time, a.UpdateDate as update_time,
|
|
|
+a.SnNo as pos_sn, a.OrderId as order_id, a.BrandId as brand_id, a.ResultDate as confirm_time, a.CancelDate as cancel_time,
|
|
|
+case a.Status when -1 then 3 when 0 then 0 when 1 then 1 when 2 then 2 end status, b.RecycEndDate as recycle_end_time
|
|
|
+FROM RecycMachineOrderPos a LEFT JOIN PosMachinesTwo b on a.SnNo = b.PosSn
|