| | |
| | | </where> |
| | | order by test_starttime desc |
| | | </select> |
| | | <select id="searchByBattGroupIdCondition" resultType="java.util.List" parameterType="com.whyc.pojo.Battinf"> |
| | | select distinct(db_battinf.tb_batt_maint_inf.battgroupid),StationName,BattGroupName |
| | | ,db_battinf.tb_batt_maint_inf.num,usr_id,fault_type_id,fault_level,fault_caption,db_battinf.tb_batt_maint_inf.record_time,maint_time_limit,maint_type_id |
| | | ,maint_result,maint_done,maint_done_time,maint_close,master_id,master_audit |
| | | ,copy_uids,appoint_uid |
| | | from db_battinf.tb_batt_maint_inf |
| | | left outer join db_battinf.tb_battinf on db_battinf.tb_battinf.BattgroupId=db_battinf.tb_batt_maint_inf.BattGroupId |
| | | left outer join db_batt_testdata.tb_batttestdata_inf on db_battinf.tb_batt_maint_inf.BattGroupId=db_batt_testdata.tb_batttestdata_inf.BattGroupId |
| | | left outer join db_user.tb_user_battgroup_baojigroup_battgroup on db_user.tb_user_battgroup_baojigroup_battgroup.battgroupid=db_battinf.tb_batt_maint_inf.BattGroupId |
| | | left outer join db_user.tb_user_battgroup_baojigroup_usr on db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id= db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id |
| | | left outer join db_user.tb_user_inf on db_user.tb_user_inf.uId=db_user.tb_user_battgroup_baojigroup_usr.uid |
| | | <where> |
| | | <if test="binf.battProductDate!=null and binf.battProductDate1!=null"> |
| | | to_days(battproductdate)>=to_days(#{binf.battProductDate}) and to_days(battproductdate)<=to_days(#{binf.battProductDate1}) |
| | | </if> |
| | | <if test="binf.battInUseDate!=null and binf.battInuseDate1!=null"> |
| | | and to_days(battinusedate)>=to_days(#{binf.battInUseDate}) and to_days(battinusedate)<=to_days(#{binf.battInUseDate1}) |
| | | </if> |
| | | <if test="binf.stationName1!=null and binf.stationName1!=''"> |
| | | and stationName1=#{binf.stationName1} |
| | | </if> |
| | | <if test="binf.battProducer!=null and binf.battProducer!=''"> |
| | | and battProducer=#{binf.battProducer} |
| | | </if> |
| | | <if test="binf.getTestType==2 or binf.getTestType==3 or binf.getTestType==9 "> |
| | | and db_battinf.tb_batt_maint_inf.BattGroupId in |
| | | (select distinct(db_batt_testdata.tb_batttestdata_inf.BattGroupId ) from db_batt_testdata.tb_batttestdata_inf |
| | | where db_batt_testdata.tb_batttestdata_inf.test_type=? |
| | | and to_days(record_time)>=to_days(?) and to_days(record_time)<=to_days(?)) |
| | | </if> |
| | | <if test="testtype==5"> <!--tb_battresdata_inf表,不是testdata表--> |
| | | and db_battinf.tb_batt_maint_inf.BattGroupId in |
| | | (select distinct(db_batt_testdata.tb_battresdata_inf.BattGroupId ) from db_batt_testdata.tb_battresdata_inf |
| | | where db_batt_testdata.tb_battresdata_inf.test_type=? |
| | | and to_days(record_time)>=to_days(?) and to_days(record_time)<=to_days(?)) |
| | | </if> |
| | | <if test="testType==3000"> |
| | | and db_battinf.tb_batt_maint_inf.BattGroupId in( |
| | | select distinct(db_batt_testdata.tb_batttestdata_inf.BattGroupId ) from db_batt_testdata.tb_batttestdata_inf |
| | | where db_batt_testdata.tb_batttestdata_inf.test_type in(?,2,3) |
| | | and to_days(record_time)>=to_days(?) and to_days(record_time)<=to_days(?)) |
| | | </if> |
| | | <if test="testType==4000"> |
| | | and db_battinf.tb_batt_maint_inf.BattGroupId not in( |
| | | select distinct(db_batt_testdata.tb_batttestdata_inf.BattGroupId ) from db_batt_testdata.tb_batttestdata_inf |
| | | where db_batt_testdata.tb_batttestdata_inf.test_type in(?,2,3) |
| | | and to_days(record_time)>=to_days(?) and to_days(record_time)<=to_days(?)) |
| | | </if> |
| | | <if test="testType==0"> |
| | | and db_battinf.tb_batt_maint_inf.BattGroupId!=( |
| | | select count(distinct(db_batt_testdata.tb_batttestdata_inf.BattGroupId )) from db_batt_testdata.tb_batttestdata_inf |
| | | where db_batt_testdata.tb_batttestdata_inf.test_type in(?,2,3) |
| | | and to_days(record_time)>=to_days(?) and to_days(record_time)<=to_days(?)) |
| | | </if> |
| | | |
| | | <if test="binf.battGroupId"> |
| | | and db_battinf.tb_battinf.battgroupid=? |
| | | </if> |
| | | |
| | | <if test="binf.battGroupName=='其他'"> |
| | | and BattGroupName1 not like '%开关电源系统%' and BattGroupName1 not like '%UPS系统%' and BattGroupName1 not like ? |
| | | </if> |
| | | <if test="binf.battGroupName!=null and binf.battGroupName!='其他'"> |
| | | and BattGroupName1 like ? |
| | | </if> |
| | | <if test="binf.monVolStd!=0"> |
| | | and monVolStd=? |
| | | </if> |
| | | <if test="binf.monCapStd!=0"> |
| | | and monCapStd=? |
| | | </if> |
| | | <if test="uName!=0 and uName!=null and uName!=''"> |
| | | and db_user.tb_user_inf.uname=? and db_user.tb_user_inf.ubaojiusr=1 |
| | | </if> |
| | | <if test="testStartType==1"> |
| | | and test_starttype<5 and test_type not in(2,9) and test_starttype!=2 |
| | | </if> |
| | | <if test="testStartType==2"> |
| | | and test_starttype>=5 or (test_type not in(2,9) and test_starttype=2) |
| | | </if> |
| | | <if test="remark==0"> |
| | | and db_battinf.tb_battinf.BattGroupId not in( |
| | | select db_battinf.tb_batt_maint_inf.battgroupid from db_battinf.tb_batt_maint_inf |
| | | where to_days(maint_done_time)>=to_days(?) and to_days(maint_done_time)<=to_days(?) ) |
| | | </if> |
| | | <if test="remark==1"> |
| | | and db_battinf.tb_battinf.BattGroupId in( |
| | | select db_battinf.tb_batt_maint_inf.battgroupid from db_battinf.tb_batt_maint_inf· |
| | | where to_days(maint_done_time)>=to_days(?) and to_days(maint_done_time)<=to_days(?) ) |
| | | </if> |
| | | <if test="remark==100"> |
| | | and db_battinf.tb_battinf.BattGroupId!=( |
| | | select count(distinct(db_battinf.tb_batt_maint_inf.battgroupid )) from db_battinf.tb_batt_maint_inf |
| | | where to_days(maint_done_time)>=to_days(?) and to_days(maint_done_time)<=to_days(?)) |
| | | </if> |
| | | </where> |
| | | order by StationName1 asc,db_battinf.tb_battinf.BattgroupId asc,test_starttime asc |
| | | </select> |
| | | </mapper> |