Commit 980ffc18 by yinyong

普通用户只展示自己的费用列表信息

parent 1729a577
......@@ -64,8 +64,12 @@ public class CostListController {
String pageNum = request.getParameter("pageNum");
String pageSize = request.getParameter("pageSize");
Map<String, Object> result = costService.getAllCost(Integer.parseInt(pageNum),Integer.parseInt(pageSize));
Integer userId = (request.getParameter("userId") == null ? null : Integer.valueOf(request.getParameter("userId")));
Integer authType = (request.getParameter("authType") == null ? 0 : Integer.valueOf(request.getParameter("authType")));
if(authType != 0) {
userId = null;
}
Map<String, Object> result = costService.getAllCost(Integer.parseInt(pageNum),Integer.parseInt(pageSize), userId);
result.put("success",true);
return result;
}
......
......@@ -51,12 +51,17 @@ public class CostPlanController {
Integer pageNum = null;
String pageSizeStr = request.getParameter("pageSize");
Integer pageSize = null;
Integer userId = (request.getParameter("userId") == null ? null : Integer.valueOf(request.getParameter("userId")));
Integer authType = (request.getParameter("authType") == null ? 0 : Integer.valueOf(request.getParameter("authType")));
if (null != pageNumStr && null != pageSizeStr){
pageNum = Integer.parseInt(pageNumStr);
pageSize = Integer.parseInt(pageSizeStr);
}
PageHelper.startPage(pageNum,pageSize);
List<CostPlanDomain> allCostList = costPlanService.getAllCostList();
if(authType != 0) {
userId = null;
}
List<CostPlanDomain> allCostList = costPlanService.getAllCostList(userId);
PageInfo<CostPlanDomain> pageInfo = new PageInfo<>(allCostList);
List<CostPlanDto> costPlanDtos = costPlanService.domainListToDtoList(allCostList);
result.put("success",true);
......
......@@ -24,7 +24,7 @@ public interface CostDao {
/**
* 获取费用单列表
*/
List<CostDomain> selectAll();
List<CostDomain> selectAll(@Param("userId") Integer userId);
/**
* 根据 costNo 获取费用单详情
......
......@@ -2,6 +2,7 @@ package com.blt.other.other_cost.dao;
import com.blt.other.other_database.model.CostPlanDomain;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
......@@ -18,5 +19,5 @@ public interface CostPlanDao{
Integer deleted(String costPlanNo);
List<CostPlanDomain> selectAll();
List<CostPlanDomain> selectAll(@Param("userId") Integer userId);
}
......@@ -17,7 +17,7 @@ public interface CostPlanService {
Integer deleted(String costPlanNo);
List<CostPlanDomain> getAllCostList();
List<CostPlanDomain> getAllCostList(Integer userId);
List<CostPlanDto> domainListToDtoList(List<CostPlanDomain> costPlanDomains);
......
......@@ -19,7 +19,7 @@ public interface CostService {
* 获取所有费用单
* @return
*/
Map<String, Object> getAllCost(Integer pageNum,Integer pageSize);
Map<String, Object> getAllCost(Integer pageNum,Integer pageSize, Integer userId);
/**
* 根据 costNo 获取 cost
......
......@@ -514,8 +514,8 @@ public class CostPlanServiceImpl implements CostPlanService {
}
@Override
public List<CostPlanDomain> getAllCostList() {
List<CostPlanDomain> costPlanDomains = costPlanDao.selectAll();
public List<CostPlanDomain> getAllCostList(Integer userId) {
List<CostPlanDomain> costPlanDomains = costPlanDao.selectAll(userId);
return costPlanDomains;
}
......
......@@ -107,11 +107,11 @@ public class CostServiceImpl implements CostService {
* @return
*/
@Override
public Map<String, Object> getAllCost(Integer pageNum,Integer pageSize) {
public Map<String, Object> getAllCost(Integer pageNum,Integer pageSize, Integer userId) {
Map<String, Object> result = new HashMap<>();
PageHelper.startPage(pageNum,pageSize);
List<CostDomain> costDomains = costDao.selectAll();
List<CostDomain> costDomains = costDao.selectAll(userId);
PageInfo<CostDomain> pageInfo = new PageInfo<>(costDomains);
List<CostDto> costDtos = domainToDto(costDomains);
......
......@@ -27,6 +27,9 @@
*
FROM
cost
<if test="userId != null">
where create_userid = #{userId}
</if>
ORDER BY
id DESC
</select>
......
......@@ -90,6 +90,9 @@
*
FROM
cost_plan
<if test="userId != null">
where create_userid = #{userId}
</if>
ORDER BY
id DESC
</select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment