Przeglądaj źródła

民宿管理接口

raojiaolong@163.com 2 lat temu
rodzic
commit
86f6568738

+ 6 - 6
mhotel/src/com/happy/Model/File.java

@@ -6,12 +6,12 @@ public class File {
     /**
     /**
      * id
      * id
      */
      */
-    private Long id;
+    private Integer id;
 
 
 	/**
 	/**
      * 关联id
      * 关联id
      */
      */
-    private String linkId;
+    private Integer linkId;
 
 
     /**
     /**
      * 附件路径
      * 附件路径
@@ -25,19 +25,19 @@ public class File {
 
 
 
 
 
 
-	public Long getId() {
+	public Integer getId() {
 		return id;
 		return id;
 	}
 	}
 
 
-	public void setId(Long id) {
+	public void setId(Integer id) {
 		this.id = id;
 		this.id = id;
 	}
 	}
 
 
-	public String getLinkId() {
+	public Integer getLinkId() {
 		return linkId;
 		return linkId;
 	}
 	}
 
 
-	public void setLinkId(String linkId) {
+	public void setLinkId(Integer linkId) {
 		this.linkId = linkId;
 		this.linkId = linkId;
 	}
 	}
 
 

+ 13 - 0
mhotel/src/com/happy/Model/Hotel.java

@@ -20,6 +20,11 @@ public class Hotel {
 	private String managerId;
 	private String managerId;
 
 
 	/**
 	/**
+	 * 封面图
+	 */
+	private String coverImg;
+
+	/**
 	 * 酒店名称
 	 * 酒店名称
 	 */
 	 */
 	private String hname;
 	private String hname;
@@ -135,6 +140,14 @@ public class Hotel {
 		this.managerId = managerId;
 		this.managerId = managerId;
 	}
 	}
 
 
+	public String getCoverImg() {
+		return coverImg;
+	}
+
+	public void setCoverImg(String coverImg) {
+		this.coverImg = coverImg;
+	}
+
 	public String getHname() {
 	public String getHname() {
 		return hname;
 		return hname;
 	}
 	}

+ 147 - 8
mhotel/src/com/happy/action/HotelAction.java

@@ -2,20 +2,18 @@ package com.happy.action;
 
 
 import com.google.gson.Gson;
 import com.google.gson.Gson;
 import com.google.gson.reflect.TypeToken;
 import com.google.gson.reflect.TypeToken;
-import com.happy.Model.Admin;
-import com.happy.Model.AdminManager;
-import com.happy.Model.AdminPower;
-import com.happy.Model.HotelDict;
+import com.happy.Model.*;
 import com.happy.Until.GetHttpParam;
 import com.happy.Until.GetHttpParam;
 import com.happy.Until.PwdDefind;
 import com.happy.Until.PwdDefind;
 import com.happy.Until.ResUtil;
 import com.happy.Until.ResUtil;
+import com.happy.Until.UUIDUtil;
+import com.happy.dto.HotelEto;
 import com.happy.dto.IPage;
 import com.happy.dto.IPage;
-import com.happy.service.AdminManagerService;
-import com.happy.service.AdminService;
-import com.happy.service.HotelDictService;
+import com.happy.service.*;
 import com.opensymphony.xwork2.ActionSupport;
 import com.opensymphony.xwork2.ActionSupport;
 import net.sf.json.JSONObject;
 import net.sf.json.JSONObject;
 import org.apache.struts2.ServletActionContext;
 import org.apache.struts2.ServletActionContext;
