def GET(self):
all_col = ('name','description','owner','family_id','time','change_log')
citype_input = web.input()
condition = " "
for col in range(len(all_col)):
col_name = all_col[col]
value = citype_input.get(col_name,None)
if value <> None:
if col_name == 'time' :
condition = condition + "ct.starttime <= '" + value + "' and ct.endtime > '" + value + "' and "
else :
condition = condition + "ct." + col_name + " = '" + value + "' and "
if value == None and col_name == 'time':
condition = condition + "ct.endtime = '" + ENDTIME + "' and "
v_sql = "select ct.name , convert(ct.description,'utf8') description,ct.owner,ct.family_id,convert(ct.displayname,'utf8') " \
"displayname,ct.change_log from t_ci_type ct where " + condition + "1=1"
#v_sql = "select ct.name , ct.description,ct.owner,ct.family_id,ct.displayname,ct.change_log from t_ci_type ct where " + condition + "1=1"
ci_type = db.query(v_sql)
ci_as_dict = []
for ci in ci_type:
ci_as_dict.append(ci)
ci_type_json = json.dumps(ci_as_dict, indent = 4,ensure_ascii=False, separators = (',',':')).decode("GB2312")
#Type is unicode
# import sys,httplib, urllib
# params = urllib.urlencode({'fid':'FCIT00000004','change_log':'test'})
# headers = {'Content-type': 'application/x-www-form-urlencoded', 'Accept': 'text/plain'}
# con2 = httplib.HTTPConnection("localhost:8080")
# con2.request("DELETE","/citype",params,headers)
# con2.close()
return ci_type_json
评论列表
文章目录