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

给网站做优化刷活跃要收费吗手机地图app下载安装

给网站做优化刷活跃要收费吗,手机地图app下载安装,如何建设网站论坛,潍坊网站制作公司前言: 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/117601.html

相关文章:

  • 宁波快速制作网站做灰色词seo靠谱
  • 如何做凡客网站免费的关键词优化工具
  • nodejs可以做网站吗推广app有哪些
  • 江门网站建设易搜互联太原seo优化公司
  • 如何做好政府网站的特色建设百度问答平台
  • 中山企业网站建设定制女生学电子商务好吗
  • 鲜花店网站建设的总结最近刚发生的新闻
  • 开发流程管理郑州seo技术培训班
  • 电商设计网站素材拉新平台哪个好佣金高
  • 电话手表网站站长之家素材
  • 深圳网站建设工作室上海网络推广外包公司
  • 建设银行手机查询网站深圳网络营销平台
  • 杭州企业网站长尾关键词挖掘熊猫
  • 做企业宣传片的网站网址百度刷排名
  • 党刊网站怎么做公司市场营销策划方案
  • 抖音运营公司排名前十武汉网站建设优化
  • 沈阳网站建设方案外包网站优化推广怎么做
  • 呼家楼网站建设百度公司名称
  • 什么是wap网站十大品牌营销策划公司
  • 求一个做烧肉的网站网络舆情分析报告范文
  • 做网站引流的最佳方法厦门人才网唯一官方网站
  • 一般给公司做网站用什么软件昆明seo建站
  • 文登 网站建设六六seo基础运营第三讲
  • 聊城做网站的公司市场百度广告联盟平台官网
  • 免费软件下载appseo交流论坛
  • 做pc端网站要多少钱上海seo网站推广公司
  • 网站接口怎么做一键优化软件
  • go 网站开发百度指数功能模块
  • 怎做卖东西的网站四川自助seo建站
  • 淘宝客网站做一种还是做好几种哪里可以接广告