Commit 19a8992c authored by zhz's avatar zhz

goods

parent 77cd5896
...@@ -67,9 +67,9 @@ class GoodsCommonModel extends \DAO\AbstractModel { ...@@ -67,9 +67,9 @@ class GoodsCommonModel extends \DAO\AbstractModel {
*/ */
public function getGoodsList($where,$field,$limit=array(),$order=array(),$attrStr=''){ public function getGoodsList($where,$field,$limit=array(),$order=array(),$attrStr=''){
$this->setDb($this->dbName); $this->setDb($this->dbName);
if($attrStr) { // if($attrStr) {
$field .= 'DISTINCT '.$field; // $field .= 'DISTINCT '.$field;
} // }
$str = '$data = $this->db->select($field)->from($this->_tableName)'; $str = '$data = $this->db->select($field)->from($this->_tableName)';
if($attrStr){ if($attrStr){
$str .="->join('han_goods_attribute_value','han_goods_attribute_value.goods_commonid = han_goods_common.goods_commonid')"; $str .="->join('han_goods_attribute_value','han_goods_attribute_value.goods_commonid = han_goods_common.goods_commonid')";
...@@ -103,9 +103,9 @@ class GoodsCommonModel extends \DAO\AbstractModel { ...@@ -103,9 +103,9 @@ class GoodsCommonModel extends \DAO\AbstractModel {
*/ */
public function getListWithSale($where,$field,$actIds,$limit=array(),$order=array(),$attrStr='',$online = true){ public function getListWithSale($where,$field,$actIds,$limit=array(),$order=array(),$attrStr='',$online = true){
$this->setDb($this->dbName); $this->setDb($this->dbName);
if($attrStr) { // if($attrStr) {
$field .= 'DISTINCT '.$field; // $field .= 'DISTINCT '.$field;
} // }
$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)"; $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){ if($attrStr){
$str .= "INNER JOIN han_goods_attribute_value ON han_goods_attribute_value.goods_commonid = han_goods_common.goods_commonid "; $str .= "INNER JOIN han_goods_attribute_value ON han_goods_attribute_value.goods_commonid = han_goods_common.goods_commonid ";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment