代码拉取完成,页面将自动刷新
扩展:
2023.2.16:
1.三张表:
店主表:Sid Sname Sphone Spassword
客人表:Cid Cname Cphone
订单表:Rid Rstime Retime Rweight Rprice Rstate Cid Sid
2.对订单业务: 添加订单(完成)
完成订单(完成) 提交id数组
修改订单(完成) 订单完成要与状态一致 0未完成,1完成
删除订单(完成)
查询订单: 按时间查询(完成 待优化) 今天1 昨天2 近7天3 本月4 上一月5 季度6 今年7 建立record:time:分组
按是否完成查询(完成) 建立record:state:分组
对客户业务: 查看客户(完成) 建立customer:all缓存
修改客户(完成) 增加在信息更新过程中修改返回原因
删除客户(完成)
增加客户(完成)
对店主: 登录
3.注入: 3.1 @Autowired
3.2 private final UserService userService;
public UserController(UserService userService) {
this.userService = userService;
}
3.3 @Resource
4.添加redis配置及工具类
5.添加mybatis plus : customerQueryWrapper.eq("id",myid) 相当于where id = myid
6.为测试redis过期时间在0到60秒
2023.2.18:
1.1 查看所有客户 customer:all改为customer:all:pagenum+pagesize 简单单表直接mybatis plus的page方法,多表自定义分页 1.2 查看所有订单 record:all:pagenum+pagesize 1.3 查询订单 record:time:pagenum+pagesize record:state:pagenum+pagesize 2.重写增加与修改订单信息方法 增加与修改都要判别是否是新客户(保证手机号)
2023.2.19: 新增客户返回主键
xml:
<insert id="insertBatch" useGeneratedKeys="true" keyProperty="id" parameterType="com.hamspringboot.po.Customer">
insert into t_customer (cname,cphone) values (#{customer.name},#{customer.phone})
</insert>
mapper接口:
void insertBatch(@Param("customer") Customer customer);
使用:
customerMapper.insertBatch(customer);
cid=customer.getId();
2023.3.3:
前端:
export default defineConfig({
plugins: [vue()],
server:{
proxy:{
'/api':{
target:"http://127.0.0.1:8081/ham", //跨域地址
changeOrigin:true, //支持跨域
rewrite:(path) => path.replace(/^\/api/, "")//重写路径,替换/api
}
},
port:5173,
},
})
后端:
package com.hamspringboot.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class MyWebConfigurer implements WebMvcConfigurer {
@Bean
public CorsFilter corsFilter() {
final UrlBasedCorsConfigurationSource urlBasedCorsConfigurationSource = new UrlBasedCorsConfigurationSource();
final CorsConfiguration corsConfiguration = new CorsConfiguration();
/* 是否允许请求带有验证信息 */
corsConfiguration.setAllowCredentials(true);
/* 允许访问的客户端域名 */
corsConfiguration.addAllowedOrigin("http://127.0.0.1:5173/");
/* 允许服务端访问的客户端请求头 */
corsConfiguration.addAllowedHeader("*");
/* 允许访问的方法名,GET POST等 */
corsConfiguration.addAllowedMethod("*");
urlBasedCorsConfigurationSource.registerCorsConfiguration("/**", corsConfiguration);
return new CorsFilter(urlBasedCorsConfigurationSource);
}
}
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date stime;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date etime;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。