后端请求"/>
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') >= 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') <= 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 后端请求
发布评论