whycrzg
2021-02-20 1c6f32cc6674dea616f220920f06b455153ded56
update battMaintInf# etc
12个文件已修改
495 ■■■■ 已修改文件
src/main/java/com/fgkj/controller/Batt_maint_infController.java 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fgkj/mapper/impl/BattInfMapper.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fgkj/mapper/impl/Batt_maint_infAgainMapper.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fgkj/mapper/impl/Batt_maint_infMapper.java 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fgkj/mapper/impl/Batt_maint_processMapper.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fgkj/services/Batt_maint_infService.java 163 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fgkj/services/Batt_maint_processService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fgkj/services/User_infService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/BattInfMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/BattMaintInfAgainMapper.xml 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/BattMaintInfMapper.xml 209 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/BattMaintProcessMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fgkj/controller/Batt_maint_infController.java
@@ -4,6 +4,7 @@
import com.fgkj.services.Batt_maint_infService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@@ -24,12 +25,11 @@
    
    //2.1电池故障维护记录查询
    @GetMapping("maint")
    @ApiOperation(notes = "",value="电池故障维护记录查询")
    @PostMapping("maint")
    @ApiOperation(notes = "TODO have no data",value="电池故障维护记录查询")
    public ServiceModel serchMaint(@RequestBody Batt_Maint_Dealarm bd){
        //System.out.println(bd);
        // bd = ActionUtil.getGson("yyyy-MM-dd").fromJson(result, Batt_Maint_Dealarm.class);
        ServiceModel model=service.serchMaint(bd);
        System.out.println(bd);
        ServiceModel model=service.serchMaint(bd);//222不带条件查询无数据
        return model;
    }
    