+import org.springframework.beans.BeanUtils;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
@@ -28,9 +26,20 @@ public class HotelAction extends ActionSupport {
     public HttpServletResponse response;
     public HttpServletResponse response;
 
 
     @Resource
     @Resource
+    public AdminManagerService adminManagerService;
+
+    @Resource
+    public HotelService hotelService;
+
+    @Resource
     public HotelDictService hotelDictService;
     public HotelDictService hotelDictService;
 
 
+    @Resource
+    public FileService fileService;
+
     public Integer id;
     public Integer id;
+    public Integer managerId;//所属商家账号id
+    public Integer code;//查询字典编码
     public int page; // 当前页
     public int page; // 当前页
     public int rows;// 每页显示的行数rows
     public int rows;// 每页显示的行数rows
 
 
@@ -55,6 +64,99 @@ public class HotelAction extends ActionSupport {
     }
     }
 
 
     /**
     /**
+     * 描述:维护民宿信息
+     * @return
+     */
+    public String updateHotel(){
+        JSONObject resultJson = new JSONObject();
+        Gson gson = new Gson();
+        com.alibaba.fastjson.JSONObject json = GetHttpParam.getRequestParameters(request);
+        if (json == null) {
+            resultJson.put("message", "请传入参数");
+            ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+            return null;
+        }
+        HotelEto hotelEto = new HotelEto();
+        try{
+            hotelEto = gson.fromJson(json.toString(), new TypeToken<HotelEto>() {}.getType());
+            Hotel hotel = new Hotel();
+            BeanUtils.copyProperties(hotelEto,hotel);
+            int hotelId = hotel.getId()!= null ? hotel.getId():Math.toIntExact(UUIDUtil.generateID());
+            int m = 0;
+            //保存基本信息
+            if(hotel.getId()!= null){
+                m = hotelService.updateHotel(hotel);
+            }else{
+                hotel.setId(hotelId);
+                m = hotelService.insertHotel(hotel);
+            }
+            //保存详细图附件
+            if(hotelEto.getFileList()!=null && hotelEto.getFileList().size()>0){
+                if(hotel.getId()!= null){
+                    fileService.delLinkFile(hotel.getId());
+                }
+                for(File file : hotelEto.getFileList()){
+                    file.setLinkId(hotelId);
+                    fileService.insertFile(file);
+                }
+            }else{
+                resultJson.put("message", "请上传详细图");
+                ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+                return null;
+            }
+            if (m > 0) {
+                resultJson.put("message", "维护成功");
+                resultJson.put("code", 200);
+                ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+                return null;
+            } else {
+                resultJson.put("message", "维护失败");
+                resultJson.put("code", 502);
+                ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+                return null;
+            }
+        } catch (Exception e){
+            e.printStackTrace();
+        }
+        resultJson.put("message", "未知异常");
+        resultJson.put("code", 205);
+        ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+        return null;
+    }
+
+    /**
+     * 描述:查看民宿详细
+     * @return
+     */
+    public String getByHotelInfo(){
+        JSONObject resultJson = new JSONObject();
+        StringBuilder s1 = new StringBuilder("");
+        if (managerId!=null){
+            s1.append(" and manager_id = '").append(managerId).append("'");
+        }else{
+            resultJson.put("message", "请传入登陆人账号Id");
+            ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+            return null;
+        }
+        //查询商户信息
+        AdminManager adminManager = adminManagerService.getById(managerId);
+        //查询民宿信息
+        Hotel hotel = hotelService.getOen(s1.toString());
+        HotelEto hotelEto = new HotelEto();
+        BeanUtils.copyProperties(adminManager,hotelEto);
+        BeanUtils.copyProperties(hotel,hotelEto);
+        StringBuilder fileSqlx = new StringBuilder("");
+        fileSqlx.append("and link_id = '").append(id).append("'");
+        List<File> fileList = fileService.queryList(fileSqlx.toString());
+        hotelEto.setFileList(fileList);
+        resultJson.put("message", "查询成功");
+        resultJson.put("code", 200);
+        resultJson.put("date", hotelEto);
+        ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+        return null;
+    }
+
+    /**
      * 描述:新增民宿配置字典 code 1.民宿类型;2.民宿服务;3.房型名称;4.房型服务
      * 描述:新增民宿配置字典 code 1.民宿类型;2.民宿服务;3.房型名称;4.房型服务
      * @return
      * @return
      */
      */
