$str="select ".$field." FROM ".$this->_tableName." LEFT JOIN (SELECT MIN(discount_price) discount_price,goods_commonid,goods_id FROM han_sale_goods where sale_act_id in(".implode(',',$actIds).") GROUP BY goods_commonid) a on (han_goods_common.goods_commonid = a.goods_commonid)";
if($attrStr){
$str.="INNER JOIN han_goods_attribute_value ON han_goods_attribute_value.goods_commonid = han_goods_common.goods_commonid ";
...
...
@@ -147,7 +170,7 @@ class GoodsCommonModel extends \DAO\AbstractModel {
$updateSql=\Our\Common::format(" WHEN {0} THEN goods_storage-{1} ",$datas[$i]['goodsCommonId'],$datas[$i]['goodsNum']);
$updateSql=\Our\Common::format(" WHEN {0} THEN goods_storage{1}{2} ",$datas[$i]['goodsCommonId'],\Our\ArrayConst::ops[$op],$datas[$i]['goodsNum']);
if($updateSaleNumFlag){
$updateSql=\Our\Common::format(" WHEN {0} THEN goods_storage{1}{2} END,sale_num = case goods_commonid when {0} THEN sale_num {3}{2} END",$datas[$i]['goodsCommonId'],\Our\ArrayConst::ops[$op],$datas[$i]['goodsNum'],$updateSaleNumOp);
}
$dataIds[]=$datas[$i]['goodsCommonId'];
$updateAllSql.=$updateSql;
$updateAllSql.=$updateSql;;
if($i%1000==0&&$i!=0){
$updateAllSql.=\Our\Common::format('END where goods_commonid in ({0})',implode(',',$dataIds));
$updateAllSql.=\Our\Common::format(' where goods_commonid in ({0})',implode(',',$dataIds));