12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
- namespace app\common\service;
- use app\common\constant\CommonConstant;
- use app\common\model\ApproveMaintainUser;
- use app\common\model\Department;
- use app\common\model\User;
- /**
- * 用户服务类
- */
- class UserService
- {
- /**
- * 列表
- *
- * @param integer $type
- * @param integer $offset 起始位置
- * @param integer $length 查询数量
- **/
- public static function get_list($type = 0,$offset = 0, $length = 1000)
- {
- $list = User::field('userid,name')
- ->when($type == 0,function ($query){
- $query->where('status', CommonConstant::IS_WHO_1);
- })
- ->where('is_deleted', CommonConstant::IS_DELETED_0)
- ->limit($offset, $length)
- ->select();
- return $list;
- }
- /**
- * 维修人员列表
- *
- * @param integer $type 类型:1=物业主管,2=信息负责人
- **/
- public static function get_maintain_user($type){
- $list = ApproveMaintainUser::field('is_deleted',true)
- ->where('is_deleted',CommonConstant::IS_DELETED_0)
- ->where('type',$type)
- ->select();
- return $list;
- }
- /**
- * 部门列表
- **/
- public static function get_department_column(){
- $list = Department::where('is_deleted',CommonConstant::IS_DELETED_0)
- ->column('dept_id,name');
- return $list;
- }
- /**
- * 根据用户的所属部门获取部门列表
- *
- * @param string $dept_ids 部门ids
- **/
- public static function get_user_department_list($dept_ids){
- $list = Department::field('dept_id,name')
- ->where('dept_id', 'in', $dept_ids)
- ->where('is_deleted',CommonConstant::IS_DELETED_0)
- ->select();
- return $list;
- }
- }
|