<?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="com.whyc.mapper.BattLithiumTestDataInfMapper">
|
<resultMap id="staticTinf" type="BattLithiumTestDataInf">
|
<id property="num" column="num"></id>
|
<result property="devId" column="dev_id"></result>
|
<result property="testType" column="test_type"></result>
|
<result property="devType" column="dev_type"></result>
|
</resultMap>
|
<select id="getDevTinf" resultMap="staticTinf">
|
select num,dev_id,test_type,floor(dev_id/100000000) as dev_type from db_lithium_testdata.tb_batttestdata_inf
|
<where>
|
dev_id in (
|
SELECT distinct dev_id from db_user.tb_battgroup_baojigroup,db_user.tb_battgroup_usr
|
<where>
|
tb_battgroup_baojigroup.baoji_group_id=tb_battgroup_usr.baoji_group_id
|
<if test="uid!=null">
|
and uid=#{uid}
|
</if>
|
</where>
|
)
|
</where>
|
</select>
|
<select id="getDevTinfByYear" resultMap="staticTinf">
|
select num,dev_id,test_type,floor(dev_id/100000000) as dev_type from db_lithium_testdata.tb_batttestdata_inf
|
<where>
|
EXTRACT (YEAR from test_starttime)= EXTRACT (YEAR from NOW())
|
and dev_id in (
|
SELECT distinct dev_id from db_user.tb_battgroup_baojigroup,db_user.tb_battgroup_usr
|
<where>
|
tb_battgroup_baojigroup.baoji_group_id=tb_battgroup_usr.baoji_group_id
|
<if test="uid!=null">
|
and uid=#{uid}
|
</if>
|
</where>
|
)
|
</where>
|
</select>
|
<select id="getDevTinfByMonth" resultMap="staticTinf">
|
select num,dev_id,test_type,floor(dev_id/100000000) as dev_type from db_lithium_testdata.tb_batttestdata_inf
|
<where>
|
DATE_FORMAT(test_starttime,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m')
|
and dev_id in (
|
SELECT distinct dev_id from db_user.tb_battgroup_baojigroup,db_user.tb_battgroup_usr
|
<where>
|
tb_battgroup_baojigroup.baoji_group_id=tb_battgroup_usr.baoji_group_id
|
<if test="uid!=null">
|
and uid=#{uid}
|
</if>
|
</where>
|
)
|
</where>
|
</select>
|
<resultMap id="staticTinfWeek" type="BattLithiumTestDataInf">
|
<id property="num" column="num"></id>
|
<result property="devId" column="dev_id"></result>
|
<result property="testType" column="test_type"></result>
|
<result property="devType" column="dev_type"></result>
|
<result property="weekDay" column="week_day"></result>
|
</resultMap>
|
<select id="getDevTinfByWeek" resultMap="staticTinfWeek">
|
select num,dev_id,test_type,floor(dev_id/100000000) as dev_type,DATE_FORMAT(test_starttime, '%Y-%m-%d') AS week_day
|
from db_lithium_testdata.tb_batttestdata_inf
|
<where>
|
(CURRENT_DATE - INTERVAL '6 day') <= DATE(test_starttime)
|
and floor(dev_id/100000000)=#{type}
|
and dev_id in (
|
SELECT distinct dev_id from db_user.tb_battgroup_baojigroup,db_user.tb_battgroup_usr
|
<where>
|
tb_battgroup_baojigroup.baoji_group_id=tb_battgroup_usr.baoji_group_id
|
<if test="uid!=null">
|
and uid=#{uid}
|
</if>
|
</where>
|
)
|
</where>
|
</select>
|
<select id="getTinfById" resultType="com.whyc.pojo.db_lithium_testdata.BattLithiumTestDataInf">
|
select *
|
from db_lithium_testdata.tb_batttestdata_inf
|
<where>
|
and test_type=#{type}
|
and dev_id=#{devId}
|
</where>
|
order by test_starttime desc
|
</select>
|
</mapper>
|