diff --git a/dsBaseRpc/RpcService/BaseClass/BaseClassDao/BaseClassDao.go b/dsBaseRpc/RpcService/BaseClass/BaseClassDao/BaseClassDao.go index 5e7151a6..7c4ed60b 100644 --- a/dsBaseRpc/RpcService/BaseClass/BaseClassDao/BaseClassDao.go +++ b/dsBaseRpc/RpcService/BaseClass/BaseClassDao/BaseClassDao.go @@ -155,7 +155,7 @@ func GetStage(schoolId string) ([]map[string]interface{}, int32, error) { if err != nil { return nil, 0, err } - return SqlKit.QueryForPk(sql) + return SqlKit.Query(sql) } /** @@ -184,7 +184,7 @@ func GetRxnf(schoolId string, stageId string) ([]map[string]interface{}, int32, if err != nil { return nil, 0, err } - return SqlKit.QueryForPk(sql) + return SqlKit.Query(sql) } /** @@ -201,7 +201,7 @@ func ClearPersonBzr(teacherIds []string) error { if err != nil { return err } - list, _, err := SqlKit.QueryForPk(sql) + list, _, err := SqlKit.Query(sql) if err != nil { return err } diff --git a/dsBaseRpc/RpcService/BaseGlobal/BaseGlobalDao/BaseGlobalDao.go b/dsBaseRpc/RpcService/BaseGlobal/BaseGlobalDao/BaseGlobalDao.go index 09bca649..04548de4 100644 --- a/dsBaseRpc/RpcService/BaseGlobal/BaseGlobalDao/BaseGlobalDao.go +++ b/dsBaseRpc/RpcService/BaseGlobal/BaseGlobalDao/BaseGlobalDao.go @@ -45,7 +45,7 @@ func PageBaseGlobal(in *BaseGlobalProto.QueryArg) ([]map[string]interface{}, int } //获取拼接完成的SQL语句 sql, _ := myBuilder.OrderBy("global_id asc").Limit(limit, offset).ToBoundSQL() - list, count, err := SqlKit.QueryForPk(sql) + list, count, err := SqlKit.Query(sql) return list, count, err } @@ -56,6 +56,6 @@ func GetBaseGlobalByCodes(globalCodes []string) ([]map[string]interface{}, int32 myBuilder.And(builder.In("global_code", globalCodes)) //获取拼接完成的SQL语句 sql, _ := myBuilder.ToBoundSQL() - list, count, err := SqlKit.QueryForPk(sql) + list, count, err := SqlKit.Query(sql) return list, count, err } diff --git a/dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationDao/BaseOrganizationDao.go b/dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationDao/BaseOrganizationDao.go index 49474dfc..2fff1c94 100644 --- a/dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationDao/BaseOrganizationDao.go +++ b/dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationDao/BaseOrganizationDao.go @@ -164,7 +164,7 @@ func PageBaseOrganization(in *BaseOrganizationProto.QueryArg) ([]map[string]inte sql, _ := myBuilder.Limit(limit, offset).ToBoundSQL() //通过SQL获取带缓存的数据 - list, count, err := SqlKit.QueryForPk(sql) + list, count, err := SqlKit.Query(sql) //修改密码的显示项目 SysLoginpersonDao.FillPwd(&list) @@ -298,7 +298,7 @@ func GetBureauOrgTree(BureauId string) ([]map[string]interface{}, int32, error) myBuilder.Where(builder.Eq{"b_use": 1}).And(builder.Eq{"bureau_id": BureauId}).OrderBy("parent_id,sort_id") //通过SQL获取带缓存的数据 sql, _ := myBuilder.ToBoundSQL() - list, count, err := SqlKit.QueryForPk(sql) + list, count, err := SqlKit.Query(sql) return list, count, err } @@ -311,7 +311,7 @@ func GetOrgManager(Ids []string) ([]map[string]interface{}, int32, error) { And(builder.In("t1.org_id", Ids)) //通过SQL获取数据 sql, _ := myBuilder.ToBoundSQL() - list, count, err := SqlKit.QueryForPk(sql) + list, count, err := SqlKit.Query(sql) return list, count, err } @@ -426,7 +426,7 @@ func GetChildOrg(orgId string) ([]map[string]interface{}, int32, error) { if err != nil { return nil, 0, err } - return SqlKit.QueryForPk(sql) + return SqlKit.Query(sql) } /** diff --git a/dsBaseRpc/RpcService/BasePurview/BasePurviewDao/BasePurviewDao.go b/dsBaseRpc/RpcService/BasePurview/BasePurviewDao/BasePurviewDao.go index 18dbb012..32de6b59 100644 --- a/dsBaseRpc/RpcService/BasePurview/BasePurviewDao/BasePurviewDao.go +++ b/dsBaseRpc/RpcService/BasePurview/BasePurviewDao/BasePurviewDao.go @@ -67,7 +67,7 @@ func UpdateBasePurview(model models.TBasePurview, ForceUpdateFields []string) (i func GetRoleInfoByPersonId(personId string) ([]map[string]interface{}, error) { var myBuilder = builder.Dialect(builder.MYSQL).Select("id").From("t_base_role_person") sql, _ := myBuilder.Where(builder.Eq{"person_id": personId}).ToBoundSQL() - list, _, err := SqlKit.QueryForPk(sql) + list, _, err := SqlKit.Query(sql) return list, err } @@ -75,7 +75,7 @@ func GetRoleInfoByPersonId(personId string) ([]map[string]interface{}, error) { func GetPurviewByRoleArray(roleArray []string) ([]map[string]interface{}, error) { var myBuilder = builder.Dialect(builder.MYSQL).Select("id").From("t_base_purview_role") sql, _ := myBuilder.Where(builder.In("role_id", roleArray)).ToBoundSQL() - list, _, err := SqlKit.QueryForPk(sql) + list, _, err := SqlKit.Query(sql) return list, err } @@ -105,5 +105,5 @@ func PageBasePurview(in *BasePurviewProto.QueryArg) ([]map[string]interface{}, i //获取拼接完成的SQL语句 sql, _ := myBuilder.OrderBy("sort_id asc").Limit(limit, offset).ToBoundSQL() //通过SQL获取带缓存的数据 - return SqlKit.QueryForPk(sql) + return SqlKit.Query(sql) } diff --git a/dsBaseRpc/RpcService/BaseRolePerson/BaseRolePersonDao/BaseRolePersonDao.go b/dsBaseRpc/RpcService/BaseRolePerson/BaseRolePersonDao/BaseRolePersonDao.go index aa3dfe37..9be91270 100644 --- a/dsBaseRpc/RpcService/BaseRolePerson/BaseRolePersonDao/BaseRolePersonDao.go +++ b/dsBaseRpc/RpcService/BaseRolePerson/BaseRolePersonDao/BaseRolePersonDao.go @@ -57,7 +57,7 @@ func PageBaseRolePerson(in *BaseRolePersonProto.QueryArg) ([]map[string]interfac sql, _ := myBuilder.OrderBy("id asc").ToBoundSQL() //分页 myBuilder.Limit(limit, offset) - list, count, err := SqlKit.QueryForPk(sql) + list, count, err := SqlKit.Query(sql) //扩展rule_name 黄海添加于2020-08-04 for i := range list { @@ -301,7 +301,7 @@ func ConvertRoleIntIdsToGuidIds(idIntArray []string) ([]string, error) { if err != nil { return nil, err } - list, _, err := SqlKit.QueryForPk(sql) + list, _, err := SqlKit.Query(sql) if err != nil { return nil, err } diff --git a/dsBaseRpc/RpcService/BaseStudent/BaseStudentDao/BaseStudentDao.go b/dsBaseRpc/RpcService/BaseStudent/BaseStudentDao/BaseStudentDao.go index fbbb00d4..f931e6ab 100644 --- a/dsBaseRpc/RpcService/BaseStudent/BaseStudentDao/BaseStudentDao.go +++ b/dsBaseRpc/RpcService/BaseStudent/BaseStudentDao/BaseStudentDao.go @@ -101,7 +101,7 @@ func PageBaseStudent(in *BaseStudentProto.QueryArg) ([]map[string]interface{}, i if err != nil { return nil, 0, err } - list, count, err := SqlKit.QueryForPk(sql) + list, count, err := SqlKit.Query(sql) //对于教师是不是修改过账号进行判断 SysLoginpersonService.FillPwdIsChange(&list) //返回结果 @@ -162,7 +162,7 @@ func ExportStudentAccountInfoExcel(in *BaseStudentProto.ModelArg) ([]map[string] if err != nil { return nil, 0, err } - list, count, err := SqlKit.QueryForPk(sql) + list, count, err := SqlKit.Query(sql) return list, count, err } diff --git a/dsBaseRpc/RpcService/BaseTeacher/BaseTeacherDao/BaseTeacherDao.go b/dsBaseRpc/RpcService/BaseTeacher/BaseTeacherDao/BaseTeacherDao.go index 938dc52b..9e2593bb 100644 --- a/dsBaseRpc/RpcService/BaseTeacher/BaseTeacherDao/BaseTeacherDao.go +++ b/dsBaseRpc/RpcService/BaseTeacher/BaseTeacherDao/BaseTeacherDao.go @@ -132,7 +132,7 @@ func PageBaseTeacher(in *BaseTeacherProto.QueryArg) ([]map[string]interface{}, i if err != nil { return nil, 0, err } - list, count, err := SqlKit.QueryForPk(sql) + list, count, err := SqlKit.Query(sql) //扩展登录信息 _ = FillLoginInfo(&list) //对于教师是不是修改过账号进行判断 @@ -292,7 +292,7 @@ func ExportTeacherAccountInfoExcel(in *BaseTeacherProto.ModelArg) ([]map[string] if err != nil { return nil, 0, err } - list, count, err := SqlKit.QueryForPk(sql) + list, count, err := SqlKit.Query(sql) return list, count, err } diff --git a/dsBaseRpc/RpcService/GovArea/GovAreaDao/GovAreaDao.go b/dsBaseRpc/RpcService/GovArea/GovAreaDao/GovAreaDao.go index 32ca5183..22be3ae7 100644 --- a/dsBaseRpc/RpcService/GovArea/GovAreaDao/GovAreaDao.go +++ b/dsBaseRpc/RpcService/GovArea/GovAreaDao/GovAreaDao.go @@ -41,7 +41,7 @@ func PageGovArea(in *GovAreaProto.QueryArg) (bool, string, int32, []map[string]i //获取拼接完成的SQL语句 sql, _ := myBuilder.OrderBy("area_code asc").Limit(limit,offset).ToBoundSQL() - list, count, err := SqlKit.QueryForPk(sql) + list, count, err := SqlKit.Query(sql) if err != nil { //记录到错误日志 LogUtil.Error(ErrorConst.SqlQueryError, "执行PageGovArea时发生严重错误:"+err.Error()) diff --git a/dsBaseRpc/RpcService/SysDict/SysDictDao/SysDictDao.go b/dsBaseRpc/RpcService/SysDict/SysDictDao/SysDictDao.go index fea2f80a..f0cd96d3 100644 --- a/dsBaseRpc/RpcService/SysDict/SysDictDao/SysDictDao.go +++ b/dsBaseRpc/RpcService/SysDict/SysDictDao/SysDictDao.go @@ -28,7 +28,7 @@ func PageSysDict(in *SysDictProto.QueryArg) ([]map[string]interface{}, int32, er myBuilder.Where(builder.Eq{"b_use": 1}) //获取拼接完成的SQL语句 sql, _ := myBuilder.OrderBy("sort_id asc").Limit(limit, offset).ToBoundSQL() - list, count, err := SqlKit.QueryForPk(sql) + list, count, err := SqlKit.Query(sql) return list, count, err } @@ -43,7 +43,7 @@ func PageSysDictMultipleDictCode(dictKind string, codeAry []string) ([]map[strin myBuilder.Where(builder.Eq{"b_use": 1}) //获取拼接完成的SQL语句 sql, _ := myBuilder.OrderBy("sort_id asc").ToBoundSQL() - list, count, err := SqlKit.QueryForPk(sql) + list, count, err := SqlKit.Query(sql) return list, count, err } @@ -55,7 +55,7 @@ func GetStage() ([]map[string]interface{}, int32, error) { if err != nil { return nil, 0, err } - list, count, err := SqlKit.QueryForPk(sql) + list, count, err := SqlKit.Query(sql) return list, count, err } @@ -70,7 +70,7 @@ func GetSubject(in *SysDictProto.GetSubjectArg) ([]map[string]interface{}, int32 if err != nil { return nil, 0, err } - list, count, err := SqlKit.QueryForPk(sql) + list, count, err := SqlKit.Query(sql) return list, count, err } @@ -82,7 +82,7 @@ func GetMultipleDict(in *SysDictProto.GetMultipleDictArg) ([]map[string]interfac if err != nil { return nil, 0, err } - list, count, err := SqlKit.QueryForPk(sql) + list, count, err := SqlKit.Query(sql) return list, count, err } @@ -94,7 +94,7 @@ func GetStageName(in *SysDictProto.GetStageNameArg) ([]map[string]interface{}, i if err != nil { return nil, 0, err } - list, count, err := SqlKit.QueryForPk(sql) + list, count, err := SqlKit.Query(sql) return list, count, err } @@ -106,6 +106,6 @@ func GetSubjectName(in *SysDictProto.GetSubjectNameArg) ([]map[string]interface{ if err != nil { return nil, 0, err } - list, count, err := SqlKit.QueryForPk(sql) + list, count, err := SqlKit.Query(sql) return list, count, err } diff --git a/dsBaseRpc/RpcService/SysLoginperson/SysLoginpersonDao/SysLoginpersonDao.go b/dsBaseRpc/RpcService/SysLoginperson/SysLoginpersonDao/SysLoginpersonDao.go index 34ad4942..dfd8548b 100644 --- a/dsBaseRpc/RpcService/SysLoginperson/SysLoginpersonDao/SysLoginpersonDao.go +++ b/dsBaseRpc/RpcService/SysLoginperson/SysLoginpersonDao/SysLoginpersonDao.go @@ -142,7 +142,7 @@ func PageSysLoginPerson(in *SysLoginpersonProto.QueryArg) ([]map[string]interfac if err != nil { fmt.Println(err.Error()) } - list, count, err := SqlKit.QueryForPk(sql) + list, count, err := SqlKit.Query(sql) //处理一下是不是初始密码的问题 FillPwd(&list) return list, count, err @@ -173,7 +173,7 @@ func PageAreaManager(in *SysLoginpersonProto.AreaManagerArg) ([]map[string]inter And(builder.In("t1.role_id", []string{Const.ProvinceManager, Const.CityManager, Const.DistrictManager})). And(builder.In("t1.rule_id", areaCodes)).Limit(limit, offset) sql, _ = myBuilder.ToBoundSQL() - list, count, err := SqlKit.QueryForPk(sql) + list, count, err := SqlKit.Query(sql) //处理一下是不是初始密码的问题 FillPwd(&list) return list, count, err @@ -266,7 +266,7 @@ func GetBureauIdsByPersonIds(personIds []string) ([]map[string]interface{}, stri if err != nil { return nil, Const.DataBaseActionError, err } - _list, _, err := SqlKit.QueryForPk(sql) + _list, _, err := SqlKit.Query(sql) if err != nil { return nil, Const.DataBaseActionError, err } @@ -304,7 +304,7 @@ func GetBureauIdsByPersonIds(personIds []string) ([]map[string]interface{}, stri if err != nil { return nil, Const.DataBaseActionError, err } - list, _, err := SqlKit.QueryForPk(sql) + list, _, err := SqlKit.Query(sql) return list, Const.SuccessDataBaseAction, nil } diff --git a/dsBaseRpc/Utils/SqlKit/SqlKit.go b/dsBaseRpc/Utils/SqlKit/SqlKit.go index 128da77c..ae9cd3e0 100644 --- a/dsBaseRpc/Utils/SqlKit/SqlKit.go +++ b/dsBaseRpc/Utils/SqlKit/SqlKit.go @@ -205,7 +205,7 @@ func isDistinctSql(sql string) bool { 作者:黄海 时间:2020-06-10 */ -func QueryForPk(sql string) ([]map[string]interface{}, int32, error) { +func Query(sql string) ([]map[string]interface{}, int32, error) { if isMultiFieldSql(sql) || isDistinctSql(sql) { return pageSql(sql) } else {