Brand.php
2.35 KB
<?php
namespace YHMBrand\SqlMap\Brand;
class Brand {
const SELECT_HOT_BRAND_LIST = "select id,brand_name,brand_ico,yohobuy_brand_url from brand as b where is_hot='Y' and ( SELECT sum(stock_number) from goods AS g LEFT JOIN stock AS s ON g.product_skc = s.product_skc where b.id = brand_id and g. STATUS = 1)>0 order by order_by,id desc limit :offset,:num";
const SELECT_BY_PARAMS = "select * from brand where is_system_brand=:is_system_brand order by brand_alif asc limit :offset,:num";
const SELECT_USED_BRAND_LIST = "select brand_id from brand_user_relate where uid=:uid order by id desc limit :num";
const SELECT_ONE_BRAND_BY_ID = 'select * from brand where id=:id';
const FIND_BRAND_BY_NAME = 'select id,brand_name from brand where brand_name=:brand_name';
const INSERT_BRAND = 'insert into brand(brand_name,brand_alif,is_system_brand,create_time) values(:brand_name,:brand_alif,"N",UNIX_TIMESTAMP())';
const SELECT_RELATE = 'select * from brand_user_relate where uid=:uid and brand_id=:brand_id';
const INSERT_BRAND_USER_RELATE = 'insert into brand_user_relate(uid,brand_id,create_time) values(:uid,:brand_id,UNIX_TIMESTAMP())';
## Admin ##
const SELECT_BRAND_PAGE = 'select * from brand order by id desc limit :offset,:num';
const SELECT_HOT_BRAND = 'select * from brand where is_hot=:is_hot order by order_by desc limit :offset,:num';
const COUNT_BRAND = 'select count(id) from brand where status=:status and is_hot=:hot';
const SET_HOT_BY_BRAND_ID = "update brand set is_hot=:hot where id=:brand_id";
const SET_BRAND_INFO = 'update brand set brand_name=:brand_name,brand_ico=:brand_ico,brand_alif=:brand_alif,pinyin=:brand_pinyin,order_by=:order_by,is_hot=:is_hot,status=:status where id=:brand_id';
const SELECT_COUNT_BRAND_BY_SYSTEM = 'select count(1) from brand where is_system_brand=:is_system_brand #sql#';
const SELECT_LIST_BRAND_BY_SYSTEM = 'select * from brand where is_system_brand=:is_system_brand #sql# order by order_by,id desc limit :offset,:num';
const INSERT_BRAND_ALL = 'insert into brand(brand_name,brand_alif,is_system_brand,brand_ico,create_time) values(:brand_name,:brand_alif,:is_system_brand,:brand_ico,UNIX_TIMESTAMP())';
const UPDATE_BRAND_SYSTEM_BY_ID = "update brand set is_system_brand=:is_system where id=:id";
const DELETE_BY_ID = 'update brand set status=:status where id=:id';
}