当前位置: 首页 > 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://www.dtcms.com/wzjs/781512.html

相关文章:

  • 网站优化建设深圳seo分析及优化建议
  • 建网站一般多少钱幸福里建设部网站监理工程师报名
  • 个人网站不备案做经营性质网站近几年的网络营销案例
  • 有关做生态环境的官方网站软件开发文档通用要求
  • 桐乡市建设局网站大通酩悦微商怎么推广自己的产品
  • 网站关键词设置wordpress主题W3C
  • 开封市网站建设电子商务网站建设维护实训报告
  • 免费建设dj网站免费广告设计素材
  • 网站建设销售客户开发站酷网站的比赛网页谁做的
  • 做dm素材网站信阳做网站
  • 苏州工业园区两学一做网站为什么很少用python做网站
  • 山东外贸网站是什么意思做广告推广哪个平台好
  • 飞卢盗版做的最好的网站爱尔眼科医院集团
  • 和萝莉做的电影网站建官网公司
  • 深圳响应式网站公司上海网站建设 公司案例
  • 外贸婚纱礼服网站兼职网站建设 开源
  • 经营网站赚钱wordpress登录界面出错
  • 制作微网站的平台有哪些东莞建网站的公
  • 纯净软件网站推荐上海恒鑫网站建设
  • 免费信息网站排名旅游最新资讯 新闻
  • 查询网站空间的服务商做优化送网站
  • 石家庄市工程建设造价管理站网站深圳外贸公司有哪些公司
  • 如何在电网网站做备案校园网的规划与设计
  • 外国人做的关于中国的视频网站吗工程建设有限公司
  • 溧阳住房和城乡建设局网站提供网站建设收费标准
  • 南京品牌网站建设天津百度搜索网站排名
  • 电影采集网站怎么做seo商城网站怎么做内链
  • 电脑做网站服务器改端口jpress wordpress
  • 手机怎么开网站wordpress搭建教育平台
  • 仿牌外贸网站推广潍坊高新建设局网站