1 Star 0 Fork 0

linhaid / Ham-springboot

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

扩展:

1.josn传递数组用[]开始

2.时间选择时间戳,默认写 CURRENT_TIMESTAMP

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.分页查询(vo dto do po) 传统分页查询后存入redis

​ 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:

1.解决跨域问题:

前端:

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);
    }

}

2.解决前端与后端时间配对

@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date stime;

@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date etime;

以上注解含义如下:

  • @PostAuthorize: 在目前标方法执行之后进行权限校验。
  • @PostFiter: 在目标方法执行之后对方法的返回结果进行过滤。
  • @PreAuthorize:在目标方法执行之前进行权限校验。
  • @PreFiter:在目前标方法执行之前对方法参数进行过滤。
  • @Secured:访问目标方法必须具各相应的角色。
  • @DenyAll:拒绝所有访问。
  • @PermitAll:允许所有访问。
  • @RolesAllowed:访问目标方法必须具备相应的角色。

空文件

简介

取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/linhaid/Ham-springboot.git
git@gitee.com:linhaid/Ham-springboot.git
linhaid
Ham-springboot
Ham-springboot
master

搜索帮助