微信小程序實現數據庫管理,java ssm框架調用微信,微信小程序實現前后臺交互(后臺使用ssm框架)

 2023-10-12 阅读 29 评论 0

摘要:微信小程序前端代碼 :index.js中page的onload函數。onLoad: function () {wx.request({微信小程序實現數據庫管理,url: 'http://localhost:8080/BaseProjectSSM/admin/clazz_table/list2',method: 'post',header: {'content-type': 'appl

微信小程序前端代碼 :

index.js中page的onload函數。

onLoad: function () {

wx.request({

微信小程序實現數據庫管理,url: 'http://localhost:8080/BaseProjectSSM/admin/clazz_table/list2',

method: 'post',

header: {

'content-type': 'application/json' // 默認值

},

nodejs后端框架,success: res => {

console.log(res.data)

this.setData({

})

},

php websocket框架、fail: res => {

console.log("失敗")

}

})

if (app.globalData.userInfo) {

微信小程序交互、this.setData({

userInfo: app.globalData.userInfo,

hasUserInfo: true

})

} else if (this.data.canIUse){

Java微服務,// 由于 getUserInfo 是網絡請求,可能會在 Page.onLoad 之后才返回

// 所以此處加入 callback 以防止這種情況

app.userInfoReadyCallback = res => {

this.setData({

userInfo: res.userInfo,

java微服務開發?hasUserInfo: true

})

}

} else {

// 在沒有 open-type=getUserInfo 版本的兼容處理

ssm添加好友功能、wx.getUserInfo({

success: res => {

app.globalData.userInfo = res.userInfo

this.setData({

userInfo: res.userInfo,

微信小程序、hasUserInfo: true

})

}

})

}

微信小程序前后端ssm搭建,},

微信控制臺結果:

b1c3611b854e2b832a9c38446767022e.png

后臺代碼:

控制層:

@RequestMapping(value="/list2",method=RequestMethod.POST)

微信小程序后端部署,@ResponseBody

public MapgetList2(){

Mapret = new HashMap();

Listclazz1 = clazzService.findList2();

ret.put("clazzList2", clazz1);

微信小程序后端怎么搭建,return ret;

}

service.java文件

public ListfindList2();

serviceImpl.java文件

java后端實現微信小程序登錄。@Override

public ListfindList2() {

// TODO Auto-generated method stub

return clazzDao.findList2();

}

dao.java文件

public ListfindList2();

clazz.java實體類

package com.ischoolbar.programmer.entity.admin;

import java.text.ParseException;

import java.text.SimpleDateFormat;

import java.util.Date;

import java.util.List;

import org.springframework.stereotype.Component;

/**

* 課程實體

* @author whs

*

*/

@Component

public class Clazz {

private Long id;

private String clazzname;//課程名字

private Long categoryId;//分類id

private ClazzCategory clazzCategory;//課程類別

private Long addressId;//課程地址

private String teacher;//教師

private Date clazzTime;//上課時間

private Integer duration; //時長

private String weekday;//星期

private String cost;//費用

private String remark;//備注

public Long getId() {

return id;

}

public void setId(Long id) {

this.id = id;

}

public String getClazzname() {

return clazzname;

}

public void setClazzname(String clazzname) {

this.clazzname = clazzname;

}

public Long getCategoryId() {

return categoryId;

}

public void setCategoryId(Long categoryId) {

this.categoryId = categoryId;

}

public ClazzCategory getClazzCategory() {

return clazzCategory;

}

public void setClazzCategory(ClazzCategory clazzCategory) {

this.clazzCategory = clazzCategory;

}

public Long getAddressId() {

return addressId;

}

public void setAddressId(Long addressId) {

this.addressId = addressId;

}

public String getTeacher() {

return teacher;

}

public void setTeacher(String teacher) {

this.teacher = teacher;

}

public Date getClazzTime() {

return clazzTime;

}

public void setClazzTime(String clazzTime) {

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");

try {

this.clazzTime = sdf.parse(clazzTime);

} catch (ParseException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

public Integer getDuration() {

return duration;

}

public void setDuration(Integer duration) {

this.duration = duration;

}

public String getWeekday() {

return weekday;

}

public void setWeekday(String weekday) {

this.weekday = weekday;

}

public String getCost() {

return cost;

}

public void setCost(String cost) {

this.cost = cost;

}

public String getRemark() {

return remark;

}

public void setRemark(String remark) {

this.remark = remark;

}

}

mapper.xml文件

select * from clazz where 1 = 1

數據庫:

af3c48606b8b8f52a355c59cb1cc655a.png

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/2/135425.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息