Bladeren bron

千海金查客户资料增加生日查询条件

zou.yingbin 4 jaren geleden
bovenliggende
commit
85d494ff38
5 gewijzigde bestanden met toevoegingen van 33 en 3 verwijderingen
  1. 3 1
      controllers/qhjPCWeb/qryQhjPCWeb.go
  2. 6 0
      docs/docs.go
  3. 6 0
      docs/swagger.json
  4. 5 0
      docs/swagger.yaml
  5. 13 2
      models/qhjPCWeb.go

+ 3 - 1
controllers/qhjPCWeb/qryQhjPCWeb.go

@@ -42,6 +42,7 @@ func QuerySubArea(c *gin.Context) {
 // @Param customername query string false "客户名称(模糊匹配)"
 // @Param nickname query string false "昵称(模糊匹配)"
 // @Param brokername query string false "所属客户经理(模糊匹配)"
+// @Param birthday query string false "生日查询(格式 mmdd 或 mm) 只填2位表示月份匹配(mm, 如05 - 5月), 4位表示查月日匹配(mmdd, 如0503 -5月3日)"
 // @Param includesub query int false "是否包含子级 1-包含"
 // @Success 200 {array} models.QhjMgrCustomer
 // @Failure 500 {object} app.Response
@@ -57,11 +58,12 @@ func QueryCustomerInfo(c *gin.Context) {
 		NICKNAME     string `form:"nickname"`                                 // 昵称
 		INCLUDESUB   int32  `form:"includesub"`                               // 是否包含子级
 		BROKERNAME   string `form:"brokername"`                               // 所属客户经理
+		BIRTHDAY     string `form:"birthday"`                                 // 生日
 	}{}
 	a.DoBindReq(&req)
 	// Tips: 手机号码是加密存储的, 做不了模糊匹配, 加了又去掉了
 	m := models.QhjMgrCustomer{USERID: mtpcache.GetAreaUserId(req.USERID, 0), USERINFOTYPE: req.USERINFOTYPE, QUERYTYPE: req.QUERYTYPE,
-		CUSTOMERNAME: req.CUSTOMERNAME, NICKNAME: req.NICKNAME, IncludeSub: req.INCLUDESUB, BROKERNAME: req.BROKERNAME}
+		CUSTOMERNAME: req.CUSTOMERNAME, NICKNAME: req.NICKNAME, IncludeSub: req.INCLUDESUB, BROKERNAME: req.BROKERNAME, BIRTHDAY: req.BIRTHDAY}
 	a.DoGetDataI(&m)
 }
 

+ 6 - 0
docs/docs.go

@@ -8727,6 +8727,12 @@ var doc = `{
                         "in": "query"
                     },
                     {
+                        "type": "string",
+                        "description": "生日查询(格式 mmdd 或 mm) 只填2位表示月份匹配(mm, 如05 - 5月), 4位表示查月日匹配(mmdd, 如0503 -5月3日)",
+                        "name": "birthday",
+                        "in": "query"
+                    },
+                    {
                         "type": "integer",
                         "description": "是否包含子级 1-包含",
                         "name": "includesub",

+ 6 - 0
docs/swagger.json

@@ -8711,6 +8711,12 @@
                         "in": "query"
                     },
                     {
+                        "type": "string",
+                        "description": "生日查询(格式 mmdd 或 mm) 只填2位表示月份匹配(mm, 如05 - 5月), 4位表示查月日匹配(mmdd, 如0503 -5月3日)",
+                        "name": "birthday",
+                        "in": "query"
+                    },
+                    {
                         "type": "integer",
                         "description": "是否包含子级 1-包含",
                         "name": "includesub",

+ 5 - 0
docs/swagger.yaml

@@ -23081,6 +23081,11 @@ paths:
         in: query
         name: brokername
         type: string
+      - description: 生日查询(格式 mmdd 或 mm) 只填2位表示月份匹配(mm, 如05 - 5月), 4位表示查月日匹配(mmdd,
+          如0503 -5月3日)
+        in: query
+        name: birthday
+        type: string
       - description: 是否包含子级 1-包含
         in: query
         name: includesub

+ 13 - 2
models/qhjPCWeb.go

@@ -93,7 +93,7 @@ type QhjMgrCustomer struct {
 	LOGINCODE         string `json:"logincode"  xorm:"'LOGINCODE'"`                 // 登录账号(代码)
 	BROKERID          int64  `json:"brokerid"  xorm:"'BROKERID'"`                   // 所属客户经理id
 	BROKERNAME        string `json:"brokername"  xorm:"'BROKERNAME'"`               // 所属客户经理名称
-	BIRTHDAY          string `json:"birthday"  xorm:"'BIRTHDAY'"`                   // 生日
+	BIRTHDAY          string `json:"birthday"  xorm:"'BIRTHDAY'" form:"birthday"`   // 生日
 	SEX               int32  `json:"sex"  xorm:"'SEX'"`                             // 性别 0-女 1-男
 
 	COUNTRYNAME    string `json:"countryname"`    // 国家名称
@@ -206,7 +206,8 @@ select u.accountname brokername, a.*
                t.usertype,
                t.sex,
                to_char(t.birthday, 'yyyy-mm-dd hh24:mi:ss') birthday,
-               to_number(t.brokerid) brokerid
+               to_number(t.brokerid) brokerid,
+               t.birthday birthday2
           from wskh_userinfo t
          start with t.areaid = %v
         connect by prior t.userid = t.areaid
@@ -224,6 +225,11 @@ select u.accountname brokername, a.*
 	sqlId.JoinEx(len(r.CUSTOMERNAME) > 0, fmt.Sprintf(` and a.customername like '%%%v%%'`, r.CUSTOMERNAME))
 	sqlId.JoinEx(len(r.NICKNAME) > 0, fmt.Sprintf(` and a.nickname like '%%%v%%'`, r.NICKNAME))
 	sqlId.JoinEx(len(r.BROKERNAME) > 0, fmt.Sprintf(` and u.accountname like '%%%v%%'`, r.BROKERNAME))
+	if len(r.BIRTHDAY) == 2 {
+		sqlId.JoinFormat(" and to_char(a.birthday2, 'mm') = '%v'", r.BIRTHDAY)
+	} else if len(r.BIRTHDAY) == 4 {
+		sqlId.JoinFormat(" and to_char(a.birthday2, 'mmdd') = '%v'", r.BIRTHDAY)
+	}
 	return sqlId.String()
 }
 
@@ -291,6 +297,11 @@ select a.*,
 	sqlId.JoinEx(len(r.CUSTOMERNAME) > 0, fmt.Sprintf(` and u.customername like '%%%v%%'`, r.CUSTOMERNAME))
 	sqlId.JoinEx(len(r.NICKNAME) > 0, fmt.Sprintf(` and u.nickname like '%%%v%%'`, r.NICKNAME))
 	sqlId.JoinEx(len(r.BROKERNAME) > 0, fmt.Sprintf(` and u2.accountname like '%%%v%%'`, r.BROKERNAME))
+	if len(r.BIRTHDAY) == 2 {
+		sqlId.JoinFormat(" and to_char(u.birthday, 'mm') = '%v'", r.BIRTHDAY)
+	} else if len(r.BIRTHDAY) == 4 {
+		sqlId.JoinFormat(" and to_char(u.birthday, 'mmdd') = '%v'", r.BIRTHDAY)
+	}
 	return sqlId.String()
 }