-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUser.php
More file actions
82 lines (71 loc) · 1.59 KB
/
User.php
File metadata and controls
82 lines (71 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php declare(strict_types=1);
namespace Tests\DbModel\TestModel;
/**
* 用户表
*
* @author fdipzone
* @DateTime 2024-12-26 15:29:49
*
*/
class User extends \DbModel\AbstractDbModel implements \DbModel\IDbModel
{
// 数据库名
protected $db_name = 'test_user';
// 数据表名
protected $table_name = 'user';
// 数据表注释
protected $table_comment = '用户表';
// 自增值
protected $auto_increment = 1001;
/**
* 用户id
*
* @Column name=id type=int length=11 is_null=0 is_unsigned=1 auto_increment=1 comment=用户id
* @var int
*/
private $id;
/**
* 电话
*
* @Column name=phone type=varchar length=11 is_null=0 comment=电话号码
* @var string
*/
private $phone;
/**
* 姓名
*
* @Column name=name type=varchar length=11 is_null=0 default='' comment=姓名
* @var string
*/
private $name;
/**
* 年龄
*
* @Column name=age type=tinyint length=3 is_null=0 is_unsigned=1 default=0 comment=年龄
* @var int
*/
private $age;
/**
* 备注
*
* @Column name=remark type=text is_null=0 comment=备注
* @var string
*/
private $remark;
/**
* 获取数据表索引设置
*
* @author fdipzone
* @DateTime 2024-12-28 17:14:32
*
* @return string
*/
public function tableIndex(): string
{
$index = [
'UNIQUE INDEX `phone` (`phone` ASC)',
'INDEX `age` (`age` ASC)',
];
return implode(','.PHP_EOL, $index);
}
}