@@ -198,7 +300,7 @@ public class HotelAction extends ActionSupport {
     }
     }
 
 
     /**
     /**
-     * 描述:删除
+     * 描述:删除民宿配置字典
      * @return
      * @return
      */
      */
     public String delHotelDict(){
     public String delHotelDict(){
@@ -222,4 +324,41 @@ public class HotelAction extends ActionSupport {
         return null;
         return null;
     }
     }
 
 
+    /**
+     * 描述:查询民宿配置列表
+     * @return
+     */
+    public String queryList(){
+        JSONObject resultJson = new JSONObject();
+        StringBuilder s1 = new StringBuilder("");
+        StringBuilder s2 = new StringBuilder("");
+        StringBuilder s3 = new StringBuilder("");
+        StringBuilder s4 = new StringBuilder("");
+        if(code==null){//查询全部
+            s1.append("and code = '1'");
+            List<HotelDict> list1 = hotelDictService.queryList(s1.toString());
+            s2.append("and code = '2'");
+            List<HotelDict> list2 = hotelDictService.queryList(s2.toString());
+            s1.append("and code = '3'");
+            List<HotelDict> list3 = hotelDictService.queryList(s3.toString());
+            s1.append("and code = '4'");
+            List<HotelDict> list4 = hotelDictService.queryList(s4.toString());
+            resultJson.put("message", "查询成功");
+            resultJson.put("code", 200);
+            resultJson.put("date1", list1);
+            resultJson.put("date2", list2);
+            resultJson.put("date3", list3);
+            resultJson.put("date4", list4);
+            ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+            return null;
+        }else{
+            s1.append("and code = '").append(code).append("'");
+            List<HotelDict> list1 = hotelDictService.queryList(s1.toString());
+            resultJson.put("message", "查询成功");
+            resultJson.put("code", 200);
+            resultJson.put("date1", list1);
+            return null;
+        }
+    }
+
 }
 }

+ 59 - 274
mhotel/src/com/happy/action/houseAction.java

