SpringBoot 后端请求

编程入门 行业动态 更新时间:2024-10-09 06:27:13

SpringBoot <a href=https://www.elefans.com/category/jswz/34/1771414.html style=后端请求"/>

SpringBoot 后端请求

知识点:

1、Java返回JSON的时间格式

/** 操作时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date oper_time;

2、Bean万能参数,在实体之外加一个Key,Value的参数

/** 请求参数 */
private Map<String, Object> params;

3、前端请求的日期格式化

this.loading = true;
if (this.queryForm.operTime.length == 2) {this.queryForm.params.beginTime = this.queryForm.operTime[0].format('YYYY-MM-DD')this.queryForm.params.endTime = this.queryForm.operTime[1].format('YYYY-MM-DD')
} else {this.queryForm.params.beginTime = ""this.queryForm.params.endTime = ""
}//合并查询对象和分页对象
getOperLogList(Object.assign(this.queryForm, this.tablePage))

4、Mybits的使用

<select id="selectOperLogList" parameterType="com.java.core.entity.master.SysOperLog" resultType="com.java.core.entity.master.SysOperLog">select * from sys_oper_log owhere 1=1<if test="title != null and title != ''">AND o.title like concat('%', #{title}, '%')</if><if test="oper_user_name != null and oper_user_name != ''">AND o.oper_user_name like concat('%', #{oper_user_name}, '%')</if><if test="business_type != null and business_type != ''">AND o.business_type = #{business_type}</if><if test="status != null and status != ''">AND o.status = #{status}</if><if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->and date_format(o.oper_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')</if><if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->and date_format(o.oper_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')</if></select>

5、后端接收

@ApiOperation(value = "分页查询信息")@Log(title = "系统配置信息", businessType = BusinessType.GET)@PreAuthorize("hasAuthority('sys:oper_log:get')")@GetMapping(value = "/getOperLogList")public HttpResult getOperLogList(SysOperLog operLog){this.startPage();List<SysOperLog> list = operLogService.selectOperLogList(operLog);TableDataInfo dataInfo = this.getDataTable(list);return HttpResult.ok(dataInfo.getRows(),dataInfo.getTotal());}

更多推荐

SpringBoot 后端请求

本文发布于:2024-02-28 07:35:51,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1768883.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:后端   SpringBoot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!