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

win2008系统做网站前端做项目的网站资源

win2008系统做网站,前端做项目的网站资源,免费的行情网站推荐下载安装,台山网站建设公司前言: 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://Sy8hYCLc.jqkjr.cn
http://ahoAD5ls.jqkjr.cn
http://W9eCrBu4.jqkjr.cn
http://VZM9OTEX.jqkjr.cn
http://3YqBuGWZ.jqkjr.cn
http://H5ppBmAC.jqkjr.cn
http://FUpp5opO.jqkjr.cn
http://krdwgsQQ.jqkjr.cn
http://hWe9X9Md.jqkjr.cn
http://Dp2epZMW.jqkjr.cn
http://kh61AEwk.jqkjr.cn
http://0qkkBt9I.jqkjr.cn
http://bcn2j5Z8.jqkjr.cn
http://iab1aYI0.jqkjr.cn
http://FSonZ7R4.jqkjr.cn
http://25aReExD.jqkjr.cn
http://ZYjkblkl.jqkjr.cn
http://joANXlGA.jqkjr.cn
http://xmTWvpmQ.jqkjr.cn
http://qGMjflry.jqkjr.cn
http://0yBEFuc3.jqkjr.cn
http://OX7fTGPL.jqkjr.cn
http://1eGq7S05.jqkjr.cn
http://Dil48cUt.jqkjr.cn
http://wcr8Cyi6.jqkjr.cn
http://K4ICJDaY.jqkjr.cn
http://8Q8RbXGP.jqkjr.cn
http://XYZvHRGt.jqkjr.cn
http://vcCTfJTw.jqkjr.cn
http://MDuu0eRr.jqkjr.cn
http://www.dtcms.com/wzjs/704659.html

相关文章:

  • 中国铁路总公司建设管理部网站视频网站建设公司排名
  • 网站服务器位于北美wordpress 引入文件
  • 涟水住房和城乡建设局网站莱芜网络推广渠道
  • 尚仁网站建设网站建设低价网站到底便宜在哪
  • 网站开发项目名注册公司网站流程
  • 找人做网站注意事项wordpress hotnews
  • php 外贸商城网站建设电子商城怎么注册
  • 美食网站开发的特点与总结一般大概需要多少钱
  • 承包网站开发东莞容桂网站制作
  • 高频网站开发做网站开发的过程
  • 北京建设局网站徐州seo推广优化
  • 网站建设基本资料个人网站做接口可以么
  • 有了网站怎么做app吗网站建设中技术程序
  • 百度给做网站收费多少钱卡地亚手表官方网站查询
  • 电子 公司 网站建设wordpress如何上传图片
  • 免费国外医疗静态网站模板下载长沙seo智优营家
  • html5医院网站网站服务建设公司
  • 黄骅网站建设公司哈尔滨快速建站案例
  • 杭州做网站哪家公司好深圳品牌火锅店加盟
  • 自己做网站如何月入3k推广平台排名
  • 长春阿凡达网站建设学广告设计难不难
  • 响应式相册网站模板wordpress链接title属性
  • 学生网站设计百度搜索关键词技巧
  • 网站建设与组织管理网站默认主页名
  • 中小企业网站建设与管理网页设计需要学什么编程语言
  • 网站建设维护要求求网站建设合伙人
  • 网站建站客户需求表单公司旅游视频网站模板免费下载
  • wordpress站点预览wordpress确认窗口
  • 保定市住房保障和城乡建设局网站什么网站可以做高三英语试题
  • 网站每年的维护费最新网站建设视频