提交 b425b7dc 编写于 作者: N nrd

添加了customer控制层修改了获取全部的功能

上级 472b7170
package com.hqyj.seven.controller;
import com.hqyj.seven.pojo.Customer;
import com.hqyj.seven.pojo.House;
import com.hqyj.seven.pojo.PageData;
import com.hqyj.seven.service.CustomerService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.session.Session;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("/customer")
public class CustomerController {
@Autowired
CustomerService customerService;
@RequestMapping("/getallcus")
@ResponseBody
public Map<String,Object> getAllcus(){
List<Customer> customerList = customerService.queryAll();
Map<String,Object> customer = new HashMap<>();
if (customerList == null){
customer.put("code",-1);
customer.put("msg","没有客房信息");
}else {
customer.put("code", 0);
customer.put("data", customerList);
customer.put("msg","获取数据成功!");
}
Session session= SecurityUtils.getSubject().getSession();
session.setAttribute("customerList",customerList);
return customer;
}
}
......@@ -6,7 +6,9 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface CustomerDao {
List<Customer> queryAll();
int updataByCustomerIdToremainder(@Param("money") double money, @Param("id") int id);
Customer queryByCustomer(int CustomerId);
//获取全部客户信息
List<Customer> queryAll();
}
......@@ -2,9 +2,14 @@ package com.hqyj.seven.service;
import com.hqyj.seven.pojo.Customer;
import java.util.List;
public interface CustomerService {
//住房更新金额
int updateByNameToRemainder(double money, int id);
//按id查找用户
Customer queryById(int customerId);
//查询所有客户信息
List<Customer> queryAll();
}
......@@ -6,6 +6,8 @@ import com.hqyj.seven.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class CustomerServiceImpl implements CustomerService {
@Autowired
......@@ -19,4 +21,9 @@ public class CustomerServiceImpl implements CustomerService {
public Customer queryById(int customerId) {
return customerDao.queryByCustomer(customerId);
}
@Override
public List<Customer> queryAll() {
return customerDao.queryAll();
}
}
......@@ -37,5 +37,9 @@
<!-- <select id="queryAll" resultMap="customerBaseResultMap">-->
<!-- <include refid="customerBaseQuerySql" />-->
<!-- </select>-->
<select id="queryAll" resultType="com.hqyj.seven.pojo.Customer">
select * from customer
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册