首页 > 移动平台 > 详细

Mapper中自写SQl查询语句(IN)

时间:2021-07-29 10:47:45      阅读:45      评论:0      收藏:0      [点我收藏+]

技术分享图片

@Select("<script>" +
"select o.id id,COUNT(o.id) num,o.name name from (\n" +
"SELECT n.id id,n.REAL_NAME name,m.createtime\n" +
"FROM\n" +
"\t(\n" +
"SELECT CREATEUSER,TO_CHAR( CREATETIME, ‘yyyy-mm-dd‘ ) createtime \n" +
"FROM YCNY_USER_ROUTES \n" +
"WHERE CREATETIME BETWEEN TO_DATE(#{beginTime}, ‘YYYY-MM-DD HH24:MI:SS‘) AND TO_DATE(#{endTime}, ‘YYYY-MM-DD HH24:MI:SS‘)\n" +
"AND ISDEL = 0 AND CREATEUSER IN " +
"<foreach item=‘id‘ index=‘index‘ collection=‘idList‘ open=‘(‘ separator=‘,‘ close=‘)‘>" +
"#{id}\n" +
"</foreach>" +
"GROUP BY CREATEUSER,TO_CHAR( CREATETIME, ‘yyyy-mm-dd‘ )\n" +
") m\n" +
"\tLEFT JOIN TIN_HR_USERS n ON m.CREATEUSER = n.ID\n" +
") o\n" +
"GROUP BY o.id,o.name" +
"</script>")
List<UserRoutesVo> findByCreatetimeAndCreateUser(@Param("beginTime")String beginTime,@Param("endTime")String endTime,@Param("idList")List<String> idList);

拓展:
技术分享图片
技术分享图片

Mapper中自写SQl查询语句(IN)

原文:https://www.cnblogs.com/dhc1995/p/15073635.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!