|
@@ -1,5 +1,6 @@
|
|
|
package cn.com.ty.lift.manager.library.service;
|
|
|
|
|
|
+import cn.com.ty.lift.common.export.ExportUtils;
|
|
|
import cn.com.ty.lift.manager.library.dao.entity.Lift;
|
|
|
import cn.com.ty.lift.manager.library.dao.mapper.LiftMapper;
|
|
|
import cn.com.ty.lift.manager.library.dao.entity.model.LiftRequest;
|
|
@@ -9,7 +10,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* @author bieao
|
|
@@ -22,38 +25,59 @@ public class LibraryService extends BaseServiceImpl {
|
|
|
@Resource
|
|
|
private LiftMapper mapper;
|
|
|
|
|
|
+ private Map<String, String> paramMap = new HashMap<String, String>() {{
|
|
|
+ put("liftCode", "电梯号");
|
|
|
+ put("registrationCode", "注册代码");
|
|
|
+ put("liftBrand", "电梯品牌");
|
|
|
+ put("liftType", "电梯类型");
|
|
|
+ put("devicePosition", "设备使用地点");
|
|
|
+ }};
|
|
|
+
|
|
|
/**
|
|
|
+ * @param request
|
|
|
+ * @return
|
|
|
* @description 条件查询电梯档案列表
|
|
|
* @date 2019/11/27 2:10 PM
|
|
|
- * @param
|
|
|
- * @return
|
|
|
*/
|
|
|
- public RestResponse<IPage<Lift>> list(LiftRequest request) {
|
|
|
+ public IPage<Lift> list(LiftRequest request) {
|
|
|
IPage page = this.getPage(request);
|
|
|
List<Lift> lifts = mapper.findByCondition(page, request);
|
|
|
page.setRecords(lifts);
|
|
|
- return RestResponse.ok(page);
|
|
|
+ return page;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * @param lift
|
|
|
+ * @return
|
|
|
* @description 新增电梯
|
|
|
* @date 2019/11/27 2:22 PM
|
|
|
- * @param
|
|
|
- * @return
|
|
|
*/
|
|
|
- public RestResponse add(Lift lift){
|
|
|
+ public RestResponse add(Lift lift) {
|
|
|
Integer result = mapper.insertSelective(lift);
|
|
|
return RestResponse.ok(result);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * @param lift
|
|
|
+ * @return
|
|
|
* @description 修改电梯
|
|
|
* @date 2019/11/27 2:22 PM
|
|
|
- * @param
|
|
|
- * @return
|
|
|
*/
|
|
|
- public RestResponse modify(Lift lift){
|
|
|
+ public RestResponse modify(Lift lift) {
|
|
|
Integer result = mapper.updateByPrimaryKeySelective(lift);
|
|
|
return RestResponse.ok(result);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param request
|
|
|
+ * @return
|
|
|
+ * @description 导出电梯
|
|
|
+ * @date 2019/11/27 2:22 PM
|
|
|
+ */
|
|
|
+ public void export(LiftRequest request) {
|
|
|
+ IPage page = list(request);
|
|
|
+ List<Lift> liftList = page.getRecords();
|
|
|
+ ExportUtils utils = new ExportUtils();
|
|
|
+ utils.export(liftList, paramMap, "/Users/bieao/Downloads/test.xlsx");
|
|
|
+ }
|
|
|
}
|