基于javaweb+mysql的springboot园区招商管理系统(java+springboot+html+thymeleaf+maven+mysql)
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SpringBoot园区招商管理系统(java+springboot+html+thymeleaf+maven+mysql)
项目介绍
园区招商管理系统。共分为三种角色,超级管理员、企业人员、高级用户。
超级管理员角色具有功能: 系统设置-用户管理、页面管理、角色管理; 招商管理-招商列表; 公司管理-公司列表、我的申请; 投诉管理-投诉列表、我的投诉; 合同管理-合同列表; 项目管理-项目列表、我的项目;
新闻管理-新闻列表;
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.是否Maven项目: 是;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目
6.数据库:MySql 8.0版本;
技术栈
-
后端:SpringBoot;
-
前端:html+thymeleaf;
使用说明
-
使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
-
将项目中application.properties配置文件中的数据库配置改为自己的配置 3. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat,然后运行; 4. 运行项目,输入localhost:8081 登录 5. 管理员账户:admin 密码:123456
-
企业人员和高级用户菜单可通过管理员进行分配;
/**
* Method name: delUserRoleByUserIdAndRoleId <BR>
* Description: 根据用户id权限id删除用户权限表 <BR>
*
* @param userId
* @param roleId
* @return ResultMap<BR>
*/
@RequestMapping("/delUserRoleByUserIdAndRoleId")
@ResponseBody
public ResultMap delUserRoleByUserIdAndRoleId(String userId, Integer roleId) {
return userRoleService.delUserRoleByUserIdAndRoleId(userId, roleId);
}
/**
* Method name: selectUserRole <BR>
* Description: 跳转到选择用户角色页面 <BR>
*
* @return String<BR>
*/
@RequestMapping("/selectUserRole")
public String selectUserRole() {
return "sa/selectUserRole";
}
/**
* Method name: addUserRole <BR>
* Description: 增加用户的角色 <BR>
*
* @param roleId
* @param userIds
* @return String<BR>
*/
@RequestMapping("/addUserRole")
@ResponseBody
public String addUserRole(Integer roleId, String[] userIds) {
return userRoleService.addUserRole(roleId, userIds);
}
/**
* Method name: userAddPage <BR>
* Description: 用户添加页面 <BR>
*
* @return String<BR>
*/
@RequestMapping(value = "/userAddPage")
public String userAddPage() {
return "sa/userAdd";
}
/**
/**
* <p>
* 招商信息
* </p>
*
*/
@Controller("AdminAttract")
@RequestMapping("/admin/attract")
public class AttractController {
@Autowired
private AttractService attractService;
@RequestMapping("/xq")
public String xq(Long id, Model model) {
Attract attract = attractService.getById(id);
model.addAttribute("item", attract);
return "/sa/xqAttract";
}
@RequestMapping("/list")
public String list() {
return "/sa/attractList";
}
@RequestMapping("/doAttract")
public String doComplaint(Long id, Model model) {
model.addAttribute("cId", id);
return "/sa/doAttract";
}
@RequestMapping("/getAllByLimit")
@ResponseBody
public Object getAllByLimit(Attract attract) {
return attractService.getAllByLimit(attract);
}
@ResponseBody
@RequestMapping("/del")
public String delWord(String[] ids) {
try {
for (String id : ids){
attractService.delById(id);
}
return "SUCCESS";
@ResponseBody
public ResultMap delUserRoleByUserIdAndRoleId(String userId, Integer roleId) {
return userRoleService.delUserRoleByUserIdAndRoleId(userId, roleId);
}
/**
* Method name: selectUserRole <BR>
* Description: 跳转到选择用户角色页面 <BR>
*
* @return String<BR>
*/
@RequestMapping("/selectUserRole")
public String selectUserRole() {
return "sa/selectUserRole";
}
/**
* Method name: addUserRole <BR>
* Description: 增加用户的角色 <BR>
*
* @param roleId
* @param userIds
* @return String<BR>
*/
@RequestMapping("/addUserRole")
@ResponseBody
public String addUserRole(Integer roleId, String[] userIds) {
return userRoleService.addUserRole(roleId, userIds);
}
/**
* Method name: userAddPage <BR>
* Description: 用户添加页面 <BR>
*
* @return String<BR>
*/
@RequestMapping(value = "/userAddPage")
public String userAddPage() {
return "sa/userAdd";
}
try {
complaintService.save(complaint);
return "SUCCESS";
} catch (Exception e) {
e.printStackTrace();
return "ERR";
}
}
}
package com.pims.controller.admin;
/**
* <p>
* 前端控制器
* </p>
*
*/
@Controller("AdminContractController")
@RequestMapping("/admin/contract")
public class ContractController {
@Autowired
private ContractService contractService;
@RequestMapping("/xq")
public String xq(Long id, Model model) {
Contract contract = contractService.getById(id);
model.addAttribute("title", contract.getTitle());
model.addAttribute("c", contract.getContent());
model.addAttribute("time", MyUtils.getDate2String(contract.getCreateTime()).split(" ")[0]);
model.addAttribute("firstParty", contract.getFirstParty());
model.addAttribute("secondParty", contract.getSecondParty());
private ProjectService projectService;
@Autowired
private AttractService attractService;
@RequestMapping("/list")
public String list() {
return "/user/projectList";
}
@RequestMapping("/applyList")
public String applyList() {
return "/user/applyList";
}
@RequestMapping("/applyProject")
public String applyProject(Long id, Model model) {
model.addAttribute("cId", id);
return "/user/applyProject";
}
@RequestMapping("/getAllByLimit")
@ResponseBody
public Object getAllByLimit(Project project) {
Subject subject = SecurityUtils.getSubject();
User user = (User) subject.getPrincipal();
project.setCompanyId(user.getId());
return projectService.getAllByLimit(project);
}
@RequestMapping("/getApplyList")
@ResponseBody
public Object getApplyList(Project project) {
return projectService.getApplyList(project);
}
@RequestMapping("/apply")
@ResponseBody
public String apply(Attract attract) {
try {
Subject subject = SecurityUtils.getSubject();
User user = (User) subject.getPrincipal();
/**
* class name:LoginController <BR>
* class description: 登录操作 <BR>
* Remark: <BR>
*/
@Controller("OpenLogin")
@RequestMapping()
public class LoginController {
@Autowired
private ResultMap resultMap;
@Autowired
private UserService userService;// 用户登录service
@Autowired
private PageService pageService;
private final Logger logger = LoggerFactory.getLogger(LoginController.class);
@RequestMapping(value = "/notLogin", method = RequestMethod.GET)
@ResponseBody
public ResultMap notLogin() {
logger.warn("尚未登陆!");
return resultMap.success().message("您尚未登陆!");
}
@RequestMapping(value = "/notRole", method = RequestMethod.GET)
@ResponseBody
public ResultMap notRole() {
Subject subject = SecurityUtils.getSubject();
User user = (User) subject.getPrincipal();
if (user != null) {
logger.info("{}---没有权限!", user.getName());
}
/**
*/
@Controller("OpenHome")
@RequestMapping()
public class HomeController {
@RequestMapping(value = "/yqjs")
public String yqjs(Model model) {
Subject subject = SecurityUtils.getSubject();
User user = (User) subject.getPrincipal();
model.addAttribute("uname", user.getName());
return "yqjs";
}
}
package com.pims.controller.open;
/**
* <p>
* 前端控制器
* </p>
*
*/
@RestController("OpenWord")
@RequestMapping("/open/word")
public class WordController {
}
package com.pims.controller.company;
/**
* <p>
* @return ResultMap<BR>
*/
@RequestMapping("/delUserRoleByUserIdAndRoleId")
@ResponseBody
public ResultMap delUserRoleByUserIdAndRoleId(String userId, Integer roleId) {
return userRoleService.delUserRoleByUserIdAndRoleId(userId, roleId);
}
/**
* Method name: selectUserRole <BR>
* Description: 跳转到选择用户角色页面 <BR>
*
* @return String<BR>
*/
@RequestMapping("/selectUserRole")
public String selectUserRole() {
return "sa/selectUserRole";
}
/**
* Method name: addUserRole <BR>
* Description: 增加用户的角色 <BR>
*
* @param roleId
* @param userIds
* @return String<BR>
*/
@RequestMapping("/addUserRole")
@ResponseBody
public String addUserRole(Integer roleId, String[] userIds) {
return userRoleService.addUserRole(roleId, userIds);
}
/**
* Method name: userAddPage <BR>
* Description: 用户添加页面 <BR>
*
* @return String<BR>
*/
@RequestMapping(value = "/userAddPage")
public String userAddPage() {
return "sa/userAdd";
}
/**
* 前端控制器
* </p>
*
*/
@Controller("AdminWord")
@RequestMapping("/admin/word")
public class WordController {
private WordService wordService;
public WordController(WordService wordService) {
this.wordService = wordService;
}
@RequestMapping("/xq")
public String xq(Long id, Model model) {
wordService.view(id);
Word word = wordService.getById(id);
System.out.println(word.getContent());
model.addAttribute("c", word.getContent());
model.addAttribute("title", word.getTitle());
model.addAttribute("view", word.getViewCount());
model.addAttribute("time", MyUtils.getDate2String(word.getCreateTime()));
return "/sa/xqWord";
}
@RequestMapping("/list")
public String list() {
return "/sa/wordList";
}
@RequestMapping("/publish")
public String delUserPage() {
return "/sa/word";
}
@ResponseBody
@RequestMapping("/addWord")
public String addWord(Word word) {
try {
word.setCreateTime(new Date());
word.setViewCount(0);
wordService.save(word);
return "SUCCESS";
} catch (Exception e) {
e.printStackTrace();
* Method name: checkUserId <BR>
* Description: 检测用户账号是否存在 <BR>
*
* @param userId
* @return User<BR>
*/
@ResponseBody
@RequestMapping("/checkUserId")
public User checkUserId(String userId) {
return userService.selectByPrimaryKey(userId);
}
/**
* Method name: addUser <BR>
* Description: 用户添加 <BR>
*
* @param user
* @return String<BR>
*/
@ResponseBody
@RequestMapping("/addUser")
public String addUser(User user) {
try {
user.setPassword(MD5.md5(user.getPassword()));
user.setCreateTime(new Date());
userService.addUser(user);
User u = userService.getUserByPhoneAndName(user.getPhone(), user.getName());
String[] ids = new String[1];
ids[0] = u.getId()+"";
userRoleService.addUserRole(user.getRole(), ids);
return "SUCCESS";
} catch (Exception e) {
return "ERR";
}
}
/**
* Method name: updateUser <BR>
* Description: 更新用户 <BR>
*
* @param user
* @return String<BR>
*/
@ResponseBody
@RequestMapping("/updateUser")
public String updateUser(User user, String oldId) {
return userService.updateUser(oldId, user);
}
/**
* </p>
*
*/
@Controller("AdminContractController")
@RequestMapping("/admin/contract")
public class ContractController {
@Autowired
private ContractService contractService;
@RequestMapping("/xq")
public String xq(Long id, Model model) {
Contract contract = contractService.getById(id);
model.addAttribute("title", contract.getTitle());
model.addAttribute("c", contract.getContent());
model.addAttribute("time", MyUtils.getDate2String(contract.getCreateTime()).split(" ")[0]);
model.addAttribute("firstParty", contract.getFirstParty());
model.addAttribute("secondParty", contract.getSecondParty());
model.addAttribute("money", contract.getMoney());
model.addAttribute("sign", contract.getSign());
return "/sa/xqContract";
}
@RequestMapping("/list")
public String list() {
return "/sa/contractList";
}
@RequestMapping("/addContract")
public String addContract() {
return "/sa/contract";
}
@ResponseBody
@RequestMapping("/add")
public String addContract(Contract contract) {
try {
contractService.save(contract);
return "SUCCESS";
} catch (Exception e) {
e.printStackTrace();
return "ERR";
return "SUCCESS";
} catch (Exception e) {
e.printStackTrace();
return "ERR";
}
}
}
package com.pims.controller.admin;
/**
* <p>
* 前端控制器
* </p>
*
*/
@Controller("AdminCompany")
@RequestMapping("/admin/company")
public class CompanyController {
@Autowired
private CompanyService companyService;
@RequestMapping("/xq")
public String xq(Long id, Model model) {
Company company = companyService.getById(id);
model.addAttribute("item", company);
return "/sa/xqCompany";
}
@RequestMapping("/list")
public String list() {
return "/sa/companyList";
}
@RequestMapping("/doCompany")
public String doComplaint(Long id, Model model) {
model.addAttribute("cId", id);
return "/sa/doCompany";
}
/**
*/
@Controller
public class UploadFileController {
/**
* 富文本编辑器图片上传
* @param file
* @return
*/
@RequestMapping(value = "/upload", method = RequestMethod.POST)
@ResponseBody
public void uploadImage(@RequestParam("upload") MultipartFile file,
HttpServletRequest request, HttpServletResponse response){
if (file.isEmpty()) {
System.out.println("文件为空空");
}
PrintWriter out=null;
// CKEditor提交的很重要的一个参数 ,回调函数的序号
String callback = request.getParameter("CKEditorFuncNum");
String fileName = file.getOriginalFilename(); // 文件名
String suffixName = fileName.substring(fileName.lastIndexOf(".")); // 后缀名
String filePath = "D://upload//"; // 上传后的路径
fileName = UUID.randomUUID() + suffixName; // 新文件名
FileResponse fileResponse = new FileResponse();
File dest = new File(filePath + fileName);
if (!dest.getParentFile().exists()) {
dest.getParentFile().mkdirs();
}
try {
@RequestMapping("/xq")
public String xq(Long id, Model model) {
Contract contract = contractService.getById(id);
model.addAttribute("title", contract.getTitle());
model.addAttribute("c", contract.getContent());
model.addAttribute("time", MyUtils.getDate2String(contract.getCreateTime()).split(" ")[0]);
model.addAttribute("firstParty", contract.getFirstParty());
model.addAttribute("secondParty", contract.getSecondParty());
model.addAttribute("money", contract.getMoney());
model.addAttribute("sign", contract.getSign());
return "/sa/xqContract";
}
@RequestMapping("/list")
public String list() {
return "/sa/contractList";
}
@RequestMapping("/addContract")
public String addContract() {
return "/sa/contract";
}
@ResponseBody
@RequestMapping("/add")
public String addContract(Contract contract) {
try {
contractService.save(contract);
return "SUCCESS";
} catch (Exception e) {
e.printStackTrace();
return "ERR";
}
}
@RequestMapping("/getAllByLimit")
@ResponseBody
public Object getAllByLimit(Contract contract) {
return contractService.getAllByLimit(contract);
}
@ResponseBody
@RequestMapping("/del")
public String delWord(String[] ids) {
@Controller("Admin")
@RequestMapping("/admin")
public class Adminontroller {
@Autowired
private PageService pageService;
@Autowired
private RoleService roleService;
@Autowired
private PageRoleService pageRoleService;
@Autowired
private UserRoleService userRoleService;
@Autowired
private UserService userService;
private final Logger logger = LoggerFactory.getLogger(Adminontroller.class);
/**
* Method name: page <BR>
* Description: 跳转到页面设置页面 <BR>
*
* @param model
* @return String<BR>
*/
@RequestMapping("/page")
public String page(Model model) {
List<Page> pageList = pageService.getAllPage();
model.addAttribute("pageList", pageList);
return "sa/page";
}
/**
* Method name: role <BR>
* Description: 跳转到角色设置页面 <BR>
*
* @param model
* @return String<BR>
*/
@RequestMapping("/role")
public String role(Model model) {
return "sa/role";
}
/**
* Method name: getAllRole <BR>
* Description: 获取所有权限 <BR>
/**
* <p>
* 招商信息
* </p>
*
*/
@Controller("AdminAttract")
@RequestMapping("/admin/attract")
public class AttractController {
@Autowired
private AttractService attractService;
@RequestMapping("/xq")
public String xq(Long id, Model model) {
Attract attract = attractService.getById(id);
model.addAttribute("item", attract);
return "/sa/xqAttract";
}
@RequestMapping("/list")
public String list() {
return "/sa/attractList";
}
@RequestMapping("/doAttract")
public String doComplaint(Long id, Model model) {
model.addAttribute("cId", id);
return "/sa/doAttract";
}
@RequestMapping("/getAllByLimit")
@ResponseBody
public Object getAllByLimit(Attract attract) {
return attractService.getAllByLimit(attract);
}
@ResponseBody
@RequestMapping("/del")
public String delWord(String[] ids) {
try {
}
/**
* Method name: getAllPage <BR>
* Description: 获取所有页面 <BR>
*
* @return List<Page><BR>
*/
@RequestMapping("/getAllPage")
@ResponseBody
public List<Page> getAllPage() {
return pageService.getAllPage();
}
/**
* Method name: getPageByRole <BR>
* Description: 获取某个角色的权限页面 <BR>
*/
@RequestMapping("/getPageByRole")
@ResponseBody
public Object getPageByRole(Integer roleId) {
return pageService.getAllPageByRoleId(roleId);
}
/**
* Method name: updatePageById <BR>
* Description: 根据页面id更新页面 <BR>
*
* @param page
* @return ResultMap<BR>
*/
@RequestMapping("/updatePageById")
@ResponseBody
public ResultMap updatePageById(Page page) {
return pageService.updatePageById(page);
}
/**
* Method name: addPage <BR>
* Description: 添加页面 <BR>
*
* @param page
* @return Page<BR>
*/
@RequestMapping("/addPage")
@ResponseBody
public Page addPage(Page page) {
return pageService.addPage(page);
}
/**
* Method name: delPageById <BR>
* Description: 根据页面id删除页面 <BR>
@Autowired
private AttractService attractService;
@RequestMapping("/list")
public String list() {
return "/user/projectList";
}
@RequestMapping("/applyList")
public String applyList() {
return "/user/applyList";
}
@RequestMapping("/applyProject")
public String applyProject(Long id, Model model) {
model.addAttribute("cId", id);
return "/user/applyProject";
}
@RequestMapping("/getAllByLimit")
@ResponseBody
public Object getAllByLimit(Project project) {
Subject subject = SecurityUtils.getSubject();
User user = (User) subject.getPrincipal();
project.setCompanyId(user.getId());
return projectService.getAllByLimit(project);
}
@RequestMapping("/getApplyList")
@ResponseBody
public Object getApplyList(Project project) {
return projectService.getApplyList(project);
}
@RequestMapping("/apply")
@ResponseBody
public String apply(Attract attract) {
try {
Subject subject = SecurityUtils.getSubject();
User user = (User) subject.getPrincipal();
List<Attract> list = attractService.getByUserIdAndProId(user.getId(), attract.getProjectId());
if (list.size()>0){
return "CCC";
}
attract.setUserId(user.getId());
attract.setCreateTime(new Date());
attract.setStatus(0+"");
@ResponseBody
public Object getPageByRole(Integer roleId) {
return pageService.getAllPageByRoleId(roleId);
}
/**
* Method name: updatePageById <BR>
* Description: 根据页面id更新页面 <BR>
*
* @param page
* @return ResultMap<BR>
*/
@RequestMapping("/updatePageById")
@ResponseBody
public ResultMap updatePageById(Page page) {
return pageService.updatePageById(page);
}
/**
* Method name: addPage <BR>
* Description: 添加页面 <BR>
*
* @param page
* @return Page<BR>
*/
@RequestMapping("/addPage")
@ResponseBody
public Page addPage(Page page) {
return pageService.addPage(page);
}
/**
* Method name: delPageById <BR>
* Description: 根据页面id删除页面 <BR>
*
* @param id
* @return ResultMap<BR>
*/
@RequestMapping("/delPageById")
@ResponseBody
public ResultMap delPageById(Integer id) {
if (null == id) {
return new ResultMap().fail().message("参数错误");
}
@RequestMapping(value = "/upload", method = RequestMethod.POST)
@ResponseBody
public void uploadImage(@RequestParam("upload") MultipartFile file,
HttpServletRequest request, HttpServletResponse response){
if (file.isEmpty()) {
System.out.println("文件为空空");
}
PrintWriter out=null;
// CKEditor提交的很重要的一个参数 ,回调函数的序号
String callback = request.getParameter("CKEditorFuncNum");
String fileName = file.getOriginalFilename(); // 文件名
String suffixName = fileName.substring(fileName.lastIndexOf(".")); // 后缀名
String filePath = "D://upload//"; // 上传后的路径
fileName = UUID.randomUUID() + suffixName; // 新文件名
FileResponse fileResponse = new FileResponse();
File dest = new File(filePath + fileName);
if (!dest.getParentFile().exists()) {
dest.getParentFile().mkdirs();
}
try {
file.transferTo(dest);
out = response.getWriter();
String filename = "/file/" + fileName;
String s = fileResponse.success(1, fileName, filename, null);
// 返回"图像"选项卡并显示图片 request.getContextPath()为web项目名
out.println(s);
} catch (IOException e) {
String s = fileResponse.error(0, "上传失败!");
// 返回"图像"选项卡并显示图片 request.getContextPath()为web项目名
out.println(s);
}
}
}
package com.pims.controller.admin;
/**
* <p>
* 前端控制器
* </p>
*
*/
@Controller("AdminContractController")
@RequestMapping("/admin/contract")
public class ContractController {
@Autowired
private ContractService contractService;
@RequestMapping("/xq")
public String xq(Long id, Model model) {
Contract contract = contractService.getById(id);
model.addAttribute("title", contract.getTitle());
model.addAttribute("c", contract.getContent());
model.addAttribute("time", MyUtils.getDate2String(contract.getCreateTime()).split(" ")[0]);
model.addAttribute("firstParty", contract.getFirstParty());
model.addAttribute("secondParty", contract.getSecondParty());
model.addAttribute("money", contract.getMoney());
model.addAttribute("sign", contract.getSign());
return "/sa/xqContract";
}
@RequestMapping("/list")
public String list() {
return "/sa/contractList";
}
@RequestMapping("/addContract")
public String addContract() {
return "/sa/contract";
}
@ResponseBody
@RequestMapping(value = "/logout", method = RequestMethod.GET)
public String logout() {
Subject subject = SecurityUtils.getSubject();
User user = (User) subject.getPrincipal();
if (null != user) {
logger.info("{}---退出登录!", user.getName());
}
subject.logout();
return "login";
}
/**
* Method name: login <BR>
* Description: 登录验证 <BR>
* Remark: <BR>
*
* @param username 用户名
* @param password 密码
* @return ResultMap<BR>
*/
@RequestMapping(value = "/login")
@ResponseBody
public ResultMap login(String username, String password) {
return userService.login(username, password);
}
/**
* Method name: login <BR>
* Description: 登录页面 <BR>
*
* @return String login.html<BR>
*/
@RequestMapping(value = "/index")
public String login() {
return "login";
}
@RequestMapping(value = "/regist")
public String regist() {
return "regist";
}
@RequestMapping(value = "/doRegist")
@ResponseBody
public String xq(Long id, Model model) {
wordService.view(id);
Word word = wordService.getById(id);
System.out.println(word.getContent());
model.addAttribute("c", word.getContent());
model.addAttribute("title", word.getTitle());
model.addAttribute("view", word.getViewCount());
model.addAttribute("time", MyUtils.getDate2String(word.getCreateTime()));
return "/sa/xqWord";
}
@RequestMapping("/list")
public String list() {
return "/sa/wordList";
}
@RequestMapping("/publish")
public String delUserPage() {
return "/sa/word";
}
@ResponseBody
@RequestMapping("/addWord")
public String addWord(Word word) {
try {
word.setCreateTime(new Date());
word.setViewCount(0);
wordService.save(word);
return "SUCCESS";
} catch (Exception e) {
e.printStackTrace();
return "ERR";
}
}
@RequestMapping("/getAllWordByLimit")
@ResponseBody
public Object getAllWordByLimit(Word word) {
return wordService.getAllWordByLimit(word);
}
@ResponseBody
@RequestMapping("/delWord")
public String delWord(String[] ids) {
try {
for (String id : ids){
wordService.delById(id);
}
return "SUCCESS";
* Description: 增加用户的角色 <BR>
*
* @param roleId
* @param userIds
* @return String<BR>
*/
@RequestMapping("/addUserRole")
@ResponseBody
public String addUserRole(Integer roleId, String[] userIds) {
return userRoleService.addUserRole(roleId, userIds);
}
/**
* Method name: userAddPage <BR>
* Description: 用户添加页面 <BR>
*
* @return String<BR>
*/
@RequestMapping(value = "/userAddPage")
public String userAddPage() {
return "sa/userAdd";
}
/**
* Method name: userPage <BR>
* Description: 用户管理页面 <BR>
*
* @return String<BR>
*/
@RequestMapping(value = "/userPage")
public String userPage() {
return "sa/userList";
}
/**
* Method name: getAllUserByLimit <BR>
* Description: 根据条件获取所有用户 <BR>
*
* @param userParameter
* @return Object<BR>
*/
@RequestMapping("/getAllUserByLimit")
@ResponseBody
public Object getAllUserByLimit(UserParameter userParameter) {
public class WordController {
private WordService wordService;
public WordController(WordService wordService) {
this.wordService = wordService;
}
@RequestMapping("/xq")
public String xq(Long id, Model model) {
wordService.view(id);
Word word = wordService.getById(id);
System.out.println(word.getContent());
model.addAttribute("c", word.getContent());
model.addAttribute("title", word.getTitle());
model.addAttribute("view", word.getViewCount());
model.addAttribute("time", MyUtils.getDate2String(word.getCreateTime()));
return "/sa/xqWord";
}
@RequestMapping("/list")
public String list() {
return "/sa/wordList";
}
@RequestMapping("/publish")
public String delUserPage() {
return "/sa/word";
}
@ResponseBody
@RequestMapping("/addWord")
public String addWord(Word word) {
try {
word.setCreateTime(new Date());
word.setViewCount(0);
wordService.save(word);
return "SUCCESS";
} catch (Exception e) {
e.printStackTrace();
return "ERR";
}
}
@RequestMapping("/getAllWordByLimit")
@ResponseBody
public Object getAllWordByLimit(Word word) {
return wordService.getAllWordByLimit(word);
}
@ResponseBody
/**
* Method name: addRole <BR>
* Description: 增加角色 <BR>
*
* @param name
* @return String<BR>
*/
@RequestMapping("/addRole")
@ResponseBody
public String addRole(String name) {
return roleService.addRole(name);
}
/**
* Method name: delManageRole <BR>
* Description: 根据角色id删除角色 <BR>
*
* @param id
* @return String<BR>
*/
@RequestMapping("/delRole")
@ResponseBody
public String delRole(int id) {
// 删除角色
boolean flag1 = roleService.delRoleById(id);
// 删除角色_权限表
boolean flag2 = pageRoleService.delPageRoleByRoleId(id);
// 删除某个角色的所有用户
boolean flag3 = userRoleService.delUserRoleByRoleId(id);
if (flag1 && flag2 && flag3) {
return "SUCCESS";
}
return "ERROR";
}
/**
* Method name: updateRole <BR>
* Description: 根据权限id修改权限信息 <BR>
*