Преглед на файлове

修改我的项目数量

xuzhiheng преди 2 години
родител
ревизия
5dffe44d88
променени са 5 файла, в които са добавени 21 реда и са изтрити 3 реда
  1. 11 1
      entity/entity.go
  2. 1 1
      rpc/biservice.go
  3. 7 0
      rpc/etc/biservice.yaml
  4. 1 0
      rpc/internal/config/config.go
  5. 1 1
      service/yearEndReport.go

+ 11 - 1
entity/entity.go

@@ -14,12 +14,13 @@ var (
 	JyMysql    *mysql.Mysql
 	JyDocMysql *mysql.Mysql
 	JyBiMysql  *mysql.Mysql
+	JyTidb     *mysql.Mysql
 	Mgo        *mongodb.MongodbSim
 	Es         *elastic.Elastic
 	AreaCode   = map[string]string{}
 )
 
-func InitMysql(n, x, y *mysql.Mysql) {
+func InitMysql(n, x, y, z *mysql.Mysql) {
 	JyMysql = &mysql.Mysql{
 		Address:      n.Address,
 		UserName:     n.UserName,
@@ -47,6 +48,15 @@ func InitMysql(n, x, y *mysql.Mysql) {
 		MaxIdleConns: y.MaxIdleConns,
 	}
 	JyBiMysql.Init()
+	JyTidb = &mysql.Mysql{
+		Address:      z.Address,
+		UserName:     z.UserName,
+		PassWord:     z.PassWord,
+		DBName:       z.DBName,
+		MaxOpenConns: z.MaxOpenConns,
+		MaxIdleConns: z.MaxIdleConns,
+	}
+	JyTidb.Init()
 	logx.Info("初始化mysql")
 }
 

+ 1 - 1
rpc/biservice.go

@@ -26,7 +26,7 @@ func main() {
 	conf.MustLoad(*configFile, &c)
 	ctx := svc.NewServiceContext(c)
 	srv := server.NewBiServiceServer(ctx)
-	entity.InitMysql(c.Mysql.JianYu, c.Mysql.JyDoc, c.Mysql.Bi)
+	entity.InitMysql(c.Mysql.JianYu, c.Mysql.JyDoc, c.Mysql.Bi, c.Mysql.Tidb)
 	entity.InitMongo(c.Mongo.Qfw.MongodbAddr, c.Mongo.Qfw.DbName, c.Mongo.Qfw.Size)
 	entity.InitEs(c.Es.Address, c.Es.DbSize)
 	entity.InitArea()

+ 7 - 0
rpc/etc/biservice.yaml

@@ -27,6 +27,13 @@ Mysql:
     PassWord: "Xzh#20221122K"
     MaxOpenConns: 5
     MaxIdleConns: 5
+  Tidb:
+    DBName: base_service
+    Address: 192.168.3.217:4000
+    UserName: root
+    PassWord: "=PDT49#80Z!RVv52_z"
+    MaxOpenConns: 5
+    MaxIdleConns: 5
 Mongo:
   Qfw:
     MongodbAddr: 192.168.3.206:27080

+ 1 - 0
rpc/internal/config/config.go

@@ -14,6 +14,7 @@ type Config struct {
 		JianYu *mysql.Mysql
 		JyDoc  *mysql.Mysql
 		Bi     *mysql.Mysql
+		Tidb   *mysql.Mysql
 	}
 	Mongo struct {
 		Qfw struct {

+ 1 - 1
service/yearEndReport.go

@@ -101,7 +101,7 @@ func AddProject(this *biservice.AddProjectReq, addCountLimit int) *biservice.Add
 func MyDataAsset(this *biservice.MyDataAssetReq) *biservice.MyDataAssetResp {
 	collectInfoCount, followProjectCount, collectDocCount, claimCustomerCount, claimNzjCount := int64(0), int64(0), int64(0), int64(0), int64(0)
 	collectInfoCount = JyMysql.CountBySql(`select count(1) from bdcollection where userid=?`, this.UserId)
-	followProjectCount = int64(Mgo.Count("follow_project", map[string]interface{}{"s_userid": this.UserId})) + int64(Mgo.Count("follow_project_bigvip", map[string]interface{}{"s_userid": this.UserId}))
+	followProjectCount = JyTidb.CountBySql(`select count(1) from follow_project_monitor where s_userid=?`, this.UserId)
 	claimCustomerCount = JyMysql.CountBySql(`select count(1) from entniche_user_customer where user_id=? and source=1`, this.EntUserId)
 	collectDocCount = JyDocMysql.CountBySql(`select count(1) from user_doc where userId=? and docCategory=2 and isDelete=0`, this.UserId)
 	claimNzjCount = JyBiMysql.CountBySql(`select count(1) from dwd_f_user_claim where user_id=? and status=0 and source_type=1`, this.NewUserId)