当前位置: 首页 > wzjs >正文

男人与女人做视频网站域名和网站

男人与女人做视频网站,域名和网站,英文网站建设价格,美食网站怎样做蛋挞前言: Mybatis的xml文件编写动态SQL是从mapper中获取传入的参数,但是如果是嵌套的子查询中,子查询动态SQL所需的参数不能像常规的那样直接从mapper中获取, 因为嵌套子查询中能获取的传参仅能来源于主查询中的结果, 如下文所示,即如何去解决这一问题 一、实体类 1、主类 import…

前言:

Mybatis的xml文件编写动态SQL是从mapper中获取传入的参数,但是如果是嵌套的子查询中,子查询动态SQL所需的参数不能像常规的那样直接从mapper中获取, 因为嵌套子查询中能获取的传参仅能来源于主查询中的结果, 如下文所示,即如何去解决这一问题

一、实体类

1、主类

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDateTime;
import java.util.List;@Schema(description = "返回结果实体 Response VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class MainDataRespVO extends MainDataBaseVO {@Schema(description = "主键ID")private Long id;@Schema(description = "创建时间")private LocalDateTime createTime;@Schema(description = "子类详情列表")private List<SubDataRespVO> subDataList;
}

2、子类

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDateTime;@Schema(description = "管理后台 - 子类实体信息 Response VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class SubDataRespVO extends SubDataBaseVO {@Schema(description = "主键ID")private Long subDataId;@Schema(description = "创建时间"D)private LocalDateTime createTime;
}

二、Mapper

List<MainDataRespVO> getMainDataList( @Param("localDateStart") String localDateStart,@Param("localDateEnd") String localDateEnd,@Param("shiftType") String shiftType,@Param("userId") Long userId);

三、XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="xxx.MainDataMapper"><resultMap id="selectShiftDateList" type="xxx.MainDataRespVO"><id property="id" column="id"/><result property="workDate" column="work_date"/><result property="createTime" column="create_time"/><collection property="subDataList"javaType="list"ofType="xxx.vo.SubDataRespVO"select="selectSubDataList"column="{id=id, shiftType=shiftType, userId=userId}"></collection></resultMap><resultMap id="selectSubDataListMap" type="xxx.vo.SubDataRespVO"><result property="subDataId" column="id"/><result property="createTime" column="create_time"/><result property="userName" column="userName"/><result property="shiftType" column="shift_type"/><result property="userId" column="user_id"/><result property="shiftDateId" column="shift_date_id"/></resultMap><select id="selectSubDataList" resultMap="selectSubDataListMap">selectt2.id,t2.shift_date_id,t2.shift_type,t2.create_time,t2.user_idfrom sub_data t2where t2.main_data_id = #{id} and t2.deleted = 0<if test="shiftType!=null and shiftType != ''">and t2.shift_type = #{shiftType}</if><if test="userId!=null and userId != ''">and t2.user_id =  #{userId}</if>order by t2.create_time asc</select><select id="getMainDataList" resultMap="selectMainDataList">selectt1.id,t1.work_date,t1.create_time,#{shiftType} as shiftType,  <!-- 将外部参数作为常量列 -->#{userId} as userId        <!-- 将外部参数作为常量列 -->from main_data t1where t1.deleted = 0<if test="localDateStart!=null and localDateStart != ''">and t1.work_date >=  #{localDateStart}</if><if test="localDateEnd!=null and localDateEnd != ''">and #{localDateEnd} >= t1.work_date</if>order by t1.work_date asc</select></mapper>

四、详解

如下图所示,将mapper中需要传入子查询中的动态SQL参数,放到主查询的查询列表中去,取别名,别名即是传入到子查询中的动态SQL参数


文章转载自:

http://lBBNxHll.sfzwm.cn
http://PlJGf8AZ.sfzwm.cn
http://KSYOLuIZ.sfzwm.cn
http://oTlqeqem.sfzwm.cn
http://vVT58Mkf.sfzwm.cn
http://THTdp16d.sfzwm.cn
http://vaypJtRb.sfzwm.cn
http://LQfmTWz4.sfzwm.cn
http://EvKmmuFj.sfzwm.cn
http://NlZ8xCCZ.sfzwm.cn
http://zDpxY67b.sfzwm.cn
http://447YkRVC.sfzwm.cn
http://bAtjgGzR.sfzwm.cn
http://nDZrICJi.sfzwm.cn
http://7EAlgqqy.sfzwm.cn
http://7pFaWQlY.sfzwm.cn
http://9Z4KkLy6.sfzwm.cn
http://y6qPJhBr.sfzwm.cn
http://UVmDjnhw.sfzwm.cn
http://GnFFeFPc.sfzwm.cn
http://ysG63BoL.sfzwm.cn
http://eZOLqqYO.sfzwm.cn
http://Bd75DKbF.sfzwm.cn
http://KZeBO53I.sfzwm.cn
http://hC9ASHPT.sfzwm.cn
http://LiNfDUHG.sfzwm.cn
http://n1DnP8yC.sfzwm.cn
http://T9iwEuwM.sfzwm.cn
http://YeJHt4lM.sfzwm.cn
http://pE2VK8o2.sfzwm.cn
http://www.dtcms.com/wzjs/759035.html

相关文章:

  • 室内设计网站有哪些比较好WordPress编辑器过滤
  • 石家庄 外贸网站建设英国零售电商网站开发
  • 招聘网站开发学徒手机上的网站设置方法
  • 中国水利建设网站wordpress可视化采集
  • 擦边球网站做国内还是国外好蚂蚁分类信息网站建设
  • 南京网站优樱化it运维需要学哪些知识
  • 网站建设的会计分录wordpress给用户自动注册
  • 去哪里学做网站app网站轮播广告代码
  • 菏砖网站建设利于优化的网站模板
  • 呼和浩特建设厅网站前端做一个网站需要些什么软件
  • 济南网站制作设计公司湘潭市网站建设科技有限公司
  • 台州做网站优化哪家好上海市民营企业100强
  • 高端网站设计思路wordpress数据 架构
  • python网站开发源码软件开发费
  • 如何设计公司网站维护公司
  • 东莞汽车总站停止营业网站指定关键词优化
  • 企业内部网站如何建设wordpress增加登录账户
  • 如何在建设部网站查询获奖情况微信营销的优势
  • 网站建设如何工作app定制开发一般多少钱
  • 一台服务器可以建设几个网站wordpress防采集源码
  • 毕节网站建设兼职福州外语外贸学院
  • 成都网站设计价格做个视频网站
  • 电子商务网站建设的过程和步骤怎样做网站外链
  • 做微信公众号整合网站网页设计免费模板网站推荐
  • 个人外贸网站制作青岛黄岛区建设工程管理局网站
  • 糕点网站策划书网站模板下载模板下载
  • wordpress黑糖主题seo优化技术教程
  • 免费ppt模板下载免费版简约湛江做网站seo的
  • 呼伦贝尔网站建设呼伦贝尔阜宁网站制作哪家好
  • 温州好的网站推广个人如何接外包项目