| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212 |
- package supplier
- import (
- . "dashoo.cn/backend/api/mydb"
- "github.com/go-xorm/xorm"
- "strconv"
- )
- type OilSupplierSession struct {
- MySessionBase
- }
- func GetOilSupplierSession(session *xorm.Session) *OilSupplierSession {
- s := new(OilSupplierSession)
- s.Session = session
- return s
- }
- func (s *OilSupplierSession) CanUpdateSupplier(oilSupplierCertTableName string, supplierId int) (bool){
- sql := "select count(*) from " + oilSupplierCertTableName + " where SupplierId='" + strconv.Itoa(supplierId) + "' and status > 0"
- resultsSlice, _ := s.Session.Query(sql)
- var total int64
- if len(resultsSlice) > 0 {
- results := resultsSlice[0]
- for _, value := range results {
- total, _ = strconv.ParseInt(string(value), 10, 64)
- break
- }
- }
- return total <= 0
- }
- func (s *OilSupplierSession) GetUpdateCols(oilSupplierCertTableName string, supplierTypeCode string, supplierId int) ([]string){
- canEdit := s.CanUpdateSupplier(oilSupplierCertTableName, supplierId)
- cols := []string{
- "SupplierName",
- "OilCertificateNo",
- "Grade",
- "MgrUnit",
- "OperType",
- "Country",
- "MaunAgent",
- "ConstructTeam",
- "CommercialNo",
- "OrganCode",
- "CountryTaxNo",
- "LocalTaxNo",
- "Address",
- "Province",
- "City",
- "Street",
- "HouseNo",
- "ZipCode",
- "QualitySystemCert",
- "ProductQualityCert",
- "MaunLicense",
- "QualifCert",
- "QualifCertLevel",
- "SafetyLicense",
- "TechServiceLic",
- "TJInNotify",
- "SpecIndustryCert",
- "LegalPerson",
- "CategoryCode",
- "CategoryName",
- "RegCapital",
- "Currency",
- "ContactName",
- "CompanyType",
- "SetupTime",
- "DepositBank",
- "BankAccount",
- "EMail",
- "BankCreditRating",
- "Mobile",
- "Telphone",
- "Fax",
- "CompanyTel",
- "QQ",
- "CompanyUrl",
- "SpecSupplier",
- "SpecTypeCode",
- "SpecTypeName",
- /*"WorkerTotal",
- "ContractNum ",
- "UniversityNum",
- "TechnicalNum",
- "AboveProfNum",
- "MiddleProfNum",
- "NationalRegNum",
- "NationalCertTotal",
- "DesignerTotal",
- "SkillerTotal",*/
- "Remark",
- "IsDelete",
- "CreateOn",
- "CreateUserId",
- "CreateBy",
- "ModifiedOn",
- "ModifiedUserId",
- "ModifiedBy",
- "LinkAddress",
- "LinkProvince",
- "LinkCity",
- "LinkStreet",
- "LinkHouseNo",
- "LinkZipCode",
- "HseTraining",
- "CredentialFlag",
- "SupplierCertificate",
- "PACNumber",
- }
- if !canEdit {
- cols = []string{
- "OilCertificateNo",
- "Grade",
- "MgrUnit",
- "OperType",
- "Country",
- "MaunAgent",
- "ConstructTeam",
- "CommercialNo",
- "OrganCode",
- "QualitySystemCert",
- "ProductQualityCert",
- "MaunLicense",
- "QualifCert",
- "QualifCertLevel",
- "SafetyLicense",
- "TechServiceLic",
- "TJInNotify",
- "SpecIndustryCert",
- "LegalPerson",
- "CategoryCode",
- "CategoryName",
- "RegCapital",
- "Currency",
- "ContactName",
- "WorkerTotal",
- "ContractNum ",
- "UniversityNum",
- "TechnicalNum",
- "AboveProfNum",
- "MiddleProfNum",
- "NationalRegNum",
- "NationalCertTotal",
- "DesignerTotal",
- "SkillerTotal",
- "Remark",
- }
- }
- return cols
- }
|