mybaties将时间格式成字符串
来源:互联网 发布:中国人种基因知乎 编辑:程序博客网 时间:2024/06/07 05:13
有时候在做根据年月查询时要用到对时间切割字符串,代码如下:
select of.id, of.name, (select count(ctd.id) from car_train_driver ctd where ctd.done= '1' and ctd.car_train_id in (select id from car_train where parent_id in (select id from car_train where user_id in (select id from sys_user where office_id in (select id from sys_office where parent_id in (select id from sys_office where parent_id = of.id <if test="year !=null and year !=''"> AND DATE_FORMAT(ctd.create_date,"%Y")= #{year} </if> <if test="month != null and month !=''"> AND DATE_FORMAT(ctd.create_date,"%m")=#{month} </if> ) ) ) ) ) ) num, format(if((select (sum(score)/(count(id)*5))*100* (select count(ctd.id) from car_train_driver ctd where ctd.done= '1' and ctd.car_train_id in (select id from car_train where parent_id in (select id from car_train where user_id in (select id from sys_user where office_id in (select id from sys_office where parent_id in (select id from sys_office where parent_id = of.id <if test="year !=null and year !=''"> AND DATE_FORMAT(ctd.create_date,"%Y")= #{year} </if> <if test="month != null and month !=''"> AND DATE_FORMAT(ctd.create_date,"%m")=#{month} </if> ) ) ) ) ) ) from car_configuration_train where car_train_driver_id in (select id from car_train_driver where done= '1' and car_train_id in (select id from car_train where parent_id in (select id from car_train where user_id in (select id from sys_user where office_id in (select id from sys_office where parent_id in (select id from sys_office where parent_id = of.id) ) ) ) ) ) ) is null,0,(select (sum(score)/(count(id)*5))*100* (select count(ctd.id) from car_train_driver ctd where ctd.done= '1' and ctd.car_train_id in (select id from car_train where parent_id in (select id from car_train where user_id in (select id from sys_user where office_id in (select id from sys_office where parent_id in (select id from sys_office where parent_id = of.id <if test="year !=null and year !=''"> AND DATE_FORMAT(ctd.create_date,"%Y")= #{year} </if> <if test="month != null and month !=''"> AND DATE_FORMAT(ctd.create_date,"%m")=#{month} </if> ) ) ) ) ) ) from car_configuration_train where car_train_driver_id in (select id from car_train_driver where done= '1' and car_train_id in (select id from car_train where parent_id in (select id from car_train where user_id in (select id from sys_user where office_id in (select id from sys_office where parent_id in (select id from sys_office where parent_id = of.id) ) ) ) ) ) )),0) score from <choose> <when test="user.id != null and user.id != ''"> (select id,name from sys_office where parent_id = '1') of </when> <otherwise> (select id,name from sys_office where parent_id = (select parent_id from sys_office where id = #{user.office.id}) ) of </otherwise> </choose> ORDER BY num desc;以上红色字体是关键代码,返回的类型是hashmap.
阅读全文
0 0
- mybaties将时间格式成字符串
- java将字符串转化成时间格式
- C语言 将时间转换成指定格式的字符串
- iOS NSDateFormatter将一串字符串转换成时间格式
- Python将日期时间按照格式转换成字符串
- 将时间格式转化为字符串
- javaScript将字符串格式的时间转换为date格式
- Oracle将number类型的时间值转换成时间格式的字符串
- php将标准字符串格式时间转换成unix时间戳_strtotime
- js将时间戳转化成时间格式字符串(兼容各种浏览器)
- Java将CST的时间字符串转换成需要的日期格式字符串
- 字符串转换成时间格式
- 时间戳转换成时间格式字符串
- 将time_t格式的字符串转换成具体的时间, 存放在SystemTime结构体中
- 将时间转换成yyyy-MM-dd HH:mm:ss的格式字符串
- 将时间转换成yyyy-MM-dd HH:mm:ss的格式字符串
- java编程题:将某个时间以固定格式转化成字符串
- IOS将字符串转换为日期时间格式
- CAS
- 2017年11月6日作业
- 1015. 德才论 (25)
- 1133. Splitting A Linked List (25)(结构体)
- LayoutInflater中inflate方法详解
- mybaties将时间格式成字符串
- 深度了解default constructor(深度了解默认构造函数)
- 一位10年Java工作经验的架构师聊Java和工作经验
- VUE 利用 webpack 给生产环境和发布环境配置不同的接口地址
- 移动广告平台Android SDK接入指南
- flexbox-弹性盒子详解
- 11.6考试爆炸记
- 脚手架搭建react项目
- PLSQL远程连接Oracle数据库