业务流程图
用户在市场活动主页面,点击"创建"按钮,弹出创建市场活动的模态窗口;
代码实现
1.UserMapper
/**
* 查询所有用户
*/
List<User> selectAllUsers();
<!--List<User> selectAllUsers();-->
<select id="selectAllUsers" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tbl_user
where lock_state = '1'
</select>
2.UserService接口和实现类
// 查询所有用户
List<User> queryAllUsers();
@Override
public List<User> queryAllUsers() {
return userMapper.selectAllUsers();
}
3.ActivityController
package com.wzl.crm.workbench.web.controller;
import com.wzl.crm.settings.service.UserService;
import com.wzl.crm.workbench.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
* @author wang
* @version 1.0
*/
@Controller
public class ActivityController{
/**
* 注入UserService
*/
@Autowired
private UserService userService;
/**
* 市场活动
*/
@RequestMapping("/workbench/activity/index.do")
public String activityIndex(HttpServletRequest request){
//调用service层方法,查询所有用户
List<User> userList = userService.queryAllUsers();
//存放request
request.setAttribute("userList",userList);
return "workbench/activity/index";
}
}
4.业务的主页index.jsp
5.workbench/activity/index.jsp 实现通过循环从请求域读取名称
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>