@@ -1,274 +1,59 @@
-//package com.happy.action;
-//
-//import com.google.gson.Gson;
-//import com.google.gson.reflect.TypeToken;
-//import com.happy.Model.Admin;
-//import com.happy.Model.Booking;
-//import com.happy.Model.House;
-//import com.happy.Until.GetHttpParam;
-//import com.happy.Until.PwdDefind;
-//import com.happy.Until.ResUtil;
-//import com.happy.Until.ResponseUtil;
-//import com.happy.service.BookService;
-//import com.happy.service.HouseService;
-//import com.opensymphony.xwork2.ActionSupport;
-//import net.sf.json.JSONObject;
-//import org.apache.struts2.ServletActionContext;
-//import org.apache.struts2.interceptor.ServletRequestAware;
-//
-//import javax.annotation.Resource;
-//import javax.servlet.http.HttpServletRequest;
-//import javax.servlet.http.HttpServletResponse;
-//import java.util.List;
-//import java.util.Objects;
-//
-//public class houseAction extends ActionSupport implements ServletRequestAware {
-//
-//    private HttpServletRequest request;
-//    public HttpServletResponse response;
-//
-//    @Resource
-//    public HouseService houseService;
-//    @Resource
-//    public BookService bookService;
-//
-//    public Integer id;
-//    public int page; // 当前页
-//    public int rows;// 每页显示的行数rows
-//    public String h_type;
-//
-//    public HttpServletRequest getRequest() {
-//        return request;
-//    }
-//
-//    public void setRequest(HttpServletRequest request) {
-//        this.request = request;
-//    }
-//
-//    public void setServletRequest(HttpServletRequest request) {
-//        this.request = request;
-//    }
-//
-//    public HttpServletResponse getResponse() {
-//        return response;
-//    }
-//
-//    public void setResponse(HttpServletResponse response) {
-//        this.response = response;
-//    }
-//
-//    public Integer getId() {
-//        return id;
-//    }
-//
-//    public void setId(Integer id) {
-//        this.id = id;
-//    }
-//
-//    public int getPage() {
-//        return page;
-//    }
-//
-//    public void setPage(int page) {
-//        this.page = page;
-//    }
-//
-//    public int getRows() {
-//        return rows;
-//    }
-//
-//    public void setRows(int rows) {
-//        this.rows = rows;
-//    }
-//
-//    public String getH_type() {
-//        return h_type;
-//    }
-//
-//    public void setH_type(String h_type) {
-//        this.h_type = h_type;
-//    }
-//
-//    public String insert() {
-//        JSONObject resultjson = new JSONObject();
-//        Gson gson = new Gson();
-//        com.alibaba.fastjson.JSONObject json = GetHttpParam.getHttpParam(request);
-//        System.out.println(json);
-//        if (json == null) {
-//            resultjson.put("message", "请传入参数");
-//            ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
-//            return null;
-//        }
-//        House house = null;
-//        try {
-//            house = gson.fromJson(json.toString(), new TypeToken<House>() {}.getType());
-//            if (house == null) {
-//                resultjson.put("message", "数据为空");
-//                resultjson.put("code", 500);
-//                ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
-//                return null;
-//            }
-////            if (house.getH_type()==null || house.getNumber()==null || house.getPrice()==null){
-////                resultjson.put("message", "各参数不能为空");
-////                resultjson.put("code", 500);
-////                ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
-////                return null;
-////            }
-////            House listc = houseService.queryByType(house.getH_type());
-////            if (listc != null) {
-////                resultjson.put("message", "该户型已存在");
-////                resultjson.put("code", 500);
-////                ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
-////                return null;
-////            }
-////            int m = houseService.insert(house);
-////            if (m > 0) {
-////                resultjson.put("message", "添加成功");
-////                resultjson.put("code", 200);
-////                ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
-////                return null;
-////            } else {
-////                resultjson.put("message", "添加失败");
-////                resultjson.put("code", 502);
-////                ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
-////                return null;
-////            }
-////        } catch (Exception e) {
-////            e.printStackTrace();
-////        }
-////        resultjson.put("message", "未知异常");
-////        resultjson.put("code", 205);
-////        ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
-//        return null;
-//    }
-//
-//    public String update() {
-//        JSONObject resultjson = new JSONObject();
-//        Gson gson = new Gson();
-//        com.alibaba.fastjson.JSONObject json = GetHttpParam.getHttpParam(request);
-//        System.out.println(json);
-//        if (json == null) {
-//            resultjson.put("message", "请传入参数");
-//            ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
-//            return null;
-//        }
-//        House house = null;
-//        try {
-//            house = gson.fromJson(json.toString(), new TypeToken<House>() {}.getType());
-//            if (house == null) {
-//                resultjson.put("message", "数据为空");
-//                resultjson.put("code", 500);
-//                ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
-//                return null;
-//            }
-//            if (house.getH_type()==null || house.getNumber()==null || house.getPrice()==null){
-//                resultjson.put("message", "各参数不能为空");
-//                resultjson.put("code", 500);
-//                ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
-//                return null;
-//            }
-//            House listc = houseService.queryByType(house.getH_type());
-//            if (listc!=null && !Objects.equals(listc.getId(), house.getId())){
-//                resultjson.put("message", "户型已存在");
-//                resultjson.put("code", 500);
-//                ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
-//                return null;
-//            }
-//            boolean booking = bookService.queryOrdering(house.getH_type(),house.getNumber());
-//            if (!booking){
-//                resultjson.put("message", "修改后的房间数量不能少于已预订的房间数量");
-//                resultjson.put("code", 500);
-//                ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
-//                return null;
-//            }
-//            int m = houseService.update(house);
-//            if (m > 0) {
-//                resultjson.put("message", "修改成功");
-//                resultjson.put("code", 200);
-//                ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
-//                return null;
-//            } else {
-//                resultjson.put("message", "修改失败");
-//                resultjson.put("code", 502);
-//                ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
-//                return null;
-//            }
-//        } catch (Exception e) {
-//            e.printStackTrace();
-//        }
-//        resultjson.put("message", "未知异常");
-//        resultjson.put("code", 205);
-//        ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
-//        return null;
-//    }
-//
-//    public String del() {
-//        JSONObject resultjson = new JSONObject();
-//        if (id == null) {
-//            resultjson.put("message", "请传入id");
-//            resultjson.put("code", 500);
-//            ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
-//            return null;
-//        }
-//        House house = houseService.queryById(id);
-//        if (house==null){
-//            resultjson.put("message", "该房型已删除");
-//            resultjson.put("code", 500);
-//            ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
-//            return null;
-//        }
-//        List<Booking> booking = bookService.queryOrderByType(house.getH_type());
-//        if (booking!=null){
-//            resultjson.put("message", "该房型有未完成的订单");
-//            resultjson.put("code", 500);
-//            ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
-//            return null;
-//        }
-//        int m = houseService.del(id);
-//        if (m > 0) {
-//            resultjson.put("message", "删除成功");
-//            resultjson.put("code", 200);
-//            ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
-//            return null;
-//        }
-//        resultjson.put("message", "未知异常");
-//        resultjson.put("code", 205);
-//        ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
-//        return null;
-//    }
-//
-//    // 查看户型
-//    public String list() {
-//        JSONObject resultJson = new JSONObject();
-//        StringBuilder s1 = new StringBuilder("");
-//        if (h_type!=null){
-//            s1.append(" and h_type like '%").append(this.h_type).append("%' ");
-//        }
-////        int total = houseService.queryHouseTotal(s1.toString()); // 查询表中的总记录数
-////        List<House> listPage = houseService.queryHousePage(s1.toString(),page,rows); // 查询分页
-//
-////        if (listPage == null) {
-////            resultJson.put("rows", "");
-////            resultJson.put("total", 0);
-////        } else {
-////            resultJson.put("code", 200);
-////            resultJson.put("rows", listPage);
-////            // int total = listAll.size();
-////            resultJson.put("total", total);// 总记录数
-////            int totalPage = total % rows == 0 ? (total / rows)
-////                    : (total / rows) + 1;// 总页数
-////            resultJson.put("totalPage", totalPage);
-////            resultJson.put("currentPage", page);// 当前页
-////            resultJson.put("numPerPage", rows);// 每页数
-////            resultJson.put("nextPage", totalPage - page == 0 ? page : page + 1);// 下一页
-////            resultJson.put("previousPage", page - 0 == 1 ? page : page - 1);// 上一页
-////            resultJson.put("hasPreviousPage", true);// 有上一页
-////            resultJson.put("hasNextPage", true);// 有下一页
-////            resultJson.put("firstPage", true);// 首页
-////            resultJson.put("lastPage", true);// 尾页
-////        }
-//        ResponseUtil.writeJson(ServletActionContext.getResponse(),
-//                resultJson.toString());
-//        return null;
-//    }
-//}
+package com.happy.action;
+
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+import com.happy.Model.Admin;
+import com.happy.Model.Booking;
+import com.happy.Model.House;
+import com.happy.Until.GetHttpParam;
+import com.happy.Until.PwdDefind;
+import com.happy.Until.ResUtil;
+import com.happy.Until.ResponseUtil;
+import com.happy.service.BookService;
+import com.happy.service.HouseService;
+import com.opensymphony.xwork2.ActionSupport;
+import net.sf.json.JSONObject;
+import org.apache.struts2.ServletActionContext;
+import org.apache.struts2.interceptor.ServletRequestAware;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+import java.util.Objects;
+
+public class houseAction extends ActionSupport implements ServletRequestAware {
+
+    private HttpServletRequest request;
+    public HttpServletResponse response;
+
+    @Resource
+    public HouseService houseService;
+    @Resource
+    public BookService bookService;
+
+    public Integer id;
+    public int page; // 当前页
+    public int rows;// 每页显示的行数rows
+
+    public HttpServletRequest getRequest() {
+        return request;
+    }
+
+    public void setRequest(HttpServletRequest request) {
+        this.request = request;
+    }
+
+    public void setServletRequest(HttpServletRequest request) {
+        this.request = request;
+    }
+
+    public HttpServletResponse getResponse() {
+        return response;
+    }
+
+    public void setResponse(HttpServletResponse response) {
+        this.response = response;
+    }
+
+}

