- GetStoreAbnormalSkuCount添加syncStatus与isBySku参数
This commit is contained in:
@@ -418,22 +418,34 @@ func GetStoresSkus(ctx *jxcontext.Context, storeIDs []int, isFocus bool, keyword
|
||||
return skuNamesInfo, err
|
||||
}
|
||||
|
||||
func GetStoreAbnoramlSkuCount(ctx *jxcontext.Context, storeID int) (count int, err error) {
|
||||
func GetStoreAbnormalSkuCount(ctx *jxcontext.Context, storeID, syncStatus int, isBySku bool) (count int, err error) {
|
||||
db := dao.GetDB()
|
||||
sql := `
|
||||
SELECT COUNT(*) ct
|
||||
FROM store_sku_bind t1
|
||||
JOIN sku t2 ON t2.id = t1.sku_id AND t2.deleted_at = ?
|
||||
JOIN sku_name t3 ON t3.id = t2.name_id AND t3.deleted_at = ?
|
||||
WHERE t1.deleted_at = ? AND t1.store_id = ? AND
|
||||
(t1.jd_sync_status <> 0 OR t1.ebai_sync_status <> 0 OR t1.mtwm_sync_status <> 0) AND
|
||||
((t2.status = ? AND t3.status = ?) OR t1.status = ?)
|
||||
`
|
||||
SELECT COUNT(*) ct`
|
||||
if !isBySku {
|
||||
sql += `
|
||||
FROM (
|
||||
SELECT DISTINCT t3.id`
|
||||
}
|
||||
sql += `
|
||||
FROM store_sku_bind t1
|
||||
JOIN sku t2 ON t2.id = t1.sku_id AND t2.deleted_at = ?
|
||||
JOIN sku_name t3 ON t3.id = t2.name_id AND t3.deleted_at = ?
|
||||
WHERE t1.deleted_at = ? AND t1.store_id = ? AND
|
||||
(t1.jd_sync_status & ? <> 0 OR t1.ebai_sync_status & ? <> 0 OR t1.mtwm_sync_status & ? <> 0) AND
|
||||
((t2.status = ? AND t3.status = ?) OR t1.status = ?)`
|
||||
if !isBySku {
|
||||
sql += `
|
||||
) t1`
|
||||
}
|
||||
sqlParams := []interface{}{
|
||||
utils.DefaultTimeValue,
|
||||
utils.DefaultTimeValue,
|
||||
utils.DefaultTimeValue,
|
||||
storeID,
|
||||
syncStatus,
|
||||
syncStatus,
|
||||
syncStatus,
|
||||
model.SkuStatusNormal,
|
||||
model.SkuStatusNormal,
|
||||
model.SkuStatusNormal,
|
||||
|
||||
@@ -96,12 +96,14 @@ func (c *StoreSkuController) GetStoresSkus() {
|
||||
// @Description 得到异常门店商品数量
|
||||
// @Param token header string true "认证token"
|
||||
// @Param storeID query int true "门店ID"
|
||||
// @Param syncStatus query int true "同步标志掩码"
|
||||
// @Param isBySku query bool false "是否按SKU分拆"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /GetStoreAbnoramlSkuCount [get]
|
||||
func (c *StoreSkuController) GetStoreAbnoramlSkuCount() {
|
||||
c.callGetStoreAbnoramlSkuCount(func(params *tStoreSkuGetStoreAbnoramlSkuCountParams) (retVal interface{}, errCode string, err error) {
|
||||
retVal, err = cms.GetStoreAbnoramlSkuCount(params.Ctx, params.StoreID)
|
||||
// @router /GetStoreAbnormalSkuCount [get]
|
||||
func (c *StoreSkuController) GetStoreAbnormalSkuCount() {
|
||||
c.callGetStoreAbnormalSkuCount(func(params *tStoreSkuGetStoreAbnormalSkuCountParams) (retVal interface{}, errCode string, err error) {
|
||||
retVal, err = cms.GetStoreAbnormalSkuCount(params.Ctx, params.StoreID, params.SyncStatus, params.IsBySku)
|
||||
return retVal, "", err
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1197,8 +1197,8 @@ func init() {
|
||||
|
||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreSkuController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:StoreSkuController"],
|
||||
beego.ControllerComments{
|
||||
Method: "GetStoreAbnoramlSkuCount",
|
||||
Router: `/GetStoreAbnoramlSkuCount`,
|
||||
Method: "GetStoreAbnormalSkuCount",
|
||||
Router: `/GetStoreAbnormalSkuCount`,
|
||||
AllowHTTPMethods: []string{"get"},
|
||||
MethodParams: param.Make(),
|
||||
Filters: nil,
|
||||
|
||||
Reference in New Issue
Block a user