def select_sup(): db_class = mod_dbconn.Database() sql = "SELECT *\ FROM taxocr.t_provider" all_sup_dict = db_class.executeAll(sql) print(all_sup_dict) dataNum = len(all_sup_dict) return render_template("supply.html", resultData=all_sup_dict, dataNum=dataNum)
def update_provider(): db_class = mod_dbconn.Database() print('수정요청접수') if request.method == "POST": args_dict = request.form.to_dict() print(args_dict) om.supply_update(args_dict, db_class) #om 참고 return redirect(url_for('select_sup'))
def supply_desc(p_id): #상세페이지 조회하는 함수 db_class = mod_dbconn.Database() sql = """SELECT * FROM taxocr.t_provider WHERE p_id = %s""" desc_dict = db_class.executeAll(sql, args=p_id) return desc_dict
def delete_provider(): db_class = mod_dbconn.Database() p_id = request.args.get('p_id') om.supply_delete(p_id, db_class) #om 참고 return redirect(url_for('select_sup'))
print('수정요청접수') if request.method == "POST": args_dict = request.form.to_dict() print(args_dict) om.supply_update(args_dict, db_class) #om 참고 return redirect(url_for('select_sup')) @app.route("/delete_provider", methods=("GET", "POST")) # 공급자 정보 삭제버튼 def delete_provider(): db_class = mod_dbconn.Database() p_id = request.args.get('p_id') om.supply_delete(p_id, db_class) #om 참고 return redirect(url_for('select_sup')) db_class = mod_dbconn.Database() @app.route("/insert_provider", methods=("GET", "POST")) def insert_provider(): print("공급자 등록 요청 접수됨") if request.method == "GET": return render_template("insert.html") if request.method == "POST": args = tuple(request.form.values()) print(args) sql = """INSERT into taxocr.t_provider (p_id, p_corp_num, p_corp_name, p_ceo_name, p_add, p_stat, p_type, p_email) VALUES (%s,%s,%s,%s,%s,%s,%s,%s)""" db_class.execute(query=sql, args=args) db_class.commit() return render_template("home.html")