信息技術(shù)課做網(wǎng)站最近三天的新聞大事小學(xué)生
文章目錄
- 項目介紹
- 主要功能截圖:
- 部分代碼展示
- 設(shè)計總結(jié)
- 項目獲取方式
🍅 作者主頁:超級無敵暴龍戰(zhàn)士塔塔開
🍅 簡介:Java領(lǐng)域優(yōu)質(zhì)創(chuàng)作者🏆、 簡歷模板、學(xué)習(xí)資料、面試題庫【關(guān)注我,都給你】
🍅文末獲取源碼聯(lián)系🍅
項目介紹
基于springboot的寵物店系統(tǒng)的設(shè)計與實現(xiàn),java項目。
eclipse和idea都能打開運行。
推薦環(huán)境配置:eclipse/idea jdk1.8 maven mysql
前端技術(shù):vue,Ajax,Json
后端技術(shù):SpringBoot,MyBatis
本系統(tǒng)共分為兩個角色:管理員和用戶。
主要功能有:
后臺:登錄注冊、首頁、個人中心、用戶管理、客服聊天管理、論壇管理、公告管理、寵物寄養(yǎng)管理
寵物寄養(yǎng)訂單管理、寄存日志管理、輪播圖信息等。
前臺:登錄注冊、首頁展示、公告列表、商品列表
購物車列表、在線客服、個人中心等。
提供遠(yuǎn)程部署、代碼講解等服務(wù)
更多精品項目,請查看主頁
主要功能截圖:
在這里插入圖片描述
部分代碼展示
控制層,ClockInNewController,對登錄用戶信息的查詢,基于Cookie,從cookie中提取用戶信息,并根據(jù)提取的用戶字段,在數(shù)據(jù)庫中查詢相關(guān)信息。
@RequestMapping("/queryClockInAll2")public JsonObject queryClockInAll2(Clockinnew clockinnew, HttpServletRequest request,@RequestParam(defaultValue = "1") Integer pageNum,@RequestParam(defaultValue = "15") Integer pageSize){//獲取當(dāng)前得登錄用戶Userinfo userinfo= (Userinfo) request.getSession().getAttribute("user");String username=userinfo.getUsername();//根據(jù)username獲取登錄賬號得業(yè)主idOwner owner=ownerService.queryOwnerByName(username);clockinnew.setOwnerId(owner.getId());PageInfo<Clockinnew> pageInfo= clockinnewService.queryClockInAll(pageNum,pageSize,clockinnew);return new JsonObject(0,"ok",pageInfo.getTotal(),pageInfo.getList());}
核心接口,封裝具體方法,方便對象的注入
package com.yx.service;import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.github.pagehelper.PageInfo;
import com.yx.model.Clockinnew;import java.util.Date;/*** <p>* 服務(wù)類* </p>** @author yx* @since 2021-04-27*/
public interface IClockInNewService extends IService<Clockinnew> {PageInfo<Clockinnew> queryClockInAll(int pageNum, int pageSize, Clockinnew clockinnew);/*** 查詢分頁數(shù)據(jù)** @param page 頁碼* @param pageCount 每頁條數(shù)* @return IPage<Clockinnew>*/IPage<Clockinnew> findListByPage(Integer page, Integer pageCount);/*** 添加** @param clockinnew * @return int*/int add(Clockinnew clockinnew);/*** 刪除** @param id 主鍵* @return int*/int delete(Long id);/*** 修改** @param clockinnew * @return int*/int updateData(Clockinnew clockinnew);/*** id查詢數(shù)據(jù)** @param id id* @return Clockinnew*/Clockinnew findById(Long id);Date queryCountByOwnId(Integer ownerId);
}
針對登錄接口進行講解
首先是controller層
涉及登錄,自然是分不開session,需要從session中提取用戶,判斷該用戶是否處于登錄狀態(tài)。其中密碼是經(jīng)過md5加密的,固定的鹽值加入到數(shù)據(jù)庫中,提高系統(tǒng)的安全行。
@RequestMapping(value="/login",method= RequestMethod.POST)public String login(Model model, String name, String password){//throws ParseExceptionSubject subject = SecurityUtils.getSubject();UsernamePasswordToken token = new UsernamePasswordToken(name,password);try {subject.login(token);User us = userService.getByName(name);String lastLoginTime = "";if(us!=null){SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//上次時間Date time = us.getLasttime();lastLoginTime = sdf.format(time);//新時間String format = sdf.format(new Date());//string轉(zhuǎn)date 不處理時間格式會不理想ParsePosition pos = new ParsePosition(0);Date strtodate = sdf.parse(format, pos);us.setLasttime(strtodate);userService.update(us);}if (us.getStatus()==1){Session session=subject.getSession();session.setAttribute("subject", subject);session.setAttribute("lastLoginTime",lastLoginTime);return "redirect:index";}else {model.addAttribute("error", "賬號已被停用!");return "/login";}} catch (AuthenticationException e) {model.addAttribute("error", "驗證失敗!");return "/login";}}
接下來就是impl實現(xiàn)類,可根據(jù)獲得的參數(shù)進行條件查詢。
當(dāng)然,具體的查詢語句一般都不會直接在implement類中寫,而是將其寫在封裝好的mapper的xml文件中,xml文件又映射對應(yīng)的mapper文件。
而真正起作用的是mapper中的sql語句,在implement實現(xiàn)類中只是對mapper進行注入。
@Overridepublic User getByName(String name) {UserExample example = new UserExample();example.createCriteria().andNameEqualTo(name);List<User> users = userMapper.selectByExample(example);if (users.isEmpty()) return null;return users.get(0);}
UserMapper.java
package com.byh.biyesheji.dao;import com.byh.biyesheji.pojo.User;
import com.byh.biyesheji.pojo.UserExample;import java.util.List;public interface UserMapper extends SysDao<User>{List<User> selectByExample(UserExample example);/*** 停用管理員賬號* @param name*/void enableStatus(String name);/*** 開啟管理員賬號* @param name*/void stopStatus(String name);
}
UserMapper.xml
<select id="selectByExample" resultMap="BaseResultMap" parameterType="com.byh.biyesheji.pojo.UserExample" >select<if test="distinct" >distinct</if><include refid="Base_Column_List" />from user<if test="_parameter != null" ><include refid="Example_Where_Clause" /></if><if test="orderByClause != null" >order by ${orderByClause}</if></select>
設(shè)計總結(jié)
通過對校園點餐系統(tǒng)的開發(fā),讓我深刻明白開發(fā)一個程序軟件需要經(jīng)歷的流程,當(dāng)確定要開發(fā)一個程序時,我在開發(fā)期間,對其功能進行合理的需求分析,然后才是程序軟件的功能的框架設(shè)計,數(shù)據(jù)庫的實體與數(shù)據(jù)表設(shè)計,程序軟件的功能詳細(xì)界面實現(xiàn),以及程序的功能測試等進行全方位的細(xì)致考慮,雖然在此過程中,各個環(huán)節(jié)都遇到了大大小小的困難,但是通過對這些問題進行反復(fù)的分析,深入的思考,借助各種相關(guān)文獻資料提供的方法與解決思路成功解決面臨的各個問題,最后成功的讓我開發(fā)的系統(tǒng)得以正常運行。在功能上面是基本可以滿足用戶對系統(tǒng)的操作,但是這個程序軟件也有許多方面是不足的,因此,在下一個時間階段,有幾點需要改進的地方需要提出來,它們分別是:
(1)操作頁面可以滿足用戶簡易操作的要求,但是在頁面多樣化設(shè)計層面上需要把一些比較豐富的設(shè)計結(jié)構(gòu)考慮進來。
(2)程序軟件的總體安全性能需要優(yōu)化,例如程序的退出安全性,以及程序的并發(fā)性等問題都需要進行安全性升級,讓開發(fā)的產(chǎn)品與現(xiàn)實中的相關(guān)網(wǎng)站更貼合。
(3)需要對程序的數(shù)據(jù)結(jié)構(gòu)方面,程序的代碼方面等進行優(yōu)化,讓運行起來的程序可以保持穩(wěn)定運行,也讓程序能夠保證短時間內(nèi)處理相關(guān)事務(wù),節(jié)省處理事務(wù)的時間,提高事務(wù)處理的效率,同時對服務(wù)器上資源占用的比例進行降低。
平臺的開發(fā)一方面是對自身專業(yè)知識技能進行最終考核,另一方面也是讓自己學(xué)會獨立解決程序開發(fā)過程中所遇到的問題,掌握將理論知識運用于程序開發(fā)實踐的方法。最終目標(biāo)就是讓系統(tǒng)更具人性化,同時在邏輯設(shè)計上,讓系統(tǒng)能夠更加的嚴(yán)謹(jǐn)。
獲取源碼聯(lián)系:
大家點贊、收藏、關(guān)注、評論啦
項目獲取方式
精彩專欄推薦訂閱:在下方專欄👇🏻
Java精品項目100套