master
huanghai 5 years ago
parent 5212f2ac99
commit eda3df941f

@ -53,32 +53,31 @@ func TreeBasePosition() ([]map[string]interface{}, int, error) {
//根据单位ID获取职务信息
func ListBasePositionByBureauId(in *BasePositionProto.ListBasePositionByBureauIdArg) ([]map[string]interface{}, int, error) {
//1、所在单位
//1、获取单位信息
bureauId := in.BureauId
//2、获取单位信息
list := SqlKit.QueryByIds([]string{bureauId}, "t_base_organization")
if list == nil || len(list) == 0 {
return nil, -1, nil
}
//这个单位ID是哪个类型的org_type
//2、这个单位ID是哪个类型的org_type
orgType := list[0]["org_type"].(int64)
xxbxlxm := list[0]["xxbxlxm"].(string)
//区域代码
areaCode := list[0]["area_code"].(string)
//办学类型
xxbxlxm := list[0]["xxbxlxm"].(string)
//级别
var areaLevel int32
//获取org_type 1:教育局2学校
if orgType == 1 {
//通过areaCode 获取区域级别是1还是2
if areaCode[4:] == "00" {
areaLevel = 1
areaLevel = 1 //市级
} else {
areaLevel = 2
areaLevel = 2 //县区级
}
} else { //2是学校
//如果是学校因为学校全都是在县区中存在所以areaLevel=2
areaLevel = 2
//如果是学校,那么还需要知道 xxbxlxm
}
var myBuilder = builder.Dialect(builder.MYSQL).Select("*").From("t_base_position")
myBuilder.Where(builder.Eq{"b_use": 1})

@ -2,7 +2,6 @@ package main
import (
"fmt"
"log"
"net/http"
)
/**
@ -28,9 +27,11 @@ func HelloServer(w http.ResponseWriter, req *http.Request) {
fmt.Fprintf(w, "hello world")
}
func main() {
http.HandleFunc("/hello", HelloServer)
err := http.ListenAndServe(":12345", nil)
if err != nil {
log.Fatal("ListenAndServe: ", err)
}
//http.HandleFunc("/hello", HelloServer)
//err := http.ListenAndServe(":12345", nil)
//if err != nil {
// log.Fatal("ListenAndServe: ", err)
//}
areaCode:="11223344"
fmt.Println(areaCode[4:])
}

Loading…
Cancel
Save