数据读取不出来,layui显示数据接口异常
在访问leave/list时候没有返回json数据,但是我在做单元测试是可以正常获取数据。
leave_form.xml
相关代码:
<select id="selectByParams" parameterType="java.util.Map" resultType="java.util.Map"> select f.*,e.name,d.* from adm_leave_form f,adm_process_flow pf,adm_employee e,adm_department d where f.form_id = pf.form_id and pf.state = #{pf_state} and pf.operator_id = #{pf_operator_id} and f.employee_id = e.employee_id and e.department_id = d.department_id </select>
LeaveFormDao
相关代码:
public interface LeaveFormDao { public void insert(LeaveForm form); public List<Map> selectByParams(@Param("pf_state") String pfState , @Param("pf_operator_id") Long operatorId); }
LeaveFormServelet
相关代码:
private void getLeaveFormList(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { User user = (User)request.getSession().getAttribute("login_user"); List<Map> formList = leaveFormService.getLeaveFormList("process", user.getEmployeeId()); Map result = new HashMap(); result.put("code", "0"); result.put("msg", ""); result.put("count", formList.size()); result.put("data", formList); String json = JSON.toJSONString(result); response.getWriter().println(json); }
LeaveFormService
相关代码:
public List<Map> getLeaveFormList(String pfState , Long operatorId){ return (List<Map>) MybatisUtils.executeQuery(sqlSession -> { LeaveFormDao leaveFormDao = sqlSession.getMapper(LeaveFormDao.class); List<Map> formList = leaveFormDao.selectByParams(pfState,operatorId); return formList; }); }
16
收起
正在回答 回答被采纳积分+1
1回答
java工程师2020版
- 参与学习 人
- 提交作业 9393 份
- 解答问题 16556 个
综合就业常年第一,编程排行常年霸榜,无需脱产即可学习,北上广深月薪过万 无论你是未就业的学生还是想转行的在职人员,不需要基础,只要你有梦想,想高薪
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星