+ 7 - 0
mhotel/src/com/happy/dao/FileDao.java

@@ -28,6 +28,13 @@ public interface FileDao {
     int delFile(int id);
     int delFile(int id);
 
 
     /**
     /**
+     * 描述:根据linkId删除
+     * @param linkId
+     * @return
+     */
+    int delLinkFile(int linkId);
+
+    /**
      * 描述:根据Id查询详细
      * 描述:根据Id查询详细
      * @param id
      * @param id
      * @return
      * @return

+ 14 - 0
mhotel/src/com/happy/dao/impl/FileImplDao.java

@@ -80,6 +80,20 @@ public class FileImplDao implements FileDao {
     }
     }
 
 
     @Override
     @Override
+    public int delLinkFile(int linkId) {
+        String sql = "DELETE FROM `file` WHERE link_id = :link_id ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("link_id",linkId);
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+        return num;
+    }
+
+    @Override
     public File getById(int id) {
     public File getById(int id) {
         String sql = "SELECT * FROM `file` WHERE id = :id ";
         String sql = "SELECT * FROM `file` WHERE id = :id ";
         MapSqlParameterSource sps = new MapSqlParameterSource();
         MapSqlParameterSource sps = new MapSqlParameterSource();

+ 69 - 0
mhotel/src/com/happy/dto/HotelEto.java

@@ -0,0 +1,69 @@
+package com.happy.dto;
+
+import com.happy.Model.File;
+import com.happy.Model.Hotel;
+
+import java.util.List;
+
+public class HotelEto extends Hotel {
+
+    private String hotelName;//民宿名称
+
+    private String hotelTownship;//所属乡镇
+
+    private String corpnName;//法人名称
+
+    private String corpnPhone;//法人电话
+
+    private String bankCard;//银行卡号
+
+    private List<File> fileList;//详细图列表
+
+    public String getHotelName() {
+        return hotelName;
+    }
+
+    public void setHotelName(String hotelName) {
+        this.hotelName = hotelName;
+    }
+
+    public String getHotelTownship() {
+        return hotelTownship;
+    }
+
+    public void setHotelTownship(String hotelTownship) {
+        this.hotelTownship = hotelTownship;
+    }
+
+    public String getCorpnName() {
+        return corpnName;
+    }
+
+    public void setCorpnName(String corpnName) {
+        this.corpnName = corpnName;
+    }
+
+    public String getCorpnPhone() {
+        return corpnPhone;
+    }
+
+    public void setCorpnPhone(String corpnPhone) {
+        this.corpnPhone = corpnPhone;
+    }
+
+    public String getBankCard() {
+        return bankCard;
+    }
+
+    public void setBankCard(String bankCard) {
+        this.bankCard = bankCard;
+    }
+
+    public List<File> getFileList() {
+        return fileList;
+    }
+
+    public void setFileList(List<File> fileList) {
+        this.fileList = fileList;
+    }
+}

+ 67 - 0
mhotel/src/com/happy/service/FileService.java

@@ -0,0 +1,67 @@
+package com.happy.service;
+
+import com.happy.Model.File;
+import com.happy.dto.IPage;
+
+import java.util.List;
+
+public interface FileService {
+
+    /**
+     * 描述:新增
+     * @param file
+     * @return
+     */
+    int insertFile(File file);
+
+    /**
+     * 描述:修改
+     * @param file
+     * @return
+     */
+    int updateFile(File file);
+
+    /**
+     * 描述:删除
+     * @param id
+     * @return
+     */
+    int delFile(int id);
+
+    /**
+     * 描述:根据linkId删除
+     * @param linkId
+     * @return
+     */
+    int delLinkFile(int linkId);
+
+    /**
+     * 描述:根据Id查询详细
+     * @param id
+     * @return
+     */
+    File getById(int id);
+
+    /**
+     * 描述:分页查询
+     * @param sqlx
+     * @param page
+     * @param rows
+     * @return
+     */
+    IPage<File> queryPage(String sqlx, int page, int rows);
+
+    /**
+     * 描述:查询列表
+     * @param sqlx
+     * @return
+     */
+    List<File> queryList(String sqlx);
+
+    /**
+     * 描述:查询一条数据
+     * @param sqlx
+     * @return
+     */
+    File getOen(String sqlx);
+}

