Commit 980ffc18 by yinyong

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

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