\Framework\ORM\TraitServicesTrait

Trait ServicesTrait

Summary

Methods
Properties
Constants
get()
getOne()
batchUpdate()
sum()
update()
be()
value()
count()
getCount()
getColumn()
delete()
destroy()
save()
saveAll()
selectList()
bcInc()
bcDec()
decStockIncSales()
incStockDecSales()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

get()

get(mixed  $id, ?array  $field = []) : array|\Framework\ORM\Trait\Model|null

获取一条数据

Parameters

mixed $id
?array $field = []

Returns

array|\Framework\ORM\Trait\Model|null —

getOne()

getOne(array  $where, ?string  $field = '*') : array|\Framework\ORM\Trait\Model|null

获取一条数据(不走搜素器)

Parameters

array $where
?string $field = '*'

Returns

array|\Framework\ORM\Trait\Model|null —

batchUpdate()

batchUpdate(array  $ids, array  $data, ?string  $key = null) : string|null

批量修改

Parameters

array $ids
array $data
?string $key = null

Returns

string|null —

sum()

sum(array  $where, string  $field, bool  $search = false) : float

求和

Parameters

array $where
string $field
bool $search = false

Returns

float —

update()

update(mixed  $id, array  $data, ?string  $field = '') : mixed

修改数据

Parameters

mixed $id
array $data
?string $field = ''

Returns

mixed —

be()

be(mixed  $map, string  $field = '') : bool

查询一条数据是否存在

Parameters

mixed $map
string $field = ''

Returns

bool —

value()

value(array  $where, string  $field) : mixed

获取指定条件下的数据

Parameters

array $where
string $field

Returns

mixed —

count()

count(array  $where = []) : int

读取数据条数

Parameters

array $where = []

Returns

int —

getCount()

getCount(array  $where = []) : int

获取某些条件总数(不走搜素器)

Parameters

array $where = []

Returns

int —

getColumn()

getColumn(array  $where, string  $field, string  $key = '') : array

获取某个字段数组(不走搜素器)

Parameters

array $where
string $field
string $key = ''

Returns

array —

delete()

delete(mixed  $id, ?string  $key = null) : mixed

删除

Parameters

mixed $id
?string $key = null

Returns

mixed —

destroy()

destroy(array  $id, mixed  $force) : mixed

删除

Parameters

array $id
mixed $force

Returns

mixed —

save()

save(array  $data) : mixed

保存数据

Parameters

array $data

Returns

mixed —

saveAll()

saveAll(array  $data) : mixed

批量保存数据

Parameters

array $data

Returns

mixed —

selectList()

selectList(array  $where, string  $field = '*', int  $page = 0, int  $limit = 0, string  $order = '', array  $with = [], bool  $search = false) : \Framework\ORM\Trait\Model

获取列表

Parameters

array $where
string $field = '*'
int $page = 0
int $limit = 0
string $order = ''
array $with = []
bool $search = false

Returns

\Framework\ORM\Trait\Model —

bcInc()

bcInc(mixed  $key, string  $incField, string  $inc, string  $keyField = null, int  $acc = 2) : bool

高精度加法

Parameters

mixed $key
string $incField
string $inc
string $keyField = null
int $acc = 2

Returns

bool —

bcDec()

bcDec(mixed  $key, string  $decField, string  $dec, string  $keyField = null, int  $acc = 2) : bool

高精度 减法

Parameters

mixed $key
string $decField
string $dec
string $keyField = null
int $acc = 2

Returns

bool —

decStockIncSales()

decStockIncSales(array  $where, int  $num, string  $stock = 'stock', string  $sales = 'sales') : mixed

减库存加销量

Parameters

array $where
int $num
string $stock = 'stock'
string $sales = 'sales'

Returns

mixed —

incStockDecSales()

incStockDecSales(array  $where, int  $num, string  $stock = 'stock', string  $sales = 'sales') : mixed

加库存减销量

Parameters

array $where
int $num
string $stock = 'stock'
string $sales = 'sales'

Returns

mixed —