|
@@ -3,6 +3,7 @@ package com.zglc.fm.service;
|
|
import com.zglc.fm.base.Result;
|
|
import com.zglc.fm.base.Result;
|
|
import com.zglc.fm.dao.FaultDao;
|
|
import com.zglc.fm.dao.FaultDao;
|
|
import com.zglc.fm.entity.FaultEntity;
|
|
import com.zglc.fm.entity.FaultEntity;
|
|
|
|
+import org.apache.poi.hssf.record.PageBreakRecord;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import tk.mybatis.mapper.entity.Example;
|
|
import tk.mybatis.mapper.entity.Example;
|
|
@@ -164,4 +165,39 @@ public class FaultService {
|
|
return getAllFault();
|
|
return getAllFault();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public List<FaultEntity> searchByType(String dataType, String name) {
|
|
|
|
+ Example example = new Example(FaultEntity.class);
|
|
|
|
+ Example.Criteria criteria = example.createCriteria();
|
|
|
|
+ if (dataType != null){
|
|
|
|
+ if (dataType.equals("fault_name")){
|
|
|
|
+ criteria.andLike("fault_name","%" + name + "%");
|
|
|
|
+ }
|
|
|
|
+ if (dataType.equals("fault_number")){
|
|
|
|
+ criteria.andLike("fault_number","%" + name + "%");
|
|
|
|
+ }
|
|
|
|
+ if (dataType.equals("author")){
|
|
|
|
+ criteria.andLike("author","%" + name + "%");
|
|
|
|
+ }
|
|
|
|
+ if (dataType.equals("department")){
|
|
|
|
+ criteria.andEqualTo("department",name);
|
|
|
|
+ }
|
|
|
|
+ if (dataType.equals("aircraft_type")){
|
|
|
|
+ criteria.andEqualTo("aircraft_type",name);
|
|
|
|
+ }
|
|
|
|
+ if (dataType.equals("major_type")){
|
|
|
|
+ criteria.andEqualTo("major_type",name);
|
|
|
|
+ }
|
|
|
|
+ if (dataType.equals("book_name")){
|
|
|
|
+ criteria.andLike("book_name","%" + name + "%");
|
|
|
|
+ }
|
|
|
|
+ if (dataType.equals("chapter")){
|
|
|
|
+ criteria.andLike("chapter","%" + name + "%");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (criteria.isValid())
|
|
|
|
+ return faultDao.selectByExample(example);
|
|
|
|
+ else
|
|
|
|
+ return getAllFault();
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|