基于微信小程序的沁園健身房預(yù)約管理系統(tǒng)設(shè)計(jì)與實(shí)現(xiàn)-計(jì)算機(jī)畢業(yè)設(shè)計(jì)源碼+LW文檔
小程序開(kāi)發(fā)說(shuō)明
開(kāi)發(fā)語(yǔ)言:Java
框架:ssm
JDK版本:JDK1.8
服務(wù)器:tomcat7
數(shù)據(jù)庫(kù):mysql 5.7(一定要5.7版本)
數(shù)據(jù)庫(kù)工具:Navicat11
開(kāi)發(fā)軟件:eclipse/myeclipse/idea
Maven包:Maven3.3.9
瀏覽器:谷歌瀏覽器
小程序框架:uniapp
小程序開(kāi)發(fā)軟件:HBuilder X
小程序運(yùn)行軟件:微信開(kāi)發(fā)者
關(guān)鍵邏輯代碼:
/**
?* 教練
?* 后端接口
?* @author?
?* @email?
?* @date 2022-05-18 16:39:28
?*/
@RestController
@RequestMapping("/jiaolian")
public class JiaolianController {
? ? @Autowired
? ? private JiaolianService jiaolianService;
? ??
@Autowired
private TokenService tokenService;
/**
* 登錄
*/
@IgnoreAuth
@RequestMapping(value = "/login")
public R login(String username, String password, String captcha, HttpServletRequest request) {
JiaolianEntity user = jiaolianService.selectOne(new EntityWrapper<JiaolianEntity>().eq("yuangonghao", username));
if(user==null || !user.getMima().equals(password)) {
return R.error("賬號(hào)或密碼不正確");
}
String token = tokenService.generateToken(user.getId(), username,"jiaolian",? "教練" );
return R.ok().put("token", token);
}
/**
? ? ?* 注冊(cè)
? ? ?*/
@IgnoreAuth
? ? @RequestMapping("/register")
? ? public R register(@RequestBody JiaolianEntity jiaolian){
? ? //ValidatorUtils.validateEntity(jiaolian);
? ? JiaolianEntity user = jiaolianService.selectOne(new EntityWrapper<JiaolianEntity>().eq("yuangonghao", jiaolian.getYuangonghao()));
if(user!=null) {
return R.error("注冊(cè)用戶(hù)已存在");
}
Long uId = new Date().getTime();
jiaolian.setId(uId);
? ? ? ? jiaolianService.insert(jiaolian);
? ? ? ? return R.ok();
? ? }
/**
* 退出
*/
@RequestMapping("/logout")
public R logout(HttpServletRequest request) {
request.getSession().invalidate();
return R.ok("退出成功");
}
/**
? ? ?* 獲取用戶(hù)的session用戶(hù)信息
? ? ?*/
? ? @RequestMapping("/session")
? ? public R getCurrUser(HttpServletRequest request){
? ? Long id = (Long)request.getSession().getAttribute("userId");
? ? ? ? JiaolianEntity user = jiaolianService.selectById(id);
? ? ? ? return R.ok().put("data", user);
? ? }
? ??
? ? /**
? ? ?* 密碼重置
? ? ?*/
? ? @IgnoreAuth
@RequestMapping(value = "/resetPass")
? ? public R resetPass(String username, HttpServletRequest request){
? ? JiaolianEntity user = jiaolianService.selectOne(new EntityWrapper<JiaolianEntity>().eq("yuangonghao", username));
? ? if(user==null) {
? ? return R.error("賬號(hào)不存在");
? ? }
? ? ? ? user.setMima("123456");
? ? ? ? jiaolianService.updateById(user);
? ? ? ? return R.ok("密碼已重置為:123456");
? ? }
? ? /**
? ? ?* 后端列表
? ? ?*/
? ? @RequestMapping("/page")
? ? public R page(@RequestParam Map<String, Object> params,JiaolianEntity jiaolian,
HttpServletRequest request){
? ? ? ? EntityWrapper<JiaolianEntity> ew = new EntityWrapper<JiaolianEntity>();
PageUtils page = jiaolianService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, jiaolian), params), params));
? ? ? ? return R.ok().put("data", page);
? ? }
? ??
? ? /**
? ? ?* 前端列表
? ? ?*/
@IgnoreAuth
? ? @RequestMapping("/list")
? ? public R list(@RequestParam Map<String, Object> params,JiaolianEntity jiaolian,?
HttpServletRequest request){
? ? ? ? EntityWrapper<JiaolianEntity> ew = new EntityWrapper<JiaolianEntity>();
PageUtils page = jiaolianService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, jiaolian), params), params));
? ? ? ? return R.ok().put("data", page);
? ? }
/**
? ? ?* 列表
? ? ?*/
? ? @RequestMapping("/lists")
? ? public R list( JiaolianEntity jiaolian){
? ? ? ? EntityWrapper<JiaolianEntity> ew = new EntityWrapper<JiaolianEntity>();
? ? ? ew.allEq(MPUtil.allEQMapPre( jiaolian, "jiaolian"));?
? ? ? ? return R.ok().put("data", jiaolianService.selectListView(ew));
? ? }
/**
? ? ?* 查詢(xún)
? ? ?*/
? ? @RequestMapping("/query")
? ? public R query(JiaolianEntity jiaolian){
? ? ? ? EntityWrapper< JiaolianEntity> ew = new EntityWrapper< JiaolianEntity>();
? ew.allEq(MPUtil.allEQMapPre( jiaolian, "jiaolian"));?
JiaolianView jiaolianView =? jiaolianService.selectView(ew);
return R.ok("查詢(xún)教練成功").put("data", jiaolianView);
? ? }
? ? /**
? ? ?* 后端詳情
? ? ?*/
? ? @RequestMapping("/info/{id}")
? ? public R info(@PathVariable("id") Long id){
? ? ? ? JiaolianEntity jiaolian = jiaolianService.selectById(id);
? ? ? ? return R.ok().put("data", jiaolian);
? ? }
? ? /**
? ? ?* 前端詳情
? ? ?*/
@IgnoreAuth
? ? @RequestMapping("/detail/{id}")
? ? public R detail(@PathVariable("id") Long id){
? ? ? ? JiaolianEntity jiaolian = jiaolianService.selectById(id);
? ? ? ? return R.ok().put("data", jiaolian);
? ? }
? ??



