mirror of
https://github.com/Karaka-Management/oms-HumanResourceManagement.git
synced 2026-02-15 20:28:41 +00:00
Add unit, dep, pos. to employee
This commit is contained in:
parent
2ad006e339
commit
adbd33c630
|
|
@ -44,14 +44,23 @@ class Installer extends InstallerAbstract
|
||||||
'CREATE TABLE if NOT EXISTS `' . $dbPool->get()->prefix . 'hr_staff` (
|
'CREATE TABLE if NOT EXISTS `' . $dbPool->get()->prefix . 'hr_staff` (
|
||||||
`hr_staff_id` int(11) NOT NULL AUTO_INCREMENT,
|
`hr_staff_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
`hr_staff_account` int(11) DEFAULT NULL,
|
`hr_staff_account` int(11) DEFAULT NULL,
|
||||||
|
`hr_staff_unit` int(11) DEFAULT NULL,
|
||||||
|
`hr_staff_department` int(11) DEFAULT NULL,
|
||||||
|
`hr_staff_position` int(11) DEFAULT NULL,
|
||||||
PRIMARY KEY (`hr_staff_id`),
|
PRIMARY KEY (`hr_staff_id`),
|
||||||
KEY `hr_staff_account` (`hr_staff_account`)
|
KEY `hr_staff_account` (`hr_staff_account`),
|
||||||
|
KEY `hr_staff_unit` (`hr_staff_unit`),
|
||||||
|
KEY `hr_staff_department` (`hr_staff_department`),
|
||||||
|
KEY `hr_staff_position` (`hr_staff_position`)
|
||||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8;'
|
)ENGINE=InnoDB DEFAULT CHARSET=utf8;'
|
||||||
)->execute();
|
)->execute();
|
||||||
|
|
||||||
$dbPool->get()->con->prepare(
|
$dbPool->get()->con->prepare(
|
||||||
'ALTER TABLE `' . $dbPool->get()->prefix . 'hr_staff`
|
'ALTER TABLE `' . $dbPool->get()->prefix . 'hr_staff`
|
||||||
ADD CONSTRAINT `' . $dbPool->get()->prefix . 'hr_staff_ibfk_1` FOREIGN KEY (`hr_staff_account`) REFERENCES `' . $dbPool->get()->prefix . 'account` (`account_id`);'
|
ADD CONSTRAINT `' . $dbPool->get()->prefix . 'hr_staff_ibfk_1` FOREIGN KEY (`hr_staff_account`) REFERENCES `' . $dbPool->get()->prefix . 'account` (`account_id`),
|
||||||
|
ADD CONSTRAINT `' . $dbPool->get()->prefix . 'hr_staff_ibfk_2` FOREIGN KEY (`hr_staff_unit`) REFERENCES `' . $dbPool->get()->prefix . 'organization_unit` (`organization_unit_id`),
|
||||||
|
ADD CONSTRAINT `' . $dbPool->get()->prefix . 'hr_staff_ibfk_3` FOREIGN KEY (`hr_staff_department`) REFERENCES `' . $dbPool->get()->prefix . 'organization_department` (`organization_department_id`),
|
||||||
|
ADD CONSTRAINT `' . $dbPool->get()->prefix . 'hr_staff_ibfk_4` FOREIGN KEY (`hr_staff_position`) REFERENCES `' . $dbPool->get()->prefix . 'organization_position` (`organization_position_id`);'
|
||||||
)->execute();
|
)->execute();
|
||||||
|
|
||||||
$dbPool->get()->con->prepare(
|
$dbPool->get()->con->prepare(
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,12 @@ class Employee {
|
||||||
|
|
||||||
private $account = null;
|
private $account = null;
|
||||||
|
|
||||||
|
private $unit = null;
|
||||||
|
|
||||||
|
private $department = null;
|
||||||
|
|
||||||
|
private $position = null;
|
||||||
|
|
||||||
private $history = [];
|
private $history = [];
|
||||||
|
|
||||||
private $status = [];
|
private $status = [];
|
||||||
|
|
@ -50,6 +56,36 @@ class Employee {
|
||||||
return $this->account;
|
return $this->account;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setUnit($unit)
|
||||||
|
{
|
||||||
|
$this->unit = $unit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUnit()
|
||||||
|
{
|
||||||
|
return $this->unit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDepartment($department)
|
||||||
|
{
|
||||||
|
$this->department = $department;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDepartment()
|
||||||
|
{
|
||||||
|
return $this->department;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPosition($position)
|
||||||
|
{
|
||||||
|
$this->position = $position;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPosition()
|
||||||
|
{
|
||||||
|
return $this->position;
|
||||||
|
}
|
||||||
|
|
||||||
public function getId() : int
|
public function getId() : int
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,9 @@ declare(strict_types=1);
|
||||||
namespace Modules\HumanResourceManagement\Models;
|
namespace Modules\HumanResourceManagement\Models;
|
||||||
|
|
||||||
use Modules\Admin\Models\AccountMapper;
|
use Modules\Admin\Models\AccountMapper;
|
||||||
|
use Modules\Organization\Models\UnitMapper;
|
||||||
|
use Modules\Organization\Models\DepartmentMapper;
|
||||||
|
use Modules\Organization\Models\PositionMapper;
|
||||||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||||
|
|
||||||
class EmployeeMapper extends DataMapperAbstract
|
class EmployeeMapper extends DataMapperAbstract
|
||||||
|
|
@ -29,12 +32,27 @@ class EmployeeMapper extends DataMapperAbstract
|
||||||
protected static $columns = [
|
protected static $columns = [
|
||||||
'hr_staff_id' => ['name' => 'hr_staff_id', 'type' => 'int', 'internal' => 'id'],
|
'hr_staff_id' => ['name' => 'hr_staff_id', 'type' => 'int', 'internal' => 'id'],
|
||||||
'hr_staff_account' => ['name' => 'hr_staff_account', 'type' => 'int', 'internal' => 'account'],
|
'hr_staff_account' => ['name' => 'hr_staff_account', 'type' => 'int', 'internal' => 'account'],
|
||||||
|
'hr_staff_unit' => ['name' => 'hr_staff_unit', 'type' => 'int', 'internal' => 'unit'],
|
||||||
|
'hr_staff_department' => ['name' => 'hr_staff_department', 'type' => 'int', 'internal' => 'department'],
|
||||||
|
'hr_staff_position' => ['name' => 'hr_staff_position', 'type' => 'int', 'internal' => 'position'],
|
||||||
];
|
];
|
||||||
|
|
||||||
protected static $ownsOne = [
|
static protected $belongsTo = [
|
||||||
'account' => [
|
'account' => [
|
||||||
'mapper' => AccountMapper::class,
|
'mapper' => AccountMapper::class,
|
||||||
'src' => 'hr_staff_account',
|
'src' => 'hr_staff_account',
|
||||||
|
],
|
||||||
|
'unit' => [
|
||||||
|
'mapper' => UnitMapper::class,
|
||||||
|
'src' => 'hr_staff_unit',
|
||||||
|
],
|
||||||
|
'department' => [
|
||||||
|
'mapper' => DepartmentMapper::class,
|
||||||
|
'src' => 'hr_staff_department',
|
||||||
|
],
|
||||||
|
'position' => [
|
||||||
|
'mapper' => PositionMapper::class,
|
||||||
|
'src' => 'hr_staff_position',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user