Class: EducodeSales::BusinessSubjectShixun
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- EducodeSales::BusinessSubjectShixun
- Defined in:
- app/models/educode_sales/business_subject_shixun.rb
Defined Under Namespace
Modules: CATEGORY_TYPE
Instance Method Summary collapse
- #all_staff ⇒ Object
-
#audit_history ⇒ Object
查询审核历史和审核人.
-
#shixun_manages ⇒ Object
项目状态: 待建设(constructed) 已签协议(signed) 建设中(construction) 审核中(review),返修中(repair) 已内部公开(public), 已公开发布(published) 已经付费(paid) enum shixun_status: { constructed: 1, signed: 2, construction: 3, review: 4, repair: 5, public: 6, published: 7,paid: 8}.
- #shixun_producer ⇒ Object
- #shixun_school ⇒ Object
- #shixun_staff ⇒ Object
Instance Method Details
#all_staff ⇒ Object
41 42 43 |
# File 'app/models/educode_sales/business_subject_shixun.rb', line 41 def all_staff staffs.joins(staff: :user).distinct.select("users.id") end |
#audit_history ⇒ Object
查询审核历史和审核人
59 60 61 62 63 64 65 66 67 68 |
# File 'app/models/educode_sales/business_subject_shixun.rb', line 59 def audit_history ShixunDectect.joins("join educode_sales_staffs on educode_sales_staffs.id = educode_sales_shixun_dectects.reviewed_id join users on users.id = educode_sales_staffs.user_id") .where(business_subject_shixun_id: id) .where("dectect_type != 0") .select("educode_sales_shixun_dectects.*, CONCAT(users.lastname, users.firstname) as examine_name") .order("created_at desc") .all end |
#shixun_manages ⇒ Object
项目状态: 待建设(constructed) 已签协议(signed) 建设中(construction) 审核中(review),返修中(repair) 已内部公开(public), 已公开发布(published) 已经付费(paid) enum shixun_status: { constructed: 1, signed: 2, construction: 3, review: 4, repair: 5, public: 6, published: 7,paid: 8}
30 31 32 |
# File 'app/models/educode_sales/business_subject_shixun.rb', line 30 def shixun_manages staffs.joins(staff: :user).where(category: BusinessSubjectStaff::CATEGORY_TYPES::SHIXUN_MANAGE).pluck("CONCAT(users.lastname, users.firstname) ").join(",") end |
#shixun_producer ⇒ Object
34 35 36 |
# File 'app/models/educode_sales/business_subject_shixun.rb', line 34 def shixun_producer staffs.joins(staff: :user).where(category: BusinessSubjectStaff::CATEGORY_TYPES::SHIXUN_PRODUCER).pluck("CONCAT(users.lastname, users.firstname) ").join(",") end |
#shixun_school ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'app/models/educode_sales/business_subject_shixun.rb', line 44 def shixun_school name = "" shixuns = BusinessSubjectShixun.find(id) if shixuns.school.present? name = shixuns.school.name end if shixuns.business_subject.present? if shixuns.business_subject.business.present? name = shixuns.business_subject.business.school.name end end p name end |
#shixun_staff ⇒ Object
38 39 40 |
# File 'app/models/educode_sales/business_subject_shixun.rb', line 38 def shixun_staff staffs.joins(staff: :user).where(category: BusinessSubjectStaff::CATEGORY_TYPES::SHIXUN_STAFF).pluck("CONCAT(users.lastname, users.firstname) ").join(",") end |