feat:完善项目信息
This commit is contained in:
@ -12,33 +12,35 @@ type ManageCompany struct {
|
||||
}
|
||||
|
||||
type (
|
||||
// ManageCompanyBasic 公司企业基本信息
|
||||
ManageCompanyBasic struct {
|
||||
*model.ManageCompany
|
||||
model.Area
|
||||
}
|
||||
// ManageCompanyInfo 公司企业信息
|
||||
ManageCompanyInfo struct {
|
||||
model.Model
|
||||
Kind model.ManageCompanyKind `json:"kind"`
|
||||
Name string `json:"name"`
|
||||
Code string `json:"code"`
|
||||
Industry string `json:"industry"`
|
||||
Industry string `json:"-"`
|
||||
Address string `json:"address"`
|
||||
*model.Examine
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
model.Area
|
||||
TenantProvince string `json:"-"`
|
||||
TenantCity string `json:"-"`
|
||||
}
|
||||
// ManageCompanyDetail 公司企业信息
|
||||
ManageCompanyDetail struct {
|
||||
*model.ManageCompany
|
||||
model.Area
|
||||
}
|
||||
)
|
||||
|
||||
// Company 公司企业信息
|
||||
func (m *ManageCompany) Company(id uint64) (*ManageCompanyBasic, error) {
|
||||
func (m *ManageCompany) Company(id uint64) (*ManageCompanyDetail, error) {
|
||||
db := orm.GetDB().Table(m.TableName()+" AS c").
|
||||
Select("c.*", "t.province", "t.city").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS t ON c.tenant_id = t.id", model.NewSysTenant().TableName())).
|
||||
Where("c.id = ?", id)
|
||||
|
||||
out := new(ManageCompanyBasic)
|
||||
out := new(ManageCompanyDetail)
|
||||
|
||||
err := db.Scan(out).Error
|
||||
|
||||
@ -47,8 +49,9 @@ func (m *ManageCompany) Company(id uint64) (*ManageCompanyBasic, error) {
|
||||
|
||||
func (m *ManageCompany) Companys(page, pageSize int, count *int64, where ...*model.ModelWhere) ([]*ManageCompanyInfo, error) {
|
||||
db := orm.GetDB().Table(m.TableName()+" AS c").
|
||||
Select("c.id", "c.kind", "c.name", "c.code", "c.industry", "c.address", "c.examine_status", "c.created_at",
|
||||
"t.province", "t.city").
|
||||
Select("c.id", "c.kind", "c.name", "c.code", "c.industry", "c.address", "c.examine_status",
|
||||
"c.created_at", "c.province", "c.city",
|
||||
"t.province AS tenant_province", "t.city AS tenant_city").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS t ON c.tenant_id = t.id", model.NewSysTenant().TableName())).
|
||||
Where("c.is_deleted = ?", model.DeleteStatusForNot)
|
||||
|
||||
|
Reference in New Issue
Block a user