Example #1
0
/*
select csd.id,class_id classId,teacher_id teacherId,assistant_id assistantId,course_id courseId,center_id centerId,time_id timeId,room_id roomId,day_date dayDate,week,capacity,start_time startTime,end_time endTime,status,cour.name courseName,r.name roomName
			from class_schedule_detail csd
			left join course cour on cour.cid=csd.course_id
			left join room r on r.rid = csd.room_id
			where csd.id=?
*/
func getScheduleDetailId(id string) (map[string]string, error) {

	sql := `
			select csd.id,csd.class_id classId,csd.teacher_id teacherId,csd.assistant_id assistantId,csd.course_id courseId,csd.center_id centerId,csd.time_id timeId,csd.room_id roomId,csd.day_date dayDate,csd.week,csd.capacity,csd.start_time startTime,csd.end_time endTime,csd.status,cour.name courseName,r.name roomName
			from class_schedule_detail csd
			left join course cour on cour.cid=csd.course_id
			left join room r on r.rid = csd.room_id
			where csd.id=?
	    	`

	lessgo.Log.Debug(sql)

	db := lessgo.GetMySQL()
	defer db.Close()

	rows, err := db.Query(sql, id)

	if err != nil {
		lessgo.Log.Error(err.Error())
		return nil, err
	}

	var dataMap map[string]string

	if rows.Next() {
		dataMap, err = lessgo.GetDataMap(rows)
	}

	if err != nil {
		return nil, err
	}

	return dataMap, nil
}
Example #2
0
/*
select cid id,name,card_id cardId,pid,sex,birthday,center_id centerId,avatar from child where cid=?
*/
func getChildById(id string) (map[string]string, error) {

	sql := `select cid id,name,card_id cardId,pid,sex,birthday,center_id centerId,avatar
	        from child where cid=?`

	lessgo.Log.Debug(sql)

	db := lessgo.GetMySQL()
	defer db.Close()

	rows, err := db.Query(sql, id)

	if err != nil {
		lessgo.Log.Error(err.Error())
		return nil, err
	}

	var dataMap map[string]string

	if rows.Next() {
		dataMap, err = lessgo.GetDataMap(rows)
	}

	if err != nil {
		return nil, err
	}

	return dataMap, nil
}
Example #3
0
/*
select id,child_id,apply_time,contract_no,parent_id,price,employee_id,center_id,course_id,left_lesson_num,type,status,expire_date from contract where id=?
*/
func getContractById(id string) (map[string]string, error) {

	sql := `select id,child_id,apply_time,contract_no,parent_id,price,employee_id,center_id,course_id,left_lesson_num,type,status,expire_date from contract where id=?`

	lessgo.Log.Debug(sql)

	db := lessgo.GetMySQL()
	defer db.Close()

	rows, err := db.Query(sql, id)

	if err != nil {
		lessgo.Log.Error(err.Error())
		return nil, err
	}

	var dataMap map[string]string

	if rows.Next() {
		dataMap, err = lessgo.GetDataMap(rows)
	}

	if err != nil {
		return nil, err
	}

	return dataMap, nil
}
Example #4
0
func getScheduleTmpsByCenterId(centerId string) ([]map[string]string, error) {
	db := lessgo.GetMySQL()
	defer db.Close()

	getScheduleTmpSql := "select id,room_id,teacher_id,assistant_id,time_id,week,course_id from schedule_template where center_id=? "
	lessgo.Log.Debug(getScheduleTmpSql)

	rows, err := db.Query(getScheduleTmpSql, centerId)

	if err != nil {
		lessgo.Log.Error(err.Error())
		return nil, err
	}

	var datas []map[string]string

	for rows.Next() {
		dataMap, err := lessgo.GetDataMap(rows)

		if err != nil {
			lessgo.Log.Error(err.Error())
			return nil, err
		}

		datas = append(datas, dataMap)
	}

	return datas, nil
}
Example #5
0
func getChildAndContractByScheduleTempId(tempId string) ([]map[string]string, error) {

	db := lessgo.GetMySQL()
	defer db.Close()

	sql := "select child_id,contract_id from schedule_template_child where schedule_template_id=? "
	lessgo.Log.Debug(sql)

	rows, err := db.Query(sql, tempId)

	if err != nil {
		lessgo.Log.Error(err.Error())
		return nil, err
	}

	var datas []map[string]string

	for rows.Next() {
		dataMap, err := lessgo.GetDataMap(rows)

		if err != nil {
			lessgo.Log.Error(err.Error())
			return nil, err
		}

		datas = append(datas, dataMap)
	}

	return datas, nil
}
Example #6
0
/*
select st.id,st.room_id,st.time_id,st.week,csd.start_time,csd.course_id
			from class_schedule_detail csd
			left join schedule_template st on csd.center_id=st.center_id and csd.room_id=st.room_id and csd.time_id=st.time_id and csd.week=st.week
			where csd.id=?
*/
func getScheduleTmpByScheduelDetailId(scheduleId string) (map[string]string, error) {

	sql := `
			select st.id,st.room_id,st.time_id,st.week,csd.start_time,csd.course_id
			from class_schedule_detail csd
			left join schedule_template st on csd.center_id=st.center_id and csd.room_id=st.room_id and csd.time_id=st.time_id and csd.week=st.week
			where csd.id=?`

	lessgo.Log.Debug(sql)

	db := lessgo.GetMySQL()
	defer db.Close()

	rows, err := db.Query(sql, scheduleId)

	if err != nil {
		lessgo.Log.Error(err.Error())
		return nil, err
	}

	var dataMap map[string]string

	if rows.Next() {
		dataMap, err = lessgo.GetDataMap(rows)
	}

	if err != nil {
		return nil, err
	}

	return dataMap, nil
}
Example #7
0
func getTimeSectionById(id string) (map[string]string, error) {

	sql := `select id,center_id,start_time,end_time,lesson_no from time_section where id=?`

	lessgo.Log.Debug(sql)

	db := lessgo.GetMySQL()
	defer db.Close()

	rows, err := db.Query(sql, id)

	if err != nil {
		lessgo.Log.Error(err.Error())
		return nil, err
	}

	var dataMap map[string]string

	if rows.Next() {
		dataMap, err = lessgo.GetDataMap(rows)
	}

	if err != nil {
		return nil, err
	}

	return dataMap, nil
}
Example #8
0
/*
select class_id id,name,start_time,end_time,code,center_id,child_num from wyclass where class_id=?
*/
func getWyClassById(id string) (map[string]string, error) {

	sql := `
			select class_id id,name,start_time,end_time,code,center_id,child_num from wyclass where class_id=?
	    	`

	lessgo.Log.Debug(sql)

	db := lessgo.GetMySQL()
	defer db.Close()

	rows, err := db.Query(sql, id)

	if err != nil {
		lessgo.Log.Error(err.Error())
		return nil, err
	}

	var dataMap map[string]string

	if rows.Next() {
		dataMap, err = lessgo.GetDataMap(rows)
	}

	if err != nil {
		return nil, err
	}

	return dataMap, nil
}
Example #9
0
func getScheduleChildByChildIdAndScheduleId(childId, scheduleId string) (map[string]string, error) {

	db := lessgo.GetMySQL()
	defer db.Close()

	sql := "select id,schedule_detail_id,child_id,create_user,wyclass_id,contract_id,is_free from schedule_detail_child where child_id=? and schedule_detail_id=? "
	lessgo.Log.Debug(sql)

	rows, err := db.Query(sql, childId, scheduleId)

	if err != nil {
		lessgo.Log.Error(err.Error())
		return nil, err
	}

	var dataMap map[string]string

	if rows.Next() {
		dataMap, err = lessgo.GetDataMap(rows)
		if err != nil {
			lessgo.Log.Error(err.Error())
			return nil, err
		}
	}

	return dataMap, nil
}
Example #10
0
/*
select cons.id,cons.center_id centerId,cons.contact_status contactStatus,cons.home_phone homePhone,cons.parent_id parentId,cons.child,cons.year,cons.month,cons.birthday,cons.last_tmk_id lastTMKId,cons.is_own_by_tmk isOwnByTmk,cons.come_from_id comeFromId,cons.current_tmk_id currentTMKId,cons.sign_in_time signInTime,cons.pay_time payTime,cons.pay_status payStatus,cons.parttime_name parttimeName,cons.level
	    	from consumer_new cons left join child ch on ch.pid=cons.parent_id where ch.cid=?
*/
func getConsumerByChildId(id string) (map[string]string, error) {

	sql := `
			select cons.id,cons.center_id centerId,cons.contact_status contactStatus,cons.home_phone homePhone,cons.parent_id parentId,cons.child,cons.year,cons.month,cons.birthday,cons.last_tmk_id lastTMKId,cons.is_own_by_tmk isOwnByTmk,cons.come_from_id comeFromId,cons.current_tmk_id currentTMKId,cons.sign_in_time signInTime,cons.pay_time payTime,cons.pay_status payStatus,cons.parttime_name parttimeName,cons.level
	    	from consumer_new cons left join child ch on ch.pid=cons.parent_id where ch.cid=?
	    	`

	lessgo.Log.Debug(sql)

	db := lessgo.GetMySQL()
	defer db.Close()

	rows, err := db.Query(sql, id)

	if err != nil {
		lessgo.Log.Error(err.Error())
		return nil, err
	}

	var dataMap map[string]string

	if rows.Next() {
		dataMap, err = lessgo.GetDataMap(rows)
	}

	if err != nil {
		return nil, err
	}

	return dataMap, nil
}