+ 8 - 0
mhotel/src/com/happy/service/HotelService.java

@@ -1,6 +1,7 @@
 package com.happy.service;
 package com.happy.service;
 
 
 import com.happy.Model.Hotel;
 import com.happy.Model.Hotel;
+import com.happy.Model.HotelDict;
 import com.happy.dto.IPage;
 import com.happy.dto.IPage;
 
 
 import java.util.List;
 import java.util.List;
@@ -50,4 +51,11 @@ public interface HotelService {
      * @return
      * @return
      */
      */
     List<Hotel> queryList(String sqlx);
     List<Hotel> queryList(String sqlx);
+
+    /**
+     * 描述:查询一条数据
+     * @param sqlx
+     * @return
+     */
+    Hotel getOen(String sqlx);
 }
 }

+ 67 - 0
mhotel/src/com/happy/service/impl/FileImplService.java

@@ -0,0 +1,67 @@
+package com.happy.service.impl;
+
+import com.happy.Model.File;
+import com.happy.dao.FileDao;
+import com.happy.dto.IPage;
+import com.happy.service.FileService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@Service("FileService")
+public class FileImplService implements FileService {
+
+    @Resource
+    public FileDao fileDao;
+
+    @Override
+    public int insertFile(File file) {
+        return fileDao.insertFile(file);
+    }
+
+    @Override
+    public int updateFile(File file) {
+        return fileDao.updateFile(file);
+    }
+
+    @Override
+    public int delFile(int id) {
+        return fileDao.delFile(id);
+    }
+
+    @Override
+    public int delLinkFile(int linkId) {
+        return fileDao.delLinkFile(linkId);
+    }
+
+    @Override
+    public File getById(int id) {
+        return fileDao.getById(id);
+    }
+
+    @Override
+    public IPage<File> queryPage(String sqlx, int page, int rows) {
+        IPage<File> iPage = new IPage();
+        List<File> fileList = fileDao.queryPage(sqlx,page,rows);
+        int total = fileDao.queryTotal(sqlx);
+        iPage.setPageList(fileList);
+        iPage.setPage(page);
+        iPage.setTotalPage( (int)Math.ceil((double)total/rows));
+        iPage.setRows(rows);
+        iPage.setTotal(total);
+        return iPage;
+    }
+
+    @Override
+    public List<File> queryList(String sqlx) {
+        return fileDao.queryList(sqlx);
+    }
+
+    @Override
+    public File getOen(String sqlx){
+        List<File> list = fileDao.queryList(sqlx);
+        if(list!=null && list.size()>0) return list.get(0);
+        return null;
+    }
+}

+ 7 - 0
mhotel/src/com/happy/service/impl/HotelImplService.java

@@ -52,4 +52,11 @@ public class HotelImplService implements HotelService {
     public List<Hotel> queryList(String sqlx) {
     public List<Hotel> queryList(String sqlx) {
         return hotelDao.queryList(sqlx);
         return hotelDao.queryList(sqlx);
     }
     }
+
+    @Override
+    public Hotel getOen(String sqlx){
+        List<Hotel> list = hotelDao.queryList(sqlx);
+        if(list!=null && list.size()>0) return list.get(0);
+        return null;
+    }
 }
 }