首页 > 分享 > A076

A076

目录 内容介绍1.宠物管理模块2.宠物前台展示2.1.宠物列表2.2.宠物详情2.2.1.跳转到店铺2.2.2.领养 2.3.扩展功能 3.4.5.课程总结5.1.重点5.2.难点5.3.如何掌握5.4.排错技巧(技巧) 6.常见问题7.课后练习8.面试题9.扩展知识或课外阅读推荐(可选)9.1.扩展知识9.2.课外阅读

寻主

内容介绍

1. 入库宠物-上架 (掌握)
2. 宠物前台展示 (掌握)
3. 领养/售卖 (掌握)

1.宠物管理模块

类型管理:扩展功能
宠物管理:
有crud,还有上架于下架,和服务差不多。 前后台都拷贝服务模块的。

2.宠物前台展示 2.1.宠物列表

Copy product.html

2.2.宠物详情 2.2.1.跳转到店铺

1)拷贝主页为店铺页
2)跳转到店铺页 宠物详情页
在这里插入图片描述
在这里插入图片描述
3)美化店铺
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

<script type="text/javascript"> new Vue({ el:"#myDiv", data:{ user:{}, shopId:null, shop:{} }, methods:{ goPublish(){ window.open("publish.html"); }, getShop(){ this.$http.get("/shop/"+this.shopId) .then(result=>{ this.shop = result.data; document.getElementById("myTitle").innerHTML = this.shop.name; }); } }, mounted(){ let user = localStorage.getItem("uUser"); if(user){ this.user = JSON.parse(user); } this.shopId = parseUrlParams2Obj(location.href).id; this.getShop(); } }) </script>

12345678910111213141516171819202122232425262728293031 2.2.2.领养

1)前台
在这里插入图片描述
在这里插入图片描述

adopt(){ let petId = this.pet.id; let flag = window.confirm("你确认包养吗?") if(flag){ this.$http.get("/pet/adopt/"+petId) .then(result=>{ result = result.data; if(result.success){ alert("领养成功!") location.href = "personcenter.html" }else{ alert(result.message); } }) } } }

1234567891011121314151617

2)后台

Controller @GetMapping("/adopt/{id}") public AjaxResult adopt(@PathVariable(value = "id")Long petId, HttpServletRequest request){ LoginInfo loginInfo = LoginContext.getLoginInfo(request); try { petService.adopt(petId,loginInfo.getId()); return AjaxResult.me(); } catch (Exception e) { e.printStackTrace(); return AjaxResult.me().setSuccess(false).setMessage("不允许包养!"+e.getMessage()); } } 123456789101112

Service @Override public void adopt(Long petId,Long loginInfoId) { Pet pet = petMapper.loadById(petId); System.out.println(pet); //1 绑定领养用户 User user = userMapper.loadByLoginInfoId(loginInfoId); pet.setUser_id(user.getId()); //2 修改状态 pet.setState(2); //已领养 petMapper.update(pet); //3 @TODO 创建领养订单 } 123456789101112131415

Mapper.xml <update id="update" parameterType="Pet"> update t_pet set name = #{name}, resources= #{resources}, saleprice= #{saleprice}, offsaletime= #{offsaletime}, onsaletime= #{onsaletime}, state= #{state}, costprice= #{costprice}, createtime= #{createtime}, type_id= #{type_id}, shop_id= #{shop_id}, user_id= #{user_id}, search_master_msg_id= #{searchMasterMsg_id} where id = #{id} </update> <resultMap id="petMap" type="Pet"> <id property="id" column="id"></id> <result property="name" column="name"></result> <result property="resources" column="resources"></result> <result property="saleprice" column="saleprice"></result> <result property="costprice" column="costprice"></result> <result property="offsaletime" column="offsaletime"></result> <result property="onsaletime" column="onsaletime"></result> <result property="state" column="state"></result> <result property="createtime" column="createtime"></result> <result property="searchMasterMsg_id" column="search_master_msg_id"></result> <result property="type_id" column="type_id"></result> <result property="shop_id" column="shop_id"></result> <!--private PetDetail detail = new PetDetail();--> <association property="detail" javaType="PetDetail"> <id property="id" column="pdid"></id> <result property="intro" column="intro"></result> <result property="adoptNotice" column="adoptNotice"></result> </association> <association property="shop" javaType="Shop"> <id property="id" column="sid"></id> <result property="name" column="sname"></result> </association> </resultMap>

12345678910111213141516171819202122232425262728293031323334353637383940414243444546 2.3.扩展功能

1)宠物类型
2)查询自己宠物
后台通过当前登录用户id,查询宠物在用户中心,我的资产里面,我的宠物进行展示
在这里插入图片描述
拷贝客人个人中心页面
在这里插入图片描述
在这里插入图片描述

3. 4. 5.课程总结

宠物后台管理 宠物前台列表 宠物详情页面基本展示跳转到店铺页面包养 查看用户自己宠物 锻炼找错能力 12345678 5.1.重点 5.2.难点 5.3.如何掌握 5.4.排错技巧(技巧) 6.常见问题 7.课后练习 8.面试题 9.扩展知识或课外阅读推荐(可选) 9.1.扩展知识 9.2.课外阅读

网址: A076 https://m.mcbbbk.com/newsview629880.html

所属分类:萌宠日常
上一篇: 一个月狗狗如何喂食,掌握这些技巧
下一篇: 怎么喂猫吃东西