@@ -40,8 +40,8 @@
     * master_check存放包机人 
     * remark存放品牌
     */
    @GetMapping("byCondition")
    @ApiOperation(notes = "",value="电池故障处理统计查询")
    @PostMapping("byCondition")
    @ApiOperation(notes = "TODO have no data",value="电池故障处理统计查询")
    public List serchByCondition(@RequestBody Batt_User_Permit bup){
        // bup= ActionUtil.getGson("yyyy-MM-dd").fromJson(result, Batt_User_Permit.class);
        List list=service.serchByCondition(bup);        
@@ -50,7 +50,7 @@
    
    //0.3查询所有的维护记录(只传page对象)
    @GetMapping("/")
    @ApiOperation(notes = "",value="查询所有的维护记录(只传page对象)")
    @ApiOperation(notes = "TODO have no data",value="查询所有的维护记录(只传page对象)")
    public ServiceModel search(){
        ServiceModel model=service.search();
        return model;
@@ -58,33 +58,40 @@
    
    //0.4电池组故障率
    @GetMapping("all")
    @ApiOperation(notes = "",value="电池组故障率")
    public ServiceModel searchAll(){
        ServiceModel model=service.searchAll();
        return model;
    @ApiOperation(notes = "newsum 所有故障的电池组;sum 所有的电池组",value="电池组故障率")
    public ServiceModelOnce searchAll(){
        return service.searchAll();
    }
    
    //0.4/0.8电池组故障率/维护率(最新)
    @GetMapping("byStationName")
    @ApiOperation(notes = "",value="电池组故障率/维护率(最新)")
    public ServiceModel searchByStationName(@RequestBody Batt_Maint_Dealarm bd) {
        ServiceModel model=service.searchByStationName(bd);
        return model;
    @PostMapping("byStationName")
    @ApiOperation(notes = "code 故障维护数;newsum 电池组数;sum 故障数; maint_done 100求故障率",value="电池组故障率/维护率(最新) TODO 待测")
    public ServiceModelOnce searchByStationName(@ApiParam(value = "站点", required = true) @RequestParam String stationName,
                                                @ApiParam(value = "100求故障率/1求维护率/其他全部", required = true) @RequestParam Integer maint_done) {
        Batt_Maint_Dealarm bd = new Batt_Maint_Dealarm();
        BattInf binf = new BattInf();
        binf.setStationName(stationName);
        Batt_maint_inf batt_maint_inf = new Batt_maint_inf();
        batt_maint_inf.setMaint_done(maint_done);
        bd.setMainf(batt_maint_inf);
        bd.setBinf(binf);
        return service.searchByStationName(bd);//数据不足待测
    }
    
    //根据电池组id查询电池的故障信息
    @GetMapping("byBattGroupId")
    @ApiOperation(notes = "",value="电池组id查询电池的故障信息")
    public ServiceModel searchByBattgroupId(@RequestBody Batt_maint_inf bmi){
        // bmi=ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(result, Batt_maint_inf.class);
        ServiceModel model=service.searchByBattgroupId(bmi);
    @PostMapping("byBattGroupId")
    @ApiOperation(notes = "TODO have no data",value="电池组id查询电池的故障信息TODO 待测")
    public ServiceModel searchByBattgroupId(@RequestParam Integer battGroupId){
        Batt_maint_inf bmi = new Batt_maint_inf();
        bmi.setBattGroupId(battGroupId);
        ServiceModel model=service.searchByBattgroupId(bmi);// have no data
        return model;
    }
    
    //2.1 电池维护记录查询(编辑记录)
    @PutMapping("/")
    @ApiOperation(notes = "",value="电池维护记录查询(编辑记录)")
    @ApiOperation(notes = "",value="电池维护记录查询(编辑记录)TODO 待完成")
    public ServiceModel update(@RequestBody Batt_maint_inf bmi,@RequestBody List<Batt_maint_process> process) {
        // bmi=ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(result, Batt_maint_inf.class);
        // List<Batt_maint_process> process = ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, new TypeToken<List<Batt_maint_process>>(){}.getType());
@@ -94,8 +101,10 @@
    //2.1 电池维护记录查询(删除记录)
    @DeleteMapping("/")
    @ApiOperation(notes = "",value="电池维护记录查询(删除记录)")
    public ServiceModel delete(@RequestBody Batt_maint_inf bmi) {
    public ServiceModel delete(@RequestParam Integer num){
        // bmi=ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(result, Batt_maint_inf.class);
        Batt_maint_inf bmi = new Batt_maint_inf();
        bmi.setNum(num);
        ServiceModel model=service.delete(bmi);
        return model;
    }
src/main/java/com/fgkj/mapper/impl/BattInfMapper.java
@@ -69,7 +69,8 @@
    public List judgeBattStationName3(Object obj);
    //0.4根据城市名称查电池组
    public List search(Object obj);
    @Select("select distinct(battgroupid) from db_battinf.tb_battinf where stationname like '%${stationName}%' ")
    public List<BattInf> search(BattInf obj);
    //查询出当前存在内存中最大的设备的id(很重要**********)
    @Select("select max(FbsDeviceId) as id from db_battinf.tb_battinf  limit 1")
src/main/java/com/fgkj/mapper/impl/Batt_maint_infAgainMapper.java
@@ -2,6 +2,9 @@
import java.util.List;
import com.fgkj.dto.BattInf;
import com.fgkj.dto.Batt_User_Permit;
import com.fgkj.dto.Batt_maint_inf;
import org.springframework.stereotype.Repository;
public interface Batt_maint_infAgainMapper{
@@ -16,7 +19,7 @@
     * 统计开始时间:battproductdate
     * 统计结束时间:battproductdata1
     * */
    public List serchByCondition(Object obj);
    public List<Batt_maint_inf> serchByCondition(BattInf obj);
    /*public static void main(String[] args) throws ParseException {
src/main/java/com/fgkj/mapper/impl/Batt_maint_infMapper.java
@@ -2,6 +2,10 @@
import java.util.List;
import com.fgkj.dto.Batt_Maint_Dealarm;
import com.fgkj.dto.Batt_maint_inf;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
public interface Batt_maint_infMapper{
@@ -12,10 +16,11 @@
    public boolean update(Object obj);
    //2.1 电池维护记录查询(删除记录)
    public boolean del(Object obj);
    @Delete("delete from db_battinf.tb_batt_maint_inf where num=#{num}")
    public int del(Batt_maint_inf obj);
    // 3.1 根据battgroupid查维护数据信息
    public List serchByCondition(Object obj) ;
    public List serchByCondition(Batt_Maint_Dealarm obj) ;
    //1.1,1.2根据battgroupid查时间
@@ -25,16 +30,25 @@
    public List statistical(Object obj);
    //0.3查询所有的维护记录
    public List search() ;
    public List<Batt_Maint_Dealarm> search() ;
    //0.4查询所有故障的电池组
    public List searchAll() ;
    @Select("select distinct(battgroupid),usr_id,fault_type_id,fault_level,fault_caption,record_time" +
            ",maint_time_limit,maint_type_id,maint_result,maint_done_time,maint_close" +
            ",master_id,master_audit,copy_uids,appoint_uid " +
            "from db_battinf.tb_batt_maint_inf " +
            "order by maint_done_time desc ")
    public List<Batt_maint_inf> searchAll() ;
    //0.4/0.8根据城市查询所有故障的电池组(故障率和维护率)
    public List searchByStationName(Object obj) ;
    public List<Batt_maint_inf> searchByStationName(Batt_Maint_Dealarm obj) ;
    
    //根据电池组id查询电池的维护记录
    public List searchByBattgroupId(Object obj) ;
    @Select("select num,BattGroupId,usr_id,fault_type_id,fault_type,fault_level,fault_caption," +
            "fault_time,record_uid,record_time,maint_time_limit,maint_type_id,maint_type,maint_result," +
            "maint_done,maint_done_time,maint_close,master_id,master_audit,copy_uids,appoint_uid,master_check,remark " +
            "from db_battinf.tb_batt_maint_inf where BattGroupId=#{battGroupId}")
    public List<Batt_maint_inf> searchByBattgroupId(Batt_maint_inf obj) ;
    /*public static void main(String[] args) throws ParseException {
        
src/main/java/com/fgkj/mapper/impl/Batt_maint_processMapper.java
@@ -3,6 +3,7 @@
import java.util.List;
import com.fgkj.dto.Batt_maint_process;
import org.apache.ibatis.annotations.Delete;
import org.springframework.stereotype.Repository;
public interface Batt_maint_processMapper{
@@ -15,7 +16,8 @@
    public boolean update(Object obj);
    //2.1 电池维护记录查询(删除记录)时,将所有的编辑记录全删除
    public boolean del(Object obj) ;
    @Delete("delete from db_battinf.tb_batt_maint_process where batt_maint_rec_id=#{batt_maint_rec_id}")
    public int del(Batt_maint_process obj) ;
    public List searchAll();
    
src/main/java/com/fgkj/services/Batt_maint_infService.java
@@ -11,6 +11,7 @@
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import javax.annotation.Resource;
@Service
@@ -38,42 +39,50 @@
    
    
    //2.1电池故障维护记录查询
    public ServiceModel serchMaint(Object obj){
        Batt_Maint_Dealarm bmd = (Batt_Maint_Dealarm) obj;
    public ServiceModel serchMaint(Batt_Maint_Dealarm bmd){
        ServiceModel model = new ServiceModel();
        User_inf uinf=new User_inf();
        Batt_maint_process pinf=new Batt_maint_process();
        List<Batt_Maint_Dealarm> list =mapper.serchByCondition(bmd);
        for(int i=0;i<list.size();i++){
            Batt_maint_inf mainf=list.get(i).getMainf();
            if(list.get(i).getMainf().getUsr_id()!=null){
                uinf.setuId(list.get(i).getMainf().getUsr_id());
                mainf.setUname(((List<User_inf>) uservice.serchuName(uinf).getData()).get(0).getuName());
            //    System.out.println(mainf.getuName());
                }
                if(list.get(i).getMainf().getCopy_uids()!=null&&list.get(i).getMainf().getCopy_uids().length()>0){
                    //System.out.println(list.get(i).getMainf().getCopy_uids());
                    String[] names=list.get(i).getMainf().getCopy_uids().split(",");
                    String copyname=new String();
                    for (String string : names) {
                        uinf.setuId(Integer.parseInt(string));
                        copyname+=((List<User_inf>) uservice.serchuName(uinf).getData()).get(0).getuName()+",";
        List<Batt_Maint_Dealarm> list = null;
        try {
            list = mapper.serchByCondition(bmd);
            for(int i=0;i<list.size();i++){
                Batt_maint_inf mainf=list.get(i).getMainf();
                if(list.get(i).getMainf().getUsr_id()!=null){
                    uinf.setuId(list.get(i).getMainf().getUsr_id());
                    mainf.setUname(((List<User_inf>) uservice.serchuName(uinf).getData()).get(0).getuName());
                //    System.out.println(mainf.getuName());
                    }
                    copyname=copyname.substring(0, copyname.length()-1);
                    mainf.setCopy_name(copyname);
                    //System.out.println(mainf.getCopy_name());
                }
                if(list.get(i).getMainf().getAppoint_uid()!=null){
                uinf.setuId(list.get(i).getMainf().getAppoint_uid());
                mainf.setAppoint_name(((List<User_inf>) uservice.serchuName(uinf).getData()).get(0).getuName());
            //    System.out.println(mainf.getAppoint_name());
                }
            list.get(i).setMainf(mainf);
            //System.out.println(list.size());
                    if(list.get(i).getMainf().getCopy_uids()!=null&&list.get(i).getMainf().getCopy_uids().length()>0){
                        //System.out.println(list.get(i).getMainf().getCopy_uids());
                        String[] names=list.get(i).getMainf().getCopy_uids().split(",");
                        String copyname=new String();
                        for (String string : names) {
                            uinf.setuId(Integer.parseInt(string));
                            copyname+=((List<User_inf>) uservice.serchuName(uinf).getData()).get(0).getuName()+",";
                        }
                        copyname=copyname.substring(0, copyname.length()-1);
                        mainf.setCopy_name(copyname);
                        //System.out.println(mainf.getCopy_name());
                    }
                    if(list.get(i).getMainf().getAppoint_uid()!=null){
                    uinf.setuId(list.get(i).getMainf().getAppoint_uid());
                    mainf.setAppoint_name(((List<User_inf>) uservice.serchuName(uinf).getData()).get(0).getuName());
                //    System.out.println(mainf.getAppoint_name());
                    }
                list.get(i).setMainf(mainf);
                //System.out.println(list.size());
            }
        } catch (NumberFormatException e) {
            e.printStackTrace();
            model.setCode(0);
            model.setMsg("查询失败!");
            return model;
        }
        if(list!=null&&list.size()>0){
            model.setCode(1);
@@ -93,20 +102,44 @@
     * master_check存放包机人 
     * remark存放品牌
     */
    public List serchByCondition(Object obj) {
        //System.out.println(obj+"&&&&&&&&&&&&");
        Batt_User_Permit bup = (Batt_User_Permit) obj;
    public List serchByCondition(Batt_User_Permit bup) {
        ServiceModelElectri model = new ServiceModelElectri();
        BattInf binf=bup.getBinf();
        List<Batt_maint_inf> list = againMapper.serchByCondition(binf);
        List listb=battInfMapper.searchAll();
        List<Batt_maint_inf> list = againMapper.serchByCondition(binf);//TODO 无数据待测试
        List<Integer> listb=battInfMapper.searchAll();
        listb = listb.stream().distinct().collect(Collectors.toList());//去重 JDK8
        // 总电池数
        int allBatt=listb.size();
        // 超时次数
        List<ServiceModel> listmodel=new ArrayList<ServiceModel>();
        List<ServiceModelElectri> listmodel=new ArrayList<>();
        
        //System.out.println(list.get(1));
        if (list != null && list.size() > 0) {
            for (int i = 0; i < list.size(); i++) {
                // maint_result存放统计方式
                list.get(i).setMaint_result(binf.getDeviceName());
                // fault_caption存放维护区
                if (binf.getStationName1().equals("")) {
                    list.get(i).setFault_caption("全部");
                } else {
                    list.get(i).setFault_caption(binf.getStationName1());
                }
                // master_check存放包机人
                if (binf.getStationName().equals("")) {
                    list.get(i).setMaster_check("全部");
                } else {
                    list.get(i).setMaster_check(binf.getStationName());
                }
                // remark存放品牌
                if (binf.getBattProducer().equals("")) {
                    list.get(i).setRemark("全部");
                } else {
                    list.get(i).setRemark(binf.getBattProducer());
                }
                //------------------------------------------------------------------------------
                //System.out.println(list.size()+"lll");
                int overTime = 0;
                // 未完成次数
@@ -163,11 +196,10 @@
                if (list.get(i).getMaint_done() == 0) {
                    lastNum++;
                }
                model = new ServiceModel();
                model.setCode(1);
                //TODO perry
                // model.setMsgN(perid_Time); // 时间段
                // model.setSum(list.size()); // 故障次数
                 model.setMsgN(perid_Time); // 时间段
                 model.setSum(list.size()); // 故障次数
                Float percentBatt=0f;
                if(allBatt!=0){
                    percentBatt= (float) (list.size()/ allBatt);
@@ -176,31 +208,31 @@
                //System.out.println(allBatt);
                //System.out.println(percentBatt);
                //TODO perry
                /*model.setLowCH(percentBatt);//电池故障率
                model.setLowCH(percentBatt);//电池故障率
                model.setNewsum(lastNum); // 未完成次数
                Float percent = (float) (overTime / list.size());
                model.setLowCA(percent); // 超时率
                model.setMsg(list.get(i).getFault_caption());//维护区
                model.setMsgO(list.get(i).getMaster_check());    //责任人
                model.setMsgV(list.get(i).getRemark());//电池品牌*/
                model.setMsgV(list.get(i).getRemark());//电池品牌
                listmodel.add(model);
            }
        } else {    
            model.setCode(0);
            //TODO perry
            // model.setMsgN("0");
             model.setMsgN("0");
            listmodel.add(model);
        }
        ServiceModel lastModel=new ServiceModel();
        ServiceModelElectri lastModel=new ServiceModelElectri();
        //TODO perry
        /*lastModel.setMsgN("0");
        lastModel.setMsgN("0");
        lastModel.setCode(model.getCode());
        lastModel.setMsg(model.getMsg());
        lastModel.setLowCH(model.getLowCH());
        lastModel.setLowCA(model.getLowCA());
        lastModel.setMsgO(model.getMsgO());
        lastModel.setMsgV(model.getMsgV());*/
        lastModel.setMsgV(model.getMsgV());
        listmodel.add(lastModel);//补全最后一次时间改变
    //    System.out.println(listmodel.size());
        int num=0;//存放下发作业数
@@ -291,13 +323,13 @@
    }
    //2.1 电池维护记录查询(删除记录)
    public ServiceModel delete(Object obj) {
        Batt_maint_inf mainf=(Batt_maint_inf) obj;
    public ServiceModel delete(Batt_maint_inf mainf) {
        ServiceModel model=new ServiceModel();
        Batt_maint_process bprocess=new Batt_maint_process();
        bprocess.setBatt_maint_rec_id(mainf.getNum());                //通过Batt_maint_rec_id属性删除
        Boolean bl = mapper.del(mainf);
        Boolean bl = mapper.del(mainf)>0;
        if (bl) {
            Boolean blp=processMapper.del(bprocess);
            Boolean blp=processMapper.del(bprocess)>0;
            if(blp){
                model.setCode(1);
                model.setMsg("删除成功!");
@@ -334,7 +366,7 @@
    //0.3查询所有的维护记录(只传page对象)
    public ServiceModel search(){
        //Batt_Maint_Dealarm bmd=(Batt_Maint_Dealarm) obj;
        ServiceModel model = new ServiceModel();
        List<Batt_Maint_Dealarm> list=mapper.search();
        if(list!=null&&list.size()>0){
            model.setCode(1);
@@ -347,22 +379,23 @@
    }
    //0.4电池组故障率
    public ServiceModel searchAll() {
    public ServiceModelOnce searchAll() {
        List<Batt_maint_inf> list = mapper.searchAll();
        List listb=battInfMapper.searchAll();
        ServiceModelOnce model = new ServiceModelOnce();
        List<Integer> listb=battInfMapper.searchAll();
        listb = listb.stream().distinct().collect(Collectors.toList());//去重 JDK8
        if(list!=null && listb!=null){
            //TODO perry
            /*model.setCode(1);
            model.setNewsum(list.size());
            model.setSum(listb.size());*/
            model.setCode(1);
            model.setNewsum(list.size());    //所有故障的电池组
            model.setSum(listb.size());        //所有的电池组
        }
        //System.out.println(model);
        return model;
    }
    //0.4/0.8电池组故障率/维护率(最新)
    public ServiceModel searchByStationName(Object obj) {
        Batt_Maint_Dealarm bmd=(Batt_Maint_Dealarm) obj;
    public ServiceModelOnce searchByStationName(Batt_Maint_Dealarm bmd) {
        ServiceModelOnce model = new ServiceModelOnce();
        BattInf binf=bmd.getBinf();
        Batt_maint_inf mainf=bmd.getMainf();
        List<Batt_maint_inf> list = mapper.searchByStationName(bmd);        //故障数
@@ -370,15 +403,15 @@
        List<Batt_maint_inf> listD = mapper.searchByStationName(bmd);    //故障维护数
        
        List<BattInf> listB=battInfMapper.search(binf);//
        //TODO perry
        /*model.setCode(listD.size());      ////故障维护数
        listB = listB.stream().distinct().collect(Collectors.toList());//去重 JDK8
        model.setCode(listD.size());      ////故障维护数
        model.setNewsum(listB.size());    //电池组数
        model.setSum(list.size());*/          //故障数
        model.setSum(list.size());          //故障数
        return model;
    }
    
    //根据电池组id查询电池的故障记录
    public ServiceModel searchByBattgroupId(Object obj) {
    public ServiceModel searchByBattgroupId(Batt_maint_inf obj) {
        ServiceModel model=new ServiceModel();
        List<Batt_maint_inf> list = mapper.searchByBattgroupId(obj);
        User_inf uinf=new User_inf();        
src/main/java/com/fgkj/services/Batt_maint_processService.java
@@ -40,8 +40,8 @@
        }
        return model;    
    }
    public ServiceModel delete(Object obj) {
        Boolean bl=mapper.del(obj);
    public ServiceModel delete(Batt_maint_process obj) {
        Boolean bl=mapper.del(obj)>0;
        if(bl){
            model.setCode(1);
            model.setMsg("删除成功!");
src/main/java/com/fgkj/services/User_infService.java
@@ -157,7 +157,7 @@
    // 3.1根据uid查用户信息(uname)
    public ServiceModel serchuName(User_inf inf) {
        model = new ServiceModel();
        ServiceModel model = new ServiceModel();
        List list = mapper.serchUname(inf);
        if (list != null && list.size() > 0) {
            model.setCode(1);
src/main/resources/mapper/BattInfMapper.xml
@@ -4357,7 +4357,7 @@
    <select id="searchMaxId" resultType="java.util.List"></select>
<!--    <select id="judgeBattStationName" resultType="java.util.List"></select>-->
    <select id="judgeBattStationName3" resultType="java.util.List"></select>
    <select id="search" resultType="java.util.List"></select>
<!--    <select id="search" resultType="java.util.List"></select>-->
<!--    <select id="searchMaxdevId_binf" resultType="java.lang.Integer"></select>-->
<!--    <select id="searchAll" resultType="java.util.List"></select>-->
src/main/resources/mapper/BattMaintInfAgainMapper.xml
@@ -102,5 +102,19 @@
        }
    -->
    <select id="serchByCondition" resultType="java.util.List"></select>
    <select id="serchByCondition" resultType="Batt_maint_inf">
        select distinct(db_battinf.tb_batt_maint_inf.usr_id),fault_time,maint_done_time,maint_time_limit,maint_done from
        db_battinf.tb_batt_maint_inf,db_battinf.tb_battinf ,db_user.tb_user_inf where
        db_battinf.tb_batt_maint_inf.battgroupid=db_battinf.tb_battinf .battgroupid and fault_time>=#{battProductDate} and fault_time
        <![CDATA[<=]]> #{battProductDate1}
        and db_battinf.tb_batt_maint_inf.usr_id=db_user.tb_user_inf.uid
        <if test="stationName==''">and db_user.tb_user_inf.uname!=#{stationName}</if>
        <if test="stationName!=''">and db_user.tb_user_inf.uname=#{stationName}</if>
        <if test="stationName1==''"> and stationname1!=#{stationName1} </if>
        <if test="stationName1!=''"> and stationname1=#{stationName1} </if>
        <if test="battProducer==''"> and battproducer!=#{battProducer} </if>
        <if test="battProducer!=''"> and battproducer=#{battProducer} </if>
    </select>
</mapper>
src/main/resources/mapper/BattMaintInfMapper.xml
@@ -1,7 +1,34 @@
<?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.fgkj.mapper.impl.Batt_maint_infMapper" >
<resultMap id="BaseResultMap" type="Batt_Maint_Dealarm">
    <association property="binf" javaType="BattInf">
        <result column="battGroupId" property="battGroupId"></result>
        <result column="stationName" property="stationName"></result>
        <result column="battGroupName" property="battGroupName"></result>
    </association>
    <association property="mainf" javaType="Batt_maint_inf">
        <result column="num" property="num"></result>
        <result column="usr_id" property="usr_id"></result>
        <result column="fault_type_id" property="fault_type_id"></result>
        <result column="fault_level" property="fault_level"></result>
        <result column="fault_caption" property="fault_caption"></result>
        <result column="record_time" property="record_time"></result>
        <result column="maint_time_limit" property="maint_time_limit"></result>
        <result column="maint_type_id" property="maint_type_id"></result>
        <result column="maint_result" property="maint_result"></result>
        <result column="maint_done" property="maint_done"></result>
        <result column="maint_done_time" property="maint_done_time"></result>
        <result column="maint_close" property="maint_close"></result>
        <result column="master_id" property="master_id"></result>
        <result column="master_audit" property="master_audit"></result>
        <result column="copy_uids" property="copy_uids"></result>
        <result column="appoint_uid" property="appoint_uid"></result>
    </association>
</resultMap>
    <!--
    public Batt_maint_infImpl() {
        DateUtil.sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@@ -748,12 +775,182 @@
    <insert id="add"></insert>
    <update id="update"></update>
    <delete id="del"></delete>
    <select id="serchByCondition" resultType="java.util.List"></select>
<!--    <delete id="del"></delete>-->
    <select id="serchByCondition" resultMap="BaseResultMap">
        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 to_days(battproductdate)>=to_days(#{binf.battProductDate})
        and to_days(battproductdate) <![CDATA[<=]]> to_days(#{binf.battProductDate1}) and to_days(battinusedate)>=to_days(#{binf.battInUseDate}) and
        to_days(battinusedate) <![CDATA[<=]]> to_days(#{binf.battInUseDate1})
        <if test="binf.stationName1==''"> and stationname1!=#{binf.stationName1} </if>
        <if test="binf.stationName1!=''"> and stationname1=#{binf.stationName1} </if>
        <if test="binf.stationName==''"> and stationname!=#{binf.stationName} </if>
        <if test="binf.stationName!=''"> and stationname=#{binf.stationName} </if>
        <if test="binf.battProducer==''"> and battproducer!=#{binf.battProducer} </if>
        <if test="binf.battProducer!=''"> and battproducer=#{binf.battProducer} </if>
        <if test="tdata.test_type==2">
        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=#{tdata.test_type} and to_days(record_time)>=to_days(#{tdata.record_time}) and
            to_days(record_time) <![CDATA[<=]]> to_days(#{tdata.record_time1}))
        </if>
        <if test="tdata.test_type==3">
        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=#{tdata.test_type} and to_days(record_time)>=to_days(#{tdata.record_time}) and
            to_days(record_time) <![CDATA[<=]]> to_days(#{tdata.record_time1}))
        </if>
        <if test="tdata.test_type==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=#{tdata.test_type} and to_days(record_time)>=to_days(#{tdata.record_time}) and
            to_days(record_time) <![CDATA[<=]]> to_days(#{tdata.record_time1}))
        </if>
        <if test="tdata.test_type==5">
            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=#{tdata.test_type} and to_days(record_time)>=to_days(#{tdata.record_time}) and
            to_days(record_time) <![CDATA[<=]]> to_days(#{tdata.record_time1}))
        </if>
        <if test="tdata.test_type==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(#{tdata.test_type},2,3) and to_days(record_time)>=to_days(#{tdata.record_time}) and
            to_days(record_time) <![CDATA[<=]]> to_days(#{tdata.record_time1}))
        </if>
        <if test="tdata.test_type==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(#{tdata.test_type},2,3) and to_days(record_time)>=to_days(#{tdata.record_time}) and
            to_days(record_time) <![CDATA[<=]]> to_days(#{tdata.record_time1}))
        </if>
        <if test="tdata.test_type==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(#{tdata.test_type},2,3) and to_days(record_time)>=to_days(#{tdata.record_time}) and
            to_days(record_time) <![CDATA[<=]]> to_days(#{tdata.record_time1}))
        </if>
        <if test="binf.battGroupId==0">
            and db_battinf.tb_battinf.battgroupid!=#{binf.battGroupId}
        </if>
        <if test="binf.battGroupId!=0">
            and db_battinf.tb_battinf.battgroupid=#{binf.battGroupId}
        </if>
        <if test="binf.battGroupName1=='其他'"> and BattGroupName1 like '%${binf.battGroupName1}%' </if>
        <if test="binf.battGroupName1!='其他'"> and BattGroupName1 not like '%开关电源系统%' and BattGroupName1 not like '%UPS系统%' and BattGroupName1 not like '%${binf.battGroupName1}%' </if>
        <if test="binf.monVolStd==0"> and monVolStd!=#{binf.monVolStd} </if>
        <if test="binf.monVolStd!=0"> and monVolStd=#{binf.monVolStd} </if>
        <if test="binf.monCapStd==0"> and monCapStd!=#{binf.monCapStd} </if>
        <if test="binf.monCapStd!=0"> and monCapStd=#{binf.monCapStd} </if>
        <if test="uinf.uName!=0"> and db_user.tb_user_inf.uname=#{uinf.uName} and db_user.tb_user_inf.ubaojiusr=1 </if>
        <!--全部 -->
        <if test="tdata.test_starttype==0"></if>
        <!--拉闸放电 -->
        <if test="tdata.test_starttype==1"> and test_starttype <![CDATA[<]]> 5 and test_type not in(2,9) and  test_starttype!=2 </if>
        <!--核对性放电 -->
        <if test="tdata.test_starttype==2"> and test_starttype>=5 or (test_type not in(2,9)  and  test_starttype=2)  </if>
        <if test="mainf.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(#{mainf.maint_done_time}) and to_days(maint_done_time)
            <![CDATA[<=]]> to_days(#{mainf.maint_done_time1}))
        </if>
        <if test="mainf.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(#{mainf.maint_done_time}) and to_days(maint_done_time)
            <![CDATA[<=]]>to_days(#{mainf.maint_done_time1}))
        </if>
        <if test="mainf.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(#{mainf.maint_done_time}) and to_days(maint_done_time)
            <![CDATA[<=]]>to_days(#{mainf.maint_done_time1}))
        </if>
        order by StationName1 asc,db_battinf.tb_battinf.BattgroupId asc,test_starttime asc
    </select>
    <select id="serchByInfo" resultType="java.util.List"></select>
    <select id="statistical" resultType="java.util.List"></select>
    <select id="search" resultType="java.util.List"></select>
    <select id="searchAll" resultType="java.util.List"></select>
    <select id="searchByStationName" resultType="java.util.List"></select>
    <select id="searchByBattgroupId" resultType="java.util.List"></select>
    <select id="search" resultType="Batt_Maint_Dealarm">
        select distinct(tb_batt_maint_inf.battgroupid),
                       tb_batt_maint_inf.usr_id,
                       fault_type_id,
                       fault_level,
                       fault_caption,
                       record_time,
                       maint_time_limit,
                       maint_type_id,
                       maint_result,
                       maint_done_time,
                       maint_close,
                       master_id,
                       master_audit,
                       copy_uids,
                       appoint_uid,
                       batt_maint_rec_id,
                       tb_batt_maint_process.usr_id,
                       work_caption,
                       work_caption_time,
                       uname,
                       stationname,
                       battgroupname
        from db_battinf.tb_batt_maint_inf,
             db_battinf.tb_batt_maint_process,
             db_user.tb_user_inf,
             db_battinf.tb_battinf
        where tb_batt_maint_inf.usr_id = tb_batt_maint_process.usr_id
          and tb_batt_maint_inf.battgroupid = tb_battinf.BattGroupId
          and tb_batt_maint_inf.usr_id = db_user.tb_user_inf.uId
        order by work_caption_time desc
    </select>
<!--    <select id="searchAll" resultType="java.util.List"></select>-->
    <select id="searchByStationName" resultType="Batt_maint_inf">
        select distinct(tb_batt_maint_inf.battgroupid),
                       usr_id,
                       fault_type_id,
                       fault_level,
                       fault_caption,
                       record_time,
                       maint_time_limit,
                       maint_type_id,
                       maint_result,
                       maint_done_time,
                       maint_close,
                       master_id,
                       master_audit,
                       copy_uids,
                       appoint_uid
        from db_battinf.tb_batt_maint_inf,
             db_battinf.tb_battinf
        where tb_batt_maint_inf.battgroupid = tb_battinf.battgroupid
          and stationname like '%${binf.stationName}%'
          <!--100求故障率 -->
        <if test="mainf.maint_done==100">
            and maint_done!=#{mainf.maint_done}
        </if>
        <!--1求维护率 -->
        <if test="mainf.maint_done!=100">
            and maint_done=#{mainf.maint_done}
        </if>
        order by maint_done_time desc
    </select>
<!--    <select id="searchByBattgroupId" resultType="java.util.List"></select>-->
</mapper>
src/main/resources/mapper/BattMaintProcessMapper.xml
@@ -82,7 +82,7 @@
    <insert id="add"></insert>
    <insert id="addPro"></insert>
    <update id="update"></update>
    <delete id="del"></delete>
<!--    <delete id="del"></delete>-->
    <select id="searchAll" resultType="java.util.List"></select>
    <select id="serchByCondition" resultMap="BaseResultMap">
        select num,batt_maint_rec_id,usr_id,work_caption,work_caption_time,uname