郯城建设局网站,重庆今天新闻事件,建网站问题,网站及app建设目录 1、编写模板
2、发送请求
3、后端返数据
1.Controller类 2.interface接口#xff08;Service层接口#xff09;
3.Service#xff08;接口实现#xff09;
4.interface接口#xff08;Mapper层接口#xff09; 5.xml
6.效果
4、el-switch属性 1、编写模板
…目录 1、编写模板
2、发送请求
3、后端返数据
1.Controller类 2.interface接口Service层接口
3.Service接口实现
4.interface接口Mapper层接口 5.xml
6.效果
4、el-switch属性 1、编写模板
el-table :datagoodsData border stylewidth: 100%el-table-column propid labelid width180/el-table-columnel-table-column propname label商品名称 width180/el-table-columnel-table-column propprice label商品价格 width180/el-table-columnel-table-column propimageUrl label商品图片 width180/el-table-columnel-table-column propstatus label状态template slot-scopescopeel-switch v-modelscope.row.statusactive-colorgreeninactive-color#ff4949active-value1active-text未删除inactive-text已删除inactive-value0width50changedeleteGoods(scope.row.id, scope.row.status)/el-switch/template/el-table-column
/el-table2、发送请求 deleteGoods(id,status){if(id!id!null){this.$axios({method:post,url:http://localhost:8080/api/upload/deleteGoods,data:{id:id,status:status}}).then((res){this.$message({message:修改成功,type:success})})}},
3、后端返数据
1.Controller类 PostMapping(/deleteGoods)public Result deleteGoods(RequestBody Goods goods) {return uploadFileService.deletegoods(goods);} 2.interface接口Service层接口
public interface UploadFileService {Result deletegoods(Goods goods);}
3.Service接口实现 Overridepublic Result deletegoods(Goods goods) {//删除物理删除逻辑删除//这里是逻辑删除int countuploadFileMapper.updateGoods(goods);if (count1){return Result.succeed(删除成功);}else{return Result.failed(删除失败);}}
4.interface接口Mapper层接口
public interface UploadFileMapper {int updateGoods(Goods goods);}5.xml
update idupdateGoodsupdate goodssetif testname!and name!nullname#{name},/ifif testprice!and price!nullprice#{price},/ifif testimageUrl!nullimageUrl#{imageUrl},/ifif teststatus!and status!nullstatus#{status}/if/setwhereid #{id}/update
6.效果 4、el-switch属性