Compare commits

..

No commits in common. 'main' and 'wujiamei_branch' have entirely different histories.

@ -1,5 +1,7 @@
package com.controller; package com.controller;
import java.util.Arrays; import java.util.Arrays;
import java.util.Map; import java.util.Map;
@ -12,10 +14,10 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.annotation.IgnoreAuth; import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper; // MyBatis-Plus的实体包装器 import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.ConfigEntity; // 配置实体类 import com.entity.ConfigEntity;
import com.service.ConfigService; // 配置服务类 import com.service.ConfigService;
import com.utils.MPUtil; // MyBatis-Plus工具类 import com.utils.MPUtil;
import com.utils.PageUtils; import com.utils.PageUtils;
import com.utils.R; import com.utils.R;
import com.utils.ValidatorUtils; import com.utils.ValidatorUtils;
@ -23,106 +25,88 @@ import com.utils.ValidatorUtils;
/** /**
* *
*/ */
@RequestMapping("config") // 设置基本请求路径为"/config" @RequestMapping("config")
@RestController // 标记为REST风格的控制器 @RestController
public class ConfigController { public class ConfigController{
@Autowired // 自动注入ConfigService @Autowired
private ConfigService configService; private ConfigService configService;
/** /**
* *
* @param params
* @param config
* @return
*/ */
@RequestMapping("/page") @RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, ConfigEntity config) { public R page(@RequestParam Map<String, Object> params,ConfigEntity config){
EntityWrapper<ConfigEntity> ew = new EntityWrapper<ConfigEntity>(); // 创建EntityWrapper用于条件构造 EntityWrapper<ConfigEntity> ew = new EntityWrapper<ConfigEntity>();
PageUtils page = configService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, config), params), params)); // 查询分页数据 PageUtils page = configService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, config), params), params));
return R.ok().put("data", page); return R.ok().put("data", page);
} }
/** /**
* *
* @param params
* @param config
* @return
*/ */
@IgnoreAuth // 忽略身份验证 @IgnoreAuth
@RequestMapping("/list") @RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params, ConfigEntity config) { public R list(@RequestParam Map<String, Object> params,ConfigEntity config){
EntityWrapper<ConfigEntity> ew = new EntityWrapper<ConfigEntity>(); // 创建EntityWrapper用于条件构造 EntityWrapper<ConfigEntity> ew = new EntityWrapper<ConfigEntity>();
PageUtils page = configService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, config), params), params)); // 查询分页数据 PageUtils page = configService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, config), params), params));
return R.ok().put("data", page); return R.ok().put("data", page);
} }
/** /**
* *
* @param id ID
* @return ID
*/ */
@RequestMapping("/info/{id}") // 用于获取指定ID的配置信息 @RequestMapping("/info/{id}")
public R info(@PathVariable("id") String id) { public R info(@PathVariable("id") String id){
ConfigEntity config = configService.selectById(id); // 根据ID查询配置 ConfigEntity config = configService.selectById(id);
return R.ok().put("data", config); return R.ok().put("data", config);
} }
/** /**
* *
* @param id ID
* @return ID
*/ */
@IgnoreAuth // 忽略身份验证 @IgnoreAuth
@RequestMapping("/detail/{id}") // 用于获取指定ID的配置信息详情 @RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") String id) { public R detail(@PathVariable("id") String id){
ConfigEntity config = configService.selectById(id); // 根据ID查询配置 ConfigEntity config = configService.selectById(id);
return R.ok().put("data", config); return R.ok().put("data", config);
} }
/** /**
* name * name
* @param name
* @return
*/ */
@RequestMapping("/info") // 用于根据名称获取配置信息 @RequestMapping("/info")
public R infoByName(@RequestParam String name) { public R infoByName(@RequestParam String name){
ConfigEntity config = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile")); // 根据名称查询配置 ConfigEntity config = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile"));
return R.ok().put("data", config); return R.ok().put("data", config);
} }
/** /**
* *
* @param config
* @return
*/ */
@PostMapping("/save") // 用于保存配置 @PostMapping("/save")
public R save(@RequestBody ConfigEntity config) { public R save(@RequestBody ConfigEntity config){
// ValidatorUtils.validateEntity(config); // 验证配置实体(注释掉此行可以在需要时启用) // ValidatorUtils.validateEntity(config);
configService.insert(config); // 保存配置 configService.insert(config);
return R.ok(); return R.ok();
} }
/** /**
* *
* @param config
* @return
*/ */
@RequestMapping("/update") // 用于修改配置 @RequestMapping("/update")
public R update(@RequestBody ConfigEntity config) { public R update(@RequestBody ConfigEntity config){
// ValidatorUtils.validateEntity(config); // 验证配置实体(注释掉此行可以在需要时启用) // ValidatorUtils.validateEntity(config);
configService.updateById(config); // 根据ID更新配置 configService.updateById(config);//全部更新
return R.ok(); return R.ok();
} }
/** /**
* *
* @param ids ID
* @return
*/ */
@RequestMapping("/delete") // 用于删除配置 @RequestMapping("/delete")
public R delete(@RequestBody Long[] ids) { public R delete(@RequestBody Long[] ids){
configService.deleteBatchIds(Arrays.asList(ids)); // 批量删除配置 configService.deleteBatchIds(Arrays.asList(ids));
return R.ok(); return R.ok();
} }
} }

@ -10,14 +10,14 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; // 导入Spring的依赖注入注解 import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; // 导入Spring的REST控制器注解 import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; // 导入Spring的文件上传接口 import org.springframework.web.multipart.MultipartFile;
import com.annotation.IgnoreAuth; // 导入自定义注解,表示忽略身份验证 import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper; // 导入MyBatis-Plus的EntityWrapper用于构建查询条件 import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.ConfigEntity; import com.entity.ConfigEntity;
import com.entity.EIException; import com.entity.EIException;
import com.service.ConfigService; import com.service.ConfigService;
@ -26,84 +26,65 @@ import com.utils.R;
/** /**
* *
*/ */
@RestController // 标记该类为REST控制器 @RestController
@RequestMapping("file") // 设置基本请求路径为"/file" @RequestMapping("file")
@SuppressWarnings({"unchecked","rawtypes"}) // 忽略编译警告 @SuppressWarnings({"unchecked","rawtypes"})
public class FileController { public class FileController{
@Autowired
@Autowired // 自动注入ConfigService服务
private ConfigService configService; private ConfigService configService;
/** /**
* *
* @param file
* @param type
* @param request HttpServletRequest
* @return
*/ */
@RequestMapping("/upload") // 映射请求路径为"/upload" @RequestMapping("/upload")
@IgnoreAuth // 忽略身份验证 @IgnoreAuth
public R upload(@RequestParam("file") MultipartFile file, String type, HttpServletRequest request) throws Exception { public R upload(@RequestParam("file") MultipartFile file, String type,HttpServletRequest request) throws Exception {
// 检查上传的文件是否为空
if (file.isEmpty()) { if (file.isEmpty()) {
throw new EIException("上传文件不能为空"); throw new EIException("上传文件不能为空");
} }
// 获取文件扩展名 String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1);
String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1); String fileName = new Date().getTime()+"."+fileExt;
String fileName = new Date().getTime() + "." + fileExt; File dest = new File(request.getSession().getServletContext().getRealPath("/upload")+"/"+fileName);
// 定义文件保存的目标路径
File dest = new File(request.getSession().getServletContext().getRealPath("/upload") + "/" + fileName);
file.transferTo(dest); file.transferTo(dest);
/** /**
* 使IDEAEclipse * 使ideaeclipse
* * "D:\\ssmpiv99\\src\\main\\webapp\\upload"upload
* "D:\\ssmpiv99\\src\\main\\webapp\\upload"upload *
*
*/ */
// FileUtils.copyFile(dest, new File("D:\\ssmpiv99\\src\\main\\webapp\\upload" + "/" + fileName)); /** 修改了路径后请将该行最前面的//注释去掉 **/ //FileUtils.copyFile(dest, new File("D:\\ssmpiv99\\src\\main\\webapp\\upload"+"/"+fileName)); /**修改了路径以后请将该行最前面的//注释去掉**/
if(StringUtils.isNotBlank(type) && type.equals("1")) {
// 如果type不为空且等于"1",则更新或保存配置信息
if (StringUtils.isNotBlank(type) && type.equals("1")) {
ConfigEntity configEntity = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile")); ConfigEntity configEntity = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile"));
if (configEntity == null) { if(configEntity==null) {
configEntity = new ConfigEntity(); // 创建新的配置实体 configEntity = new ConfigEntity();
configEntity.setName("faceFile"); configEntity.setName("faceFile");
configEntity.setValue(fileName); configEntity.setValue(fileName);
} else { } else {
configEntity.setValue(fileName); configEntity.setValue(fileName);
} }
configService.insertOrUpdate(configEntity); // 保存或更新配置 configService.insertOrUpdate(configEntity);
} }
return R.ok().put("file", fileName); // 返回上传结果,包含文件名 return R.ok().put("file", fileName);
} }
/** /**
* *
* @param fileName
* @param request HttpServletRequest
* @param response HttpServletResponse
*/ */
@IgnoreAuth // 忽略身份验证 @IgnoreAuth
@RequestMapping("/download") // 映射请求路径为"/download" @RequestMapping("/download")
public void download(@RequestParam String fileName, HttpServletRequest request, HttpServletResponse response) { public void download(@RequestParam String fileName, HttpServletRequest request, HttpServletResponse response) {
try { try {
// 定义文件的完整路径 File file = new File(request.getSession().getServletContext().getRealPath("/upload")+"/"+fileName);
File file = new File(request.getSession().getServletContext().getRealPath("/upload") + "/" + fileName);
// 检查文件是否存在
if (file.exists()) { if (file.exists()) {
response.reset(); // 重置响应 response.reset();
// 设置响应头,指示文件下载 response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName+"\"");
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
response.setHeader("Cache-Control", "no-cache"); response.setHeader("Cache-Control", "no-cache");
response.setHeader("Access-Control-Allow-Credentials", "true"); response.setHeader("Access-Control-Allow-Credentials", "true");
response.setContentType("application/octet-stream; charset=UTF-8"); // 设置内容类型 response.setContentType("application/octet-stream; charset=UTF-8");
// 将文件内容写入响应输出流
IOUtils.write(FileUtils.readFileToByteArray(file), response.getOutputStream()); IOUtils.write(FileUtils.readFileToByteArray(file), response.getOutputStream());
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); // 打印异常信息 e.printStackTrace();
} }
} }
} }

@ -2,41 +2,41 @@ package com.controller;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.text.ParseException; // 导入解析异常 import java.text.ParseException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; // 导入Arrays工具类 import java.util.Arrays;
import java.util.Calendar; import java.util.Calendar;
import java.util.Map; // 导入Map接口 import java.util.Map;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; // 导入迭代器接口 import java.util.Iterator;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletRequest; // 导入Servlet请求类 import javax.servlet.http.HttpServletRequest;
import java.io.IOException; import java.io.IOException;
import com.utils.ValidatorUtils; // 导入验证工具类 import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils; // 导入Apache Commons Lang的StringUtils类用于字符串操作 import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; // 导入Spring的依赖注入注解 import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.PathVariable; // 导入路径变量注解 import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody; // 导入请求体注解 import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; // 导入REST控制器注解 import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper; import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth; import com.annotation.IgnoreAuth;
import com.entity.ForumEntity; // 导入论坛实体类 import com.entity.ForumEntity;
import com.entity.view.ForumView; // 导入论坛视图类 import com.entity.view.ForumView;
import com.service.ForumService; // 导入论坛服务类 import com.service.ForumService;
import com.service.TokenService; import com.service.TokenService;
import com.utils.PageUtils; // 导入分页工具类 import com.utils.PageUtils;
import com.utils.R; import com.utils.R;
import com.utils.MD5Util; import com.utils.MD5Util;
import com.utils.MPUtil; // 导入MyBatis-Plus工具类 import com.utils.MPUtil;
import com.utils.CommonUtil; import com.utils.CommonUtil;
/** /**
@ -46,238 +46,217 @@ import com.utils.CommonUtil;
* @email * @email
* @date 2023-02-21 09:46:06 * @date 2023-02-21 09:46:06
*/ */
@RestController // 标记该类为REST控制器 @RestController
@RequestMapping("/forum") @RequestMapping("/forum")
public class ForumController { public class ForumController {
@Autowired @Autowired
private ForumService forumService; // 注入论坛服务 private ForumService forumService;
/** /**
* *
* @param params
* @param forum
* @param request HttpServletRequest
* @return
*/ */
@RequestMapping("/page") // 映射请求路径为"/page" @RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, ForumEntity forum, HttpServletRequest request) { public R page(@RequestParam Map<String, Object> params,ForumEntity forum,
// 如果当前用户不是管理员则设置用户ID HttpServletRequest request){
if (!request.getSession().getAttribute("role").toString().equals("管理员")) { if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
forum.setUserid((Long) request.getSession().getAttribute("userId")); forum.setUserid((Long)request.getSession().getAttribute("userId"));
} }
EntityWrapper<ForumEntity> ew = new EntityWrapper<ForumEntity>(); EntityWrapper<ForumEntity> ew = new EntityWrapper<ForumEntity>();
// 查询论坛列表分页数据
PageUtils page = forumService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, forum), params), params)); PageUtils page = forumService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, forum), params), params));
request.setAttribute("data", page); // 将数据设置到请求属性中 request.setAttribute("data", page);
return R.ok().put("data", page); return R.ok().put("data", page);
} }
/** /**
* *
* @param params
* @param forum
* @param request HttpServletRequest
* @return
*/ */
@RequestMapping("/list") // 映射请求路径为"/list" @RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params, ForumEntity forum, HttpServletRequest request) { public R list(@RequestParam Map<String, Object> params,ForumEntity forum,
// 如果当前用户不是管理员则设置用户ID HttpServletRequest request){
if (!request.getSession().getAttribute("role").toString().equals("管理员")) { if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
forum.setUserid((Long) request.getSession().getAttribute("userId")); forum.setUserid((Long)request.getSession().getAttribute("userId"));
} }
EntityWrapper<ForumEntity> ew = new EntityWrapper<ForumEntity>(); EntityWrapper<ForumEntity> ew = new EntityWrapper<ForumEntity>();
// 查询论坛列表分页数据
PageUtils page = forumService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, forum), params), params)); PageUtils page = forumService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, forum), params), params));
request.setAttribute("data", page); // 将数据设置到请求属性中 request.setAttribute("data", page);
return R.ok().put("data", page); return R.ok().put("data", page);
} }
/** /**
* 访 *
* @param params
* @param forum
* @param request HttpServletRequest
* @return
*/ */
@IgnoreAuth // 忽略身份验证 @IgnoreAuth
@RequestMapping("/flist") // 映射请求路径为"/flist" @RequestMapping("/flist")
public R flist(@RequestParam Map<String, Object> params, ForumEntity forum, HttpServletRequest request) { public R flist(@RequestParam Map<String, Object> params,ForumEntity forum, HttpServletRequest request){
EntityWrapper<ForumEntity> ew = new EntityWrapper<ForumEntity>(); EntityWrapper<ForumEntity> ew = new EntityWrapper<ForumEntity>();
// 查询论坛列表分页数据
PageUtils page = forumService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, forum), params), params)); PageUtils page = forumService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, forum), params), params));
return R.ok().put("data", page); return R.ok().put("data", page);
} }
/** /**
* *
* @param forum
* @return
*/ */
@RequestMapping("/query") // 映射请求路径为"/query" @RequestMapping("/query")
public R query(ForumEntity forum) { public R query(ForumEntity forum){
EntityWrapper<ForumEntity> ew = new EntityWrapper<ForumEntity>(); EntityWrapper< ForumEntity> ew = new EntityWrapper< ForumEntity>();
ew.allEq(MPUtil.allEQMapPre(forum, "forum")); // 构建查询条件 ew.allEq(MPUtil.allEQMapPre( forum, "forum"));
ForumView forumView = forumService.selectView(ew); // 查询论坛视图 ForumView forumView = forumService.selectView(ew);
return R.ok("查询论坛表成功").put("data", forumView); return R.ok("查询论坛表成功").put("data", forumView);
} }
/** /**
* *
* @param id ID
* @return
*/ */
@RequestMapping("/info/{id}") // 映射请求路径为"/info/{id}" @RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id) { public R info(@PathVariable("id") Long id){
ForumEntity forum = forumService.selectById(id); // 根据ID查询论坛 ForumEntity forum = forumService.selectById(id);
return R.ok().put("data", forum); return R.ok().put("data", forum);
} }
/** /**
* *
* @param id ID
* @return
*/ */
@IgnoreAuth // 忽略身份验证 @IgnoreAuth
@RequestMapping("/detail/{id}") // 映射请求路径为"/detail/{id}" @RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id) { public R detail(@PathVariable("id") Long id){
ForumEntity forum = forumService.selectById(id); // 根据ID查询论坛 ForumEntity forum = forumService.selectById(id);
return R.ok().put("data", forum); return R.ok().put("data", forum);
} }
/** /**
* *
* @param id ID
* @return
*/ */
@IgnoreAuth // 忽略身份验证 @IgnoreAuth
@RequestMapping("/list/{id}") // 映射请求路径为"/list/{id}" @RequestMapping("/list/{id}")
public R list(@PathVariable("id") String id) { public R list(@PathVariable("id") String id){
ForumEntity forum = forumService.selectById(id); // 根据ID查询论坛 ForumEntity forum = forumService.selectById(id);
getChilds(forum); // 获取子项 getChilds(forum);
return R.ok().put("data", forum); // 返回论坛信息及子项 return R.ok().put("data", forum);
} }
/**
*
* @param forum
* @return
*/
private ForumEntity getChilds(ForumEntity forum) { private ForumEntity getChilds(ForumEntity forum) {
List<ForumEntity> childs = new ArrayList<ForumEntity>(); List<ForumEntity> childs = new ArrayList<ForumEntity>();
childs = forumService.selectList(new EntityWrapper<ForumEntity>().eq("parentid", forum.getId())); // 根据父ID查询子项 childs = forumService.selectList(new EntityWrapper<ForumEntity>().eq("parentid", forum.getId()));
if (childs == null || childs.size() == 0) { if(childs == null || childs.size()==0) {
return null; // 如果没有子项则返回null return null;
} }
forum.setChilds(childs); // 设置子项 forum.setChilds(childs);
for (ForumEntity forumEntity : childs) { for(ForumEntity forumEntity : childs) {
getChilds(forumEntity); // 递归获取每个子项的子项 getChilds(forumEntity);
} }
return forum; // 返回具有子项的论坛 return forum;
} }
/** /**
* *
* @param forum
* @param request HttpServletRequest
* @return
*/ */
@RequestMapping("/save") // 映射请求路径为"/save" @RequestMapping("/save")
public R save(@RequestBody ForumEntity forum, HttpServletRequest request) { public R save(@RequestBody ForumEntity forum, HttpServletRequest request){
forum.setId(new Date().getTime() + new Double(Math.floor(Math.random() * 1000)).longValue()); // 生成唯一ID forum.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
// ValidatorUtils.validateEntity(forum); // 验证实体(可选择启用) //ValidatorUtils.validateEntity(forum);
forum.setUserid((Long) request.getSession().getAttribute("userId")); // 设置用户ID forum.setUserid((Long)request.getSession().getAttribute("userId"));
forumService.insert(forum); // 保存论坛信息
forumService.insert(forum);
return R.ok(); return R.ok();
} }
/** /**
* *
* @param forum
* @param request HttpServletRequest
* @return
*/ */
@RequestMapping("/add") // 映射请求路径为"/add" @RequestMapping("/add")
public R add(@RequestBody ForumEntity forum, HttpServletRequest request) { public R add(@RequestBody ForumEntity forum, HttpServletRequest request){
forum.setId(new Date().getTime() + new Double(Math.floor(Math.random() * 1000)).longValue()); // 生成唯一ID forum.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
// ValidatorUtils.validateEntity(forum); // 验证实体(可选择启用) //ValidatorUtils.validateEntity(forum);
forum.setUserid((Long) request.getSession().getAttribute("userId")); // 设置用户ID forum.setUserid((Long)request.getSession().getAttribute("userId"));
forumService.insert(forum); // 保存论坛信息
forumService.insert(forum);
return R.ok(); return R.ok();
} }
/** /**
* *
* @param forum
* @param request HttpServletRequest
* @return
*/ */
@RequestMapping("/update") // 映射请求路径为"/update" @RequestMapping("/update")
@Transactional // 开启事务 @Transactional
public R update(@RequestBody ForumEntity forum, HttpServletRequest request) { public R update(@RequestBody ForumEntity forum, HttpServletRequest request){
// ValidatorUtils.validateEntity(forum); // 验证实体(可选择启用) //ValidatorUtils.validateEntity(forum);
forumService.updateById(forum); // 更新论坛信息 forumService.updateById(forum);//全部更新
return R.ok(); return R.ok();
} }
/** /**
* *
* @param ids ID
* @return
*/ */
@RequestMapping("/delete") // 映射请求路径为"/delete" @RequestMapping("/delete")
public R delete(@RequestBody Long[] ids) { public R delete(@RequestBody Long[] ids){
forumService.deleteBatchIds(Arrays.asList(ids)); // 批量删除论坛 forumService.deleteBatchIds(Arrays.asList(ids));
return R.ok(); return R.ok();
} }
/** /**
* *
* @param columnName
* @param type
* @param map
* @param request HttpServletRequest
* @return
*/ */
@RequestMapping("/remind/{columnName}/{type}") // 映射请求路径为"/remind/{columnName}/{type}" @RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type, @RequestParam Map<String, Object> map) { @PathVariable("type") String type,@RequestParam Map<String, Object> map) {
map.put("column", columnName); // 将列名放入请求参数 map.put("column", columnName);
map.put("type", type); // 将类型放入请求参数 map.put("type", type);
// 如果类型为2进行日期提醒处理 if(type.equals("2")) {
if (type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance(); Calendar c = Calendar.getInstance();
Date remindStartDate = null; Date remindStartDate = null;
Date remindEndDate = null; Date remindEndDate = null;
if (map.get("remindstart") != null) { if(map.get("remindstart")!=null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString()); Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date()); c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH, remindStart); // 加上提醒天数 c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime(); remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate)); // 格式化日期并放入请求参数 map.put("remindstart", sdf.format(remindStartDate));
} }
if (map.get("remindend") != null) { if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString()); Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date()); c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH, remindEnd); // 加上提醒天数 c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime(); remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate)); // 格式化日期并放入请求参数 map.put("remindend", sdf.format(remindEndDate));
} }
} }
// 构建查询条件
Wrapper<ForumEntity> wrapper = new EntityWrapper<ForumEntity>(); Wrapper<ForumEntity> wrapper = new EntityWrapper<ForumEntity>();
if (map.get("remindstart") != null) { if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart")); // 大于等于开始日期 wrapper.ge(columnName, map.get("remindstart"));
} }
if (map.get("remindend") != null) { if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend")); // 小于等于结束日期 wrapper.le(columnName, map.get("remindend"));
} }
int count = forumService.selectCount(wrapper); // 查询数量
return R.ok().put("count", count); // 返回数量 int count = forumService.selectCount(wrapper);
return R.ok().put("count", count);
} }
} }

@ -1,6 +1,6 @@
package com.controller; package com.controller;
import java.math.BigDecimal; // 导入BigDecimal以处理高精度数值 import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.text.ParseException; import java.text.ParseException;
import java.util.ArrayList; import java.util.ArrayList;
@ -8,35 +8,35 @@ import java.util.Arrays;
import java.util.Calendar; import java.util.Calendar;
import java.util.Map; import java.util.Map;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; // 导入迭代器接口 import java.util.Iterator;
import java.util.Date; import java.util.Date;
import java.util.List; // 导入List接口 import java.util.List;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.IOException; import java.io.IOException;
import com.utils.ValidatorUtils; import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils; // 导入Apache Commons Lang的字符串处理类 import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; // 导入请求参数注解 import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper; // 导入MyBatis-Plus的EntityWrapper用于构建查询条件 import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper; // 导入MyBatis-Plus的Wrapper接口 import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth; import com.annotation.IgnoreAuth;
import com.entity.LeixingEntity; import com.entity.LeixingEntity;
import com.entity.view.LeixingView; // 导入类型视图类 import com.entity.view.LeixingView;
import com.service.LeixingService; // 导入类型服务类 import com.service.LeixingService;
import com.service.TokenService; import com.service.TokenService;
import com.utils.PageUtils; // 导入分页工具类 import com.utils.PageUtils;
import com.utils.R; // 导入响应工具类 import com.utils.R;
import com.utils.MD5Util; import com.utils.MD5Util;
import com.utils.MPUtil; // 导入MyBatis-Plus工具类 import com.utils.MPUtil;
import com.utils.CommonUtil; import com.utils.CommonUtil;
/** /**
@ -46,201 +46,185 @@ import com.utils.CommonUtil;
* @email * @email
* @date 2023-02-21 09:46:06 * @date 2023-02-21 09:46:06
*/ */
@RestController // 标记该类为REST控制器 @RestController
@RequestMapping("/leixing") // 设置基本请求路径为"/leixing" @RequestMapping("/leixing")
public class LeixingController { public class LeixingController {
@Autowired @Autowired
private LeixingService leixingService; // 自动注入类型服务 private LeixingService leixingService;
/** /**
* *
* @param params
* @param leixing
* @param request HttpServletRequest
* @return
*/ */
@RequestMapping("/page") // 映射请求路径为"/page" @RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, LeixingEntity leixing, public R page(@RequestParam Map<String, Object> params,LeixingEntity leixing,
HttpServletRequest request) { HttpServletRequest request){
EntityWrapper<LeixingEntity> ew = new EntityWrapper<LeixingEntity>(); // 创建查询条件 EntityWrapper<LeixingEntity> ew = new EntityWrapper<LeixingEntity>();
// 查询分页数据
PageUtils page = leixingService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, leixing), params), params)); PageUtils page = leixingService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, leixing), params), params));
request.setAttribute("data", page); // 将数据设置到请求属性中 request.setAttribute("data", page);
return R.ok().put("data", page); return R.ok().put("data", page);
} }
/** /**
* *
* @param params
* @param leixing
* @param request HttpServletRequest
* @return
*/ */
@IgnoreAuth // 忽略身份验证 @IgnoreAuth
@RequestMapping("/list") // 映射请求路径为"/list" @RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params, LeixingEntity leixing, public R list(@RequestParam Map<String, Object> params,LeixingEntity leixing,
HttpServletRequest request) { HttpServletRequest request){
EntityWrapper<LeixingEntity> ew = new EntityWrapper<LeixingEntity>(); // 创建查询条件 EntityWrapper<LeixingEntity> ew = new EntityWrapper<LeixingEntity>();
// 查询分页数据
PageUtils page = leixingService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, leixing), params), params)); PageUtils page = leixingService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, leixing), params), params));
request.setAttribute("data", page); // 将数据设置到请求属性中 request.setAttribute("data", page);
return R.ok().put("data", page); return R.ok().put("data", page);
} }
/** /**
* *
* @param leixing
* @return
*/ */
@RequestMapping("/lists") // 映射请求路径为"/lists" @RequestMapping("/lists")
public R list(LeixingEntity leixing) { public R list( LeixingEntity leixing){
EntityWrapper<LeixingEntity> ew = new EntityWrapper<LeixingEntity>(); // 创建查询条件 EntityWrapper<LeixingEntity> ew = new EntityWrapper<LeixingEntity>();
ew.allEq(MPUtil.allEQMapPre(leixing, "leixing")); // 设置查询条件 ew.allEq(MPUtil.allEQMapPre( leixing, "leixing"));
return R.ok().put("data", leixingService.selectListView(ew)); return R.ok().put("data", leixingService.selectListView(ew));
} }
/** /**
* *
* @param leixing
* @return
*/ */
@RequestMapping("/query") // 映射请求路径为"/query" @RequestMapping("/query")
public R query(LeixingEntity leixing) { public R query(LeixingEntity leixing){
EntityWrapper<LeixingEntity> ew = new EntityWrapper<LeixingEntity>(); // 创建查询条件 EntityWrapper< LeixingEntity> ew = new EntityWrapper< LeixingEntity>();
ew.allEq(MPUtil.allEQMapPre(leixing, "leixing")); // 设置查询条件 ew.allEq(MPUtil.allEQMapPre( leixing, "leixing"));
LeixingView leixingView = leixingService.selectView(ew); // 查询类型视图 LeixingView leixingView = leixingService.selectView(ew);
return R.ok("查询类型成功").put("data", leixingView); return R.ok("查询类型成功").put("data", leixingView);
} }
/** /**
* *
* @param id ID
* @return
*/ */
@RequestMapping("/info/{id}") // 映射请求路径为"/info/{id}" @RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id) { public R info(@PathVariable("id") Long id){
LeixingEntity leixing = leixingService.selectById(id); // 根据ID查询类型 LeixingEntity leixing = leixingService.selectById(id);
return R.ok().put("data", leixing); return R.ok().put("data", leixing);
} }
/** /**
* *
* @param id ID
* @return
*/ */
@IgnoreAuth // 忽略身份验证 @IgnoreAuth
@RequestMapping("/detail/{id}") // 映射请求路径为"/detail/{id}" @RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id) { public R detail(@PathVariable("id") Long id){
LeixingEntity leixing = leixingService.selectById(id); // 根据ID查询类型 LeixingEntity leixing = leixingService.selectById(id);
return R.ok().put("data", leixing); return R.ok().put("data", leixing);
} }
/** /**
* *
* @param leixing
* @param request HttpServletRequest
* @return
*/ */
@RequestMapping("/save") // 映射请求路径为"/save" @RequestMapping("/save")
public R save(@RequestBody LeixingEntity leixing, HttpServletRequest request) { public R save(@RequestBody LeixingEntity leixing, HttpServletRequest request){
leixing.setId(new Date().getTime() + new Double(Math.floor(Math.random() * 1000)).longValue()); // 生成唯一ID leixing.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
// ValidatorUtils.validateEntity(leixing); // 验证实体(可选择启用) //ValidatorUtils.validateEntity(leixing);
leixingService.insert(leixing); // 保存类型信息 leixingService.insert(leixing);
return R.ok(); return R.ok();
} }
/** /**
* *
* @param leixing
* @param request HttpServletRequest
* @return
*/ */
@RequestMapping("/add") // 映射请求路径为"/add" @RequestMapping("/add")
public R add(@RequestBody LeixingEntity leixing, HttpServletRequest request) { public R add(@RequestBody LeixingEntity leixing, HttpServletRequest request){
leixing.setId(new Date().getTime() + new Double(Math.floor(Math.random() * 1000)).longValue()); // 生成唯一ID leixing.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
// ValidatorUtils.validateEntity(leixing); // 验证实体(可选择启用) //ValidatorUtils.validateEntity(leixing);
leixingService.insert(leixing); // 保存类型信息 leixingService.insert(leixing);
return R.ok(); return R.ok();
} }
/** /**
* *
* @param leixing
* @param request HttpServletRequest
* @return
*/ */
@RequestMapping("/update") // 映射请求路径为"/update" @RequestMapping("/update")
@Transactional // 开启事务 @Transactional
public R update(@RequestBody LeixingEntity leixing, HttpServletRequest request) { public R update(@RequestBody LeixingEntity leixing, HttpServletRequest request){
// ValidatorUtils.validateEntity(leixing); // 验证实体(可选择启用) //ValidatorUtils.validateEntity(leixing);
leixingService.updateById(leixing); // 更新类型信息 leixingService.updateById(leixing);//全部更新
return R.ok(); return R.ok();
} }
/** /**
* *
* @param ids ID
* @return
*/ */
@RequestMapping("/delete") // 映射请求路径为"/delete" @RequestMapping("/delete")
public R delete(@RequestBody Long[] ids) { public R delete(@RequestBody Long[] ids){
leixingService.deleteBatchIds(Arrays.asList(ids)); // 批量删除类型 leixingService.deleteBatchIds(Arrays.asList(ids));
return R.ok(); return R.ok();
} }
/** /**
* *
* @param columnName
* @param type
* @param map
* @param request HttpServletRequest
* @return
*/ */
@RequestMapping("/remind/{columnName}/{type}") // 映射请求路径为"/remind/{columnName}/{type}" @RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type, @RequestParam Map<String, Object> map) { @PathVariable("type") String type,@RequestParam Map<String, Object> map) {
map.put("column", columnName); // 将列名放入请求参数 map.put("column", columnName);
map.put("type", type); // 将类型放入请求参数 map.put("type", type);
// 如果类型为2进行日期提醒处理 if(type.equals("2")) {
if (type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance(); Calendar c = Calendar.getInstance();
Date remindStartDate = null; Date remindStartDate = null;
Date remindEndDate = null; Date remindEndDate = null;
// 处理提醒开始时间 if(map.get("remindstart")!=null) {
if (map.get("remindstart") != null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString()); Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date()); c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH, remindStart); // 添加提醒天数 c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime(); // 获取新的开始日期 remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate)); // 格式化并放入请求参数 map.put("remindstart", sdf.format(remindStartDate));
} }
// 处理提醒结束时间 if(map.get("remindend")!=null) {
if (map.get("remindend") != null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString()); Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date()); c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH, remindEnd); // 添加提醒天数 c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime(); // 获取新的结束日期 remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate)); // 格式化并放入请求参数 map.put("remindend", sdf.format(remindEndDate));
} }
} }
// 构建查询条件
Wrapper<LeixingEntity> wrapper = new EntityWrapper<LeixingEntity>(); Wrapper<LeixingEntity> wrapper = new EntityWrapper<LeixingEntity>();
if (map.get("remindstart") != null) { if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart")); // 大于等于开始日期 wrapper.ge(columnName, map.get("remindstart"));
} }
if (map.get("remindend") != null) { if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend")); // 小于等于结束日期 wrapper.le(columnName, map.get("remindend"));
} }
int count = leixingService.selectCount(wrapper); // 查询数量
return R.ok().put("count", count); // 返回数量 int count = leixingService.selectCount(wrapper);
return R.ok().put("count", count);
} }
} }

@ -1,6 +1,5 @@
package com.controller; package com.controller;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.text.ParseException; import java.text.ParseException;
@ -12,7 +11,6 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.IOException; import java.io.IOException;
@ -26,13 +24,13 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper; import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth; import com.annotation.IgnoreAuth;
import com.entity.NewsEntity; import com.entity.NewsEntity;
import com.entity.view.NewsView; import com.entity.view.NewsView;
import com.service.NewsService; import com.service.NewsService;
import com.service.TokenService; import com.service.TokenService;
import com.utils.PageUtils; import com.utils.PageUtils;
@ -52,23 +50,24 @@ import com.utils.CommonUtil;
@RequestMapping("/news") @RequestMapping("/news")
public class NewsController { public class NewsController {
@Autowired @Autowired
private NewsService newsService;//注入新闻服务类 private NewsService newsService;
/** /**
* *
*/ */
@RequestMapping("/page") @RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, NewsEntity news, HttpServletRequest request) { public R page(@RequestParam Map<String, Object> params,NewsEntity news,
// 创建一个EntityWrapper对象用于构建查询条件 HttpServletRequest request){
EntityWrapper<NewsEntity> ew = new EntityWrapper<NewsEntity>(); EntityWrapper<NewsEntity> ew = new EntityWrapper<NewsEntity>();
// 使用MPUtil工具类对查询条件进行排序和分页处理
PageUtils page = newsService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, news), params), params)); PageUtils page = newsService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, news), params), params));
// 将分页结果设置到request对象中
request.setAttribute("data", page); request.setAttribute("data", page);
// 返回成功响应,包含分页结果
return R.ok().put("data", page); return R.ok().put("data", page);
} }
@ -77,17 +76,12 @@ public class NewsController {
*/ */
@IgnoreAuth @IgnoreAuth
@RequestMapping("/list") @RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params, NewsEntity news, HttpServletRequest request) { public R list(@RequestParam Map<String, Object> params,NewsEntity news,
// 创建一个EntityWrapper对象用于构建查询条件 HttpServletRequest request){
EntityWrapper<NewsEntity> ew = new EntityWrapper<NewsEntity>(); EntityWrapper<NewsEntity> ew = new EntityWrapper<NewsEntity>();
// 使用MPUtil工具类对查询条件进行排序和分页处理
PageUtils page = newsService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, news), params), params)); PageUtils page = newsService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, news), params), params));
// 将分页结果设置到request对象中
request.setAttribute("data", page); request.setAttribute("data", page);
// 返回成功响应,包含分页结果
return R.ok().put("data", page); return R.ok().put("data", page);
} }
@ -95,33 +89,19 @@ public class NewsController {
* *
*/ */
@RequestMapping("/lists") @RequestMapping("/lists")
//一个Spring MVC的注解用于将HTTP请求映射到 list 方法。当客户端发送一个HTTP请求到 /lists 路径时Spring MVC会调用 list 方法来处理这个请求 public R list( NewsEntity news){
public R list(NewsEntity news) //NewsEntity news 参数表示要查询的 NewsEntity 对象
{
// 创建一个EntityWrapper对象用于构建查询条件
EntityWrapper<NewsEntity> ew = new EntityWrapper<NewsEntity>(); EntityWrapper<NewsEntity> ew = new EntityWrapper<NewsEntity>();
ew.allEq(MPUtil.allEQMapPre( news, "news"));
// 使用MPUtil工具类对查询条件进行排序和分页处理
ew.allEq(MPUtil.allEQMapPre(news, "news"));
// 返回成功响应,包含查询结果
return R.ok().put("data", newsService.selectListView(ew)); return R.ok().put("data", newsService.selectListView(ew));
//这行代码返回一个表示请求成功的响应对象,并将 newsService.selectListView(ew) 的结果添加到响应对象中,键为 "data"。
//newsService.selectListView(ew) 方法用于查询满足 ew 对象的查询条件的记录,并返回一个包含查询结果的列表。
} }
/** /**
* *
*/ */
@RequestMapping("/query") @RequestMapping("/query")
public R query(NewsEntity news) { public R query(NewsEntity news){
// 创建一个EntityWrapper对象用于构建查询条件 EntityWrapper< NewsEntity> ew = new EntityWrapper< NewsEntity>();
EntityWrapper<NewsEntity> ew = new EntityWrapper<NewsEntity>(); ew.allEq(MPUtil.allEQMapPre( news, "news"));
// 使用MPUtil工具类对查询条件进行排序和分页处理
ew.allEq(MPUtil.allEQMapPre(news, "news"));
// 调用 newsService 对象的 selectView 方法,查询满足 ew 对象的查询条件的记录,并返回一个 NewsView 对象
NewsView newsView = newsService.selectView(ew); NewsView newsView = newsService.selectView(ew);
return R.ok("查询公告信息成功").put("data", newsView); return R.ok("查询公告信息成功").put("data", newsView);
} }
@ -129,40 +109,34 @@ public class NewsController {
/** /**
* *
*/ */
//一个Spring MVC的注解用于将HTTP请求映射到 info 方法。
//当客户端发送一个HTTP请求到 /info/{id} 路径时Spring MVC会调用 info 方法来处理这个请求
@RequestMapping("/info/{id}") @RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id) { public R info(@PathVariable("id") Long id){
// 根据ID查询并返回结果
NewsEntity news = newsService.selectById(id); NewsEntity news = newsService.selectById(id);
//调用 newsService 对象的 selectById 方法,根据 id 参数的值查询数据库中的记录,并返回一个 NewsEntity 对象。 return R.ok().put("data", news);
return R.ok().put("data", news); //将 news 对象添加到响应对象中,键为 "data"
} }
/** /**
* *
*/ */
@IgnoreAuth @IgnoreAuth
@RequestMapping("/detail/{id}") @RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id) { public R detail(@PathVariable("id") Long id){
// 根据ID查询并返回结果
NewsEntity news = newsService.selectById(id); NewsEntity news = newsService.selectById(id);
return R.ok().put("data", news); return R.ok().put("data", news);
} }
/** /**
* *
*/ */
@RequestMapping("/save") @RequestMapping("/save")
public R save(@RequestBody NewsEntity news, HttpServletRequest request) { public R save(@RequestBody NewsEntity news, HttpServletRequest request){
// 设置ID为当前时间戳加上一个随机数 news.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
news.setId(new Date().getTime() + new Double(Math.floor(Math.random() * 1000)).longValue()); //ValidatorUtils.validateEntity(news);
// 验证实体对象,如果需要验证,可以取消注释
// ValidatorUtils.validateEntity(news);
// 插入数据,将 news 对象插入到数据库中
newsService.insert(news); newsService.insert(news);
//返回一个表示请求成功的响应对象
return R.ok(); return R.ok();
} }
@ -170,100 +144,87 @@ public class NewsController {
* *
*/ */
@RequestMapping("/add") @RequestMapping("/add")
public R add(@RequestBody NewsEntity news, HttpServletRequest request) { public R add(@RequestBody NewsEntity news, HttpServletRequest request){
// 设置ID为当前时间戳加上一个随机数 news.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
news.setId(new Date().getTime() + new Double(Math.floor(Math.random() * 1000)).longValue()); //ValidatorUtils.validateEntity(news);
// 验证实体对象,如果需要验证,可以取消注释
// ValidatorUtils.validateEntity(news);
// 插入数据
newsService.insert(news); newsService.insert(news);
return R.ok(); return R.ok();
} }
/** /**
* *
*/ */
@RequestMapping("/update") @RequestMapping("/update")
@Transactional @Transactional
public R update(@RequestBody NewsEntity news, HttpServletRequest request) { public R update(@RequestBody NewsEntity news, HttpServletRequest request){
// 验证实体对象,如果需要验证,可以取消注释 //ValidatorUtils.validateEntity(news);
// ValidatorUtils.validateEntity(news); newsService.updateById(news);//全部更新
// 更新数据
newsService.updateById(news);
return R.ok(); return R.ok();
} }
/** /**
* *
*/ */
@RequestMapping("/delete")//这是一个Spring MVC的注解用于将HTTP请求映射到 delete方法上 @RequestMapping("/delete")
public R delete(@RequestBody Long[] ids) { public R delete(@RequestBody Long[] ids){
// 批量删除数据
newsService.deleteBatchIds(Arrays.asList(ids)); newsService.deleteBatchIds(Arrays.asList(ids));
return R.ok();//R.ok() 方法通常表示请求成功,并返回一个默认的成功响应。 return R.ok();
} }
/** /**
* *
*/ */
@RequestMapping("/remind/{columnName}/{type}") @RequestMapping("/remind/{columnName}/{type}")
//这是一个Spring MVC的注解用于将HTTP请求映射到 remindCount 方法。当客户端发送一个HTTP请求到 /remind/{columnName}/{type} 路径时Spring MVC会调用 remindCount 方法来处理这个请求。
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type, @RequestParam Map<String, Object> map) { @PathVariable("type") String type,@RequestParam Map<String, Object> map) {
// 将列名和类型添加到map中,@PathVariable 注解表示 columnName 和 type 参数的值将从URL路径中获取 map.put("column", columnName);
map.put("column", columnName);//将 columnName 参数的值添加到 map 中,键为 "column"。
map.put("type", type); map.put("type", type);
if (type.equals("2")) //如果 type 参数的值为 "2" if(type.equals("2")) {
{
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//创建一个 SimpleDateFormat 对象sdf用于将日期格式化为 "yyyy-MM-dd" 格式。
Calendar c = Calendar.getInstance(); Calendar c = Calendar.getInstance();
//创建一个 Calendar 对象用于处理日期和时间。Calendar.getInstance() 方法返回一个表示当前日期和时间的 Calendar 对象。 Date remindStartDate = null;
Date remindStartDate = null;//声明一个变量 remindStartDate,初始化为 null,这个变量将用于存储提醒开始日期。
Date remindEndDate = null; Date remindEndDate = null;
if(map.get("remindstart")!=null) {
if (map.get("remindstart") != null)//如果 map 中存在键为 "remindstart" 的元素
{
Integer remindStart = Integer.parseInt(map.get("remindstart").toString()); Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
//将 map 中键为 "remindstart" 的元素的值转换为 Integer 类型,并赋值给 remindStart c.setTime(new Date());
c.setTime(new Date());//setTime(new Date()) 方法将 Calendar 对象c的时间设置为当前时间。 c.add(Calendar.DAY_OF_MONTH,remindStart);
c.add(Calendar.DAY_OF_MONTH, remindStart);//将 Calendar 对象的时间增加 remindStart 天。 remindStartDate = c.getTime();
remindStartDate = c.getTime();//返回一个表示 Calendar 对象当前时间的 Date 对象,并将其赋值给 remindStartDate。 map.put("remindstart", sdf.format(remindStartDate));
map.put("remindstart", sdf.format(remindStartDate));//将 remindStartDate 格式化为 "yyyy-MM-dd" 格式,并将其作为 map 中键为 "remindstart" 的元素的值。
} }
if(map.get("remindend")!=null) {
if (map.get("remindend") != null)
{
Integer remindEnd = Integer.parseInt(map.get("remindend").toString()); Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());//c 的时间设置为当前时间 c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH, remindEnd);//c 的时间增加 remindStart 天 c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime(); remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate)); map.put("remindend", sdf.format(remindEndDate));
} }
} }
// 创建一个EntityWrapper对象用于构建查询条件
Wrapper<NewsEntity> wrapper = new EntityWrapper<NewsEntity>(); Wrapper<NewsEntity> wrapper = new EntityWrapper<NewsEntity>();
//创建一个EntityWrapper对象用于构建查询条件 if(map.get("remindstart")!=null) {
if (map.get("remindstart") != null)//如果map中存在键为"remindstart"的元素
{
wrapper.ge(columnName, map.get("remindstart")); wrapper.ge(columnName, map.get("remindstart"));
//将 wrapper 对象的查询条件设置为 columnName>=map 中键为 "remindend" 的元素的值
} }
if(map.get("remindend")!=null) {
if (map.get("remindend") != null) {
wrapper.le(columnName, map.get("remindend")); wrapper.le(columnName, map.get("remindend"));
//将 wrapper 对象的查询条件设置为 columnName<=map 中键为 "remindend" 的元素的值
} }
// 查询并返回结果
int count = newsService.selectCount(wrapper); int count = newsService.selectCount(wrapper);
//查询满足wrapper对象的查询条件的记录数并赋值给 count 变量 return R.ok().put("count", count);
return R.ok().put("count", count);//返回一个包含 count 变量的 R 对象(请求成功的响应对象)
} }
} }

@ -52,170 +52,186 @@ public class StoreupController {
@Autowired @Autowired
private StoreupService storeupService; private StoreupService storeupService;
/** /**
* *
*/ */
@RequestMapping("/page")//定义了一个处理HTTP请求的映射当请求路径为/page时会调用这个方法 @RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,StoreupEntity storeup,HttpServletRequest request) public R page(@RequestParam Map<String, Object> params,StoreupEntity storeup,
{//定义了一个公共方法接收请求参数、实体对象和HTTP请求对象 HttpServletRequest request){
if(!request.getSession().getAttribute("role").toString().equals("管理员")) if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
{//检查当前用户的角色是否为管理员如果不是管理员则设置用户ID storeup.setUserid((Long)request.getSession().getAttribute("userId"));
storeup.setUserid((Long)request.getSession().getAttribute("userId"));//设置用户ID
}
EntityWrapper<StoreupEntity> ew = new EntityWrapper<StoreupEntity>();//创建一个实体包装器对象,用于构建查询条件
PageUtils page = storeupService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, storeup), params), params));//调用storeupService的queryPage方法根据查询条件和分页参数进行分页查询并返回分页结果
request.setAttribute("data", page);//将分页结果设置到HTTP请求对象中
return R.ok().put("data", page);//返回一个包含分页结果的响应对象
} }
EntityWrapper<StoreupEntity> ew = new EntityWrapper<StoreupEntity>();
PageUtils page = storeupService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, storeup), params), params));
request.setAttribute("data", page);
return R.ok().put("data", page);
}
/** /**
* *
*/ */
@IgnoreAuth//定义了一个注解,用于标记不需要权限认证的接口 @IgnoreAuth
@RequestMapping("/list")//定义了一个处理HTTP请求的映射当请求路径为/list时会调用这个方法 @RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,StoreupEntity storeup,HttpServletRequest request) public R list(@RequestParam Map<String, Object> params,StoreupEntity storeup,
{ HttpServletRequest request){
EntityWrapper<StoreupEntity> ew = new EntityWrapper<StoreupEntity>();//创建一个实体包装器对象,用于构建查询条件 EntityWrapper<StoreupEntity> ew = new EntityWrapper<StoreupEntity>();
PageUtils page = storeupService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, storeup), params), params));//调用storeupService的queryPage方法根据查询条件和分页参数进行分页查询并返回分页结果
request.setAttribute("data", page);//将分页查询结果设置到HTTP请求对象中 PageUtils page = storeupService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, storeup), params), params));
return R.ok().put("data", page);//返回一个包含分页查询结果的响应对象 request.setAttribute("data", page);
return R.ok().put("data", page);
} }
/** /**
* *
*/ */
@RequestMapping("/lists") @RequestMapping("/lists")
public R list( StoreupEntity storeup)//定义了一个公共方法,接收实体对象 public R list( StoreupEntity storeup){
{ EntityWrapper<StoreupEntity> ew = new EntityWrapper<StoreupEntity>();
EntityWrapper<StoreupEntity> ew = new EntityWrapper<StoreupEntity>();//创建一个实体包装器对象,用于构建查询条件 ew.allEq(MPUtil.allEQMapPre( storeup, "storeup"));
ew.allEq(MPUtil.allEQMapPre( storeup, "storeup")); //使用allEq方法设置查询条件MPUtil.allEQMapPre方法将实体对象的属性转换为Map,并添加前缀"storeup",allEq方法将Map中的键值对作为查询条件查询出符合条件的实体对象 return R.ok().put("data", storeupService.selectListView(ew));
return R.ok().put("data", storeupService.selectListView(ew));//根据查询条件查询出符合条件的实体对象列表,并返回一个包含实体对象列表的响应对象
} }
/** /**
* *
*/ */
@RequestMapping("/query")//定义了一个处理HTTP请求的映射当请求路径为/query时会调用这个方法。 @RequestMapping("/query")
public R query(StoreupEntity storeup) public R query(StoreupEntity storeup){
{
EntityWrapper< StoreupEntity> ew = new EntityWrapper< StoreupEntity>(); EntityWrapper< StoreupEntity> ew = new EntityWrapper< StoreupEntity>();
//创建一个实体包装器,用于构建查询条件
ew.allEq(MPUtil.allEQMapPre( storeup, "storeup")); ew.allEq(MPUtil.allEQMapPre( storeup, "storeup"));
//使用allEq方法设置查询条件,MPUtil.allEQMapPre方法将实体对象的属性转换为Map,并添加前缀"storeup",allEq方法将Map中的键值对作为查询条件查询出符合条件的实体对象。
StoreupView storeupView = storeupService.selectView(ew); StoreupView storeupView = storeupService.selectView(ew);
//调用服务层的方法查询单个数据,并返回视图对象
return R.ok("查询收藏表成功").put("data", storeupView); return R.ok("查询收藏表成功").put("data", storeupView);
//返回一个包含查询结果的响应对象,并附带成功消息
} }
/** /**
* *
*/ */
@RequestMapping("/info/{id}")// 定义一个请求映射,当访问 /info/{id} 路径时,会调用这个方法 @RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id)// 定义一个方法,接收一个路径变量 id类型为 Long public R info(@PathVariable("id") Long id){
{ StoreupEntity storeup = storeupService.selectById(id);
StoreupEntity storeup = storeupService.selectById(id);//调用服务层的方法根据ID查询数据并返回实体对象 return R.ok().put("data", storeup);
return R.ok().put("data", storeup);//返回一个包含查询结果的 R 对象,其中包含键 "data" 和对应的 storeup 实体对象
} }
/** /**
* *
*/ */
@IgnoreAuth//定义了一个注解,用于标记不需要权限认证的接口 @IgnoreAuth
@RequestMapping("/detail/{id}")//定义了一个处理HTTP请求的映射当请求路径为/detail/{id}时,会调用这个方法 @RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id)//定义了一个方法,接收一个路径变量 id类型为 Long public R detail(@PathVariable("id") Long id){
{ StoreupEntity storeup = storeupService.selectById(id);
StoreupEntity storeup = storeupService.selectById(id);//调用服务层的方法根据ID查询数据并返回实体对象 return R.ok().put("data", storeup);
return R.ok().put("data", storeup);//返回一个包含查询结果的响应对象,并附带成功消息
} }
/** /**
* *
*/ */
@RequestMapping("/save")//定义了一个处理HTTP请求的映射当请求路径为/save时会调用这个方法 @RequestMapping("/save")
public R save(@RequestBody StoreupEntity storeup, HttpServletRequest request)//定义了一个方法接收一个JSON格式的请求体类型为 StoreupEntity并接收一个 HttpServletRequest 对象 public R save(@RequestBody StoreupEntity storeup, HttpServletRequest request){
{
storeup.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); storeup.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(storeup); //ValidatorUtils.validateEntity(storeup);
storeup.setUserid((Long)request.getSession().getAttribute("userId"));//从请求的 session 中获取用户ID并设置到 storeup 实体对象中 storeup.setUserid((Long)request.getSession().getAttribute("userId"));
storeupService.insert(storeup);//调用服务层的方法将 storeup 实体对象插入数据库
return R.ok();//返回一个包含成功信息的 R 对象 storeupService.insert(storeup);
return R.ok();
} }
/** /**
* *
*/ */
@RequestMapping("/add")//定义了一个处理HTTP请求的映射当请求路径为/add时会调用这个方法 @RequestMapping("/add")
public R add(@RequestBody StoreupEntity storeup, HttpServletRequest request) //定义一个方法,接收一个请求体中的 StoreupEntity 对象和 HttpServletRequest 对象 public R add(@RequestBody StoreupEntity storeup, HttpServletRequest request){
{ storeup.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
storeup.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());//生成一个新的唯一ID由当前时间戳加上一个随机数
//ValidatorUtils.validateEntity(storeup); //ValidatorUtils.validateEntity(storeup);
storeupService.insert(storeup);//调用服务层的方法将 storeup 实体对象插入数据库
storeupService.insert(storeup);
return R.ok(); return R.ok();
} }
/** /**
* *
*/ */
@RequestMapping("/update") @RequestMapping("/update")
@Transactional//定义了一个事务注解,表示该方法中的数据库操作应该在一个事务中执行 @Transactional
public R update(@RequestBody StoreupEntity storeup, HttpServletRequest request)//定义了一个方法,接收一个请求体中的 StoreupEntity 对象和 HttpServletRequest 对象 public R update(@RequestBody StoreupEntity storeup, HttpServletRequest request){
{
//ValidatorUtils.validateEntity(storeup); //ValidatorUtils.validateEntity(storeup);
storeupService.updateById(storeup);//调用服务层的方法根据 ID 更新 storeup 实体对象的所有字段 storeupService.updateById(storeup);//全部更新
return R.ok();//返回一个包含成功信息的 R 对象 return R.ok();
} }
/** /**
* *
*/ */
@RequestMapping("/delete") @RequestMapping("/delete")
public R delete(@RequestBody Long[] ids)// 定义一个方法,接收一个请求体中的 Long 数组,类型为 Long[] public R delete(@RequestBody Long[] ids){
{ storeupService.deleteBatchIds(Arrays.asList(ids));
storeupService.deleteBatchIds(Arrays.asList(ids));//调用服务层的方法,根据传入的 ID 数组批量删除数据 return R.ok();
return R.ok();//返回一个包含成功信息的 R 对象 R.ok()函数是R工具类中的一个静态方法用于创建一个包含成功信息的响应对象
} }
/** /**
* *
*/ */
@RequestMapping("/remind/{columnName}/{type}") // 定义一个请求映射,当访问 /remind/{columnName}/{type} 路径时,会调用这个方法 @RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type,@RequestParam Map<String, Object> map) { // 定义一个方法,接收一个路径变量 columnName 和 type类型为 String以及一个请求参数 map类型为 Map<String, Object> @PathVariable("type") String type,@RequestParam Map<String, Object> map) {
map.put("column", columnName); // 将 columnName 添加到 map 中,键为 "column" map.put("column", columnName);
map.put("type", type); // 将 type 添加到 map 中,键为 "type" map.put("type", type);
if(type.equals("2")) { // 如果 type 等于 "2" if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); // 创建一个日期格式化对象,格式为 "yyyy-MM-dd" SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance(); // 创建一个日历对象,获取当前时间 Calendar c = Calendar.getInstance();
Date remindStartDate = null; // 创建一个日期对象,用于存储提醒开始时间 Date remindStartDate = null;
Date remindEndDate = null; // 创建一个日期对象,用于存储提醒结束时间 Date remindEndDate = null;
if(map.get("remindstart")!=null) { // 如果 map 中存在 "remindstart" 键 if(map.get("remindstart")!=null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString()); // 将 "remindstart" 键对应的值转换为整数 Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date()); // 设置日历对象的时间为当前时间 c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart); // 将日历对象的时间增加 remindStart 天 c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime(); // 获取增加后的时间,并赋值给 remindStartDate remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate)); // 将 remindStartDate 格式化为 "yyyy-MM-dd" 格式,并添加到 map 中,键为 "remindstart" map.put("remindstart", sdf.format(remindStartDate));
} }
if(map.get("remindend")!=null) { // 如果 map 中存在 "remindend" 键 if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString()); // 将 "remindend" 键对应的值转换为整数 Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date()); // 设置日历对象的时间为当前时间 c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd); // 将日历对象的时间增加 remindEnd 天 c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime(); // 获取增加后的时间,并赋值给 remindEndDate remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate)); // 将 remindEndDate 格式化为 "yyyy-MM-dd" 格式,并添加到 map 中,键为 "remindend" map.put("remindend", sdf.format(remindEndDate));
} }
} }
Wrapper<StoreupEntity> wrapper = new EntityWrapper<StoreupEntity>(); // 创建一个实体包装器对象,用于构建查询条件 Wrapper<StoreupEntity> wrapper = new EntityWrapper<StoreupEntity>();
if(map.get("remindstart")!=null) { // 如果 map 中存在 "remindstart" 键 if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart")); // 设置查询条件,查询 columnName 字段大于等于 "remindstart" 键对应的值 wrapper.ge(columnName, map.get("remindstart"));
} }
if(map.get("remindend")!=null) { // 如果 map 中存在 "remindend" 键 if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend")); // 设置查询条件,查询 columnName 字段小于等于 "remindend" 键对应的值 wrapper.le(columnName, map.get("remindend"));
} }
if(!request.getSession().getAttribute("role").toString().equals("管理员")) { // 如果当前用户的角色不是管理员 if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
wrapper.eq("userid", (Long)request.getSession().getAttribute("userId")); // 设置查询条件,查询 userid 字段等于当前用户的 ID wrapper.eq("userid", (Long)request.getSession().getAttribute("userId"));
} }
int count = storeupService.selectCount(wrapper); // 调用服务层的方法,根据查询条件查询符合条件的记录数,并赋值给 count
return R.ok().put("count", count); // 返回一个包含查询结果的响应对象,其中包含键 "count" 和对应的 count 值 int count = storeupService.selectCount(wrapper);
return R.ok().put("count", count);
} }
} }

@ -1,45 +1,43 @@
package com.controller; // 定义一个包,用于组织和管理类 package com.controller;
import java.math.BigDecimal; // 导入BigDecimal类用于高精度的数学计算 import java.math.BigDecimal;
import java.text.SimpleDateFormat; // 导入SimpleDateFormat类用于日期格式化 import java.text.SimpleDateFormat;
import java.text.ParseException; // 导入ParseException类用于处理日期解析异常 import java.text.ParseException;
import java.util.ArrayList; // 导入ArrayList类用于创建动态数组 import java.util.ArrayList;
import java.util.Arrays; // 导入Arrays类提供对数组操作的工具方法 import java.util.Arrays;
import java.util.Calendar; // 导入Calendar类用于日期时间操作 import java.util.Calendar;
import java.util.Map; // 导入Map接口用于键值对集合 import java.util.Map;
import java.util.HashMap; // 导入HashMap类基于哈希表的Map实现 import java.util.HashMap;
import java.util.Iterator; // 导入Iterator接口用于遍历集合 import java.util.Iterator;
import java.util.Date; // 导入Date类用于日期时间表示 import java.util.Date;
import java.util.List; // 导入List接口用于列表集合 import java.util.List;
import javax.servlet.http.HttpServletRequest; // 导入HttpServletRequest接口用于访问HTTP请求信息 import javax.servlet.http.HttpServletRequest;
import java.io.IOException; // 导入IOException类用于处理输入输出异常 import java.io.IOException;
import com.utils.ValidatorUtils; // 导入ValidatorUtils工具类用于实体验证 import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils; // 导入StringUtils类提供字符串操作的工具方法 import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; // 导入Autowired注解用于自动注入依赖 import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; // 导入Transactional注解用于声明事务管理 import org.springframework.transaction.annotation.Transactional;
import org.springframework.format.annotation.DateTimeFormat; // 导入DateTimeFormat注解用于日期时间格式化 import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.PathVariable; // 导入PathVariable注解用于将URL中的参数绑定到控制器方法的参数上 import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody; // 导入RequestBody注解用于将HTTP请求体绑定到控制器方法的参数上 import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; // 导入RequestMapping注解用于映射HTTP请求到控制器方法 import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; // 导入RequestParam注解用于将请求参数绑定到控制器方法的参数上 import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; // 导入RestController注解用于声明一个REST风格的控制器 import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.EntityWrapper; // 导入EntityWrapper类用于构建查询条件 import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.mapper.Wrapper; // 导入Wrapper接口用于封装查询条件 import com.annotation.IgnoreAuth;
import com.annotation.IgnoreAuth; // 导入IgnoreAuth注解用于标记不需要认证的接口 import com.entity.SystemintroEntity;
import com.entity.view.SystemintroView;
import com.entity.SystemintroEntity; // 导入SystemintroEntity实体类代表存储数据
import com.entity.view.SystemintroView; // 导入SystemintroView视图类用于展示存储数据 import com.service.SystemintroService;
import com.service.TokenService;
import com.service.SystemintroService; // 导入SystemintroService接口用于存储业务操作 import com.utils.PageUtils;
import com.service.TokenService; // 导入TokenService接口用于令牌操作未使用 import com.utils.R;
import com.utils.PageUtils; // 导入PageUtils工具类用于分页处理 import com.utils.MD5Util;
import com.utils.R; // 导入R工具类用于构建统一的响应格式 import com.utils.MPUtil;
import com.utils.MD5Util; // 导入MD5Util工具类用于MD5加密未使用 import com.utils.CommonUtil;
import com.utils.MPUtil; // 导入MPUtil工具类提供MyBatis Plus操作的工具方法
import com.utils.CommonUtil; // 导入CommonUtil工具类提供通用的工具方法
/** /**
* *
@ -48,75 +46,83 @@ import com.utils.CommonUtil; // 导入CommonUtil工具类提供通用的工
* @email * @email
* @date 2023-02-21 09:46:06 * @date 2023-02-21 09:46:06
*/ */
@RestController // 声明一个REST风格的控制器 @RestController
@RequestMapping("/systemintro") // 定义一个请求映射,当访问 /systemintro 路径时,会调用这个控制器 @RequestMapping("/systemintro")
public class SystemintroController { public class SystemintroController {
@Autowired // 自动注入依赖 @Autowired
private SystemintroService systemintroService; // 声明一个SystemintroService对象用于存储业务操作 private SystemintroService systemintroService;
/** /**
* *
*/ */
@RequestMapping("/page") // 定义一个请求映射,当访问 /page 路径时,会调用这个方法 @RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,SystemintroEntity systemintro, public R page(@RequestParam Map<String, Object> params,SystemintroEntity systemintro,
HttpServletRequest request){ // 定义一个方法接收请求参数、实体对象和HTTP请求对象 HttpServletRequest request){
EntityWrapper<SystemintroEntity> ew = new EntityWrapper<SystemintroEntity>(); // 创建一个实体包装器对象,用于构建查询条件
PageUtils page = systemintroService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, systemintro), params), params)); // 调用服务层的方法,根据查询条件和分页参数进行分页查询,并返回分页结果 EntityWrapper<SystemintroEntity> ew = new EntityWrapper<SystemintroEntity>();
request.setAttribute("data", page); // 将分页结果设置到HTTP请求对象中
return R.ok().put("data", page); // 返回一个包含分页结果的响应对象 PageUtils page = systemintroService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, systemintro), params), params));
request.setAttribute("data", page);
return R.ok().put("data", page);
} }
/** /**
* *
*/ */
@IgnoreAuth // 定义了一个注解,用于标记不需要权限认证的接口 @IgnoreAuth
@RequestMapping("/list") // 定义一个请求映射,当访问 /list 路径时,会调用这个方法 @RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,SystemintroEntity systemintro, public R list(@RequestParam Map<String, Object> params,SystemintroEntity systemintro,
HttpServletRequest request){ // 定义一个方法接收请求参数、实体对象和HTTP请求对象 HttpServletRequest request){
EntityWrapper<SystemintroEntity> ew = new EntityWrapper<SystemintroEntity>(); // 创建一个实体包装器对象,用于构建查询条件 EntityWrapper<SystemintroEntity> ew = new EntityWrapper<SystemintroEntity>();
PageUtils page = systemintroService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, systemintro), params), params)); // 调用服务层的方法,根据查询条件和分页参数进行分页查询,并返回分页结果
request.setAttribute("data", page); // 将分页结果设置到HTTP请求对象中 PageUtils page = systemintroService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, systemintro), params), params));
return R.ok().put("data", page); // 返回一个包含分页结果的响应对象 request.setAttribute("data", page);
return R.ok().put("data", page);
} }
/** /**
* *
*/ */
@RequestMapping("/lists") // 定义一个请求映射,当访问 /lists 路径时,会调用这个方法 @RequestMapping("/lists")
public R list( SystemintroEntity systemintro){ // 定义一个方法,接收实体对象 public R list( SystemintroEntity systemintro){
EntityWrapper<SystemintroEntity> ew = new EntityWrapper<SystemintroEntity>(); // 创建一个实体包装器对象,用于构建查询条件 EntityWrapper<SystemintroEntity> ew = new EntityWrapper<SystemintroEntity>();
ew.allEq(MPUtil.allEQMapPre( systemintro, "systemintro")); // 使用allEq方法设置查询条件MPUtil.allEQMapPre方法将实体对象的属性转换为Map,并添加前缀"systemintro",allEq方法将Map中的键值对作为查询条件查询出符合条件的实体对象 ew.allEq(MPUtil.allEQMapPre( systemintro, "systemintro"));
return R.ok().put("data", systemintroService.selectListView(ew)); // 根据查询条件查询出符合条件的实体对象列表,并返回一个包含实体对象列表的响应对象 return R.ok().put("data", systemintroService.selectListView(ew));
} }
/** /**
* *
*/ */
@RequestMapping("/query") // 定义一个请求映射,当访问 /query 路径时,会调用这个方法 @RequestMapping("/query")
public R query(SystemintroEntity systemintro){ // 定义一个方法,接收实体对象 public R query(SystemintroEntity systemintro){
EntityWrapper< SystemintroEntity> ew = new EntityWrapper< SystemintroEntity>(); // 创建一个实体包装器对象,用于构建查询条件 EntityWrapper< SystemintroEntity> ew = new EntityWrapper< SystemintroEntity>();
ew.allEq(MPUtil.allEQMapPre( systemintro, "systemintro")); // 使用allEq方法设置查询条件MPUtil.allEQMapPre方法将实体对象的属性转换为Map,并添加前缀"systemintro",allEq方法将Map中的键值对作为查询条件查询出符合条件的实体对象 ew.allEq(MPUtil.allEQMapPre( systemintro, "systemintro"));
SystemintroView systemintroView = systemintroService.selectView(ew); // 调用服务层的方法查询单个数据,并返回视图对象 SystemintroView systemintroView = systemintroService.selectView(ew);
return R.ok("查询关于我们成功").put("data", systemintroView); // 返回一个包含查询结果的响应对象,并附带成功消息 return R.ok("查询关于我们成功").put("data", systemintroView);
} }
/** /**
* *
*/ */
@RequestMapping("/info/{id}") // 定义一个请求映射,当访问 /info/{id} 路径时,会调用这个方法 @RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){ // 定义一个方法,接收一个路径变量 id类型为 Long public R info(@PathVariable("id") Long id){
SystemintroEntity systemintro = systemintroService.selectById(id); // 调用服务层的方法根据ID查询数据并返回实体对象 SystemintroEntity systemintro = systemintroService.selectById(id);
return R.ok().put("data", systemintro); // 返回一个包含查询结果的 R 对象,其中包含键 "data" 和对应的 systemintro 实体对象 return R.ok().put("data", systemintro);
} }
/** /**
* *
*/ */
@IgnoreAuth // 定义了一个注解,用于标记不需要权限认证的接口 @IgnoreAuth
@RequestMapping("/detail/{id}") // 定义一个请求映射,当访问 /detail/{id} 路径时,会调用这个方法 @RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){ // 定义一个方法,接收一个路径变量 id类型为 Long public R detail(@PathVariable("id") Long id){
SystemintroEntity systemintro = systemintroService.selectById(id); // 调用服务层的方法根据ID查询数据并返回实体对象 SystemintroEntity systemintro = systemintroService.selectById(id);
return R.ok().put("data", systemintro); // 返回一个包含查询结果的响应对象,并附带成功消息 return R.ok().put("data", systemintro);
} }
@ -125,38 +131,37 @@ public class SystemintroController {
/** /**
* *
*/ */
@RequestMapping("/save") // 定义一个请求映射,当访问 /save 路径时,会调用这个方法 @RequestMapping("/save")
public R save(@RequestBody SystemintroEntity systemintro, HttpServletRequest request){ // 定义一个方法接收一个JSON格式的请求体类型为 SystemintroEntity并接收一个 HttpServletRequest 对象 public R save(@RequestBody SystemintroEntity systemintro, HttpServletRequest request){
systemintro.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); // 生成一个新的唯一ID由当前时间戳加上一个随机数 systemintro.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(systemintro); // 注释掉的代码,用于验证 systemintro 实体对象是否符合要求 //ValidatorUtils.validateEntity(systemintro);
systemintroService.insert(systemintro); // 调用服务层的方法将 systemintro 实体对象插入数据库
return R.ok(); // 返回一个包含成功信息的 R 对象 systemintroService.insert(systemintro);
return R.ok();
} }
/** /**
* *
*/ */
@RequestMapping("/add") @RequestMapping("/add")
// 定义一个请求映射,当访问 /add 路径时,会调用这个方法 public R add(@RequestBody SystemintroEntity systemintro, HttpServletRequest request){
public R add(@RequestBody SystemintroEntity systemintro, HttpServletRequest request){ // 定义一个方法,接收一个请求体中的 SystemintroEntity 对象和 HttpServletRequest 对象 systemintro.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
systemintro.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); // 生成一个新的唯一ID由当前时间戳加上一个随机数 //ValidatorUtils.validateEntity(systemintro);
//ValidatorUtils.validateEntity(systemintro); // 注释掉的代码,用于验证 systemintro 实体对象是否符合要求
systemintroService.insert(systemintro); // 调用服务层的方法将 systemintro 实体对象插入数据库 systemintroService.insert(systemintro);
return R.ok(); // 返回一个包含成功信息的 R 对象 return R.ok();
} }
/** /**
* *
*/ */
@RequestMapping("/update") // 定义一个请求映射,当访问 /update 路径时,会调用这个方法 @RequestMapping("/update")
@Transactional // 定义了一个事务注解,表示该方法中的数据库操作应该在一个事务中执行 @Transactional
public R update(@RequestBody SystemintroEntity systemintro, HttpServletRequest request){ // 定义一个方法,接收一个请求体中的 SystemintroEntity 对象和 HttpServletRequest 对象 public R update(@RequestBody SystemintroEntity systemintro, HttpServletRequest request){
//ValidatorUtils.validateEntity(systemintro); // 注释掉的代码,用于验证 systemintro 实体对象是否符合要求 //ValidatorUtils.validateEntity(systemintro);
systemintroService.updateById(systemintro); systemintroService.updateById(systemintro);//全部更新
// 调用服务层的方法根据 ID 更新 systemintro 实体对象的所有字段
return R.ok(); return R.ok();
// 返回一个包含成功信息的 R 对象
} }
@ -165,57 +170,61 @@ public class SystemintroController {
* *
*/ */
@RequestMapping("/delete") @RequestMapping("/delete")
// 定义一个请求映射,当访问 /delete 路径时,会调用这个方法 public R delete(@RequestBody Long[] ids){
public R delete(@RequestBody Long[] ids){ // 定义一个方法,接收一个请求体中的 Long 数组,类型为 Long[] systemintroService.deleteBatchIds(Arrays.asList(ids));
systemintroService.deleteBatchIds(Arrays.asList(ids)); // 调用服务层的方法,根据传入的 ID 数组批量删除数据
return R.ok(); return R.ok();
// 返回一个包含成功信息的 R 对象
} }
/** /**
* *
*/ */
@RequestMapping("/remind/{columnName}/{type}") // 定义一个请求映射,当访问 /remind/{columnName}/{type} 路径时,会调用这个方法 @RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type,@RequestParam Map<String, Object> map) { // 定义一个方法,接收一个路径变量 columnName 和 type类型为 String以及一个请求参数 map类型为 Map<String, Object> @PathVariable("type") String type,@RequestParam Map<String, Object> map) {
map.put("column", columnName); // 将 columnName 添加到 map 中,键为 "column" map.put("column", columnName);
map.put("type", type); map.put("type", type);
// 将 type 添加到 map 中,键为 "type"
if(type.equals("2")) { // 如果 type 等于 "2" if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); // 创建一个日期格式化对象,格式为 "yyyy-MM-dd" SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance(); // 创建一个日历对象,获取当前时间 Calendar c = Calendar.getInstance();
Date remindStartDate = null; Date remindStartDate = null;
// 创建一个日期对象,用于存储提醒开始时间 Date remindEndDate = null;
Date remindEndDate = null; // 创建一个日期对象,用于存储提醒结束时间 if(map.get("remindstart")!=null) {
if(map.get("remindstart")!=null) { // 如果 map 中存在 "remindstart" 键 Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
Integer remindStart = Integer.parseInt(map.get("remindstart").toString()); // 将 "remindstart" 键对应的值转换为整数 c.setTime(new Date());
c.setTime(new Date()); // 设置日历对象的时间为当前时间 c.add(Calendar.DAY_OF_MONTH,remindStart);
c.add(Calendar.DAY_OF_MONTH,remindStart); // 将日历对象的时间增加 remindStart 天 remindStartDate = c.getTime();
remindStartDate = c.getTime(); // 获取增加后的时间,并赋值给 remindStartDate map.put("remindstart", sdf.format(remindStartDate));
map.put("remindstart", sdf.format(remindStartDate)); // 将 remindStartDate 格式化为 "yyyy-MM-dd" 格式,并添加到 map 中,键为 "remindstart"
} }
if(map.get("remindend")!=null) { // 如果 map 中存在 "remindend" 键 if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString()); // 将 "remindend" 键对应的值转换为整数 Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date()); // 设置日历对象的时间为当前时间 c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd); // 将日历对象的时间增加 remindEnd 天 c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime(); // 获取增加后的时间,并赋值给 remindEndDate remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate)); // 将 remindEndDate 格式化为 "yyyy-MM-dd" 格式,并添加到 map 中,键为 "remindend" map.put("remindend", sdf.format(remindEndDate));
} }
} }
Wrapper<SystemintroEntity> wrapper = new EntityWrapper<SystemintroEntity>(); // 创建一个实体包装器对象,用于构建查询条件 Wrapper<SystemintroEntity> wrapper = new EntityWrapper<SystemintroEntity>();
if(map.get("remindstart")!=null) { // 如果 map 中存在 "remindstart" 键 if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart")); // 设置查询条件,查询 columnName 字段大于等于 "remindstart" 键对应的值 wrapper.ge(columnName, map.get("remindstart"));
} }
if(map.get("remindend")!=null) { // 如果 map 中存在 "remindend" 键 if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend")); // 设置查询条件,查询 columnName 字段小于等于 "remindend" 键对应的值 wrapper.le(columnName, map.get("remindend"));
} }
int count = systemintroService.selectCount(wrapper); // 调用服务层的方法,根据查询条件查询符合条件的记录数,并赋值给 count int count = systemintroService.selectCount(wrapper);
return R.ok().put("count", count); return R.ok().put("count", count);
// 返回一个包含查询结果的响应对象,其中包含键 "count" 和对应的 count 值
} }
}
}

@ -35,151 +35,140 @@ import com.utils.ValidatorUtils;
/** /**
* *
*/ */
@RequestMapping("users") // 定义请求路径的基础 URL 为 "users" @RequestMapping("users")
@RestController // 标明该类是一个控制器,返回的对象直接作为 JSON 响应 @RestController
public class UsersController { public class UsersController{
@Autowired // 自动注入 UsersService 依赖 @Autowired
private UsersService userService; private UsersService userService;
@Autowired // 自动注入 TokenService 依赖 @Autowired
private TokenService tokenService; private TokenService tokenService;
/** /**
* *
*/ */
@IgnoreAuth // 忽略认证,允许未登录用户访问 @IgnoreAuth
@PostMapping(value = "/login") // 处理 POST 请求,路径为 "users/login" @PostMapping(value = "/login")
public R login(String username, String password, String captcha, HttpServletRequest request) { public R login(String username, String password, String captcha, HttpServletRequest request) {
// 根据用户名查询用户
UsersEntity user = userService.selectOne(new EntityWrapper<UsersEntity>().eq("username", username)); UsersEntity user = userService.selectOne(new EntityWrapper<UsersEntity>().eq("username", username));
// 检查用户是否存在且密码是否匹配 if(user==null || !user.getPassword().equals(password)) {
if(user == null || !user.getPassword().equals(password)) { return R.error("账号或密码不正确");
return R.error("账号或密码不正确"); // 返回错误信息
} }
// 生成用户的 token String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());
String token = tokenService.generateToken(user.getId(), username, "users", user.getRole()); return R.ok().put("token", token);
return R.ok().put("token", token); // 返回成功信息和 token
} }
/** /**
* *
*/ */
@IgnoreAuth @IgnoreAuth
// 忽略认证,允许未登录用户访问 @PostMapping(value = "/register")
@PostMapping(value = "/register") // 处理 POST 请求,路径为 "users/register" public R register(@RequestBody UsersEntity user){
public R register(@RequestBody UsersEntity user) { // ValidatorUtils.validateEntity(user);
// 校验用户是否已存在 if(userService.selectOne(new EntityWrapper<UsersEntity>().eq("username", user.getUsername())) !=null) {
if(userService.selectOne(new EntityWrapper<UsersEntity>().eq("username", user.getUsername())) != null) { return R.error("用户已存在");
return R.error("用户已存在"); // 返回用户已存在的错误信息
} }
userService.insert(user); // 插入新用户 userService.insert(user);
return R.ok(); // 返回成功信息 return R.ok();
} }
/** /**
* 退 * 退
*/ */
@GetMapping(value = "logout") @GetMapping(value = "logout")
// 处理 GET 请求,路径为 "users/logout"
public R logout(HttpServletRequest request) { public R logout(HttpServletRequest request) {
request.getSession().invalidate(); // 使 session 失效,用户登出 request.getSession().invalidate();
return R.ok("退出成功"); // 返回成功信息 return R.ok("退出成功");
} }
/** /**
* *
*/ */
@IgnoreAuth // 忽略认证,允许未登录用户访问 @IgnoreAuth
@RequestMapping(value = "/resetPass") // 处理请求,路径为 "users/resetPass" @RequestMapping(value = "/resetPass")
public R resetPass(String username, HttpServletRequest request){ public R resetPass(String username, HttpServletRequest request){
// 根据用户名查询用户
UsersEntity user = userService.selectOne(new EntityWrapper<UsersEntity>().eq("username", username)); UsersEntity user = userService.selectOne(new EntityWrapper<UsersEntity>().eq("username", username));
if(user == null) { if(user==null) {
return R.error("账号不存在"); // 返回账号不存在的错误信息 return R.error("账号不存在");
} }
user.setPassword("123456"); user.setPassword("123456");
// 将用户密码重置为 "123456" userService.update(user,null);
userService.update(user, null);
// 更新用户信息
return R.ok("密码已重置为123456"); return R.ok("密码已重置为123456");
// 返回成功信息
} }
/** /**
* *
*/ */
@RequestMapping("/page") // 处理请求,路径为 "users/page" @RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, UsersEntity user) { public R page(@RequestParam Map<String, Object> params,UsersEntity user){
EntityWrapper<UsersEntity> ew = new EntityWrapper<UsersEntity>(); // 创建查询条件 EntityWrapper<UsersEntity> ew = new EntityWrapper<UsersEntity>();
// 调用服务层方法查询分页数据
PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params)); PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params));
return R.ok().put("data", page); // 返回查询结果 return R.ok().put("data", page);
} }
/** /**
* *
*/ */
@RequestMapping("/list") // 处理请求,路径为 "users/list" @RequestMapping("/list")
public R list(UsersEntity user) { public R list( UsersEntity user){
EntityWrapper<UsersEntity> ew = new EntityWrapper<UsersEntity>(); // 创建查询条件 EntityWrapper<UsersEntity> ew = new EntityWrapper<UsersEntity>();
ew.allEq(MPUtil.allEQMapPre(user, "user")); // 添加所有相等条件 ew.allEq(MPUtil.allEQMapPre( user, "user"));
return R.ok().put("data", userService.selectListView(ew)); return R.ok().put("data", userService.selectListView(ew));
// 返回查询结果
} }
/** /**
* *
*/ */
@RequestMapping("/info/{id}") // 处理请求,路径为 "users/info/{id}" @RequestMapping("/info/{id}")
public R info(@PathVariable("id") String id) { public R info(@PathVariable("id") String id){
UsersEntity user = userService.selectById(id); // 根据 ID 查找用户 UsersEntity user = userService.selectById(id);
return R.ok().put("data", user); // 返回用户信息 return R.ok().put("data", user);
} }
/** /**
* session * session
*/ */
@RequestMapping("/session") // 处理请求,路径为 "users/session" @RequestMapping("/session")
public R getCurrUser(HttpServletRequest request) { public R getCurrUser(HttpServletRequest request){
Long id = (Long) request.getSession().getAttribute("userId"); // 从 session 中获取用户 ID Long id = (Long)request.getSession().getAttribute("userId");
UsersEntity user = userService.selectById(id); // 根据 ID 查找用户 UsersEntity user = userService.selectById(id);
return R.ok().put("data", user); // 返回用户信息 return R.ok().put("data", user);
} }
/** /**
* *
*/ */
@PostMapping("/save") // 处理 POST 请求,路径为 "users/save" @PostMapping("/save")
public R save(@RequestBody UsersEntity user) { public R save(@RequestBody UsersEntity user){
// 校验用户是否已存在 // ValidatorUtils.validateEntity(user);
if(userService.selectOne(new EntityWrapper<UsersEntity>().eq("username", user.getUsername())) != null) { if(userService.selectOne(new EntityWrapper<UsersEntity>().eq("username", user.getUsername())) !=null) {
return R.error("用户已存在"); // 返回用户已存在的错误信息 return R.error("用户已存在");
} }
userService.insert(user); // 插入新用户 userService.insert(user);
return R.ok(); // 返回成功信息 return R.ok();
} }
/** /**
* *
*/ */
@RequestMapping("/update") // 处理请求,路径为 "users/update" @RequestMapping("/update")
public R update(@RequestBody UsersEntity user) { public R update(@RequestBody UsersEntity user){
// 校验用户是否已存在 // ValidatorUtils.validateEntity(user);
UsersEntity u = userService.selectOne(new EntityWrapper<UsersEntity>().eq("username", user.getUsername())); UsersEntity u = userService.selectOne(new EntityWrapper<UsersEntity>().eq("username", user.getUsername()));
if(u != null && u.getId() != user.getId() && u.getUsername().equals(user.getUsername())) { if(u!=null && u.getId()!=user.getId() && u.getUsername().equals(user.getUsername())) {
return R.error("用户名已存在。"); // 返回用户名已存在的错误信息 return R.error("用户名已存在。");
} }
userService.updateById(user); // 更新用户信息 userService.updateById(user);//全部更新
return R.ok(); // 返回成功信息 return R.ok();
} }
/** /**
* *
*/ */
@RequestMapping("/delete") // 处理请求,路径为 "users/delete" @RequestMapping("/delete")
public R delete(@RequestBody Long[] ids) { public R delete(@RequestBody Long[] ids){
userService.deleteBatchIds(Arrays.asList(ids)); // 批量删除用户 userService.deleteBatchIds(Arrays.asList(ids));
return R.ok(); // 返回成功信息 return R.ok();
} }
} }

@ -52,68 +52,187 @@ import com.entity.StoreupEntity;
@RequestMapping("/wenjuandiaocha") @RequestMapping("/wenjuandiaocha")
public class WenjuandiaochaController { public class WenjuandiaochaController {
@Autowired @Autowired
private WenjuandiaochaService wenjuandiaochaService; // 注入问卷调查服务 private WenjuandiaochaService wenjuandiaochaService;
@Autowired @Autowired
private StoreupService storeupService; // 注入收藏服务 private StoreupService storeupService;
/**
*
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,WenjuandiaochaEntity wenjuandiaocha,
HttpServletRequest request){
EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>();
PageUtils page = wenjuandiaochaService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wenjuandiaocha), params), params));
request.setAttribute("data", page);
return R.ok().put("data", page);
}
/**
*
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,WenjuandiaochaEntity wenjuandiaocha,
HttpServletRequest request){
EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>();
PageUtils page = wenjuandiaochaService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wenjuandiaocha), params), params));
request.setAttribute("data", page);
return R.ok().put("data", page);
}
/**
*
*/
@RequestMapping("/lists")
public R list( WenjuandiaochaEntity wenjuandiaocha){
EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>();
ew.allEq(MPUtil.allEQMapPre( wenjuandiaocha, "wenjuandiaocha"));
return R.ok().put("data", wenjuandiaochaService.selectListView(ew));
}
/**
*
*/
@RequestMapping("/query")
public R query(WenjuandiaochaEntity wenjuandiaocha){
EntityWrapper< WenjuandiaochaEntity> ew = new EntityWrapper< WenjuandiaochaEntity>();
ew.allEq(MPUtil.allEQMapPre( wenjuandiaocha, "wenjuandiaocha"));
WenjuandiaochaView wenjuandiaochaView = wenjuandiaochaService.selectView(ew);
return R.ok("查询问卷调查成功").put("data", wenjuandiaochaView);
}
/**
*
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
WenjuandiaochaEntity wenjuandiaocha = wenjuandiaochaService.selectById(id);
wenjuandiaocha.setClicktime(new Date());
wenjuandiaochaService.updateById(wenjuandiaocha);
return R.ok().put("data", wenjuandiaocha);
}
/**
*
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
WenjuandiaochaEntity wenjuandiaocha = wenjuandiaochaService.selectById(id);
wenjuandiaocha.setClicktime(new Date());
wenjuandiaochaService.updateById(wenjuandiaocha);
return R.ok().put("data", wenjuandiaocha);
}
/**
*
*/
@RequestMapping("/save")
public R save(@RequestBody WenjuandiaochaEntity wenjuandiaocha, HttpServletRequest request){
wenjuandiaocha.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(wenjuandiaocha);
wenjuandiaochaService.insert(wenjuandiaocha);
return R.ok();
}
/**
*
*/
@RequestMapping("/add")
public R add(@RequestBody WenjuandiaochaEntity wenjuandiaocha, HttpServletRequest request){
wenjuandiaocha.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(wenjuandiaocha);
wenjuandiaochaService.insert(wenjuandiaocha);
return R.ok();
}
/**
*
*/
@RequestMapping("/update")
@Transactional
public R update(@RequestBody WenjuandiaochaEntity wenjuandiaocha, HttpServletRequest request){
//ValidatorUtils.validateEntity(wenjuandiaocha);
wenjuandiaochaService.updateById(wenjuandiaocha);//全部更新
return R.ok();
}
/**
*
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
wenjuandiaochaService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/** /**
* *
*/ */
@RequestMapping("/remind/{columnName}/{type}") @RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type, @RequestParam Map<String, Object> map) { @PathVariable("type") String type,@RequestParam Map<String, Object> map) {
// 将列名和类型添加到 map 中
map.put("column", columnName); map.put("column", columnName);
map.put("type", type); map.put("type", type);
// 如果类型为 "2",处理日期范围 if(type.equals("2")) {
if (type.equals("2")) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); // 定义日期格式 Calendar c = Calendar.getInstance();
Calendar c = Calendar.getInstance(); // 获取当前日期时间
Date remindStartDate = null; Date remindStartDate = null;
Date remindEndDate = null; Date remindEndDate = null;
if(map.get("remindstart")!=null) {
// 处理 remindstart 参数 Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
if (map.get("remindstart") != null) { c.setTime(new Date());
Integer remindStart = Integer.parseInt(map.get("remindstart").toString()); // 将 remindstart 转换为整数 c.add(Calendar.DAY_OF_MONTH,remindStart);
c.setTime(new Date()); // 设置当前时间 remindStartDate = c.getTime();
c.add(Calendar.DAY_OF_MONTH, remindStart); // 添加 remindStart 天 map.put("remindstart", sdf.format(remindStartDate));
remindStartDate = c.getTime(); // 获取新的开始日期
map.put("remindstart", sdf.format(remindStartDate)); // 格式化并添加到 map 中
} }
if(map.get("remindend")!=null) {
// 处理 remindend 参数 Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
if (map.get("remindend") != null) { c.setTime(new Date());
Integer remindEnd = Integer.parseInt(map.get("remindend").toString()); // 将 remindend 转换为整数 c.add(Calendar.DAY_OF_MONTH,remindEnd);
c.setTime(new Date()); // 设置当前时间 remindEndDate = c.getTime();
c.add(Calendar.DAY_OF_MONTH, remindEnd); // 添加 remindEnd 天 map.put("remindend", sdf.format(remindEndDate));
remindEndDate = c.getTime(); // 获取新的结束日期
map.put("remindend", sdf.format(remindEndDate)); // 格式化并添加到 map 中
} }
} }
// 创建 EntityWrapper 对象,用于构建查询条件
Wrapper<WenjuandiaochaEntity> wrapper = new EntityWrapper<WenjuandiaochaEntity>(); Wrapper<WenjuandiaochaEntity> wrapper = new EntityWrapper<WenjuandiaochaEntity>();
if (map.get("remindstart") != null) { if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart")); // 大于等于 remindstart wrapper.ge(columnName, map.get("remindstart"));
} }
if (map.get("remindend") != null) { if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend")); // 小于等于 remindend wrapper.le(columnName, map.get("remindend"));
} }
// 查询符合条件的记录数
int count = wenjuandiaochaService.selectCount(wrapper); int count = wenjuandiaochaService.selectCount(wrapper);
return R.ok().put("count", count); // 返回记录数 return R.ok().put("count", count);
} }
/** /**
* *
*/ */
@IgnoreAuth // 忽略认证 @IgnoreAuth
@RequestMapping("/autoSort") @RequestMapping("/autoSort")
public R autoSort(@RequestParam Map<String, Object> params, WenjuandiaochaEntity wenjuandiaocha, HttpServletRequest request, String pre) { public R autoSort(@RequestParam Map<String, Object> params,WenjuandiaochaEntity wenjuandiaocha, HttpServletRequest request,String pre){
// 创建 EntityWrapper 对象,用于构建查询条件
EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>(); EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>();
Map<String, Object> newMap = new HashMap<String, Object>(); Map<String, Object> newMap = new HashMap<String, Object>();
Map<String, Object> param = new HashMap<String, Object>(); Map<String, Object> param = new HashMap<String, Object>();
@ -122,8 +241,6 @@ public class WenjuandiaochaController {
Map.Entry<String, Object> entry = it.next(); Map.Entry<String, Object> entry = it.next();
String key = entry.getKey(); String key = entry.getKey();
String newKey = entry.getKey(); String newKey = entry.getKey();
// 处理 pre 参数
if (pre.endsWith(".")) { if (pre.endsWith(".")) {
newMap.put(pre + newKey, entry.getValue()); newMap.put(pre + newKey, entry.getValue());
} else if (StringUtils.isEmpty(pre)) { } else if (StringUtils.isEmpty(pre)) {
@ -132,160 +249,134 @@ public class WenjuandiaochaController {
newMap.put(pre + "." + newKey, entry.getValue()); newMap.put(pre + "." + newKey, entry.getValue());
} }
} }
// 设置排序条件
params.put("sort", "clicktime"); params.put("sort", "clicktime");
params.put("order", "desc"); params.put("order", "desc");
// 查询分页数据
PageUtils page = wenjuandiaochaService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wenjuandiaocha), params), params)); PageUtils page = wenjuandiaochaService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wenjuandiaocha), params), params));
return R.ok().put("data", page); // 返回分页数据 return R.ok().put("data", page);
} }
/** /**
* *
*/ */
@RequestMapping("/autoSort2") @RequestMapping("/autoSort2")
public R autoSort2(@RequestParam Map<String, Object> params, WenjuandiaochaEntity wenjuandiaocha, HttpServletRequest request) { public R autoSort2(@RequestParam Map<String, Object> params,WenjuandiaochaEntity wenjuandiaocha, HttpServletRequest request){
// 获取用户 ID
String userId = request.getSession().getAttribute("userId").toString(); String userId = request.getSession().getAttribute("userId").toString();
String inteltypeColumn = "leixing"; // 定义智能类型列名 String inteltypeColumn = "leixing";
List<StoreupEntity> storeups = storeupService.selectList(new EntityWrapper<StoreupEntity>().eq("type", 1).eq("userid", userId).eq("tablename", "wenjuandiaocha").orderBy("addtime", false)); List<StoreupEntity> storeups = storeupService.selectList(new EntityWrapper<StoreupEntity>().eq("type", 1).eq("userid", userId).eq("tablename", "wenjuandiaocha").orderBy("addtime", false));
List<String> inteltypes = new ArrayList<String>(); List<String> inteltypes = new ArrayList<String>();
Integer limit = params.get("limit") == null ? 10 : Integer.parseInt(params.get("limit").toString()); // 设置限制数量,默认为 10 Integer limit = params.get("limit")==null?10:Integer.parseInt(params.get("limit").toString());
List<WenjuandiaochaEntity> wenjuandiaochaList = new ArrayList<WenjuandiaochaEntity>(); List<WenjuandiaochaEntity> wenjuandiaochaList = new ArrayList<WenjuandiaochaEntity>();
//去重
// 去重 if(storeups!=null && storeups.size()>0) {
if (storeups != null && storeups.size() > 0) { for(StoreupEntity s : storeups) {
for (StoreupEntity s : storeups) {
wenjuandiaochaList.addAll(wenjuandiaochaService.selectList(new EntityWrapper<WenjuandiaochaEntity>().eq(inteltypeColumn, s.getInteltype()))); wenjuandiaochaList.addAll(wenjuandiaochaService.selectList(new EntityWrapper<WenjuandiaochaEntity>().eq(inteltypeColumn, s.getInteltype())));
} }
} }
// 创建 EntityWrapper 对象,用于构建查询条件
EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>(); EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>();
params.put("sort", "id"); params.put("sort", "id");
params.put("order", "desc"); params.put("order", "desc");
// 查询分页数据
PageUtils page = wenjuandiaochaService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wenjuandiaocha), params), params)); PageUtils page = wenjuandiaochaService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wenjuandiaocha), params), params));
List<WenjuandiaochaEntity> pageList = (List<WenjuandiaochaEntity>) page.getList(); List<WenjuandiaochaEntity> pageList = (List<WenjuandiaochaEntity>)page.getList();
if(wenjuandiaochaList.size()<limit) {
// 如果结果数量小于限制数量,则从分页数据中添加 int toAddNum = (limit-wenjuandiaochaList.size())<=pageList.size()?(limit-wenjuandiaochaList.size()):pageList.size();
if (wenjuandiaochaList.size() < limit) { for(WenjuandiaochaEntity o1 : pageList) {
int toAddNum = (limit - wenjuandiaochaList.size()) <= pageList.size() ? (limit - wenjuandiaochaList.size()) : pageList.size();
for (WenjuandiaochaEntity o1 : pageList) {
boolean addFlag = true; boolean addFlag = true;
for (WenjuandiaochaEntity o2 : wenjuandiaochaList) { for(WenjuandiaochaEntity o2 : wenjuandiaochaList) {
if (o1.getId().intValue() == o2.getId().intValue()) { if(o1.getId().intValue()==o2.getId().intValue()) {
addFlag = false; addFlag = false;
break; break;
} }
} }
if (addFlag) { if(addFlag) {
wenjuandiaochaList.add(o1); wenjuandiaochaList.add(o1);
if (--toAddNum == 0) break; if(--toAddNum==0) break;
} }
} }
} else if (wenjuandiaochaList.size() > limit) { } else if(wenjuandiaochaList.size()>limit) {
wenjuandiaochaList = wenjuandiaochaList.subList(0, limit); // 如果结果数量大于限制数量,则截取前 limit 个 wenjuandiaochaList = wenjuandiaochaList.subList(0, limit);
} }
page.setList(wenjuandiaochaList);
page.setList(wenjuandiaochaList); // 设置新的列表 return R.ok().put("data", page);
return R.ok().put("data", page); // 返回分页数据
} }
/** /**
* *
*/ */
@RequestMapping("/value/{xColumnName}/{yColumnName}") @RequestMapping("/value/{xColumnName}/{yColumnName}")
public R value(@PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName, HttpServletRequest request) { public R value(@PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName,HttpServletRequest request) {
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("xColumn", xColumnName); params.put("xColumn", xColumnName);
params.put("yColumn", yColumnName); params.put("yColumn", yColumnName);
// 创建 EntityWrapper 对象,用于构建查询条件
EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>(); EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>();
// 查询统计结果
List<Map<String, Object>> result = wenjuandiaochaService.selectValue(params, ew); List<Map<String, Object>> result = wenjuandiaochaService.selectValue(params, ew);
// 处理日期格式
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for (Map<String, Object> m : result) { for(Map<String, Object> m : result) {
for (String k : m.keySet()) { for(String k : m.keySet()) {
if (m.get(k) instanceof Date) { if(m.get(k) instanceof Date) {
m.put(k, sdf.format((Date) m.get(k))); m.put(k, sdf.format((Date)m.get(k)));
} }
} }
} }
return R.ok().put("data", result); // 返回统计结果 return R.ok().put("data", result);
} }
/** /**
* *
*/ */
@RequestMapping("/value/{xColumnName}/{yColumnName}/{timeStatType}") @RequestMapping("/value/{xColumnName}/{yColumnName}/{timeStatType}")
public R valueDay(@PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName, @PathVariable("timeStatType") String timeStatType, HttpServletRequest request) { public R valueDay(@PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName, @PathVariable("timeStatType") String timeStatType,HttpServletRequest request) {
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("xColumn", xColumnName); params.put("xColumn", xColumnName);
params.put("yColumn", yColumnName); params.put("yColumn", yColumnName);
params.put("timeStatType", timeStatType); params.put("timeStatType", timeStatType);
// 创建 EntityWrapper 对象,用于构建查询条件
EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>(); EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>();
// 查询时间统计结果
List<Map<String, Object>> result = wenjuandiaochaService.selectTimeStatValue(params, ew); List<Map<String, Object>> result = wenjuandiaochaService.selectTimeStatValue(params, ew);
// 处理日期格式
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for (Map<String, Object> m : result) { for(Map<String, Object> m : result) {
for (String k : m.keySet()) { for(String k : m.keySet()) {
if (m.get(k) instanceof Date) { if(m.get(k) instanceof Date) {
m.put(k, sdf.format((Date) m.get(k))); m.put(k, sdf.format((Date)m.get(k)));
} }
} }
} }
return R.ok().put("data", result); // 返回时间统计结果 return R.ok().put("data", result);
} }
/** /**
* *
*/ */
@RequestMapping("/group/{columnName}") @RequestMapping("/group/{columnName}")
public R group(@PathVariable("columnName") String columnName, HttpServletRequest request) { public R group(@PathVariable("columnName") String columnName,HttpServletRequest request) {
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("column", columnName); params.put("column", columnName);
// 创建 EntityWrapper 对象,用于构建查询条件
EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>(); EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>();
// 查询分组统计结果
List<Map<String, Object>> result = wenjuandiaochaService.selectGroup(params, ew); List<Map<String, Object>> result = wenjuandiaochaService.selectGroup(params, ew);
// 处理日期格式
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for (Map<String, Object> m : result) { for(Map<String, Object> m : result) {
for (String k : m.keySet()) { for(String k : m.keySet()) {
if (m.get(k) instanceof Date) { if(m.get(k) instanceof Date) {
m.put(k, sdf.format((Date) m.get(k))); m.put(k, sdf.format((Date)m.get(k)));
} }
} }
} }
return R.ok().put("data", result); // 返回分组统计结果 return R.ok().put("data", result);
} }
/** /**
* *
*/ */
@RequestMapping("/count") @RequestMapping("/count")
public R count(@RequestParam Map<String, Object> params, WenjuandiaochaEntity wenjuandiaocha, HttpServletRequest request) { public R count(@RequestParam Map<String, Object> params,WenjuandiaochaEntity wenjuandiaocha, HttpServletRequest request){
// 创建 EntityWrapper 对象,用于构建查询条件
EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>(); EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>();
// 查询符合条件的记录数
int count = wenjuandiaochaService.selectCount(MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wenjuandiaocha), params), params)); int count = wenjuandiaochaService.selectCount(MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wenjuandiaocha), params), params));
return R.ok().put("data", count); // 返回记录数 return R.ok().put("data", count);
} }
} }

@ -39,7 +39,6 @@ import com.utils.MD5Util;
import com.utils.MPUtil; import com.utils.MPUtil;
import com.utils.CommonUtil; import com.utils.CommonUtil;
/** /**
* *
* *
@ -47,56 +46,56 @@ import com.utils.CommonUtil;
* @email * @email
* @date 2023-02-21 09:46:06 * @date 2023-02-21 09:46:06
*/ */
@RestController // 标记这是一个REST控制器 @RestController
@RequestMapping("/yonghu") // 设置请求路径的前缀为/yonghu @RequestMapping("/yonghu")
public class YonghuController { public class YonghuController {
@Autowired @Autowired
private YonghuService yonghuService; // 自动注入YonghuService服务 private YonghuService yonghuService;
@Autowired @Autowired
private TokenService tokenService; // 自动注入TokenService服务 private TokenService tokenService;
/** /**
* *
*/ */
@IgnoreAuth // 忽略权限验证 @IgnoreAuth
@RequestMapping(value = "/login") // 设置请求路径为/login @RequestMapping(value = "/login")
public R login(String username, String password, String captcha, HttpServletRequest request) { public R login(String username, String password, String captcha, HttpServletRequest request) {
// 根据用户名查询用户
YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("zhanghao", username)); YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("zhanghao", username));
// 验证用户名和密码
if(u==null || !u.getMima().equals(password)) { if(u==null || !u.getMima().equals(password)) {
return R.error("账号或密码不正确"); return R.error("账号或密码不正确");
} }
// 生成并返回token
String token = tokenService.generateToken(u.getId(), username,"yonghu", "用户" ); String token = tokenService.generateToken(u.getId(), username,"yonghu", "用户" );
return R.ok().put("token", token); return R.ok().put("token", token);
} }
/** /**
* *
*/ */
@IgnoreAuth // 忽略权限验证 @IgnoreAuth
@RequestMapping("/register") // 设置请求路径为/register @RequestMapping("/register")
public R register(@RequestBody YonghuEntity yonghu){ public R register(@RequestBody YonghuEntity yonghu){
// 检查用户是否已存在 //ValidatorUtils.validateEntity(yonghu);
YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("zhanghao", yonghu.getZhanghao())); YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("zhanghao", yonghu.getZhanghao()));
if(u!=null) { if(u!=null) {
return R.error("注册用户已存在"); return R.error("注册用户已存在");
} }
// 生成用户ID并插入用户数据
Long uId = new Date().getTime(); Long uId = new Date().getTime();
yonghu.setId(uId); yonghu.setId(uId);
yonghuService.insert(yonghu); yonghuService.insert(yonghu);
return R.ok(); return R.ok();
} }
/** /**
* 退 * 退
*/ */
@RequestMapping("/logout") // 设置请求路径为/logout @RequestMapping("/logout")
public R logout(HttpServletRequest request) { public R logout(HttpServletRequest request) {
// 使当前会话失效
request.getSession().invalidate(); request.getSession().invalidate();
return R.ok("退出成功"); return R.ok("退出成功");
} }
@ -104,11 +103,9 @@ public class YonghuController {
/** /**
* session * session
*/ */
@RequestMapping("/session") // 设置请求路径为/session @RequestMapping("/session")
public R getCurrUser(HttpServletRequest request){ public R getCurrUser(HttpServletRequest request){
// 从session中获取用户ID
Long id = (Long)request.getSession().getAttribute("userId"); Long id = (Long)request.getSession().getAttribute("userId");
// 根据ID查询用户信息
YonghuEntity u = yonghuService.selectById(id); YonghuEntity u = yonghuService.selectById(id);
return R.ok().put("data", u); return R.ok().put("data", u);
} }
@ -116,28 +113,28 @@ public class YonghuController {
/** /**
* *
*/ */
@IgnoreAuth // 忽略权限验证 @IgnoreAuth
@RequestMapping(value = "/resetPass") // 设置请求路径为/resetPass @RequestMapping(value = "/resetPass")
public R resetPass(String username, HttpServletRequest request){ public R resetPass(String username, HttpServletRequest request){
// 根据用户名查询用户
YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("zhanghao", username)); YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("zhanghao", username));
if(u==null) { if(u==null) {
return R.error("账号不存在"); return R.error("账号不存在");
} }
// 重置密码为123456
u.setMima("123456"); u.setMima("123456");
yonghuService.updateById(u); yonghuService.updateById(u);
return R.ok("密码已重置为123456"); return R.ok("密码已重置为123456");
} }
/** /**
* *
*/ */
@RequestMapping("/page") // 设置请求路径为/page @RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,YonghuEntity yonghu, public R page(@RequestParam Map<String, Object> params,YonghuEntity yonghu,
HttpServletRequest request){ HttpServletRequest request){
EntityWrapper<YonghuEntity> ew = new EntityWrapper<YonghuEntity>(); EntityWrapper<YonghuEntity> ew = new EntityWrapper<YonghuEntity>();
// 分页查询用户列表
PageUtils page = yonghuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yonghu), params), params)); PageUtils page = yonghuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yonghu), params), params));
request.setAttribute("data", page); request.setAttribute("data", page);
return R.ok().put("data", page); return R.ok().put("data", page);
@ -146,12 +143,12 @@ public class YonghuController {
/** /**
* *
*/ */
@IgnoreAuth // 忽略权限验证 @IgnoreAuth
@RequestMapping("/list") // 设置请求路径为/list @RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,YonghuEntity yonghu, public R list(@RequestParam Map<String, Object> params,YonghuEntity yonghu,
HttpServletRequest request){ HttpServletRequest request){
EntityWrapper<YonghuEntity> ew = new EntityWrapper<YonghuEntity>(); EntityWrapper<YonghuEntity> ew = new EntityWrapper<YonghuEntity>();
// 分页查询用户列表
PageUtils page = yonghuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yonghu), params), params)); PageUtils page = yonghuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yonghu), params), params));
request.setAttribute("data", page); request.setAttribute("data", page);
return R.ok().put("data", page); return R.ok().put("data", page);
@ -160,7 +157,7 @@ public class YonghuController {
/** /**
* *
*/ */
@RequestMapping("/lists") // 设置请求路径为/lists @RequestMapping("/lists")
public R list( YonghuEntity yonghu){ public R list( YonghuEntity yonghu){
EntityWrapper<YonghuEntity> ew = new EntityWrapper<YonghuEntity>(); EntityWrapper<YonghuEntity> ew = new EntityWrapper<YonghuEntity>();
ew.allEq(MPUtil.allEQMapPre( yonghu, "yonghu")); ew.allEq(MPUtil.allEQMapPre( yonghu, "yonghu"));
@ -170,7 +167,7 @@ public class YonghuController {
/** /**
* *
*/ */
@RequestMapping("/query") // 设置请求路径为/query @RequestMapping("/query")
public R query(YonghuEntity yonghu){ public R query(YonghuEntity yonghu){
EntityWrapper< YonghuEntity> ew = new EntityWrapper< YonghuEntity>(); EntityWrapper< YonghuEntity> ew = new EntityWrapper< YonghuEntity>();
ew.allEq(MPUtil.allEQMapPre( yonghu, "yonghu")); ew.allEq(MPUtil.allEQMapPre( yonghu, "yonghu"));
@ -181,7 +178,7 @@ public class YonghuController {
/** /**
* *
*/ */
@RequestMapping("/info/{id}") // 设置请求路径为/info/{id} @RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){ public R info(@PathVariable("id") Long id){
YonghuEntity yonghu = yonghuService.selectById(id); YonghuEntity yonghu = yonghuService.selectById(id);
return R.ok().put("data", yonghu); return R.ok().put("data", yonghu);
@ -190,23 +187,28 @@ public class YonghuController {
/** /**
* *
*/ */
@IgnoreAuth // 忽略权限验证 @IgnoreAuth
@RequestMapping("/detail/{id}") // 设置请求路径为/detail/{id} @RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){ public R detail(@PathVariable("id") Long id){
YonghuEntity yonghu = yonghuService.selectById(id); YonghuEntity yonghu = yonghuService.selectById(id);
return R.ok().put("data", yonghu); return R.ok().put("data", yonghu);
} }
/** /**
* *
*/ */
@RequestMapping("/save") // 设置请求路径为/save @RequestMapping("/save")
public R save(@RequestBody YonghuEntity yonghu, HttpServletRequest request){ public R save(@RequestBody YonghuEntity yonghu, HttpServletRequest request){
yonghu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); yonghu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(yonghu);
YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("zhanghao", yonghu.getZhanghao())); YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("zhanghao", yonghu.getZhanghao()));
if(u!=null) { if(u!=null) {
return R.error("用户已存在"); return R.error("用户已存在");
} }
yonghu.setId(new Date().getTime()); yonghu.setId(new Date().getTime());
yonghuService.insert(yonghu); yonghuService.insert(yonghu);
return R.ok(); return R.ok();
@ -215,32 +217,38 @@ public class YonghuController {
/** /**
* *
*/ */
@RequestMapping("/add") // 设置请求路径为/add @RequestMapping("/add")
public R add(@RequestBody YonghuEntity yonghu, HttpServletRequest request){ public R add(@RequestBody YonghuEntity yonghu, HttpServletRequest request){
yonghu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); yonghu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(yonghu);
YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("zhanghao", yonghu.getZhanghao())); YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("zhanghao", yonghu.getZhanghao()));
if(u!=null) { if(u!=null) {
return R.error("用户已存在"); return R.error("用户已存在");
} }
yonghu.setId(new Date().getTime()); yonghu.setId(new Date().getTime());
yonghuService.insert(yonghu); yonghuService.insert(yonghu);
return R.ok(); return R.ok();
} }
/** /**
* *
*/ */
@RequestMapping("/update") // 设置请求路径为/update @RequestMapping("/update")
@Transactional // 开启事务 @Transactional
public R update(@RequestBody YonghuEntity yonghu, HttpServletRequest request){ public R update(@RequestBody YonghuEntity yonghu, HttpServletRequest request){
//ValidatorUtils.validateEntity(yonghu);
yonghuService.updateById(yonghu);//全部更新 yonghuService.updateById(yonghu);//全部更新
return R.ok(); return R.ok();
} }
/** /**
* *
*/ */
@RequestMapping("/delete") // 设置请求路径为/delete @RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){ public R delete(@RequestBody Long[] ids){
yonghuService.deleteBatchIds(Arrays.asList(ids)); yonghuService.deleteBatchIds(Arrays.asList(ids));
return R.ok(); return R.ok();
@ -249,7 +257,7 @@ public class YonghuController {
/** /**
* *
*/ */
@RequestMapping("/remind/{columnName}/{type}") // 设置请求路径为/remind/{columnName}/{type} @RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type,@RequestParam Map<String, Object> map) { @PathVariable("type") String type,@RequestParam Map<String, Object> map) {
map.put("column", columnName); map.put("column", columnName);
@ -284,14 +292,21 @@ public class YonghuController {
wrapper.le(columnName, map.get("remindend")); wrapper.le(columnName, map.get("remindend"));
} }
int count = yonghuService.selectCount(wrapper); int count = yonghuService.selectCount(wrapper);
return R.ok().put("count", count); return R.ok().put("count", count);
} }
/** /**
* *
*/ */
@RequestMapping("/value/{xColumnName}/{yColumnName}") // 设置请求路径为/value/{xColumnName}/{yColumnName} @RequestMapping("/value/{xColumnName}/{yColumnName}")
public R value(@PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName,HttpServletRequest request) { public R value(@PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName,HttpServletRequest request) {
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("xColumn", xColumnName); params.put("xColumn", xColumnName);
@ -312,7 +327,7 @@ public class YonghuController {
/** /**
* *
*/ */
@RequestMapping("/value/{xColumnName}/{yColumnName}/{timeStatType}") // 设置请求路径为/value/{xColumnName}/{yColumnName}/{timeStatType} @RequestMapping("/value/{xColumnName}/{yColumnName}/{timeStatType}")
public R valueDay(@PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName, @PathVariable("timeStatType") String timeStatType,HttpServletRequest request) { public R valueDay(@PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName, @PathVariable("timeStatType") String timeStatType,HttpServletRequest request) {
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("xColumn", xColumnName); params.put("xColumn", xColumnName);
@ -334,7 +349,7 @@ public class YonghuController {
/** /**
* *
*/ */
@RequestMapping("/group/{columnName}") // 设置请求路径为/group/{columnName} @RequestMapping("/group/{columnName}")
public R group(@PathVariable("columnName") String columnName,HttpServletRequest request) { public R group(@PathVariable("columnName") String columnName,HttpServletRequest request) {
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("column", columnName); params.put("column", columnName);
@ -351,13 +366,18 @@ public class YonghuController {
return R.ok().put("data", result); return R.ok().put("data", result);
} }
/** /**
* *
*/ */
@RequestMapping("/count") // 设置请求路径为/count @RequestMapping("/count")
public R count(@RequestParam Map<String, Object> params,YonghuEntity yonghu, HttpServletRequest request){ public R count(@RequestParam Map<String, Object> params,YonghuEntity yonghu, HttpServletRequest request){
EntityWrapper<YonghuEntity> ew = new EntityWrapper<YonghuEntity>(); EntityWrapper<YonghuEntity> ew = new EntityWrapper<YonghuEntity>();
int count = yonghuService.selectCount(MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yonghu), params), params)); int count = yonghuService.selectCount(MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yonghu), params), params));
return R.ok().put("data", count); return R.ok().put("data", count);
} }
} }

@ -1,15 +1,12 @@
package com.dao; package com.dao;
import com.baomidou.mybatisplus.mapper.BaseMapper; // 导入MyBatis-Plus的BaseMapper接口 import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.entity.ConfigEntity; // 导入配置实体类 import com.entity.ConfigEntity;
/** /**
* DAO *
* 访ConfigEntity
*/ */
public interface ConfigDao extends BaseMapper<ConfigEntity> { public interface ConfigDao extends BaseMapper<ConfigEntity> {
// ConfigDao接口继承了BaseMapper接口意味着它自动获得了CRUD方法
// 可以根据需要在此处添加自定义的方法
}
}

@ -1,19 +1,19 @@
package com.dao; package com.dao;
import com.entity.ForumEntity; // 导入论坛实体类 import com.entity.ForumEntity;
import com.baomidou.mybatisplus.mapper.BaseMapper; // 导入MyBatis-Plus的BaseMapper接口 import com.baomidou.mybatisplus.mapper.BaseMapper;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.baomidou.mybatisplus.mapper.Wrapper; import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.pagination.Pagination; import com.baomidou.mybatisplus.plugins.pagination.Pagination;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.entity.vo.ForumVO; // 导入论坛VO类 import com.entity.vo.ForumVO;
import com.entity.view.ForumView; // 导入论坛视图类 import com.entity.view.ForumView;
/** /**
* DAO *
* 访ForumEntity
* *
* @author * @author
* @email * @email
@ -21,39 +21,15 @@ import com.entity.view.ForumView; // 导入论坛视图类
*/ */
public interface ForumDao extends BaseMapper<ForumEntity> { public interface ForumDao extends BaseMapper<ForumEntity> {
/**
* VO
* @param wrapper
* @return VO
*/
List<ForumVO> selectListVO(@Param("ew") Wrapper<ForumEntity> wrapper); List<ForumVO> selectListVO(@Param("ew") Wrapper<ForumEntity> wrapper);
/**
* VO
* @param wrapper
* @return VO
*/
ForumVO selectVO(@Param("ew") Wrapper<ForumEntity> wrapper); ForumVO selectVO(@Param("ew") Wrapper<ForumEntity> wrapper);
/**
*
* @param wrapper
* @return
*/
List<ForumView> selectListView(@Param("ew") Wrapper<ForumEntity> wrapper); List<ForumView> selectListView(@Param("ew") Wrapper<ForumEntity> wrapper);
/** List<ForumView> selectListView(Pagination page,@Param("ew") Wrapper<ForumEntity> wrapper);
*
* @param page
* @param wrapper
* @return
*/
List<ForumView> selectListView(Pagination page, @Param("ew") Wrapper<ForumEntity> wrapper);
/**
*
* @param wrapper
* @return
*/
ForumView selectView(@Param("ew") Wrapper<ForumEntity> wrapper); ForumView selectView(@Param("ew") Wrapper<ForumEntity> wrapper);
} }

@ -8,12 +8,12 @@ import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.pagination.Pagination; import com.baomidou.mybatisplus.plugins.pagination.Pagination;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.entity.vo.LeixingVO; // 导入类型VO类 import com.entity.vo.LeixingVO;
import com.entity.view.LeixingView; import com.entity.view.LeixingView;
/** /**
* DAO *
* LeixingEntity
* *
* @author * @author
* @email * @email
@ -21,39 +21,15 @@ import com.entity.view.LeixingView;
*/ */
public interface LeixingDao extends BaseMapper<LeixingEntity> { public interface LeixingDao extends BaseMapper<LeixingEntity> {
/**
* VO
* @param wrapper
* @return VO
*/
List<LeixingVO> selectListVO(@Param("ew") Wrapper<LeixingEntity> wrapper); List<LeixingVO> selectListVO(@Param("ew") Wrapper<LeixingEntity> wrapper);
/**
* VO
* @param wrapper
* @return VO
*/
LeixingVO selectVO(@Param("ew") Wrapper<LeixingEntity> wrapper); LeixingVO selectVO(@Param("ew") Wrapper<LeixingEntity> wrapper);
/**
*
* @param wrapper
* @return
*/
List<LeixingView> selectListView(@Param("ew") Wrapper<LeixingEntity> wrapper); List<LeixingView> selectListView(@Param("ew") Wrapper<LeixingEntity> wrapper);
/** List<LeixingView> selectListView(Pagination page,@Param("ew") Wrapper<LeixingEntity> wrapper);
*
* @param page
* @param wrapper
* @return
*/
List<LeixingView> selectListView(Pagination page, @Param("ew") Wrapper<LeixingEntity> wrapper);
/**
*
* @param wrapper
* @return
*/
LeixingView selectView(@Param("ew") Wrapper<LeixingEntity> wrapper); LeixingView selectView(@Param("ew") Wrapper<LeixingEntity> wrapper);
} }

@ -11,9 +11,9 @@ import org.apache.ibatis.annotations.Param;
import com.entity.vo.NewsVO; import com.entity.vo.NewsVO;
import com.entity.view.NewsView; import com.entity.view.NewsView;
/** /**
* *
* 访
* *
* @author * @author
* @email * @email
@ -21,19 +21,15 @@ import com.entity.view.NewsView;
*/ */
public interface NewsDao extends BaseMapper<NewsEntity> { public interface NewsDao extends BaseMapper<NewsEntity> {
// 根据查询条件Wrapper选择公告的信息列表并返回一个 NewsVO 对象的列表
List<NewsVO> selectListVO(@Param("ew") Wrapper<NewsEntity> wrapper); List<NewsVO> selectListVO(@Param("ew") Wrapper<NewsEntity> wrapper);
// 根据查询条件Wrapper选择单个公告的信息并返回一个 NewsVO 对象
NewsVO selectVO(@Param("ew") Wrapper<NewsEntity> wrapper); NewsVO selectVO(@Param("ew") Wrapper<NewsEntity> wrapper);
// 根据查询条件Wrapper选择公告的信息视图列表并返回一个 NewsView 对象的列表
List<NewsView> selectListView(@Param("ew") Wrapper<NewsEntity> wrapper); List<NewsView> selectListView(@Param("ew") Wrapper<NewsEntity> wrapper);
// 根据查询条件Wrapper与分页信息选择公告的信息视图列表并返回一个 NewsView 对象的列表 List<NewsView> selectListView(Pagination page,@Param("ew") Wrapper<NewsEntity> wrapper);
List<NewsView> selectListView(Pagination page, @Param("ew") Wrapper<NewsEntity> wrapper);
// 根据查询条件Wrapper选择单个公告的信息视图并返回一个 NewsView 对象
NewsView selectView(@Param("ew") Wrapper<NewsEntity> wrapper); NewsView selectView(@Param("ew") Wrapper<NewsEntity> wrapper);
} }

@ -1,40 +1,35 @@
package com.dao; // 声明该接口所在的包为com.dao package com.dao;
import com.entity.StoreupEntity; // 导入StoreupEntity类代表收藏表的实体类 import com.entity.StoreupEntity;
import com.baomidou.mybatisplus.mapper.BaseMapper; // 导入MyBatis-Plus框架的BaseMapper接口提供基础的CRUD操作 import com.baomidou.mybatisplus.mapper.BaseMapper;
import java.util.List; // 导入List接口用于返回列表结果 import java.util.List;
import java.util.Map; // 导入Map接口虽然在此代码中未使用 import java.util.Map;
import com.baomidou.mybatisplus.mapper.Wrapper; // 导入Wrapper接口用于构造查询条件 import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.pagination.Pagination; // 导入Pagination类用于支持分页查询 import com.baomidou.mybatisplus.plugins.pagination.Pagination;
import org.apache.ibatis.annotations.Param;
import com.entity.vo.StoreupVO;
import com.entity.view.StoreupView;
import org.apache.ibatis.annotations.Param; // 导入Param注解用于在Mapper方法中定义参数
import com.entity.vo.StoreupVO; // 导入StoreupVO类代表用于展示的视图对象
import com.entity.view.StoreupView; // 导入StoreupView类代表用于视图展示的另一个对象
/** /**
* *
* *
* @author // 作者信息(未填写) * @author
* @email // 邮箱信息(未填写) * @email
* @date 2023-02-21 09:46:06 // 该接口的创建日期 * @date 2023-02-21 09:46:06
*/ */
public interface StoreupDao extends BaseMapper<StoreupEntity> { // 定义StoreupDao接口继承BaseMapper以获得基本的数据库操作 public interface StoreupDao extends BaseMapper<StoreupEntity> {
// 根据条件查询返回StoreupVO类型的列表
List<StoreupVO> selectListVO(@Param("ew") Wrapper<StoreupEntity> wrapper); List<StoreupVO> selectListVO(@Param("ew") Wrapper<StoreupEntity> wrapper);
// 根据条件查询返回单个StoreupVO对象
StoreupVO selectVO(@Param("ew") Wrapper<StoreupEntity> wrapper); StoreupVO selectVO(@Param("ew") Wrapper<StoreupEntity> wrapper);
// 根据条件查询返回StoreupView类型的列表
List<StoreupView> selectListView(@Param("ew") Wrapper<StoreupEntity> wrapper); List<StoreupView> selectListView(@Param("ew") Wrapper<StoreupEntity> wrapper);
// 根据条件及分页信息查询返回StoreupView类型的列表 List<StoreupView> selectListView(Pagination page,@Param("ew") Wrapper<StoreupEntity> wrapper);
List<StoreupView> selectListView(Pagination page, @Param("ew") Wrapper<StoreupEntity> wrapper);
// 根据条件查询返回单个StoreupView对象
StoreupView selectView(@Param("ew") Wrapper<StoreupEntity> wrapper); StoreupView selectView(@Param("ew") Wrapper<StoreupEntity> wrapper);
} }

@ -11,9 +11,9 @@ import org.apache.ibatis.annotations.Param;
import com.entity.vo.SystemintroVO; import com.entity.vo.SystemintroVO;
import com.entity.view.SystemintroView; import com.entity.view.SystemintroView;
/** /**
* *
* "关于我们"访
* *
* @author * @author
* @email * @email
@ -21,19 +21,14 @@ import com.entity.view.SystemintroView;
*/ */
public interface SystemintroDao extends BaseMapper<SystemintroEntity> { public interface SystemintroDao extends BaseMapper<SystemintroEntity> {
// 根据查询条件Wrapper选择系统介绍的信息列表并返回一个 SystemintroVO 对象的列表
List<SystemintroVO> selectListVO(@Param("ew") Wrapper<SystemintroEntity> wrapper); List<SystemintroVO> selectListVO(@Param("ew") Wrapper<SystemintroEntity> wrapper);
// 根据查询条件Wrapper选择单个系统介绍的信息并返回一个 SystemintroVO 对象
SystemintroVO selectVO(@Param("ew") Wrapper<SystemintroEntity> wrapper); SystemintroVO selectVO(@Param("ew") Wrapper<SystemintroEntity> wrapper);
// 根据查询条件Wrapper选择系统介绍信息视图的列表并返回一个 SystemintroView 对象的列表
List<SystemintroView> selectListView(@Param("ew") Wrapper<SystemintroEntity> wrapper); List<SystemintroView> selectListView(@Param("ew") Wrapper<SystemintroEntity> wrapper);
// 根据查询条件Wrapper和分页信息选择系统介绍信息视图的列表并返回一个 SystemintroView 对象的列表 List<SystemintroView> selectListView(Pagination page,@Param("ew") Wrapper<SystemintroEntity> wrapper);
List<SystemintroView> selectListView(Pagination page, @Param("ew") Wrapper<SystemintroEntity> wrapper);
// 根据查询条件Wrapper选择单个平台介绍的信息视图并返回一个 SystemintroView 对象
SystemintroView selectView(@Param("ew") Wrapper<SystemintroEntity> wrapper); SystemintroView selectView(@Param("ew") Wrapper<SystemintroEntity> wrapper);

@ -9,19 +9,14 @@ import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.mapper.Wrapper; import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.pagination.Pagination; import com.baomidou.mybatisplus.plugins.pagination.Pagination;
import com.entity.UsersEntity; import com.entity.UsersEntity;
/** /**
* *
* 访
*/ */
public interface UsersDao extends BaseMapper<UsersEntity> { public interface UsersDao extends BaseMapper<UsersEntity> {
// 根据查询条件Wrapper选择用户列表并返回一个 UsersEntity 对象的列表
List<UsersEntity> selectListView(@Param("ew") Wrapper<UsersEntity> wrapper); List<UsersEntity> selectListView(@Param("ew") Wrapper<UsersEntity> wrapper);
// 根据查询条件Wrapper和分页信息选择用户列表并返回一个 UsersEntity 对象的列表 List<UsersEntity> selectListView(Pagination page,@Param("ew") Wrapper<UsersEntity> wrapper);
List<UsersEntity> selectListView(Pagination page, @Param("ew") Wrapper<UsersEntity> wrapper);
} }

@ -13,73 +13,31 @@ import com.entity.view.WenjuandiaochaView;
/** /**
* 访 *
* BaseMapperCRUD *
* @author * @author
* @email * @email
* @date 2023-02-21 09:46:06 * @date 2023-02-21 09:46:06
*/ */
public interface WenjuandiaochaDao extends BaseMapper<WenjuandiaochaEntity> { public interface WenjuandiaochaDao extends BaseMapper<WenjuandiaochaEntity> {
/** List<WenjuandiaochaVO> selectListVO(@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper);
* WenjuandiaochaVO
* @param ew
* @return VO
*/
List<WenjuandiaochaVO> selectListVO(@Param("ew") Wrapper<WenjuandiaochaEntity> ew);
/** WenjuandiaochaVO selectVO(@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper);
* WenjuandiaochaVO
* @param ew
* @return VO
*/
WenjuandiaochaVO selectVO(@Param("ew") Wrapper<WenjuandiaochaEntity> ew);
/** List<WenjuandiaochaView> selectListView(@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper);
* WenjuandiaochaView
* @param ew
* @return View
*/
List<WenjuandiaochaView> selectListView(@Param("ew") Wrapper<WenjuandiaochaEntity> ew);
/** List<WenjuandiaochaView> selectListView(Pagination page,@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper);
* WenjuandiaochaView
* @param page
* @param ew
* @return View
*/
List<WenjuandiaochaView> selectListView(Pagination page, @Param("ew") Wrapper<WenjuandiaochaEntity> ew);
/** WenjuandiaochaView selectView(@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper);
* WenjuandiaochaView
* @param ew
* @return View
*/
WenjuandiaochaView selectView(@Param("ew") Wrapper<WenjuandiaochaEntity> ew);
/**
* Map
* @param params
* @param ew
* @return Map
*/
List<Map<String, Object>> selectValue(@Param("params") Map<String, Object> params, @Param("ew") Wrapper<WenjuandiaochaEntity> ew);
/** List<Map<String, Object>> selectValue(@Param("params") Map<String, Object> params,@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper);
* Map
* @param params
* @param ew
* @return Map
*/
List<Map<String, Object>> selectTimeStatValue(@Param("params") Map<String, Object> params, @Param("ew") Wrapper<WenjuandiaochaEntity> ew);
/** List<Map<String, Object>> selectTimeStatValue(@Param("params") Map<String, Object> params,@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper);
* Map
* @param params
* @param ew
* @return Map
*/
List<Map<String, Object>> selectGroup(@Param("params") Map<String, Object> params, @Param("ew") Wrapper<WenjuandiaochaEntity> ew);
} List<Map<String, Object>> selectGroup(@Param("params") Map<String, Object> params,@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper);
}

@ -9,25 +9,25 @@ import com.baomidou.mybatisplus.enums.IdType;
/** /**
* : * :
*/ */
@TableName("config")// 指定该类对应的数据库表名为"config" @TableName("config")
public class ConfigEntity implements Serializable{ public class ConfigEntity implements Serializable{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@TableId(type = IdType.AUTO) // 主键ID使用自增长方式 @TableId(type = IdType.AUTO)
private Long id; private Long id;
/** /**
* * key
*/ */
private String name; private String name;
/** /**
* * value
*/ */
private String value; private String value;
public Long getId() { public Long getId() {
return id; // 返回配置ID return id;
} }
public void setId(Long id) { public void setId(Long id) {
@ -39,7 +39,7 @@ private static final long serialVersionUID = 1L;
} }
public void setName(String name) { public void setName(String name) {
this.name = name;//设置配置名称 this.name = name;
} }
public String getValue() { public String getValue() {
@ -47,7 +47,7 @@ private static final long serialVersionUID = 1L;
} }
public void setValue(String value) { public void setValue(String value) {
this.value = value;// 设置配置值 this.value = value;
} }
} }

@ -16,8 +16,6 @@ import java.util.List;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
import org.apache.poi.ss.formula.functions.T;
import com.baomidou.mybatisplus.annotations.TableField; import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.enums.FieldFill; import com.baomidou.mybatisplus.enums.FieldFill;
import com.baomidou.mybatisplus.enums.IdType; import com.baomidou.mybatisplus.enums.IdType;
@ -39,15 +37,14 @@ public class ForumEntity<T> implements Serializable {
} }
// 接收ForumEntity对象的构造函数
public ForumEntity(T t) { public ForumEntity(T t) {
try { try {
// 复制属性,将传入对象的属性复制到当前对象
BeanUtils.copyProperties(this, t); BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) { } catch (IllegalAccessException | InvocationTargetException e) {
// 异常处理,打印堆栈信息 // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
}
/** /**
* id * id
@ -102,10 +99,10 @@ public class ForumEntity<T> implements Serializable {
private Date addtime; private Date addtime;
public Date getAddtime() { public Date getAddtime() {
return addtime;// 返回添加时间 return addtime;
} }
public void setAddtime(Date addtime) { public void setAddtime(Date addtime) {
this.addtime = addtime;// 设置添加时间 this.addtime = addtime;
} }
public Long getId() { public Long getId() {
@ -113,12 +110,9 @@ public class ForumEntity<T> implements Serializable {
} }
public void setId(Long id) { public void setId(Long id) {
this.id = id;// 设置帖子ID this.id = id;
} }
/** @TableField(exist = false)
*
*/
@TableField(exist = false) // 该字段不在数据库表中存在
private List<ForumEntity> childs; private List<ForumEntity> childs;
public List<ForumEntity> getChilds() { public List<ForumEntity> getChilds() {
@ -126,7 +120,7 @@ public class ForumEntity<T> implements Serializable {
} }
public void setChilds(List<ForumEntity> childs) { public void setChilds(List<ForumEntity> childs) {
this.childs = childs;// 设置子帖子 this.childs = childs;
} }
/** /**
* *

@ -16,8 +16,6 @@ import java.util.List;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
import org.apache.poi.ss.formula.functions.T;
import com.baomidou.mybatisplus.annotations.TableField; import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.enums.FieldFill; import com.baomidou.mybatisplus.enums.FieldFill;
import com.baomidou.mybatisplus.enums.IdType; import com.baomidou.mybatisplus.enums.IdType;
@ -39,13 +37,11 @@ public class LeixingEntity<T> implements Serializable {
} }
// 接收LeixingEntity对象的构造函数
public LeixingEntity(T t) { public LeixingEntity(T t) {
try { try {
// 复制属性,将传入对象的属性复制到当前对象
BeanUtils.copyProperties(this, t); BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) { } catch (IllegalAccessException | InvocationTargetException e) {
// 异常处理,打印堆栈信息 // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -62,15 +58,15 @@ public class LeixingEntity<T> implements Serializable {
private String leixing; private String leixing;
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")// 指定JSON格式化 @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat// 用于Spring格式化 @DateTimeFormat
private Date addtime;// 存放添加时间 private Date addtime;
public Date getAddtime() { public Date getAddtime() {
return addtime; return addtime;
} }
public void setAddtime(Date addtime) { public void setAddtime(Date addtime) {
this.addtime = addtime;// 设置添加时间 this.addtime = addtime;
} }
public Long getId() { public Long getId() {
@ -78,7 +74,7 @@ public class LeixingEntity<T> implements Serializable {
} }
public void setId(Long id) { public void setId(Long id) {
this.id = id;// 设置类型ID this.id = id;
} }
/** /**
* *

@ -5,11 +5,14 @@ import com.baomidou.mybatisplus.annotations.TableName;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
@ -29,13 +32,16 @@ import com.baomidou.mybatisplus.enums.IdType;
public class StoreupEntity<T> implements Serializable { public class StoreupEntity<T> implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public StoreupEntity() { public StoreupEntity() {
} }
public StoreupEntity(T t) { public StoreupEntity(T t) {
try { try {
BeanUtils.copyProperties(this, t); BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) { } catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -48,43 +54,52 @@ public class StoreupEntity<T> implements Serializable {
/** /**
* id * id
*/ */
private Long userid; private Long userid;
/** /**
* id * id
*/ */
private Long refid; private Long refid;
/** /**
* *
*/ */
private String tablename; private String tablename;
/** /**
* *
*/ */
private String name; private String name;
/** /**
* *
*/ */
private String picture; private String picture;
/** /**
* (1:,21:,22:,31:,41:) * (1:,21:,22:,31:,41:)
*/ */
private String type; private String type;
/** /**
* *
*/ */
private String inteltype; private String inteltype;
/** /**
* *
*/ */
private String remark; private String remark;
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat @DateTimeFormat
private Date addtime; private Date addtime;
@ -199,4 +214,5 @@ public class StoreupEntity<T> implements Serializable {
public String getRemark() { public String getRemark() {
return remark; return remark;
} }
} }

@ -7,72 +7,71 @@ import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName; import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType; import com.baomidou.mybatisplus.enums.IdType;
/** /**
* *
*/ */
@TableName("users") // 指定实体类对应的数据库表为users @TableName("users")
public class UsersEntity implements Serializable { // 定义UsersEntity类实现Serializable接口 public class UsersEntity implements Serializable {
private static final long serialVersionUID = 1L; // 定义序列化ID private static final long serialVersionUID = 1L;
@TableId(type = IdType.AUTO) // 标识为主键,并设置主键自增 @TableId(type = IdType.AUTO)
private Long id; // 主键id private Long id;
/** /**
* *
*/ */
private String username; // 用户名 private String username;
/** /**
* *
*/ */
private String password; // 用户密码 private String password;
/** /**
* *
*/ */
private String role; // 用户角色 private String role;
private Date addtime; // 添加时间 private Date addtime;
public String getUsername() { // 获取用户名 public String getUsername() {
return username; // 返回username return username;
} }
public void setUsername(String username) { // 设置用户名 public void setUsername(String username) {
this.username = username; // 赋值username this.username = username;
} }
public String getPassword() { // 获取密码 public String getPassword() {
return password; // 返回password return password;
} }
public void setPassword(String password) { // 设置密码 public void setPassword(String password) {
this.password = password; // 赋值password this.password = password;
} }
public String getRole() { // 获取用户角色 public String getRole() {
return role; // 返回role return role;
} }
public void setRole(String role) { // 设置用户角色 public void setRole(String role) {
this.role = role; // 赋值role this.role = role;
} }
public Date getAddtime() { // 获取添加时间 public Date getAddtime() {
return addtime; // 返回addtime return addtime;
} }
public void setAddtime(Date addtime) { // 设置添加时间 public void setAddtime(Date addtime) {
this.addtime = addtime; // 赋值addtime this.addtime = addtime;
} }
public Long getId() { // 获取主键id public Long getId() {
return id; // 返回id return id;
} }
public void setId(Long id) { // 设置主键id public void setId(Long id) {
this.id = id; // 赋值id this.id = id;
} }
} }

@ -3,6 +3,7 @@ package com.entity;
import com.baomidou.mybatisplus.annotations.TableId; import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName; import com.baomidou.mybatisplus.annotations.TableName;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@ -10,39 +11,37 @@ import java.lang.reflect.InvocationTargetException;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.baomidou.mybatisplus.enums.IdType;
/** /**
* *
* *
* @author * @author
* @email * @email
* @date 2023-02-21 09:46:06 * @date 2023-02-21 09:46:06
*/ */
@TableName("wenjuandiaocha") // 指定该实体类对应的数据库表名为“wenjuandiaocha” @TableName("wenjuandiaocha")
@JsonIgnoreProperties(ignoreUnknown = true) // 忽略未知属性,防止反序列化时出现错误 public class WenjuandiaochaEntity<T> implements Serializable {
public class WenjuandiaochaEntity<T> implements Serializable { // 实现Serializable接口以支持序列化 private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L; // 序列化版本号
/**
*
*/
public WenjuandiaochaEntity() { public WenjuandiaochaEntity() {
} }
/**
* t
* @param t
*/
public WenjuandiaochaEntity(T t) { public WenjuandiaochaEntity(T t) {
try { try {
BeanUtils.copyProperties(this, t); // 使用BeanUtils工具类复制属性 BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) { } catch (IllegalAccessException | InvocationTargetException e) {
// 打印堆栈跟踪信息以便调试 // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -50,274 +49,210 @@ public class WenjuandiaochaEntity<T> implements Serializable { // 实现Serializ
/** /**
* id * id
*/ */
@TableId // 指定该字段为主键 @TableId
private Long id; private Long id;
/** /**
* *
* 使NotBlank
*/ */
@NotBlank(message = "问卷标题不能为空")
private String wenjuanbiaoti; private String wenjuanbiaoti;
/** /**
* *
* 使NotBlank
*/ */
@NotBlank(message = "封面图片路径不能为空")
private String fengmiantupian; private String fengmiantupian;
/** /**
* *
* 使NotBlank
*/ */
@NotBlank(message = "类型不能为空")
private String leixing; private String leixing;
/** /**
* *
* 使NotBlank
*/ */
@NotBlank(message = "问题一不能为空")
private String wentiyi; private String wentiyi;
/** /**
* *
* 使NotBlank
*/ */
@NotBlank(message = "问题二不能为空")
private String wentier; private String wentier;
/** /**
* *
* 使NotBlank
*/ */
@NotBlank(message = "问题三不能为空")
private String wentisan; private String wentisan;
/** /**
* *
* 使NotBlank
*/ */
@NotBlank(message = "问题四不能为空")
private String wentisi; private String wentisi;
/** /**
* *
* 使NotBlank
*/ */
@NotBlank(message = "问题五不能为空")
private String wentiwu; private String wentiwu;
/** /**
* *
* 使JsonFormatyyyy-MM-dd HH:mm:ss
* 使DateTimeFormatyyyy-MM-dd HH:mm:ss
* 使NotNullnull
*/ */
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd")
@NotNull(message = "发布日期不能为空") @DateTimeFormat
private Date faburiqi; private Date faburiqi;
/** /**
* *
* 使JsonFormatyyyy-MM-dd HH:mm:ss
* 使DateTimeFormatyyyy-MM-dd HH:mm:ss
*/ */
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @DateTimeFormat
private Date clicktime; private Date clicktime;
/**
*
* @param addtime
*/
public void setAddtime(Date addtime) {
this.addtime = addtime;
}
/** @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
* @DateTimeFormat
* @return private Date addtime;
*/
public Date getAddtime() { public Date getAddtime() {
return addtime; return addtime;
} }
public void setAddtime(Date addtime) {
/** this.addtime = addtime;
* id
* @param id id
*/
public void setId(Long id) {
this.id = id;
} }
/**
* id
* @return id
*/
public Long getId() { public Long getId() {
return id; return id;
} }
public void setId(Long id) {
this.id = id;
}
/** /**
* *
* @param wenjuanbiaoti
*/ */
public void setWenjuanbiaoti(String wenjuanbiaoti) { public void setWenjuanbiaoti(String wenjuanbiaoti) {
this.wenjuanbiaoti = wenjuanbiaoti; this.wenjuanbiaoti = wenjuanbiaoti;
} }
/** /**
* *
* @return
*/ */
public String getWenjuanbiaoti() { public String getWenjuanbiaoti() {
return wenjuanbiaoti; return wenjuanbiaoti;
} }
/** /**
* *
* @param fengmiantupian
*/ */
public void setFengmiantupian(String fengmiantupian) { public void setFengmiantupian(String fengmiantupian) {
this.fengmiantupian = fengmiantupian; this.fengmiantupian = fengmiantupian;
} }
/** /**
* *
* @return
*/ */
public String getFengmiantupian() { public String getFengmiantupian() {
return fengmiantupian; return fengmiantupian;
} }
/** /**
* *
* @param leixing
*/ */
public void setLeixing(String leixing) { public void setLeixing(String leixing) {
this.leixing = leixing; this.leixing = leixing;
} }
/** /**
* *
* @return
*/ */
public String getLeixing() { public String getLeixing() {
return leixing; return leixing;
} }
/** /**
* *
* @param wentiyi
*/ */
public void setWentiyi(String wentiyi) { public void setWentiyi(String wentiyi) {
this.wentiyi = wentiyi; this.wentiyi = wentiyi;
} }
/** /**
* *
* @return
*/ */
public String getWentiyi() { public String getWentiyi() {
return wentiyi; return wentiyi;
} }
/** /**
* *
* @param wentier
*/ */
public void setWentier(String wentier) { public void setWentier(String wentier) {
this.wentier = wentier; this.wentier = wentier;
} }
/** /**
* *
* @return
*/ */
public String getWentier() { public String getWentier() {
return wentier; return wentier;
} }
/** /**
* *
* @param wentisan
*/ */
public void setWentisan(String wentisan) { public void setWentisan(String wentisan) {
this.wentisan = wentisan; this.wentisan = wentisan;
} }
/** /**
* *
* @return
*/ */
public String getWentisan() { public String getWentisan() {
return wentisan; return wentisan;
} }
/** /**
* *
* @param wentisi
*/ */
public void setWentisi(String wentisi) { public void setWentisi(String wentisi) {
this.wentisi = wentisi; this.wentisi = wentisi;
} }
/** /**
* *
* @return
*/ */
public String getWentisi() { public String getWentisi() {
return wentisi; return wentisi;
} }
/** /**
* *
* @param wentiwu
*/ */
public void setWentiwu(String wentiwu) { public void setWentiwu(String wentiwu) {
this.wentiwu = wentiwu; this.wentiwu = wentiwu;
} }
/** /**
* *
* @return
*/ */
public String getWentiwu() { public String getWentiwu() {
return wentiwu; return wentiwu;
} }
/** /**
* *
* @param faburiqi
*/ */
public void setFaburiqi(Date faburiqi) { public void setFaburiqi(Date faburiqi) {
this.faburiqi = faburiqi; this.faburiqi = faburiqi;
} }
/** /**
* *
* @return
*/ */
public Date getFaburiqi() { public Date getFaburiqi() {
return faburiqi; return faburiqi;
} }
/** /**
* *
* @param clicktime
*/ */
public void setClicktime(Date clicktime) { public void setClicktime(Date clicktime) {
this.clicktime = clicktime; this.clicktime = clicktime;
} }
/** /**
* *
* @return
*/ */
public Date getClicktime() { public Date getClicktime() {
return clicktime; return clicktime;
} }
} }

@ -1,144 +1,157 @@
package com.entity.model; package com.entity.model;
import com.entity.ForumEntity; import com.entity.ForumEntity;
import java.io.Serializable; // 导入可序列化接口
import com.baomidou.mybatisplus.annotations.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
/** /**
* *
* *
* entity * entity
* ModelAndViewmodel * ModelAndView model
*
* @author * @author
* @email * @email
* @date 2023-02-21 09:46:06 * @date 2023-02-21 09:46:06
*/ */
public class ForumModel implements Serializable { public class ForumModel implements Serializable {
private static final long serialVersionUID = 1L; // 版本控制 private static final long serialVersionUID = 1L;
/** /**
* *
*/ */
private String content; // 存放帖子内容
private String content;
/** /**
* id * id
*/ */
private Long parentid; // 存放父节点ID
private Long parentid;
/** /**
* id * id
*/ */
private Long userid; // 存放用户ID
private Long userid;
/** /**
* *
*/ */
private String username; // 存放用户名
private String username;
/** /**
* *
*/ */
private String avatarurl; // 存放用户头像URL
private String avatarurl;
/** /**
* *
*/ */
private String isdone; // 存放帖子状态(例如:已完成/未完成等)
private String isdone;
/** /**
* *
* @param content
*/ */
public void setContent(String content) { public void setContent(String content) {
this.content = content; // 设置帖子内容 this.content = content;
} }
/** /**
* *
* @return
*/ */
public String getContent() { public String getContent() {
return content; return content;
} }
/** /**
* id * id
* @param parentid ID
*/ */
public void setParentid(Long parentid) { public void setParentid(Long parentid) {
this.parentid = parentid; // 设置父节点ID this.parentid = parentid;
} }
/** /**
* id * id
* @return ID
*/ */
public Long getParentid() { public Long getParentid() {
return parentid; // 返回父节点ID return parentid;
} }
/** /**
* id * id
* @param userid ID
*/ */
public void setUserid(Long userid) { public void setUserid(Long userid) {
this.userid = userid; // 设置用户ID this.userid = userid;
} }
/** /**
* id * id
* @return ID
*/ */
public Long getUserid() { public Long getUserid() {
return userid; return userid;
} }
/** /**
* *
* @param username
*/ */
public void setUsername(String username) { public void setUsername(String username) {
this.username = username; // 设置用户名 this.username = username;
} }
/** /**
* *
* @return
*/ */
public String getUsername() { public String getUsername() {
return username; return username;
} }
/** /**
* *
* @param avatarurl URL
*/ */
public void setAvatarurl(String avatarurl) { public void setAvatarurl(String avatarurl) {
this.avatarurl = avatarurl; // 设置头像URL this.avatarurl = avatarurl;
} }
/** /**
* *
* @return URL
*/ */
public String getAvatarurl() { public String getAvatarurl() {
return avatarurl; return avatarurl;
} }
/** /**
* *
* @param isdone
*/ */
public void setIsdone(String isdone) { public void setIsdone(String isdone) {
this.isdone = isdone; // 设置帖子状态 this.isdone = isdone;
} }
/** /**
* *
* @return
*/ */
public String getIsdone() { public String getIsdone() {
return isdone; return isdone;
} }
} }

@ -19,7 +19,7 @@ import java.io.Serializable;
* @date 2023-02-21 09:46:06 * @date 2023-02-21 09:46:06
*/ */
public class LeixingModel implements Serializable { public class LeixingModel implements Serializable {
private static final long serialVersionUID = 1L;// 版本控制 private static final long serialVersionUID = 1L;
// 可以根据需求定义属性,例如类型的名称、描述等
} }

@ -9,73 +9,83 @@ import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
/** /**
* *
* *
* entity * entity
* ModelAndView model * ModelAndView model
* @author * @author
* @email * @email
* @date 2023-02-21 09:46:06 * @date 2023-02-21 09:46:06
*/ */
public class NewsModel implements Serializable { public class NewsModel implements Serializable {
private static final long serialVersionUID = 1L; // 序列化版本号 private static final long serialVersionUID = 1L;
/** /**
* *
*/ */
private String introduction; // 存放公告的简介
private String introduction;
/** /**
* *
*/ */
private String picture; // 存放公告相关的图片
private String picture;
/** /**
* *
*/ */
private String content; // 存放公告的详细内容
private String content;
/** /**
* *
*/ */
public void setIntroduction(String introduction) { public void setIntroduction(String introduction) {
this.introduction = introduction; // 设置简介字段 this.introduction = introduction;
} }
/** /**
* *
*/ */
public String getIntroduction() { public String getIntroduction() {
return introduction; // 返回简介字段的值 return introduction;
} }
/** /**
* *
*/ */
public void setPicture(String picture) { public void setPicture(String picture) {
this.picture = picture; // 设置图片字段 this.picture = picture;
} }
/** /**
* *
*/ */
public String getPicture() { public String getPicture() {
return picture; // 返回图片字段的值 return picture;
} }
/** /**
* *
*/ */
public void setContent(String content) { public void setContent(String content) {
this.content = content; // 设置内容字段 this.content = content;
} }
/** /**
* *
*/ */
public String getContent() { public String getContent() {
return content; // 返回内容字段的值 return content;
} }
} }

@ -1,75 +1,90 @@
package com.entity.model; package com.entity.model;
import com.entity.WenjuandiaochaEntity; import com.entity.WenjuandiaochaEntity;
import com.baomidou.mybatisplus.annotations.TableName; import com.baomidou.mybatisplus.annotations.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date; import java.util.Date;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
/** /**
* *
* *
* ModelAndViewmodel * entity
* @author * ModelAndView model
* @email * @author
* @email
* @date 2023-02-21 09:46:06 * @date 2023-02-21 09:46:06
*/ */
public class WenjuandiaochaModel implements Serializable { public class WenjuandiaochaModel implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* *
*/ */
private String fengmiantupian; private String fengmiantupian;
/** /**
* *
*/ */
private String leixing; private String leixing;
/** /**
* *
*/ */
private String wentiyi; private String wentiyi;
/** /**
* *
*/ */
private String wentier; private String wentier;
/** /**
* *
*/ */
private String wentisan; private String wentisan;
/** /**
* *
*/ */
private String wentisi; private String wentisi;
/** /**
* *
*/ */
private String wentiwu; private String wentiwu;
/** /**
* *
*/ */
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat @DateTimeFormat
private Date faburiqi; private Date faburiqi;
/** /**
* *
*/ */
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat @DateTimeFormat
private Date clicktime; private Date clicktime;
/** /**
* *
*/ */
public void setFengmiantupian(String fengmiantupian) { public void setFengmiantupian(String fengmiantupian) {
this.fengmiantupian = fengmiantupian; this.fengmiantupian = fengmiantupian;
} }
@ -81,9 +96,11 @@ public class WenjuandiaochaModel implements Serializable {
return fengmiantupian; return fengmiantupian;
} }
/** /**
* *
*/ */
public void setLeixing(String leixing) { public void setLeixing(String leixing) {
this.leixing = leixing; this.leixing = leixing;
} }
@ -95,9 +112,11 @@ public class WenjuandiaochaModel implements Serializable {
return leixing; return leixing;
} }
/** /**
* *
*/ */
public void setWentiyi(String wentiyi) { public void setWentiyi(String wentiyi) {
this.wentiyi = wentiyi; this.wentiyi = wentiyi;
} }
@ -109,9 +128,11 @@ public class WenjuandiaochaModel implements Serializable {
return wentiyi; return wentiyi;
} }
/** /**
* *
*/ */
public void setWentier(String wentier) { public void setWentier(String wentier) {
this.wentier = wentier; this.wentier = wentier;
} }
@ -123,9 +144,11 @@ public class WenjuandiaochaModel implements Serializable {
return wentier; return wentier;
} }
/** /**
* *
*/ */
public void setWentisan(String wentisan) { public void setWentisan(String wentisan) {
this.wentisan = wentisan; this.wentisan = wentisan;
} }
@ -137,9 +160,11 @@ public class WenjuandiaochaModel implements Serializable {
return wentisan; return wentisan;
} }
/** /**
* *
*/ */
public void setWentisi(String wentisi) { public void setWentisi(String wentisi) {
this.wentisi = wentisi; this.wentisi = wentisi;
} }
@ -151,9 +176,11 @@ public class WenjuandiaochaModel implements Serializable {
return wentisi; return wentisi;
} }
/** /**
* *
*/ */
public void setWentiwu(String wentiwu) { public void setWentiwu(String wentiwu) {
this.wentiwu = wentiwu; this.wentiwu = wentiwu;
} }
@ -165,9 +192,11 @@ public class WenjuandiaochaModel implements Serializable {
return wentiwu; return wentiwu;
} }
/** /**
* *
*/ */
public void setFaburiqi(Date faburiqi) { public void setFaburiqi(Date faburiqi) {
this.faburiqi = faburiqi; this.faburiqi = faburiqi;
} }
@ -179,9 +208,11 @@ public class WenjuandiaochaModel implements Serializable {
return faburiqi; return faburiqi;
} }
/** /**
* *
*/ */
public void setClicktime(Date clicktime) { public void setClicktime(Date clicktime) {
this.clicktime = clicktime; this.clicktime = clicktime;
} }
@ -192,4 +223,5 @@ public class WenjuandiaochaModel implements Serializable {
public Date getClicktime() { public Date getClicktime() {
return clicktime; return clicktime;
} }
} }

@ -24,15 +24,13 @@ public class ForumView extends ForumEntity implements Serializable {
public ForumView(){ public ForumView(){
} }
// 接收 ForumEntity 对象的构造函数 public ForumView(ForumEntity forumEntity){
public ForumView(ForumEntity forumEntity) {
try { try {
// 将ForumEntity的属性复制到当前ForumView对象
BeanUtils.copyProperties(this, forumEntity); BeanUtils.copyProperties(this, forumEntity);
} catch (IllegalAccessException | InvocationTargetException e) { } catch (IllegalAccessException | InvocationTargetException e) {
// 异常处理,打印堆栈信息 // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
}
}
} }

@ -24,14 +24,13 @@ public class LeixingView extends LeixingEntity implements Serializable {
public LeixingView(){ public LeixingView(){
} }
// 接收 LeixingEntity 对象的构造函数 public LeixingView(LeixingEntity leixingEntity){
public LeixingView(LeixingEntity leixingEntity) {
try { try {
// 将LeixingEntity的属性复制到当前LeixingView对象
BeanUtils.copyProperties(this, leixingEntity); BeanUtils.copyProperties(this, leixingEntity);
} catch (IllegalAccessException | InvocationTargetException e) { } catch (IllegalAccessException | InvocationTargetException e) {
// 异常处理,打印堆栈信息 // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
} }
} }

@ -9,10 +9,6 @@ import java.lang.reflect.InvocationTargetException;
import java.io.Serializable; import java.io.Serializable;
/**
*
*
* 使
/** /**
* *
* *
@ -21,22 +17,20 @@ import java.io.Serializable;
* @email * @email
* @date 2023-02-21 09:46:06 * @date 2023-02-21 09:46:06
*/ */
@TableName("news") // 指定该类对应的数据库表名为 "news" @TableName("news")
public class NewsView extends NewsEntity implements Serializable { public class NewsView extends NewsEntity implements Serializable {
private static final long serialVersionUID = 1L; // 序列化版本号 private static final long serialVersionUID = 1L;
// 默认构造函数 public NewsView(){
public NewsView() {
} }
// 构造函数,接受一个 NewsEntity 对象并复制其属性 public NewsView(NewsEntity newsEntity){
public NewsView(NewsEntity newsEntity) {
try { try {
BeanUtils.copyProperties(this, newsEntity); // 使用 BeanUtils 复制属性 BeanUtils.copyProperties(this, newsEntity);
} catch (IllegalAccessException | InvocationTargetException e) { } catch (IllegalAccessException | InvocationTargetException e) {
// 捕获并处理属性复制过程中的异常 // TODO Auto-generated catch block
e.printStackTrace(); // 打印异常堆栈跟踪 e.printStackTrace();
} }
} }
} }

@ -17,21 +17,20 @@ import java.io.Serializable;
* @email * @email
* @date 2023-02-21 09:46:06 * @date 2023-02-21 09:46:06
*/ */
@TableName("storeup") // 指定该类对应的数据库表名为 "storeup" @TableName("storeup")
public class StoreupView extends StoreupEntity implements Serializable { public class StoreupView extends StoreupEntity implements Serializable {
private static final long serialVersionUID = 1L; // 序列化版本号 private static final long serialVersionUID = 1L;
// 默认构造函数 public StoreupView(){
public StoreupView() {
} }
// 构造函数,接受一个 StoreupEntity 对象并复制其属性 public StoreupView(StoreupEntity storeupEntity){
public StoreupView(StoreupEntity storeupEntity) {
try { try {
BeanUtils.copyProperties(this, storeupEntity); // 使用 BeanUtils 复制属性 BeanUtils.copyProperties(this, storeupEntity);
} catch (IllegalAccessException | InvocationTargetException e) { } catch (IllegalAccessException | InvocationTargetException e) {
// 捕获并处理属性复制过程中的异常 // TODO Auto-generated catch block
e.printStackTrace(); // 打印异常堆栈跟踪 e.printStackTrace();
} }
} }
} }

@ -1,18 +1,14 @@
package com.entity.view; package com.entity.view;
// 导入系统介绍实体类
import com.entity.SystemintroEntity; import com.entity.SystemintroEntity;
// 导入MyBatis-Plus的注解库
import com.baomidou.mybatisplus.annotations.TableName; import com.baomidou.mybatisplus.annotations.TableName;
// 导入Apache Commons BeanUtils类
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
// 导入反射异常处理类
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
// 导入序列化接口
import java.io.Serializable; import java.io.Serializable;
/** /**
* *
* *
@ -21,24 +17,20 @@ import java.io.Serializable;
* @email * @email
* @date 2023-02-21 09:46:06 * @date 2023-02-21 09:46:06
*/ */
// 指定表名为"systemintro"的实体类
@TableName("systemintro") @TableName("systemintro")
public class SystemintroView extends SystemintroEntity implements Serializable { public class SystemintroView extends SystemintroEntity implements Serializable {
// 版本控制
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
// 默认构造函数 public SystemintroView(){
public SystemintroView() {
} }
// 带参构造函数用于根据SystemintroEntity对象初始化SystemintroView public SystemintroView(SystemintroEntity systemintroEntity){
public SystemintroView(SystemintroEntity systemintroEntity) {
try { try {
// 复制systemintroEntity的属性到当前对象
BeanUtils.copyProperties(this, systemintroEntity); BeanUtils.copyProperties(this, systemintroEntity);
} catch (IllegalAccessException | InvocationTargetException e) { } catch (IllegalAccessException | InvocationTargetException e) {
// 捕获反射过程中的异常并打印堆栈信息 // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
} }
} }

@ -1,40 +1,36 @@
package com.entity.view; package com.entity.view;
import com.entity.WenjuandiaochaEntity; import com.entity.WenjuandiaochaEntity;
import com.baomidou.mybatisplus.annotations.TableName; import com.baomidou.mybatisplus.annotations.TableName;
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.io.Serializable; import java.io.Serializable;
/** /**
* *
* 使 *
* 使 * 使
* @author * @author
* @email * @email
* @date 2023-02-21 09:46:06 * @date 2023-02-21 09:46:06
*/ */
@TableName("wenjuandiaocha") @TableName("wenjuandiaocha")
public class WenjuandiaochaView extends WenjuandiaochaEntity implements Serializable { public class WenjuandiaochaView extends WenjuandiaochaEntity implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** public WenjuandiaochaView(){
*
*/
public WenjuandiaochaView() {
} }
/** public WenjuandiaochaView(WenjuandiaochaEntity wenjuandiaochaEntity){
* WenjuandiaochaEntityWenjuandiaochaView
* @param wenjuandiaochaEntity
*/
public WenjuandiaochaView(WenjuandiaochaEntity wenjuandiaochaEntity) {
try { try {
BeanUtils.copyProperties(this, wenjuandiaochaEntity); BeanUtils.copyProperties(this, wenjuandiaochaEntity);
} catch (IllegalAccessException | InvocationTargetException e) { } catch (IllegalAccessException | InvocationTargetException e) {
// 打印堆栈跟踪信息以便调试 // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
} }
} }

@ -19,7 +19,7 @@ import java.io.Serializable;
* @date 2023-02-21 09:46:06 * @date 2023-02-21 09:46:06
*/ */
public class LeixingVO implements Serializable { public class LeixingVO implements Serializable {
private static final long serialVersionUID = 1L;// 版本控制,用于序列化 private static final long serialVersionUID = 1L;
} }

@ -1,13 +1,14 @@
package com.entity.vo; // 定义包名 package com.entity.vo;
import com.entity.NewsEntity; // 导入NewsEntity类 import com.entity.NewsEntity;
import com.baomidou.mybatisplus.annotations.TableName; // 导入MyBatis-Plus的TableName注解 import com.baomidou.mybatisplus.annotations.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; // 导入Jackson的JsonFormat注解 import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date; // 导入Date类 import java.util.Date;
import org.springframework.format.annotation.DateTimeFormat; // 导入Spring的DateTimeFormat注解 import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.io.Serializable; // 导入Serializable接口
/** /**
* *
@ -17,63 +18,74 @@ import java.io.Serializable; // 导入Serializable接口
* @email * @email
* @date 2023-02-21 09:46:06 * @date 2023-02-21 09:46:06
*/ */
public class NewsVO implements Serializable { // 定义NewsVO类实现Serializable接口 public class NewsVO implements Serializable {
private static final long serialVersionUID = 1L; // 定义序列化版本号 private static final long serialVersionUID = 1L;
/** /**
* *
*/ */
private String introduction; // 定义简介字段
private String introduction;
/** /**
* *
*/ */
private String picture; // 定义图片字段
private String picture;
/** /**
* *
*/ */
private String content; // 定义内容字段
private String content;
/** /**
* *
*/ */
public void setIntroduction(String introduction) { // 设置简介的方法
public void setIntroduction(String introduction) {
this.introduction = introduction; this.introduction = introduction;
} }
/** /**
* *
*/ */
public String getIntroduction() { // 获取简介的方法 public String getIntroduction() {
return introduction; return introduction;
} }
/** /**
* *
*/ */
public void setPicture(String picture) { // 设置图片的方法
public void setPicture(String picture) {
this.picture = picture; this.picture = picture;
} }
/** /**
* *
*/ */
public String getPicture() { // 获取图片的方法 public String getPicture() {
return picture; return picture;
} }
/** /**
* *
*/ */
public void setContent(String content) { // 设置内容的方法
public void setContent(String content) {
this.content = content; this.content = content;
} }
/** /**
* *
*/ */
public String getContent() { // 获取内容的方法 public String getContent() {
return content; return content;
} }
} }

@ -1,13 +1,14 @@
package com.entity.vo; // 定义包名 package com.entity.vo;
import com.entity.StoreupEntity; // 导入StoreupEntity类 import com.entity.StoreupEntity;
import com.baomidou.mybatisplus.annotations.TableName; // 导入MyBatis-Plus的TableName注解 import com.baomidou.mybatisplus.annotations.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; // 导入Jackson的JsonFormat注解 import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date; // 导入Date类 import java.util.Date;
import org.springframework.format.annotation.DateTimeFormat; // 导入Spring的DateTimeFormat注解 import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.io.Serializable; // 导入Serializable接口
/** /**
* *
@ -17,139 +18,162 @@ import java.io.Serializable; // 导入Serializable接口
* @email * @email
* @date 2023-02-21 09:46:06 * @date 2023-02-21 09:46:06
*/ */
public class StoreupVO implements Serializable { // 定义StoreupVO类实现Serializable接口 public class StoreupVO implements Serializable {
private static final long serialVersionUID = 1L; // 定义序列化版本号 private static final long serialVersionUID = 1L;
/** /**
* id * id
*/ */
private Long refid; // 定义商品id字段
private Long refid;
/** /**
* *
*/ */
private String tablename; // 定义表名字段
private String tablename;
/** /**
* *
*/ */
private String name; // 定义名称字段
private String name;
/** /**
* *
*/ */
private String picture; // 定义图片字段
private String picture;
/** /**
* (1:,21:,22:,31:,41:) * (1:,21:,22:,31:,41:)
*/ */
private String type; // 定义类型字段
private String type;
/** /**
* *
*/ */
private String inteltype; // 定义推荐类型字段
private String inteltype;
/** /**
* *
*/ */
private String remark; // 定义备注字段
private String remark;
/** /**
* id * id
*/ */
public void setRefid(Long refid) { // 设置商品id的方法
public void setRefid(Long refid) {
this.refid = refid; this.refid = refid;
} }
/** /**
* id * id
*/ */
public Long getRefid() { // 获取商品id的方法 public Long getRefid() {
return refid; return refid;
} }
/** /**
* *
*/ */
public void setTablename(String tablename) { // 设置表名的方法
public void setTablename(String tablename) {
this.tablename = tablename; this.tablename = tablename;
} }
/** /**
* *
*/ */
public String getTablename() { // 获取表名的方法 public String getTablename() {
return tablename; return tablename;
} }
/** /**
* *
*/ */
public void setName(String name) { // 设置名称的方法
public void setName(String name) {
this.name = name; this.name = name;
} }
/** /**
* *
*/ */
public String getName() { // 获取名称的方法 public String getName() {
return name; return name;
} }
/** /**
* *
*/ */
public void setPicture(String picture) { // 设置图片的方法
public void setPicture(String picture) {
this.picture = picture; this.picture = picture;
} }
/** /**
* *
*/ */
public String getPicture() { // 获取图片的方法 public String getPicture() {
return picture; return picture;
} }
/** /**
* (1:,21:,22:,31:,41:) * (1:,21:,22:,31:,41:)
*/ */
public void setType(String type) { // 设置类型的方法
public void setType(String type) {
this.type = type; this.type = type;
} }
/** /**
* (1:,21:,22:,31:,41:) * (1:,21:,22:,31:,41:)
*/ */
public String getType() { // 获取类型的方法 public String getType() {
return type; return type;
} }
/** /**
* *
*/ */
public void setInteltype(String inteltype) { // 设置推荐类型的方法
public void setInteltype(String inteltype) {
this.inteltype = inteltype; this.inteltype = inteltype;
} }
/** /**
* *
*/ */
public String getInteltype() { // 获取推荐类型的方法 public String getInteltype() {
return inteltype; return inteltype;
} }
/** /**
* *
*/ */
public void setRemark(String remark) { // 设置备注的方法
public void setRemark(String remark) {
this.remark = remark; this.remark = remark;
} }
/** /**
* *
*/ */
public String getRemark() { // 获取备注的方法 public String getRemark() {
return remark; return remark;
} }
} }

@ -1,13 +1,14 @@
package com.entity.vo; // 定义包名 package com.entity.vo;
import com.entity.SystemintroEntity; // 导入SystemintroEntity类 import com.entity.SystemintroEntity;
import com.baomidou.mybatisplus.annotations.TableName; // 导入MyBatis-Plus的TableName注解 import com.baomidou.mybatisplus.annotations.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; // 导入Jackson的JsonFormat注解 import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date; // 导入Date类 import java.util.Date;
import org.springframework.format.annotation.DateTimeFormat; // 导入Spring的DateTimeFormat注解 import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.io.Serializable; // 导入Serializable接口
/** /**
* *
@ -17,101 +18,118 @@ import java.io.Serializable; // 导入Serializable接口
* @email * @email
* @date 2023-02-21 09:46:06 * @date 2023-02-21 09:46:06
*/ */
public class SystemintroVO implements Serializable { // 定义SystemintroVO类实现Serializable接口 public class SystemintroVO implements Serializable {
private static final long serialVersionUID = 1L; // 定义序列化版本号 private static final long serialVersionUID = 1L;
/** /**
* *
*/ */
private String subtitle; // 定义副标题字段
private String subtitle;
/** /**
* *
*/ */
private String content; // 定义内容字段
private String content;
/** /**
* 1 * 1
*/ */
private String picture1; // 定义图片1字段
private String picture1;
/** /**
* 2 * 2
*/ */
private String picture2; // 定义图片2字段
private String picture2;
/** /**
* 3 * 3
*/ */
private String picture3; // 定义图片3字段
private String picture3;
/** /**
* *
*/ */
public void setSubtitle(String subtitle) { // 设置副标题的方法
public void setSubtitle(String subtitle) {
this.subtitle = subtitle; this.subtitle = subtitle;
} }
/** /**
* *
*/ */
public String getSubtitle() { // 获取副标题的方法 public String getSubtitle() {
return subtitle; return subtitle;
} }
/** /**
* *
*/ */
public void setContent(String content) { // 设置内容的方法
public void setContent(String content) {
this.content = content; this.content = content;
} }
/** /**
* *
*/ */
public String getContent() { // 获取内容的方法 public String getContent() {
return content; return content;
} }
/** /**
* 1 * 1
*/ */
public void setPicture1(String picture1) { // 设置图片1的方法
public void setPicture1(String picture1) {
this.picture1 = picture1; this.picture1 = picture1;
} }
/** /**
* 1 * 1
*/ */
public String getPicture1() { // 获取图片1的方法 public String getPicture1() {
return picture1; return picture1;
} }
/** /**
* 2 * 2
*/ */
public void setPicture2(String picture2) { // 设置图片2的方法
public void setPicture2(String picture2) {
this.picture2 = picture2; this.picture2 = picture2;
} }
/** /**
* 2 * 2
*/ */
public String getPicture2() { // 获取图片2的方法 public String getPicture2() {
return picture2; return picture2;
} }
/** /**
* 3 * 3
*/ */
public void setPicture3(String picture3) { // 设置图片3的方法
public void setPicture3(String picture3) {
this.picture3 = picture3; this.picture3 = picture3;
} }
/** /**
* 3 * 3
*/ */
public String getPicture3() { // 获取图片3的方法 public String getPicture3() {
return picture3; return picture3;
} }
} }

@ -3,8 +3,8 @@ package com.service;
import java.util.Map; import java.util.Map;
import com.baomidou.mybatisplus.mapper.Wrapper;// 导入MyBatis-Plus的Wrapper接口用于构建查询条件 import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.service.IService;// 导入MyBatis-Plus的服务接口 import com.baomidou.mybatisplus.service.IService;
import com.entity.ConfigEntity; import com.entity.ConfigEntity;
import com.utils.PageUtils; import com.utils.PageUtils;
@ -13,12 +13,5 @@ import com.utils.PageUtils;
* *
*/ */
public interface ConfigService extends IService<ConfigEntity> { public interface ConfigService extends IService<ConfigEntity> {
PageUtils queryPage(Map<String, Object> params,Wrapper<ConfigEntity> wrapper);
/**
*
* @param params
* @param wrapper
* @return
*/
PageUtils queryPage(Map<String, Object> params, Wrapper<ConfigEntity> wrapper);
} }

@ -3,12 +3,14 @@ package com.service;
import com.baomidou.mybatisplus.mapper.Wrapper; import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.service.IService; import com.baomidou.mybatisplus.service.IService;
import com.utils.PageUtils; import com.utils.PageUtils;
import com.entity.ForumEntity; // 导入论坛实体类 import com.entity.ForumEntity;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.entity.vo.ForumVO;// 导入论坛VO类 import com.entity.vo.ForumVO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.entity.view.ForumView;v// 导入论坛视图类 import com.entity.view.ForumView;
/** /**
* *
* *
@ -18,47 +20,18 @@ import com.entity.view.ForumView;v// 导入论坛视图类
*/ */
public interface ForumService extends IService<ForumEntity> { public interface ForumService extends IService<ForumEntity> {
/**
*
* @param params
* @return
*/
PageUtils queryPage(Map<String, Object> params); PageUtils queryPage(Map<String, Object> params);
/**
* VO
* @param wrapper
* @return ForumVO
*/
List<ForumVO> selectListVO(Wrapper<ForumEntity> wrapper); List<ForumVO> selectListVO(Wrapper<ForumEntity> wrapper);
/**
* VO
* @param wrapper
* @return ForumVO
*/
ForumVO selectVO(@Param("ew") Wrapper<ForumEntity> wrapper); ForumVO selectVO(@Param("ew") Wrapper<ForumEntity> wrapper);
/**
*
* @param wrapper
* @return ForumView
*/
List<ForumView> selectListView(Wrapper<ForumEntity> wrapper); List<ForumView> selectListView(Wrapper<ForumEntity> wrapper);
/**
*
* @param wrapper
* @return ForumView
*/
ForumView selectView(@Param("ew") Wrapper<ForumEntity> wrapper); ForumView selectView(@Param("ew") Wrapper<ForumEntity> wrapper);
/** PageUtils queryPage(Map<String, Object> params,Wrapper<ForumEntity> wrapper);
*
* @param params
* @param wrapper
* @return
*/
PageUtils queryPage(Map<String, Object> params, Wrapper<ForumEntity> wrapper);
} }

@ -3,12 +3,12 @@ package com.service;
import com.baomidou.mybatisplus.mapper.Wrapper; import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.service.IService; import com.baomidou.mybatisplus.service.IService;
import com.utils.PageUtils; import com.utils.PageUtils;
import com.entity.LeixingEntity; // 导入类型实体类 import com.entity.LeixingEntity;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.entity.vo.LeixingVO; import com.entity.vo.LeixingVO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.entity.view.LeixingView;// 导入类型视图类 import com.entity.view.LeixingView;
/** /**
@ -20,47 +20,18 @@ import com.entity.view.LeixingView;// 导入类型视图类
*/ */
public interface LeixingService extends IService<LeixingEntity> { public interface LeixingService extends IService<LeixingEntity> {
/**
*
* @param params
* @return
*/
PageUtils queryPage(Map<String, Object> params); PageUtils queryPage(Map<String, Object> params);
/**
* VO
* @param wrapper
* @return LeixingVO
*/
List<LeixingVO> selectListVO(Wrapper<LeixingEntity> wrapper); List<LeixingVO> selectListVO(Wrapper<LeixingEntity> wrapper);
/**
* VO
* @param wrapper
* @return LeixingVO
*/
LeixingVO selectVO(@Param("ew") Wrapper<LeixingEntity> wrapper); LeixingVO selectVO(@Param("ew") Wrapper<LeixingEntity> wrapper);
/**
*
* @param wrapper
* @return LeixingView
*/
List<LeixingView> selectListView(Wrapper<LeixingEntity> wrapper); List<LeixingView> selectListView(Wrapper<LeixingEntity> wrapper);
/**
*
* @param wrapper
* @return LeixingView
*/
LeixingView selectView(@Param("ew") Wrapper<LeixingEntity> wrapper); LeixingView selectView(@Param("ew") Wrapper<LeixingEntity> wrapper);
/** PageUtils queryPage(Map<String, Object> params,Wrapper<LeixingEntity> wrapper);
*
* @param params
* @param wrapper
* @return
*/
PageUtils queryPage(Map<String, Object> params, Wrapper<LeixingEntity> wrapper);
} }

@ -14,24 +14,24 @@ import com.entity.view.NewsView;
/** /**
* *
* *
* @author // 作者信息 * @author
* @email // 邮箱信息 * @email
* @date 2023-02-21 09:46:06 // 创建日期 * @date 2023-02-21 09:46:06
*/ */
public interface NewsService extends IService<NewsEntity> { // 声明一个接口,扩展 IService 用于基本的 CRUD 操作 public interface NewsService extends IService<NewsEntity> {
PageUtils queryPage(Map<String, Object> params); // 根据传入的参数进行分页查询,并返回分页结果 PageUtils queryPage(Map<String, Object> params);
List<NewsVO> selectListVO(Wrapper<NewsEntity> wrapper); // 根据条件包装器查询并返回 NewsVO 列表 List<NewsVO> selectListVO(Wrapper<NewsEntity> wrapper);
NewsVO selectVO(@Param("ew") Wrapper<NewsEntity> wrapper); // 根据条件包装器查询并返回单个 NewsVO 对象 NewsVO selectVO(@Param("ew") Wrapper<NewsEntity> wrapper);
List<NewsView> selectListView(Wrapper<NewsEntity> wrapper); // 根据条件包装器查询并返回 NewsView 列表 List<NewsView> selectListView(Wrapper<NewsEntity> wrapper);
NewsView selectView(@Param("ew") Wrapper<NewsEntity> wrapper); // 根据条件包装器查询并返回单个 NewsView 对象 NewsView selectView(@Param("ew") Wrapper<NewsEntity> wrapper);
PageUtils queryPage(Map<String, Object> params, Wrapper<NewsEntity> wrapper); // 根据参数和条件包装器进行分页查询,并返回分页结果 PageUtils queryPage(Map<String, Object> params,Wrapper<NewsEntity> wrapper);
}
}

@ -10,27 +10,28 @@ import com.entity.vo.StoreupVO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.entity.view.StoreupView; import com.entity.view.StoreupView;
/** /**
* *
* *
* @author // 作者信息 * @author
* @email // 邮箱信息 * @email
* @date 2023-02-21 09:46:06 // 创建日期 * @date 2023-02-21 09:46:06
*/ */
public interface StoreupService extends IService<StoreupEntity> { // 声明一个接口,扩展 IService 用于基本的 CRUD 操作 public interface StoreupService extends IService<StoreupEntity> {
PageUtils queryPage(Map<String, Object> params); // 根据传入的参数进行分页查询,并返回分页结果 PageUtils queryPage(Map<String, Object> params);
List<StoreupVO> selectListVO(Wrapper<StoreupEntity> wrapper); // 根据条件包装器查询并返回 StoreupVO 列表 List<StoreupVO> selectListVO(Wrapper<StoreupEntity> wrapper);
StoreupVO selectVO(@Param("ew") Wrapper<StoreupEntity> wrapper); // 根据条件包装器查询并返回单个 StoreupVO 对象 StoreupVO selectVO(@Param("ew") Wrapper<StoreupEntity> wrapper);
List<StoreupView> selectListView(Wrapper<StoreupEntity> wrapper); // 根据条件包装器查询并返回 StoreupView 列表 List<StoreupView> selectListView(Wrapper<StoreupEntity> wrapper);
StoreupView selectView(@Param("ew") Wrapper<StoreupEntity> wrapper); // 根据条件包装器查询并返回单个 StoreupView 对象 StoreupView selectView(@Param("ew") Wrapper<StoreupEntity> wrapper);
PageUtils queryPage(Map<String, Object> params, Wrapper<StoreupEntity> wrapper); // 根据参数和条件包装器进行分页查询,并返回分页结果 PageUtils queryPage(Map<String, Object> params,Wrapper<StoreupEntity> wrapper);
}
}

@ -9,27 +9,29 @@ import java.util.Map;
import com.entity.vo.SystemintroVO; import com.entity.vo.SystemintroVO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.entity.view.SystemintroView; import com.entity.view.SystemintroView;
/** /**
* *
* *
* @author // 作者信息 * @author
* @email // 邮箱信息 * @email
* @date 2023-02-21 09:46:06 // 创建日期 * @date 2023-02-21 09:46:06
*/ */
public interface SystemintroService extends IService<SystemintroEntity> { // 声明一个接口,扩展 IService 用于基本的 CRUD 操作 public interface SystemintroService extends IService<SystemintroEntity> {
PageUtils queryPage(Map<String, Object> params); // 根据传入的参数进行分页查询,并返回分页结果 PageUtils queryPage(Map<String, Object> params);
List<SystemintroVO> selectListVO(Wrapper<SystemintroEntity> wrapper); // 根据条件包装器查询并返回 SystemintroVO 列表 List<SystemintroVO> selectListVO(Wrapper<SystemintroEntity> wrapper);
SystemintroVO selectVO(@Param("ew") Wrapper<SystemintroEntity> wrapper); // 根据条件包装器查询并返回单个 SystemintroVO 对象 SystemintroVO selectVO(@Param("ew") Wrapper<SystemintroEntity> wrapper);
List<SystemintroView> selectListView(Wrapper<SystemintroEntity> wrapper); // 根据条件包装器查询并返回 SystemintroView 列表 List<SystemintroView> selectListView(Wrapper<SystemintroEntity> wrapper);
SystemintroView selectView(@Param("ew") Wrapper<SystemintroEntity> wrapper); // 根据条件包装器查询并返回单个 SystemintroView 对象 SystemintroView selectView(@Param("ew") Wrapper<SystemintroEntity> wrapper);
PageUtils queryPage(Map<String, Object> params, Wrapper<SystemintroEntity> wrapper); // 根据参数和条件包装器进行分页查询,并返回分页结果 PageUtils queryPage(Map<String, Object> params,Wrapper<SystemintroEntity> wrapper);
}
}

@ -11,15 +11,15 @@ import com.baomidou.mybatisplus.service.IService;
import com.entity.UsersEntity; import com.entity.UsersEntity;
import com.utils.PageUtils; import com.utils.PageUtils;
/** /**
* *
*/ */
public interface UsersService extends IService<UsersEntity> { // 声明一个接口,扩展 IService用于基本的 CRUD 操作 public interface UsersService extends IService<UsersEntity> {
PageUtils queryPage(Map<String, Object> params);
PageUtils queryPage(Map<String, Object> params); // 根据传入的参数进行分页查询,并返回分页结果 List<UsersEntity> selectListView(Wrapper<UsersEntity> wrapper);
List<UsersEntity> selectListView(Wrapper<UsersEntity> wrapper); // 根据条件包装器查询并返回 UsersEntity 列表 PageUtils queryPage(Map<String, Object> params,Wrapper<UsersEntity> wrapper);
PageUtils queryPage(Map<String, Object> params, Wrapper<UsersEntity> wrapper); // 根据参数和条件包装器进行分页查询,并返回分页结果
} }

@ -20,70 +20,26 @@ import com.entity.view.WenjuandafuView;
*/ */
public interface WenjuandafuService extends IService<WenjuandafuEntity> { public interface WenjuandafuService extends IService<WenjuandafuEntity> {
/**
*
* @param params
* @return
*/
PageUtils queryPage(Map<String, Object> params); PageUtils queryPage(Map<String, Object> params);
/**
* VO
* @param wrapper
* @return VO
*/
List<WenjuandafuVO> selectListVO(Wrapper<WenjuandafuEntity> wrapper); List<WenjuandafuVO> selectListVO(Wrapper<WenjuandafuEntity> wrapper);
/**
* VO
* @param wrapper
* @return VO
*/
WenjuandafuVO selectVO(@Param("ew") Wrapper<WenjuandafuEntity> wrapper); WenjuandafuVO selectVO(@Param("ew") Wrapper<WenjuandafuEntity> wrapper);
/**
*
* @param wrapper
* @return
*/
List<WenjuandafuView> selectListView(Wrapper<WenjuandafuEntity> wrapper); List<WenjuandafuView> selectListView(Wrapper<WenjuandafuEntity> wrapper);
/**
*
* @param wrapper
* @return
*/
WenjuandafuView selectView(@Param("ew") Wrapper<WenjuandafuEntity> wrapper); WenjuandafuView selectView(@Param("ew") Wrapper<WenjuandafuEntity> wrapper);
/** PageUtils queryPage(Map<String, Object> params,Wrapper<WenjuandafuEntity> wrapper);
*
* @param params
* @param wrapper
* @return
*/
PageUtils queryPage(Map<String, Object> params, Wrapper<WenjuandafuEntity> wrapper);
/**
* Map
* @param params
* @param wrapper
* @return Map
*/
List<Map<String, Object>> selectValue(Map<String, Object> params, Wrapper<WenjuandafuEntity> wrapper);
/** List<Map<String, Object>> selectValue(Map<String, Object> params,Wrapper<WenjuandafuEntity> wrapper);
*
* @param params
* @param wrapper
* @return Map
*/
List<Map<String, Object>> selectTimeStatValue(Map<String, Object> params, Wrapper<WenjuandafuEntity> wrapper);
/** List<Map<String, Object>> selectTimeStatValue(Map<String, Object> params,Wrapper<WenjuandafuEntity> wrapper);
*
* @param params List<Map<String, Object>> selectGroup(Map<String, Object> params,Wrapper<WenjuandafuEntity> wrapper);
* @param wrapper
* @return Map
*/
List<Map<String, Object>> selectGroup(Map<String, Object> params, Wrapper<WenjuandafuEntity> wrapper); }

@ -10,80 +10,36 @@ import com.entity.vo.WenjuandiaochaVO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.entity.view.WenjuandiaochaView; import com.entity.view.WenjuandiaochaView;
/** /**
* *
* *
* @author * @author
* @email * @email
* @date 2023-02-21 09:46:06 * @date 2023-02-21 09:46:06
*/ */
public interface WenjuandiaochaService extends IService<WenjuandiaochaEntity> { public interface WenjuandiaochaService extends IService<WenjuandiaochaEntity> {
/**
*
* @param params
* @return
*/
PageUtils queryPage(Map<String, Object> params); PageUtils queryPage(Map<String, Object> params);
/**
*
* @param wrapper
* @return
*/
List<WenjuandiaochaVO> selectListVO(Wrapper<WenjuandiaochaEntity> wrapper); List<WenjuandiaochaVO> selectListVO(Wrapper<WenjuandiaochaEntity> wrapper);
/**
*
* @param wrapper
* @return
*/
WenjuandiaochaVO selectVO(@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper); WenjuandiaochaVO selectVO(@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper);
/**
*
* @param wrapper
* @return
*/
List<WenjuandiaochaView> selectListView(Wrapper<WenjuandiaochaEntity> wrapper); List<WenjuandiaochaView> selectListView(Wrapper<WenjuandiaochaEntity> wrapper);
/**
*
* @param wrapper
* @return
*/
WenjuandiaochaView selectView(@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper); WenjuandiaochaView selectView(@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper);
/** PageUtils queryPage(Map<String, Object> params,Wrapper<WenjuandiaochaEntity> wrapper);
*
* @param params
* @param wrapper
* @return
*/
PageUtils queryPage(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper);
/** List<Map<String, Object>> selectValue(Map<String, Object> params,Wrapper<WenjuandiaochaEntity> wrapper);
*
* @param params List<Map<String, Object>> selectTimeStatValue(Map<String, Object> params,Wrapper<WenjuandiaochaEntity> wrapper);
* @param wrapper
* @return List<Map<String, Object>> selectGroup(Map<String, Object> params,Wrapper<WenjuandiaochaEntity> wrapper);
*/
List<Map<String, Object>> selectValue(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper);
/**
*
* @param params
* @param wrapper
* @return
*/
List<Map<String, Object>> selectTimeStatValue(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper);
/**
*
* @param params
* @param wrapper
* @return
*/
List<Map<String, Object>> selectGroup(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper);
} }

@ -24,10 +24,10 @@ import com.utils.Query;
public class ConfigServiceImpl extends ServiceImpl<ConfigDao, ConfigEntity> implements ConfigService { public class ConfigServiceImpl extends ServiceImpl<ConfigDao, ConfigEntity> implements ConfigService {
@Override @Override
public PageUtils queryPage(Map<String, Object> params, Wrapper<ConfigEntity> wrapper) { public PageUtils queryPage(Map<String, Object> params, Wrapper<ConfigEntity> wrapper) {
// 使用MyBatis-Plus的selectPage方法进行分页查询
Page<ConfigEntity> page = this.selectPage( Page<ConfigEntity> page = this.selectPage(
new Query<ConfigEntity>(params).getPage(), // 获取分页参数 new Query<ConfigEntity>(params).getPage(),
wrapper // 查询条件 wrapper
); );
return new PageUtils(page); // 返回分页结果 return new PageUtils(page);
}
} }

@ -18,76 +18,46 @@ import com.service.ForumService;
import com.entity.vo.ForumVO; import com.entity.vo.ForumVO;
import com.entity.view.ForumView; import com.entity.view.ForumView;
@Service("forumService") // 将该类标记为Spring的Service组件 @Service("forumService")
public class ForumServiceImpl extends ServiceImpl<ForumDao, ForumEntity> implements ForumService { public class ForumServiceImpl extends ServiceImpl<ForumDao, ForumEntity> implements ForumService {
/**
*
* @param params
* @return
*/
@Override @Override
public PageUtils queryPage(Map<String, Object> params) { public PageUtils queryPage(Map<String, Object> params) {
// 调用selectPage方法进行分页查询
Page<ForumEntity> page = this.selectPage( Page<ForumEntity> page = this.selectPage(
new Query<ForumEntity>(params).getPage(), // 获取分页信息 new Query<ForumEntity>(params).getPage(),
new EntityWrapper<ForumEntity>() // 创建查询条件 new EntityWrapper<ForumEntity>()
); );
return new PageUtils(page); // 返回分页结果 return new PageUtils(page);
} }
/**
*
* @param params
* @param wrapper
* @return
*/
@Override @Override
public PageUtils queryPage(Map<String, Object> params, Wrapper<ForumEntity> wrapper) { public PageUtils queryPage(Map<String, Object> params, Wrapper<ForumEntity> wrapper) {
// 创建分页对象 Page<ForumView> page =new Query<ForumView>(params).getPage();
Page<ForumView> page = new Query<ForumView>(params).getPage(); page.setRecords(baseMapper.selectListView(page,wrapper));
// 设置记录 PageUtils pageUtil = new PageUtils(page);
page.setRecords(baseMapper.selectListView(page, wrapper)); return pageUtil;
return new PageUtils(page); // 返回分页结果
} }
/**
* VO
* @param wrapper
* @return VO
*/
@Override @Override
public List<ForumVO> selectListVO(Wrapper<ForumEntity> wrapper) { public List<ForumVO> selectListVO(Wrapper<ForumEntity> wrapper) {
return baseMapper.selectListVO(wrapper); // 调用数据访问对象方法返回VO对象列表 return baseMapper.selectListVO(wrapper);
} }
/**
* VO
* @param wrapper
* @return VO
*/
@Override @Override
public ForumVO selectVO(Wrapper<ForumEntity> wrapper) { public ForumVO selectVO(Wrapper<ForumEntity> wrapper) {
return baseMapper.selectVO(wrapper); // 调用数据访问对象方法返回单个VO对象 return baseMapper.selectVO(wrapper);
} }
/**
*
* @param wrapper
* @return
*/
@Override @Override
public List<ForumView> selectListView(Wrapper<ForumEntity> wrapper) { public List<ForumView> selectListView(Wrapper<ForumEntity> wrapper) {
return baseMapper.selectListView(wrapper); // 调用数据访问对象方法,返回视图对象列表 return baseMapper.selectListView(wrapper);
} }
/**
*
* @param wrapper
* @return
*/
@Override @Override
public ForumView selectView(Wrapper<ForumEntity> wrapper) { public ForumView selectView(Wrapper<ForumEntity> wrapper) {
return baseMapper.selectView(wrapper); // 调用数据访问对象方法,返回单个视图对象 return baseMapper.selectView(wrapper);
} }
} }

@ -17,75 +17,47 @@ import com.entity.LeixingEntity;
import com.service.LeixingService; import com.service.LeixingService;
import com.entity.vo.LeixingVO; import com.entity.vo.LeixingVO;
import com.entity.view.LeixingView; import com.entity.view.LeixingView;
@Service("leixingService") // 将该类标记为Spring的Service组件
@Service("leixingService")
public class LeixingServiceImpl extends ServiceImpl<LeixingDao, LeixingEntity> implements LeixingService { public class LeixingServiceImpl extends ServiceImpl<LeixingDao, LeixingEntity> implements LeixingService {
/**
*
* @param params
* @return
*/
@Override @Override
public PageUtils queryPage(Map<String, Object> params) { public PageUtils queryPage(Map<String, Object> params) {
// 使用selectPage方法进行分页查询
Page<LeixingEntity> page = this.selectPage( Page<LeixingEntity> page = this.selectPage(
new Query<LeixingEntity>(params).getPage(), // 获取分页信息 new Query<LeixingEntity>(params).getPage(),
new EntityWrapper<LeixingEntity>() // 创建查询条件 new EntityWrapper<LeixingEntity>()
); );
return new PageUtils(page); // 返回分页结果 return new PageUtils(page);
} }
/**
*
* @param params
* @param wrapper
* @return
*/
@Override @Override
public PageUtils queryPage(Map<String, Object> params, Wrapper<LeixingEntity> wrapper) { public PageUtils queryPage(Map<String, Object> params, Wrapper<LeixingEntity> wrapper) {
// 创建分页对象 Page<LeixingView> page =new Query<LeixingView>(params).getPage();
Page<LeixingView> page = new Query<LeixingView>(params).getPage(); page.setRecords(baseMapper.selectListView(page,wrapper));
// 设置记录 PageUtils pageUtil = new PageUtils(page);
page.setRecords(baseMapper.selectListView(page, wrapper)); return pageUtil;
return new PageUtils(page); // 返回分页结果
} }
/**
* VO
* @param wrapper
* @return VO
*/
@Override @Override
public List<LeixingVO> selectListVO(Wrapper<LeixingEntity> wrapper) { public List<LeixingVO> selectListVO(Wrapper<LeixingEntity> wrapper) {
return baseMapper.selectListVO(wrapper); // 调用数据访问对象方法返回VO对象列表 return baseMapper.selectListVO(wrapper);
} }
/**
* VO
* @param wrapper
* @return VO
*/
@Override @Override
public LeixingVO selectVO(Wrapper<LeixingEntity> wrapper) { public LeixingVO selectVO(Wrapper<LeixingEntity> wrapper) {
return baseMapper.selectVO(wrapper); // 调用数据访问对象方法返回单个VO对象 return baseMapper.selectVO(wrapper);
} }
/**
*
* @param wrapper
* @return
*/
@Override @Override
public List<LeixingView> selectListView(Wrapper<LeixingEntity> wrapper) { public List<LeixingView> selectListView(Wrapper<LeixingEntity> wrapper) {
return baseMapper.selectListView(wrapper); // 调用数据访问对象方法,返回视图对象列表 return baseMapper.selectListView(wrapper);
} }
/**
*
* @param wrapper
* @return
*/
@Override @Override
public LeixingView selectView(Wrapper<LeixingEntity> wrapper) { public LeixingView selectView(Wrapper<LeixingEntity> wrapper) {
return baseMapper.selectView(wrapper); // 调用数据访问对象方法,返回单个视图对象 return baseMapper.selectView(wrapper);
} }
}

@ -18,52 +18,46 @@ import com.service.NewsService;
import com.entity.vo.NewsVO; import com.entity.vo.NewsVO;
import com.entity.view.NewsView; import com.entity.view.NewsView;
@Service("newsService") // 声明该类为服务层组件,并指定服务名称为 "newsService" @Service("newsService")
public class NewsServiceImpl extends ServiceImpl<NewsDao, NewsEntity> implements NewsService { public class NewsServiceImpl extends ServiceImpl<NewsDao, NewsEntity> implements NewsService {
// 实现分页查询
@Override @Override
public PageUtils queryPage(Map<String, Object> params) { public PageUtils queryPage(Map<String, Object> params) {
// 创建一个分页对象,使用传入的参数获取页面信息
Page<NewsEntity> page = this.selectPage( Page<NewsEntity> page = this.selectPage(
new Query<NewsEntity>(params).getPage(), // 获取分页对象 new Query<NewsEntity>(params).getPage(),
new EntityWrapper<NewsEntity>() // 构建查询条件的包装器 new EntityWrapper<NewsEntity>()
); );
return new PageUtils(page); // 返回分页结果包装 return new PageUtils(page);
} }
// 实现带条件的分页查询
@Override @Override
public PageUtils queryPage(Map<String, Object> params, Wrapper<NewsEntity> wrapper) { public PageUtils queryPage(Map<String, Object> params, Wrapper<NewsEntity> wrapper) {
// 创建分页对象 Page<NewsView> page =new Query<NewsView>(params).getPage();
Page<NewsView> page = new Query<NewsView>(params).getPage(); page.setRecords(baseMapper.selectListView(page,wrapper));
// 设置页面记录 PageUtils pageUtil = new PageUtils(page);
page.setRecords(baseMapper.selectListView(page, wrapper)); return pageUtil;
PageUtils pageUtil = new PageUtils(page); // 包装分页结果
return pageUtil; // 返回分页结果
} }
// 查询符合条件的所有 NewsVO 对象
@Override @Override
public List<NewsVO> selectListVO(Wrapper<NewsEntity> wrapper) { public List<NewsVO> selectListVO(Wrapper<NewsEntity> wrapper) {
return baseMapper.selectListVO(wrapper); // 调用 DAO 层方法执行查询 return baseMapper.selectListVO(wrapper);
} }
// 查询单个 NewsVO 对象
@Override @Override
public NewsVO selectVO(Wrapper<NewsEntity> wrapper) { public NewsVO selectVO(Wrapper<NewsEntity> wrapper) {
return baseMapper.selectVO(wrapper); // 调用 DAO 层方法执行查询 return baseMapper.selectVO(wrapper);
} }
// 查询符合条件的所有 NewsView 对象
@Override @Override
public List<NewsView> selectListView(Wrapper<NewsEntity> wrapper) { public List<NewsView> selectListView(Wrapper<NewsEntity> wrapper) {
return baseMapper.selectListView(wrapper); // 调用 DAO 层方法执行查询 return baseMapper.selectListView(wrapper);
} }
// 查询单个 NewsView 对象
@Override @Override
public NewsView selectView(Wrapper<NewsEntity> wrapper) { public NewsView selectView(Wrapper<NewsEntity> wrapper) {
return baseMapper.selectView(wrapper); // 调用 DAO 层方法执行查询 return baseMapper.selectView(wrapper);
} }
} }

@ -18,51 +18,46 @@ import com.service.StoreupService;
import com.entity.vo.StoreupVO; import com.entity.vo.StoreupVO;
import com.entity.view.StoreupView; import com.entity.view.StoreupView;
@Service("storeupService") // 将该类标记为服务,并指定 bean 的名称为 "storeupService" @Service("storeupService")
public class StoreupServiceImpl extends ServiceImpl<StoreupDao, StoreupEntity> implements StoreupService { public class StoreupServiceImpl extends ServiceImpl<StoreupDao, StoreupEntity> implements StoreupService {
@Override @Override
public PageUtils queryPage(Map<String, Object> params) { public PageUtils queryPage(Map<String, Object> params) {
// 根据传入的参数创建分页对象,并调用 selectPage 方法获取数据
Page<StoreupEntity> page = this.selectPage( Page<StoreupEntity> page = this.selectPage(
new Query<StoreupEntity>(params).getPage(), // 构造分页信息 new Query<StoreupEntity>(params).getPage(),
new EntityWrapper<StoreupEntity>() // 创建 EntityWrapper 用于封装查询条件 new EntityWrapper<StoreupEntity>()
); );
// 返回封装好的分页结果
return new PageUtils(page); return new PageUtils(page);
} }
@Override @Override
public PageUtils queryPage(Map<String, Object> params, Wrapper<StoreupEntity> wrapper) { public PageUtils queryPage(Map<String, Object> params, Wrapper<StoreupEntity> wrapper) {
// 创建分页对象 Page<StoreupView> page =new Query<StoreupView>(params).getPage();
Page<StoreupView> page = new Query<StoreupView>(params).getPage(); page.setRecords(baseMapper.selectListView(page,wrapper));
// 设置分页记录
page.setRecords(baseMapper.selectListView(page, wrapper)); // 根据分页信息和条件查询数据
// 返回封装好的分页结果
PageUtils pageUtil = new PageUtils(page); PageUtils pageUtil = new PageUtils(page);
return pageUtil; return pageUtil;
} }
@Override @Override
public List<StoreupVO> selectListVO(Wrapper<StoreupEntity> wrapper) { public List<StoreupVO> selectListVO(Wrapper<StoreupEntity> wrapper) {
// 根据 Wrapper 条件查询并返回 StoreupVO 列表
return baseMapper.selectListVO(wrapper); return baseMapper.selectListVO(wrapper);
} }
@Override @Override
public StoreupVO selectVO(Wrapper<StoreupEntity> wrapper) { public StoreupVO selectVO(Wrapper<StoreupEntity> wrapper) {
// 根据 Wrapper 条件查询并返回单个 StoreupVO 对象
return baseMapper.selectVO(wrapper); return baseMapper.selectVO(wrapper);
} }
@Override @Override
public List<StoreupView> selectListView(Wrapper<StoreupEntity> wrapper) { public List<StoreupView> selectListView(Wrapper<StoreupEntity> wrapper) {
// 根据 Wrapper 条件查询并返回 StoreupView 列表
return baseMapper.selectListView(wrapper); return baseMapper.selectListView(wrapper);
} }
@Override @Override
public StoreupView selectView(Wrapper<StoreupEntity> wrapper) { public StoreupView selectView(Wrapper<StoreupEntity> wrapper) {
// 根据 Wrapper 条件查询并返回单个 StoreupView 对象
return baseMapper.selectView(wrapper); return baseMapper.selectView(wrapper);
} }
} }

@ -18,51 +18,46 @@ import com.service.SystemintroService;
import com.entity.vo.SystemintroVO; import com.entity.vo.SystemintroVO;
import com.entity.view.SystemintroView; import com.entity.view.SystemintroView;
@Service("systemintroService") // 将该类标记为服务,并指定 bean 的名称为 "systemintroService" @Service("systemintroService")
public class SystemintroServiceImpl extends ServiceImpl<SystemintroDao, SystemintroEntity> implements SystemintroService { public class SystemintroServiceImpl extends ServiceImpl<SystemintroDao, SystemintroEntity> implements SystemintroService {
@Override @Override
public PageUtils queryPage(Map<String, Object> params) { public PageUtils queryPage(Map<String, Object> params) {
// 根据传入的参数创建分页对象,并调用 selectPage 方法获取数据
Page<SystemintroEntity> page = this.selectPage( Page<SystemintroEntity> page = this.selectPage(
new Query<SystemintroEntity>(params).getPage(), // 构造分页信息 new Query<SystemintroEntity>(params).getPage(),
new EntityWrapper<SystemintroEntity>() // 创建 EntityWrapper 用于封装查询条件 new EntityWrapper<SystemintroEntity>()
); );
// 返回封装好的分页结果
return new PageUtils(page); return new PageUtils(page);
} }
@Override @Override
public PageUtils queryPage(Map<String, Object> params, Wrapper<SystemintroEntity> wrapper) { public PageUtils queryPage(Map<String, Object> params, Wrapper<SystemintroEntity> wrapper) {
// 创建分页对象 Page<SystemintroView> page =new Query<SystemintroView>(params).getPage();
Page<SystemintroView> page = new Query<SystemintroView>(params).getPage(); page.setRecords(baseMapper.selectListView(page,wrapper));
// 设置分页记录
page.setRecords(baseMapper.selectListView(page, wrapper)); // 根据分页信息和条件查询数据
// 返回封装好的分页结果
PageUtils pageUtil = new PageUtils(page); PageUtils pageUtil = new PageUtils(page);
return pageUtil; return pageUtil;
} }
@Override @Override
public List<SystemintroVO> selectListVO(Wrapper<SystemintroEntity> wrapper) { public List<SystemintroVO> selectListVO(Wrapper<SystemintroEntity> wrapper) {
// 根据 Wrapper 条件查询并返回 SystemintroVO 列表
return baseMapper.selectListVO(wrapper); return baseMapper.selectListVO(wrapper);
} }
@Override @Override
public SystemintroVO selectVO(Wrapper<SystemintroEntity> wrapper) { public SystemintroVO selectVO(Wrapper<SystemintroEntity> wrapper) {
// 根据 Wrapper 条件查询并返回单个 SystemintroVO 对象
return baseMapper.selectVO(wrapper); return baseMapper.selectVO(wrapper);
} }
@Override @Override
public List<SystemintroView> selectListView(Wrapper<SystemintroEntity> wrapper) { public List<SystemintroView> selectListView(Wrapper<SystemintroEntity> wrapper) {
// 根据 Wrapper 条件查询并返回 SystemintroView 列表
return baseMapper.selectListView(wrapper); return baseMapper.selectListView(wrapper);
} }
@Override @Override
public SystemintroView selectView(Wrapper<SystemintroEntity> wrapper) { public SystemintroView selectView(Wrapper<SystemintroEntity> wrapper) {
// 根据 Wrapper 条件查询并返回单个 SystemintroView 对象
return baseMapper.selectView(wrapper); return baseMapper.selectView(wrapper);
} }
} }

@ -21,33 +21,28 @@ import com.utils.Query;
/** /**
* *
*/ */
@Service("usersService") // 将该类标记为服务,并指定 bean 的名称为 "usersService" @Service("usersService")
public class UsersServiceImpl extends ServiceImpl<UsersDao, UsersEntity> implements UsersService { public class UsersServiceImpl extends ServiceImpl<UsersDao, UsersEntity> implements UsersService {
@Override @Override
public PageUtils queryPage(Map<String, Object> params) { public PageUtils queryPage(Map<String, Object> params) {
// 根据传入的参数创建分页对象,并调用 selectPage 方法获取用户数据
Page<UsersEntity> page = this.selectPage( Page<UsersEntity> page = this.selectPage(
new Query<UsersEntity>(params).getPage(), // 构造分页信息 new Query<UsersEntity>(params).getPage(),
new EntityWrapper<UsersEntity>() // 创建 EntityWrapper 用于封装查询条件 new EntityWrapper<UsersEntity>()
); );
// 返回封装好的分页结果
return new PageUtils(page); return new PageUtils(page);
} }
@Override @Override
public List<UsersEntity> selectListView(Wrapper<UsersEntity> wrapper) { public List<UsersEntity> selectListView(Wrapper<UsersEntity> wrapper) {
// 根据 Wrapper 条件查询并返回 UsersEntity 列表
return baseMapper.selectListView(wrapper); return baseMapper.selectListView(wrapper);
} }
@Override @Override
public PageUtils queryPage(Map<String, Object> params, Wrapper<UsersEntity> wrapper) { public PageUtils queryPage(Map<String, Object> params,
// 创建分页对象 Wrapper<UsersEntity> wrapper) {
Page<UsersEntity> page = new Query<UsersEntity>(params).getPage(); Page<UsersEntity> page =new Query<UsersEntity>(params).getPage();
// 设置分页记录 page.setRecords(baseMapper.selectListView(page,wrapper));
page.setRecords(baseMapper.selectListView(page, wrapper)); // 根据分页信息和条件查询数据
// 返回封装好的分页结果
PageUtils pageUtil = new PageUtils(page); PageUtils pageUtil = new PageUtils(page);
return pageUtil; return pageUtil;
} }

@ -11,27 +11,19 @@ import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.utils.PageUtils; import com.utils.PageUtils;
import com.utils.Query; import com.utils.Query;
import com.dao.WenjuandiaochaDao; import com.dao.WenjuandiaochaDao;
import com.entity.WenjuandiaochaEntity; import com.entity.WenjuandiaochaEntity;
import com.service.WenjuandiaochaService; import com.service.WenjuandiaochaService;
import com.entity.vo.WenjuandiaochaVO; import com.entity.vo.WenjuandiaochaVO;
import com.entity.view.Wenjuandiaocha; import com.entity.view.WenjuandiaochaView;
/**
*
* MyBatis-PlusServiceImplWenjuandiaochaService
*/
@Service("wenjuandiaochaService") @Service("wenjuandiaochaService")
public class WenjuandiaochaServiceImpl extends ServiceImpl<WenjuandiaochaDao, WenjuandiaochaEntity> implements WenjuandiaochaService { public class WenjuandiaochaServiceImpl extends ServiceImpl<WenjuandiaochaDao, WenjuandiaochaEntity> implements WenjuandiaochaService {
/**
*
* @param params
* @return
*/
@Override @Override
public PageUtils queryPage(Map<String, Object> params) { public PageUtils queryPage(Map<String, Object> params) {
// 使用MyBatis-Plus的分页插件进行分页查询
Page<WenjuandiaochaEntity> page = this.selectPage( Page<WenjuandiaochaEntity> page = this.selectPage(
new Query<WenjuandiaochaEntity>(params).getPage(), new Query<WenjuandiaochaEntity>(params).getPage(),
new EntityWrapper<WenjuandiaochaEntity>() new EntityWrapper<WenjuandiaochaEntity>()
@ -39,93 +31,50 @@ public class WenjuandiaochaServiceImpl extends ServiceImpl<WenjuandiaochaDao, We
return new PageUtils(page); return new PageUtils(page);
} }
/**
*
* @param params
* @param wrapper
* @return
*/
@Override @Override
public PageUtils queryPage(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper) { public PageUtils queryPage(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper) {
// 创建分页对象 Page<WenjuandiaochaView> page =new Query<WenjuandiaochaView>(params).getPage();
Page<WenjuandiaochaView> page = new Query<WenjuandiaochaView>(params).getPage(); page.setRecords(baseMapper.selectListView(page,wrapper));
// 设置分页记录
page.setRecords(baseMapper.selectListView(page, wrapper));
// 返回分页工具类
PageUtils pageUtil = new PageUtils(page); PageUtils pageUtil = new PageUtils(page);
return pageUtil; return pageUtil;
} }
/**
*
* @param wrapper
* @return
*/
@Override @Override
public List<WenjuandiaochaVO> selectListVO(Wrapper<WenjuandiaochaEntity> wrapper) { public List<WenjuandiaochaVO> selectListVO(Wrapper<WenjuandiaochaEntity> wrapper) {
return baseMapper.selectListVO(wrapper); return baseMapper.selectListVO(wrapper);
} }
/**
*
* @param wrapper
* @return
*/
@Override @Override
public WenjuandiaochaVO selectVO(Wrapper<WenjuandiaochaEntity> wrapper) { public WenjuandiaochaVO selectVO(Wrapper<WenjuandiaochaEntity> wrapper) {
return baseMapper.selectVO(wrapper); return baseMapper.selectVO(wrapper);
} }
/**
*
* @param wrapper
* @return
*/
@Override @Override
public List<WenjuandiaochaView> selectListView(Wrapper<WenjuandiaochaEntity> wrapper) { public List<WenjuandiaochaView> selectListView(Wrapper<WenjuandiaochaEntity> wrapper) {
return baseMapper.selectListView(wrapper); return baseMapper.selectListView(wrapper);
} }
/**
*
* @param wrapper
* @return
*/
@Override @Override
public WenjuandiaochaView selectView(Wrapper<WenjuandiaochaEntity> wrapper) { public WenjuandiaochaView selectView(Wrapper<WenjuandiaochaEntity> wrapper) {
return baseMapper.selectView(wrapper); return baseMapper.selectView(wrapper);
} }
/**
*
* @param params
* @param wrapper
* @return
*/
@Override @Override
public List<Map<String, Object>> selectValue(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper) { public List<Map<String, Object>> selectValue(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper) {
return baseMapper.selectValue(params, wrapper); return baseMapper.selectValue(params, wrapper);
} }
/**
*
* @param params
* @param wrapper
* @return
*/
@Override @Override
public List<Map<String, Object>> selectTimeStatValue(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper) { public List<Map<String, Object>> selectTimeStatValue(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper) {
return baseMapper.selectTimeStatValue(params, wrapper); return baseMapper.selectTimeStatValue(params, wrapper);
} }
/**
*
* @param params
* @param wrapper
* @return
*/
@Override @Override
public List<Map<String, Object>> selectGroup(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper) { public List<Map<String, Object>> selectGroup(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper) {
return baseMapper.selectGroup(params, wrapper); return baseMapper.selectGroup(params, wrapper);
} }
} }

@ -1,7 +1,7 @@
package com.utils; package com.utils;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.File;// 导入File类 import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@ -11,26 +11,17 @@ import java.io.InputStream;
*/ */
public class FileUtil { public class FileUtil {
/**
*
* @param file
* @return
* @throws IOException
*/
public static byte[] FileToByte(File file) throws IOException { public static byte[] FileToByte(File file) throws IOException {
// 将文件数据转为输入 // 将数据转为流
@SuppressWarnings("resource") // 这个资源在方法末尾会自动关闭,抑制编译警告 @SuppressWarnings("resource")
InputStream content = new FileInputStream(file); // 创建FileInputStream对象读取文件 InputStream content = new FileInputStream(file);
ByteArrayOutputStream swapStream = new ByteArrayOutputStream(); // 创建字节数组输出流对象 ByteArrayOutputStream swapStream = new ByteArrayOutputStream();
byte[] buff = new byte[100]; byte[] buff = new byte[100];
int rc = 0; int rc = 0;
// 循环读取文件数据,直到文件结束
while ((rc = content.read(buff, 0, 100)) > 0) { while ((rc = content.read(buff, 0, 100)) > 0) {
swapStream.write(buff, 0, rc); // 将读取的数据写入字节数组输出流 swapStream.write(buff, 0, rc);
} }
// 获得二进制数组
return swapStream.toByteArray(); return swapStream.toByteArray();
} }
} }

@ -1,8 +1,8 @@
validationQuery=SELECT 1 validationQuery=SELECT 1
jdbc_url=jdbc:mysql://127.0.0.1:3306/jspm0c59i?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true jdbc_url=jdbc:mysql://127.0.0.1:3306/jspm0c59i?useUnicode=true&characterEncoding=UTF-8&tinyInt1isBit=false
jdbc_username=root jdbc_username=root
jdbc_password=ZST123456 jdbc_password=123456
#jdbc_url=jdbc:sqlserver://127.0.0.1:1433;DatabaseName=jspm0c59i #jdbc_url=jdbc:sqlserver://127.0.0.1:1433;DatabaseName=jspm0c59i
#jdbc_username=sa #jdbc_username=sa

@ -3,109 +3,38 @@
<mapper namespace="com.dao.ChatDao"> <mapper namespace="com.dao.ChatDao">
<!-- <!-- 可根据自己的需求,是否要使用 -->
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.ChatEntity的属性
-->
<resultMap type="com.entity.ChatEntity" id="chatMap"> <resultMap type="com.entity.ChatEntity" id="chatMap">
<result property="userid" column="userid"/> <!-- 将数据库列userid映射到ChatEntity的属性userid --> <result property="userid" column="userid"/>
<result property="adminid" column="adminid"/> <!-- 将数据库列adminid映射到ChatEntity的属性adminid --> <result property="adminid" column="adminid"/>
<result property="ask" column="ask"/> <!-- 将数据库列ask映射到ChatEntity的属性ask --> <result property="ask" column="ask"/>
<result property="reply" column="reply"/> <!-- 将数据库列reply映射到ChatEntity的属性reply --> <result property="reply" column="reply"/>
<result property="isreply" column="isreply"/> <!-- 将数据库列isreply映射到ChatEntity的属性isreply --> <result property="isreply" column="isreply"/>
</resultMap> </resultMap>
<!--
分页查询Chat的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.ChatVO
-->
<select id="selectListVO" <select id="selectListVO"
resultType="com.entity.vo.ChatVO"> resultType="com.entity.vo.ChatVO" >
SELECT * FROM chat chat SELECT * FROM chat chat
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<!--
查询单个Chat的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.ChatVO
-->
<select id="selectVO" <select id="selectVO"
resultType="com.entity.vo.ChatVO"> resultType="com.entity.vo.ChatVO" >
SELECT chat.* FROM chat chat SELECT chat.* FROM chat chat
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<!--
分页查询Chat的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.ChatView
-->
<select id="selectListView" <select id="selectListView"
resultType="com.entity.view.ChatView"> resultType="com.entity.view.ChatView" >
SELECT chat.* FROM chat chat SELECT chat.* FROM chat chat
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<!--
查询单个Chat的视图记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.ChatView
-->
<select id="selectView" <select id="selectView"
resultType="com.entity.view.ChatView"> resultType="com.entity.view.ChatView" >
SELECT * FROM chat chat SELECT * FROM chat chat <where> 1=1 ${ew.sqlSegment}</where>
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
查询Chat的统计值
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为map
这里假设需要查询每个用户和管理员的聊天总数,具体查询逻辑需要根据实际需求编写
-->
<select id="selectValue"
resultType="map">
SELECT COUNT(*) AS total, userid, adminid
FROM chat chat
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
GROUP BY userid, adminid <!-- 按userid和adminid分组统计每个用户和管理员的聊天总数 -->
</select> </select>
<!--
查询Chat的时间统计值
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为map
这里假设需要查询某个时间范围内的每日聊天总数,具体查询逻辑需要根据实际需求编写
-->
<select id="selectTimeStatValue"
resultType="map">
SELECT DATE(ask) AS date, COUNT(*) AS count
FROM chat chat
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE(ask) <!-- 按ask列的日期分组统计每日聊天总数 -->
</select>
<!--
查询Chat的分组统计值
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为map
这里假设需要查询按isreply字段分组的聊天记录数具体查询逻辑需要根据实际需求编写
-->
<select id="selectGroup"
resultType="map">
SELECT isreply, COUNT(*) AS count
FROM chat chat
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
GROUP BY isreply <!-- 按isreply字段分组统计每个分组的聊天记录数 -->
</select>
</mapper> </mapper>

@ -2,158 +2,70 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dao.CommonDao"> <mapper namespace="com.dao.CommonDao">
<select id="getOption" resultType="String" >
<!-- SELECT distinct ${column} FROM ${table}
查询表中的唯一选项值 where ${column} is not null and ${column} !=''
@param column 需要查询的列名 <if test = "conditionColumn != null and conditionValue != null">
@param table 需要查询的表名 and ${conditionColumn}=#{conditionValue}
@param conditionColumn 附加条件的列名(可选)
@param conditionValue 附加条件的列值(可选)
@param level 级别条件(可选)
@param parent 父级条件(可选)
@return 唯一的选项值列表
-->
<select id="getOption" resultType="String">
SELECT DISTINCT ${column} FROM ${table}
WHERE ${column} IS NOT NULL AND ${column} != ''
<!-- 如果条件列和条件值不为空,则添加相应的条件 -->
<if test="conditionColumn != null and conditionValue != null">
AND ${conditionColumn} = #{conditionValue}
</if> </if>
<!-- 如果级别条件不为空,则添加相应的条件 --> <if test = "level != null">
<if test="level != null"> and level=#{level}
AND level = #{level}
</if> </if>
<!-- 如果父级条件不为空,则添加相应的条件 --> <if test = "parent != null">
<if test="parent != null"> and parent=#{parent}
AND parent = #{parent}
</if> </if>
</select> </select>
<!-- <select id="getFollowByOption" resultType="map" >
根据选项值查询表中的记录 SELECT * FROM ${table} where ${column}=#{columnValue}
@param column 需要查询的列名
@param columnValue 列的值
@param table 需要查询的表名
@return 符合条件的记录列表
-->
<select id="getFollowByOption" resultType="map">
SELECT * FROM ${table}
WHERE ${column} = #{columnValue}
</select> </select>
<!--
更新表中记录的审核状态
@param table 需要更新的表名
@param sfsh 审核状态
@param id 记录的id
-->
<update id="sh"> <update id="sh">
UPDATE ${table} UPDATE ${table} set sfsh=#{sfsh} where id=#{id}
SET sfsh = #{sfsh}
WHERE id = #{id}
</update> </update>
<!-- <select id="remindCount" resultType="int" >
查询表中需要提醒的记录数 SELECT count(1) FROM ${table}
@param table 需要查询的表名 where 1=1
@param column 需要查询的列名 <if test = "type == 1 ">
@param type 提醒类型1或2 <if test = " remindstart != null ">
@param remindstart 提醒开始时间 and ${column} &gt;= #{remindstart}
@param remindend 提醒结束时间
@return 符合条件的记录数
-->
<select id="remindCount" resultType="int">
SELECT COUNT(1) FROM ${table}
WHERE 1=1
<!-- 如果类型为1则根据数值范围进行过滤 -->
<if test="type == 1">
<if test="remindstart != null">
AND ${column} >= #{remindstart}
</if> </if>
<if test="remindend != null"> <if test = " remindend != null ">
AND ${column} <= #{remindend} and ${column} &lt;= #{remindend}
</if> </if>
</if> </if>
<!-- 如果类型为2则根据日期范围进行过滤 --> <if test = "type == 2 ">
<if test="type == 2"> <if test = " remindstart != null ">
<if test="remindstart != null"> and ${column} &gt;= str_to_date(#{remindstart},'%Y-%m-%d')
AND ${column} >= STR_TO_DATE(#{remindstart}, '%Y-%m-%d')
</if> </if>
<if test="remindend != null"> <if test = " remindend != null ">
AND ${column} <= STR_TO_DATE(#{remindend}, '%Y-%m-%d') and ${column} &lt;= str_to_date(#{remindend},'%Y-%m-%d')
</if> </if>
</if> </if>
</select> </select>
<!-- <select id="selectCal" resultType="map" >
查询表中某一列的统计信息(总和、最大值、最小值、平均值) SELECT sum(${column}) sum,max(${column}) max,min(${column}) min,avg(${column}) avg FROM ${table}
@param column 需要查询的列名
@param table 需要查询的表名
@return 包含统计信息的map
-->
<select id="selectCal" resultType="map">
SELECT SUM(${column}) AS sum,
MAX(${column}) AS max,
MIN(${column}) AS min,
AVG(${column}) AS avg
FROM ${table}
</select> </select>
<!-- <select id="selectGroup" resultType="map" >
按某一列分组查询记录总数 SELECT ${column} , count(1) total FROM ${table} group by ${column}
@param column 需要分组的列名
@param table 需要查询的表名
@return 包含分组信息和记录总数的map列表
-->
<select id="selectGroup" resultType="map">
SELECT ${column},
COUNT(1) AS total
FROM ${table}
GROUP BY ${column}
</select> </select>
<!-- <select id="selectValue" resultType="map" >
按某一列分组查询另一列的总和 SELECT ${xColumn}, sum(${yColumn}) total FROM ${table} group by ${xColumn}
@param xColumn 需要分组的列名
@param yColumn 需要求和的列名
@param table 需要查询的表名
@return 包含分组信息和总和的map列表
-->
<select id="selectValue" resultType="map">
SELECT ${xColumn},
SUM(${yColumn}) AS total
FROM ${table}
GROUP BY ${xColumn}
</select> </select>
<!-- <select id="selectTimeStatValue" resultType="map" >
按时间统计查询某一列的总和 <if test = 'timeStatType == "日"'>
@param timeStatType 时间统计类型(日、月、年) SELECT DATE_FORMAT(${xColumn},'%Y-%m-%d') ${xColumn}, sum(${yColumn}) total FROM ${table} group by DATE_FORMAT(${xColumn},'%Y-%m-%d')
@param xColumn 需要格式化的时间列名
@param yColumn 需要求和的列名
@param table 需要查询的表名
@return 包含格式化时间信息和总和的map列表
-->
<select id="selectTimeStatValue" resultType="map">
<!-- 根据时间统计类型进行不同的日期格式化处理 -->
<if test='timeStatType == "日"'>
SELECT DATE_FORMAT(${xColumn}, '%Y-%m-%d') AS ${xColumn},
SUM(${yColumn}) AS total
FROM ${table}
GROUP BY DATE_FORMAT(${xColumn}, '%Y-%m-%d')
</if> </if>
<if test='timeStatType == "月"'> <if test = 'timeStatType == "月"'>
SELECT DATE_FORMAT(${xColumn}, '%Y-%m') AS ${xColumn}, SELECT DATE_FORMAT(${xColumn},'%Y-%m') ${xColumn}, sum(${yColumn}) total FROM ${table} group by DATE_FORMAT(${xColumn},'%Y-%m')
SUM(${yColumn}) AS total
FROM ${table}
GROUP BY DATE_FORMAT(${xColumn}, '%Y-%m')
</if> </if>
<if test='timeStatType == "年"'> <if test = 'timeStatType == "年"'>
SELECT DATE_FORMAT(${xColumn}, '%Y') AS ${xColumn}, SELECT DATE_FORMAT(${xColumn},'%Y') ${xColumn}, sum(${yColumn}) total FROM ${table} group by DATE_FORMAT(${xColumn},'%Y')
SUM(${yColumn}) AS total
FROM ${table}
GROUP BY DATE_FORMAT(${xColumn}, '%Y')
</if> </if>
</select> </select>
</mapper> </mapper>

@ -1,8 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.ConfigDao"> <mapper namespace="com.dao.ConfigDao">
<!-- 定义Mapper的命名空间对应于ConfigDao接口 -->
</mapper> </mapper>

@ -1,71 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.ForumDao"> <mapper namespace="com.dao.ForumDao">
<!-- 定义Mapper的命名空间对应于ForumDao接口 -->
<!-- <!-- 可根据自己的需求,是否要使用 -->
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.ForumEntity的属性
-->
<resultMap type="com.entity.ForumEntity" id="forumMap"> <resultMap type="com.entity.ForumEntity" id="forumMap">
<result property="title" column="title"/> <!-- 将数据库列title映射到ForumEntity的属性title --> <result property="title" column="title"/>
<result property="content" column="content"/> <!-- 将数据库列content映射到ForumEntity的属性content --> <result property="content" column="content"/>
<result property="parentid" column="parentid"/> <!-- 将数据库列parentid映射到ForumEntity的属性parentid --> <result property="parentid" column="parentid"/>
<result property="userid" column="userid"/> <!-- 将数据库列userid映射到ForumEntity的属性userid --> <result property="userid" column="userid"/>
<result property="username" column="username"/> <!-- 将数据库列username映射到ForumEntity的属性username --> <result property="username" column="username"/>
<result property="avatarurl" column="avatarurl"/> <!-- 将数据库列avatarurl映射到ForumEntity的属性avatarurl --> <result property="avatarurl" column="avatarurl"/>
<result property="isdone" column="isdone"/> <!-- 将数据库列isdone映射到ForumEntity的属性isdone --> <result property="isdone" column="isdone"/>
</resultMap> </resultMap>
<!--
分页查询Forum的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.ForumVO
-->
<select id="selectListVO" <select id="selectListVO"
resultType="com.entity.vo.ForumVO"> resultType="com.entity.vo.ForumVO" >
SELECT * FROM forum forum SELECT * FROM forum forum
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<!--
查询单个Forum的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.ForumVO
-->
<select id="selectVO" <select id="selectVO"
resultType="com.entity.vo.ForumVO"> resultType="com.entity.vo.ForumVO" >
SELECT forum.* FROM forum forum SELECT forum.* FROM forum forum
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<!--
分页查询Forum的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.ForumView
-->
<select id="selectListView" <select id="selectListView"
resultType="com.entity.view.ForumView"> resultType="com.entity.view.ForumView" >
SELECT forum.* FROM forum forum SELECT forum.* FROM forum forum
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<!--
查询单个Forum的视图记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.ForumView
-->
<select id="selectView" <select id="selectView"
resultType="com.entity.view.ForumView"> resultType="com.entity.view.ForumView" >
SELECT * FROM forum forum SELECT * FROM forum forum <where> 1=1 ${ew.sqlSegment}</where>
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
</mapper> </mapper>

@ -1,108 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.LeixingDao"> <mapper namespace="com.dao.LeixingDao">
<!-- 定义Mapper的命名空间对应于LeixingDao接口 -->
<!-- <!-- 可根据自己的需求,是否要使用 -->
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.LeixingEntity的属性
-->
<resultMap type="com.entity.LeixingEntity" id="leixingMap"> <resultMap type="com.entity.LeixingEntity" id="leixingMap">
<result property="leixing" column="leixing"/> <!-- 将数据库列leixing映射到LeixingEntity的属性leixing --> <result property="leixing" column="leixing"/>
</resultMap> </resultMap>
<!--
分页查询Leixing的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.LeixingVO
-->
<select id="selectListVO" <select id="selectListVO"
resultType="com.entity.vo.LeixingVO"> resultType="com.entity.vo.LeixingVO" >
SELECT * FROM leixing leixing SELECT * FROM leixing leixing
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<!--
查询单个Leixing的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.LeixingVO
-->
<select id="selectVO" <select id="selectVO"
resultType="com.entity.vo.LeixingVO"> resultType="com.entity.vo.LeixingVO" >
SELECT leixing.* FROM leixing leixing SELECT leixing.* FROM leixing leixing
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
当然,我会在你的代码中添加详细的注释,以确保每个部分的功能和参数都能被详细理解。以下是添加了注释的代码:
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.LeixingDao">
<!-- 定义Mapper的命名空间对应于LeixingDao接口 -->
<!--
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.LeixingEntity的属性
-->
<resultMap type="com.entity.LeixingEntity" id="leixingMap">
<result property="leixing" column="leixing"/> <!-- 将数据库列leixing映射到LeixingEntity的属性leixing -->
</resultMap>
<!--
分页查询Leixing的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.LeixingVO
-->
<select id="selectListVO"
resultType="com.entity.vo.LeixingVO">
SELECT * FROM leixing leixing
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<!--
查询单个Leixing的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.LeixingVO
-->
<select id="selectVO"
resultType="com.entity.vo.LeixingVO">
SELECT leixing.* FROM leixing leixing
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
分页查询Leixing的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.LeixingView
-->
<select id="selectListView" <select id="selectListView"
resultType="com.entity.view.LeixingView"> resultType="com.entity.view.LeixingView" >
SELECT leixing.* FROM leixing leixing SELECT leixing.* FROM leixing leixing
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<!--
查询单个Leixing的视图记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.LeixingView
-->
<select id="selectView" <select id="selectView"
resultType="com.entity.view.LeixingView"> resultType="com.entity.view.LeixingView" >
SELECT * FROM leixing leixing SELECT * FROM leixing leixing <where> 1=1 ${ew.sqlSegment}</where>
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
</mapper> </mapper>

@ -1,68 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.NewsDao"> <mapper namespace="com.dao.NewsDao">
<!-- 定义Mapper的命名空间对应于NewsDao接口 -->
<!-- <!-- 可根据自己的需求,是否要使用 -->
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.NewsEntity的属性
-->
<resultMap type="com.entity.NewsEntity" id="newsMap"> <resultMap type="com.entity.NewsEntity" id="newsMap">
<result property="title" column="title"/> <!-- 将数据库列title映射到NewsEntity的属性title --> <result property="title" column="title"/>
<result property="introduction" column="introduction"/> <!-- 将数据库列introduction映射到NewsEntity的属性introduction --> <result property="introduction" column="introduction"/>
<result property="picture" column="picture"/> <!-- 将数据库列picture映射到NewsEntity的属性picture --> <result property="picture" column="picture"/>
<result property="content" column="content"/> <!-- 将数据库列content映射到NewsEntity的属性content --> <result property="content" column="content"/>
</resultMap> </resultMap>
<!--
分页查询News的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.NewsVO
-->
<select id="selectListVO" <select id="selectListVO"
resultType="com.entity.vo.NewsVO"> resultType="com.entity.vo.NewsVO" >
SELECT * FROM news news SELECT * FROM news news
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<!--
查询单个News的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.NewsVO
-->
<select id="selectVO" <select id="selectVO"
resultType="com.entity.vo.NewsVO"> resultType="com.entity.vo.NewsVO" >
SELECT news.* FROM news news SELECT news.* FROM news news
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<!--
分页查询News的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.NewsView
-->
<select id="selectListView" <select id="selectListView"
resultType="com.entity.view.NewsView"> resultType="com.entity.view.NewsView" >
SELECT news.* FROM news news SELECT news.* FROM news news
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<!--
查询单个News的视图记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.NewsView
-->
<select id="selectView" <select id="selectView"
resultType="com.entity.view.NewsView"> resultType="com.entity.view.NewsView" >
SELECT * FROM news news SELECT * FROM news news <where> 1=1 ${ew.sqlSegment}</where>
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
</mapper> </mapper>

@ -1,72 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.StoreupDao"> <mapper namespace="com.dao.StoreupDao">
<!-- 定义Mapper的命名空间对应于StoreupDao接口 -->
<!-- <!-- 可根据自己的需求,是否要使用 -->
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.StoreupEntity的属性
-->
<resultMap type="com.entity.StoreupEntity" id="storeupMap"> <resultMap type="com.entity.StoreupEntity" id="storeupMap">
<result property="userid" column="userid"/> <!-- 将数据库列userid映射到StoreupEntity的属性userid --> <result property="userid" column="userid"/>
<result property="refid" column="refid"/> <!-- 将数据库列refid映射到StoreupEntity的属性refid --> <result property="refid" column="refid"/>
<result property="tablename" column="tablename"/> <!-- 将数据库列tablename映射到StoreupEntity的属性tablename --> <result property="tablename" column="tablename"/>
<result property="name" column="name"/> <!-- 将数据库列name映射到StoreupEntity的属性name --> <result property="name" column="name"/>
<result property="picture" column="picture"/> <!-- 将数据库列picture映射到StoreupEntity的属性picture --> <result property="picture" column="picture"/>
<result property="type" column="type"/> <!-- 将数据库列type映射到StoreupEntity的属性type --> <result property="type" column="type"/>
<result property="inteltype" column="inteltype"/> <!-- 将数据库列inteltype映射到StoreupEntity的属性inteltype --> <result property="inteltype" column="inteltype"/>
<result property="remark" column="remark"/> <!-- 将数据库列remark映射到StoreupEntity的属性remark --> <result property="remark" column="remark"/>
</resultMap> </resultMap>
<!--
分页查询Storeup的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.StoreupVO
-->
<select id="selectListVO" <select id="selectListVO"
resultType="com.entity.vo.StoreupVO"> resultType="com.entity.vo.StoreupVO" >
SELECT * FROM storeup storeup SELECT * FROM storeup storeup
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<!--
查询单个Storeup的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.StoreupVO
-->
<select id="selectVO" <select id="selectVO"
resultType="com.entity.vo.StoreupVO"> resultType="com.entity.vo.StoreupVO" >
SELECT storeup.* FROM storeup storeup SELECT storeup.* FROM storeup storeup
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<!--
分页查询Storeup的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.StoreupView
-->
<select id="selectListView" <select id="selectListView"
resultType="com.entity.view.StoreupView"> resultType="com.entity.view.StoreupView" >
SELECT storeup.* FROM storeup storeup SELECT storeup.* FROM storeup storeup
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<!--
查询单个Storeup的视图记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.StoreupView
-->
<select id="selectView" <select id="selectView"
resultType="com.entity.view.StoreupView"> resultType="com.entity.view.StoreupView" >
SELECT * FROM storeup storeup SELECT * FROM storeup storeup <where> 1=1 ${ew.sqlSegment}</where>
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
</mapper> </mapper>

@ -1,70 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.SystemintroDao"> <mapper namespace="com.dao.SystemintroDao">
<!-- 定义Mapper的命名空间对应于SystemintroDao接口 -->
<!-- <!-- 可根据自己的需求,是否要使用 -->
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.SystemintroEntity的属性
-->
<resultMap type="com.entity.SystemintroEntity" id="systemintroMap"> <resultMap type="com.entity.SystemintroEntity" id="systemintroMap">
<result property="title" column="title"/> <!-- 将数据库列title映射到SystemintroEntity的属性title --> <result property="title" column="title"/>
<result property="subtitle" column="subtitle"/> <!-- 将数据库列subtitle映射到SystemintroEntity的属性subtitle --> <result property="subtitle" column="subtitle"/>
<result property="content" column="content"/> <!-- 将数据库列content映射到SystemintroEntity的属性content --> <result property="content" column="content"/>
<result property="picture1" column="picture1"/> <!-- 将数据库列picture1映射到SystemintroEntity的属性picture1 --> <result property="picture1" column="picture1"/>
<result property="picture2" column="picture2"/> <!-- 将数据库列picture2映射到SystemintroEntity的属性picture2 --> <result property="picture2" column="picture2"/>
<result property="picture3" column="picture3"/> <!-- 将数据库列picture3映射到SystemintroEntity的属性picture3 --> <result property="picture3" column="picture3"/>
</resultMap> </resultMap>
<!--
分页查询Systemintro的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.SystemintroVO
-->
<select id="selectListVO" <select id="selectListVO"
resultType="com.entity.vo.SystemintroVO"> resultType="com.entity.vo.SystemintroVO" >
SELECT * FROM systemintro systemintro SELECT * FROM systemintro systemintro
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<!--
查询单个Systemintro的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.SystemintroVO
-->
<select id="selectVO" <select id="selectVO"
resultType="com.entity.vo.SystemintroVO"> resultType="com.entity.vo.SystemintroVO" >
SELECT systemintro.* FROM systemintro systemintro SELECT systemintro.* FROM systemintro systemintro
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<!--
分页查询Systemintro的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.SystemintroView
-->
<select id="selectListView" <select id="selectListView"
resultType="com.entity.view.SystemintroView"> resultType="com.entity.view.SystemintroView" >
SELECT systemintro.* FROM systemintro systemintro SELECT systemintro.* FROM systemintro systemintro
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<!--
查询单个Systemintro的视图记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.SystemintroView
-->
<select id="selectView" <select id="selectView"
resultType="com.entity.view.SystemintroView"> resultType="com.entity.view.SystemintroView" >
SELECT * FROM systemintro systemintro SELECT * FROM systemintro systemintro <where> 1=1 ${ew.sqlSegment}</where>
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
</mapper> </mapper>

@ -1,20 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.TokenDao"> <mapper namespace="com.dao.TokenDao">
<!-- 定义Mapper的命名空间对应于TokenDao接口 -->
<!--
分页查询Token的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.TokenEntity
-->
<select id="selectListView" <select id="selectListView"
resultType="com.entity.TokenEntity" > resultType="com.entity.TokenEntity" >
SELECT t.* FROM token t SELECT t.* FROM token t
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>

@ -1,20 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.UsersDao"> <mapper namespace="com.dao.UsersDao">
<!-- 定义Mapper的命名空间对应于UsersDao接口 -->
<!--
分页查询Users的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.UsersEntity
-->
<select id="selectListView" <select id="selectListView"
resultType="com.entity.UsersEntity" > resultType="com.entity.UsersEntity" >
SELECT u.* FROM users u SELECT u.* FROM users u
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>

@ -1,138 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.WenjuandafuDao"> <mapper namespace="com.dao.WenjuandafuDao">
<!-- 定义Mapper的命名空间对应于WenjuandafuDao接口 -->
<!-- <!-- 可根据自己的需求,是否要使用 -->
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.WenjuandafuEntity的属性
-->
<resultMap type="com.entity.WenjuandafuEntity" id="wenjuandafuMap"> <resultMap type="com.entity.WenjuandafuEntity" id="wenjuandafuMap">
<result property="wenjuanbiaoti" column="wenjuanbiaoti"/> <!-- 将数据库列wenjuanbiaoti映射到WenjuandafuEntity的属性wenjuanbiaoti --> <result property="wenjuanbiaoti" column="wenjuanbiaoti"/>
<result property="leixing" column="leixing"/> <!-- 将数据库列leixing映射到WenjuandafuEntity的属性leixing --> <result property="leixing" column="leixing"/>
<result property="wentiyi" column="wentiyi"/> <!-- 将数据库列wentiyi映射到WenjuandafuEntity的属性wentiyi --> <result property="wentiyi" column="wentiyi"/>
<result property="dafuyi" column="dafuyi"/> <!-- 将数据库列dafuyi映射到WenjuandafuEntity的属性dafuyi --> <result property="dafuyi" column="dafuyi"/>
<result property="wentier" column="wentier"/> <!-- 将数据库列wentier映射到WenjuandafuEntity的属性wentier --> <result property="wentier" column="wentier"/>
<result property="dafuer" column="dafuer"/> <!-- 将数据库列dafuer映射到WenjuandafuEntity的属性dafuer --> <result property="dafuer" column="dafuer"/>
<result property="wentisan" column="wentisan"/> <!-- 将数据库列wentisan映射到WenjuandafuEntity的属性wentisan --> <result property="wentisan" column="wentisan"/>
<result property="dafusan" column="dafusan"/> <!-- 将数据库列dafusan映射到WenjuandafuEntity的属性dafusan --> <result property="dafusan" column="dafusan"/>
<result property="wentisi" column="wentisi"/> <!-- 将数据库列wentisi映射到WenjuandafuEntity的属性wentisi --> <result property="wentisi" column="wentisi"/>
<result property="dafusi" column="dafusi"/> <!-- 将数据库列dafusi映射到WenjuandafuEntity的属性dafusi --> <result property="dafusi" column="dafusi"/>
<result property="wentiwu" column="wentiwu"/> <!-- 将数据库列wentiwu映射到WenjuandafuEntity的属性wentiwu --> <result property="wentiwu" column="wentiwu"/>
<result property="dafuwu" column="dafuwu"/> <!-- 将数据库列dafuwu映射到WenjuandafuEntity的属性dafuwu --> <result property="dafuwu" column="dafuwu"/>
<result property="zhanghao" column="zhanghao"/> <!-- 将数据库列zhanghao映射到WenjuandafuEntity的属性zhanghao --> <result property="zhanghao" column="zhanghao"/>
<result property="xingming" column="xingming"/> <!-- 将数据库列xingming映射到WenjuandafuEntity的属性xingming --> <result property="xingming" column="xingming"/>
<result property="tijiaoriqi" column="tijiaoriqi"/> <!-- 将数据库列tijiaoriqi映射到WenjuandafuEntity的属性tijiaoriqi --> <result property="tijiaoriqi" column="tijiaoriqi"/>
</resultMap> </resultMap>
<!--
分页查询Wenjuandafu的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.WenjuandafuVO
-->
<select id="selectListVO" <select id="selectListVO"
resultType="com.entity.vo.WenjuandafuVO"> resultType="com.entity.vo.WenjuandafuVO" >
SELECT * FROM wenjuandafu wenjuandafu SELECT * FROM wenjuandafu wenjuandafu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<!--
查询单个Wenjuandafu的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.WenjuandafuVO
-->
<select id="selectVO" <select id="selectVO"
resultType="com.entity.vo.WenjuandafuVO"> resultType="com.entity.vo.WenjuandafuVO" >
SELECT wenjuandafu.* FROM wenjuandafu wenjuandafu SELECT wenjuandafu.* FROM wenjuandafu wenjuandafu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<!--
分页查询Wenjuandafu的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.WenjuandafuView
-->
<select id="selectListView" <select id="selectListView"
resultType="com.entity.view.WenjuandafuView"> resultType="com.entity.view.WenjuandafuView" >
SELECT wenjuandafu.* FROM wenjuandafu wenjuandafu SELECT wenjuandafu.* FROM wenjuandafu wenjuandafu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<!--
查询单个Wenjuandafu的视图记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.WenjuandafuView
-->
<select id="selectView" <select id="selectView"
resultType="com.entity.view.WenjuandafuView"> resultType="com.entity.view.WenjuandafuView" >
SELECT * FROM wenjuandafu wenjuandafu SELECT * FROM wenjuandafu wenjuandafu <where> 1=1 ${ew.sqlSegment}</where>
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<!--
查询Wenjuandafu的统计值 <select id="selectValue" resultType="map" >
使用${ew.sqlSegment}来动态拼接SQL条件 SELECT ${params.xColumn}, sum(${params.yColumn}) total FROM wenjuandafu
resultType指定返回的结果类型为map
@param params 包含查询参数的map包括xColumn和yColumn
@return 包含统计值的map列表
-->
<select id="selectValue" resultType="map">
SELECT ${params.xColumn}, sum(${params.yColumn}) AS total FROM wenjuandafu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
GROUP BY ${params.xColumn} <!-- 按xColumn分组统计每个组的yColumn总和 --> group by ${params.xColumn}
LIMIT 10 <!-- 限制结果集最多返回10条记录 --> limit 10
</select> </select>
<!-- <select id="selectTimeStatValue" resultType="map" >
查询Wenjuandafu的时间统计值 <if test = 'params.timeStatType == "日"'>
使用${ew.sqlSegment}来动态拼接SQL条件 SELECT DATE_FORMAT(${params.xColumn},'%Y-%m-%d') ${params.xColumn}, sum(${params.yColumn}) total FROM wenjuandafu
resultType指定返回的结果类型为map
@param params 包含查询参数的map包括timeStatType、xColumn和yColumn
@return 包含时间统计值的map列表
-->
<select id="selectTimeStatValue" resultType="map">
<!-- 根据时间统计类型进行不同的日期格式化处理 -->
<if test='params.timeStatType == "日"'>
SELECT DATE_FORMAT(${params.xColumn}, '%Y-%m-%d') AS ${params.xColumn}, sum(${params.yColumn}) AS total FROM wenjuandafu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE_FORMAT(${params.xColumn}, '%Y-%m-%d') <!-- 按日分组统计每个组的yColumn总和 --> group by DATE_FORMAT(${params.xColumn},'%Y-%m-%d')
</if> </if>
<if test='params.timeStatType == "月"'> <if test = 'params.timeStatType == "月"'>
SELECT DATE_FORMAT(${params.xColumn}, '%Y-%m') AS ${params.xColumn}, sum(${params.yColumn}) AS total FROM wenjuandafu SELECT DATE_FORMAT(${params.xColumn},'%Y-%m') ${params.xColumn}, sum(${params.yColumn}) total FROM wenjuandafu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE_FORMAT(${params.xColumn}, '%Y-%m') <!-- 按月分组统计每个组的yColumn总和 --> group by DATE_FORMAT(${params.xColumn},'%Y-%m')
</if> </if>
<if test='params.timeStatType == "年"'> <if test = 'params.timeStatType == "年"'>
SELECT DATE_FORMAT(${params.xColumn}, '%Y') AS ${params.xColumn}, sum(${params.yColumn}) AS total FROM wenjuandafu SELECT DATE_FORMAT(${params.xColumn},'%Y') ${params.xColumn}, sum(${params.yColumn}) total FROM wenjuandafu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE_FORMAT(${params.xColumn}, '%Y') <!-- 按年分组统计每个组的yColumn总和 --> group by DATE_FORMAT(${params.xColumn},'%Y')
</if> </if>
</select> </select>
<!-- <select id="selectGroup" resultType="map" >
查询Wenjuandafu的分组统计值 SELECT ${params.column} , count(1) total FROM wenjuandafu
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为map
@param params 包含查询参数的map包括column
@return 包含分组统计值的map列表
-->
<select id="selectGroup" resultType="map">
SELECT ${params.column}, count(1) AS total FROM wenjuandafu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
GROUP BY ${params.column} <!-- 按column分组统计每个组的记录数 --> group by ${params.column}
LIMIT 10 <!-- 限制结果集最多返回10条记录 --> limit 10
</select> </select>
</mapper> </mapper>

@ -1,133 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.WenjuandiaochaDao"> <mapper namespace="com.dao.WenjuandiaochaDao">
<!-- 定义Mapper的命名空间对应于WenjuandiaochaDao接口 -->
<!-- <!-- 可根据自己的需求,是否要使用 -->
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.WenjuandiaochaEntity的属性
-->
<resultMap type="com.entity.WenjuandiaochaEntity" id="wenjuandiaochaMap"> <resultMap type="com.entity.WenjuandiaochaEntity" id="wenjuandiaochaMap">
<result property="wenjuanbiaoti" column="wenjuanbiaoti"/> <!-- 将数据库列wenjuanbiaoti映射到WenjuandiaochaEntity的属性wenjuanbiaoti --> <result property="wenjuanbiaoti" column="wenjuanbiaoti"/>
<result property="fengmiantupian" column="fengmiantupian"/> <!-- 将数据库列fengmiantupian映射到WenjuandiaochaEntity的属性fengmiantupian --> <result property="fengmiantupian" column="fengmiantupian"/>
<result property="leixing" column="leixing"/> <!-- 将数据库列leixing映射到WenjuandiaochaEntity的属性leixing --> <result property="leixing" column="leixing"/>
<result property="wentiyi" column="wentiyi"/> <!-- 将数据库列wentiyi映射到WenjuandiaochaEntity的属性wentiyi --> <result property="wentiyi" column="wentiyi"/>
<result property="wentier" column="wentier"/> <!-- 将数据库列wentier映射到WenjuandiaochaEntity的属性wentier --> <result property="wentier" column="wentier"/>
<result property="wentisan" column="wentisan"/> <!-- 将数据库列wentisan映射到WenjuandiaochaEntity的属性wentisan --> <result property="wentisan" column="wentisan"/>
<result property="wentisi" column="wentisi"/> <!-- 将数据库列wentisi映射到WenjuandiaochaEntity的属性wentisi --> <result property="wentisi" column="wentisi"/>
<result property="wentiwu" column="wentiwu"/> <!-- 将数据库列wentiwu映射到WenjuandiaochaEntity的属性wentiwu --> <result property="wentiwu" column="wentiwu"/>
<result property="faburiqi" column="faburiqi"/> <!-- 将数据库列faburiqi映射到WenjuandiaochaEntity的属性faburiqi --> <result property="faburiqi" column="faburiqi"/>
<result property="clicktime" column="clicktime"/> <!-- 将数据库列clicktime映射到WenjuandiaochaEntity的属性clicktime --> <result property="clicktime" column="clicktime"/>
</resultMap> </resultMap>
<!--
分页查询Wenjuandiaocha的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.WenjuandiaochaVO
-->
<select id="selectListVO" <select id="selectListVO"
resultType="com.entity.vo.WenjuandiaochaVO"> resultType="com.entity.vo.WenjuandiaochaVO" >
SELECT * FROM wenjuandiaocha wenjuandiaocha SELECT * FROM wenjuandiaocha wenjuandiaocha
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<!--
查询单个Wenjuandiaocha的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.WenjuandiaochaVO
-->
<select id="selectVO" <select id="selectVO"
resultType="com.entity.vo.WenjuandiaochaVO"> resultType="com.entity.vo.WenjuandiaochaVO" >
SELECT wenjuandiaocha.* FROM wenjuandiaocha wenjuandiaocha SELECT wenjuandiaocha.* FROM wenjuandiaocha wenjuandiaocha
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<!--
分页查询Wenjuandiaocha的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.WenjuandiaochaView
-->
<select id="selectListView" <select id="selectListView"
resultType="com.entity.view.WenjuandiaochaView"> resultType="com.entity.view.WenjuandiaochaView" >
SELECT wenjuandiaocha.* FROM wenjuandiaocha wenjuandiaocha SELECT wenjuandiaocha.* FROM wenjuandiaocha wenjuandiaocha
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<!--
查询单个Wenjuandiaocha的视图记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.WenjuandiaochaView
-->
<select id="selectView" <select id="selectView"
resultType="com.entity.view.WenjuandiaochaView"> resultType="com.entity.view.WenjuandiaochaView" >
SELECT * FROM wenjuandiaocha wenjuandiaocha SELECT * FROM wenjuandiaocha wenjuandiaocha <where> 1=1 ${ew.sqlSegment}</where>
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<!--
查询Wenjuandiaocha的统计值 <select id="selectValue" resultType="map" >
使用${ew.sqlSegment}来动态拼接SQL条件 SELECT ${params.xColumn}, sum(${params.yColumn}) total FROM wenjuandiaocha
resultType指定返回的结果类型为map
@param params 包含查询参数的map包括xColumn和yColumn
@return 包含统计值的map列表
-->
<select id="selectValue" resultType="map">
SELECT ${params.xColumn}, sum(${params.yColumn}) AS total FROM wenjuandiaocha
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
GROUP BY ${params.xColumn} <!-- 按xColumn分组统计每个组的yColumn总和 --> group by ${params.xColumn}
LIMIT 10 <!-- 限制结果集最多返回10条记录 --> limit 10
</select> </select>
<!-- <select id="selectTimeStatValue" resultType="map" >
查询Wenjuandiaocha的时间统计值 <if test = 'params.timeStatType == "日"'>
使用${ew.sqlSegment}来动态拼接SQL条件 SELECT DATE_FORMAT(${params.xColumn},'%Y-%m-%d') ${params.xColumn}, sum(${params.yColumn}) total FROM wenjuandiaocha
resultType指定返回的结果类型为map
@param params 包含查询参数的map包括timeStatType、xColumn和yColumn
@return 包含时间统计值的map列表
-->
<select id="selectTimeStatValue" resultType="map">
<!-- 根据时间统计类型进行不同的日期格式化处理 -->
<if test='params.timeStatType == "日"'>
SELECT DATE_FORMAT(${params.xColumn}, '%Y-%m-%d') AS ${params.xColumn}, sum(${params.yColumn}) AS total FROM wenjuandiaocha
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE_FORMAT(${params.xColumn}, '%Y-%m-%d') <!-- 按日分组统计每个组的yColumn总和 --> group by DATE_FORMAT(${params.xColumn},'%Y-%m-%d')
</if> </if>
<if test='params.timeStatType == "月"'> <if test = 'params.timeStatType == "月"'>
SELECT DATE_FORMAT(${params.xColumn}, '%Y-%m') AS ${params.xColumn}, sum(${params.yColumn}) AS total FROM wenjuandiaocha SELECT DATE_FORMAT(${params.xColumn},'%Y-%m') ${params.xColumn}, sum(${params.yColumn}) total FROM wenjuandiaocha
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE_FORMAT(${params.xColumn}, '%Y-%m') <!-- 按月分组统计每个组的yColumn总和 --> group by DATE_FORMAT(${params.xColumn},'%Y-%m')
</if> </if>
<if test='params.timeStatType == "年"'> <if test = 'params.timeStatType == "年"'>
SELECT DATE_FORMAT(${params.xColumn}, '%Y') AS ${params.xColumn}, sum(${params.yColumn}) AS total FROM wenjuandiaocha SELECT DATE_FORMAT(${params.xColumn},'%Y') ${params.xColumn}, sum(${params.yColumn}) total FROM wenjuandiaocha
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE_FORMAT(${params.xColumn}, '%Y') <!-- 按年分组统计每个组的yColumn总和 --> group by DATE_FORMAT(${params.xColumn},'%Y')
</if> </if>
</select> </select>
<!-- <select id="selectGroup" resultType="map" >
查询Wenjuandiaocha的分组统计值 SELECT ${params.column} , count(1) total FROM wenjuandiaocha
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为map
@param params 包含查询参数的map包括column
@return 包含分组统计值的map列表
-->
<select id="selectGroup" resultType="map">
SELECT ${params.column}, count(1) AS total FROM wenjuandiaocha
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
GROUP BY ${params.column} <!-- 按column分组统计每个组的记录数 --> group by ${params.column}
LIMIT 10 <!-- 限制结果集最多返回10条记录 --> limit 10
</select> </select>
</mapper> </mapper>

@ -1,130 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.YonghuDao"> <mapper namespace="com.dao.YonghuDao">
<!-- 定义Mapper的命名空间对应于YonghuDao接口 -->
<!-- <!-- 可根据自己的需求,是否要使用 -->
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.YonghuEntity的属性
-->
<resultMap type="com.entity.YonghuEntity" id="yonghuMap"> <resultMap type="com.entity.YonghuEntity" id="yonghuMap">
<result property="zhanghao" column="zhanghao"/> <!-- 将数据库列zhanghao映射到YonghuEntity的属性zhanghao --> <result property="zhanghao" column="zhanghao"/>
<result property="mima" column="mima"/> <!-- 将数据库列mima映射到YonghuEntity的属性mima --> <result property="mima" column="mima"/>
<result property="xingming" column="xingming"/> <!-- 将数据库列xingming映射到YonghuEntity的属性xingming --> <result property="xingming" column="xingming"/>
<result property="xingbie" column="xingbie"/> <!-- 将数据库列xingbie映射到YonghuEntity的属性xingbie --> <result property="xingbie" column="xingbie"/>
<result property="youxiang" column="youxiang"/> <!-- 将数据库列youxiang映射到YonghuEntity的属性youxiang --> <result property="youxiang" column="youxiang"/>
<result property="shoujihaoma" column="shoujihaoma"/> <!-- 将数据库列shoujihaoma映射到YonghuEntity的属性shoujihaoma --> <result property="shoujihaoma" column="shoujihaoma"/>
<result property="touxiang" column="touxiang"/> <!-- 将数据库列touxiang映射到YonghuEntity的属性touxiang --> <result property="touxiang" column="touxiang"/>
</resultMap> </resultMap>
<!--
分页查询Yonghu的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.YonghuVO
-->
<select id="selectListVO" <select id="selectListVO"
resultType="com.entity.vo.YonghuVO"> resultType="com.entity.vo.YonghuVO" >
SELECT * FROM yonghu yonghu SELECT * FROM yonghu yonghu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<!--
查询单个Yonghu的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.YonghuVO
-->
<select id="selectVO" <select id="selectVO"
resultType="com.entity.vo.YonghuVO"> resultType="com.entity.vo.YonghuVO" >
SELECT yonghu.* FROM yonghu yonghu SELECT yonghu.* FROM yonghu yonghu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<!--
分页查询Yonghu的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.YonghuView
-->
<select id="selectListView" <select id="selectListView"
resultType="com.entity.view.YonghuView"> resultType="com.entity.view.YonghuView" >
SELECT yonghu.* FROM yonghu yonghu SELECT yonghu.* FROM yonghu yonghu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<!--
查询单个Yonghu的视图记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.YonghuView
-->
<select id="selectView" <select id="selectView"
resultType="com.entity.view.YonghuView"> resultType="com.entity.view.YonghuView" >
SELECT * FROM yonghu yonghu SELECT * FROM yonghu yonghu <where> 1=1 ${ew.sqlSegment}</where>
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<!--
查询Yonghu的统计值 <select id="selectValue" resultType="map" >
使用${ew.sqlSegment}来动态拼接SQL条件 SELECT ${params.xColumn}, sum(${params.yColumn}) total FROM yonghu
resultType指定返回的结果类型为map
@param params 包含查询参数的map包括xColumn和yColumn
@return 包含统计值的map列表
-->
<select id="selectValue" resultType="map">
SELECT ${params.xColumn}, sum(${params.yColumn}) AS total FROM yonghu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
GROUP BY ${params.xColumn} <!-- 按xColumn分组统计每个组的yColumn总和 --> group by ${params.xColumn}
LIMIT 10 <!-- 限制结果集最多返回10条记录 --> limit 10
</select> </select>
<!-- <select id="selectTimeStatValue" resultType="map" >
查询Yonghu的时间统计值 <if test = 'params.timeStatType == "日"'>
使用${ew.sqlSegment}来动态拼接SQL条件 SELECT DATE_FORMAT(${params.xColumn},'%Y-%m-%d') ${params.xColumn}, sum(${params.yColumn}) total FROM yonghu
resultType指定返回的结果类型为map
@param params 包含查询参数的map包括timeStatType、xColumn和yColumn
@return 包含时间统计值的map列表
-->
<select id="selectTimeStatValue" resultType="map">
<!-- 根据时间统计类型进行不同的日期格式化处理 -->
<if test='params.timeStatType == "日"'>
SELECT DATE_FORMAT(${params.xColumn}, '%Y-%m-%d') AS ${params.xColumn}, sum(${params.yColumn}) AS total FROM yonghu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE_FORMAT(${params.xColumn}, '%Y-%m-%d') <!-- 按日分组统计每个组的yColumn总和 --> group by DATE_FORMAT(${params.xColumn},'%Y-%m-%d')
</if> </if>
<if test='params.timeStatType == "月"'> <if test = 'params.timeStatType == "月"'>
SELECT DATE_FORMAT(${params.xColumn}, '%Y-%m') AS ${params.xColumn}, sum(${params.yColumn}) AS total FROM yonghu SELECT DATE_FORMAT(${params.xColumn},'%Y-%m') ${params.xColumn}, sum(${params.yColumn}) total FROM yonghu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE_FORMAT(${params.xColumn}, '%Y-%m') <!-- 按月分组统计每个组的yColumn总和 --> group by DATE_FORMAT(${params.xColumn},'%Y-%m')
</if> </if>
<if test='params.timeStatType == "年"'> <if test = 'params.timeStatType == "年"'>
SELECT DATE_FORMAT(${params.xColumn}, '%Y') AS ${params.xColumn}, sum(${params.yColumn}) AS total FROM yonghu SELECT DATE_FORMAT(${params.xColumn},'%Y') ${params.xColumn}, sum(${params.yColumn}) total FROM yonghu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE_FORMAT(${params.xColumn}, '%Y') <!-- 按年分组统计每个组的yColumn总和 --> group by DATE_FORMAT(${params.xColumn},'%Y')
</if> </if>
</select> </select>
<!-- <select id="selectGroup" resultType="map" >
查询Yonghu的分组统计值 SELECT ${params.column} , count(1) total FROM yonghu
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为map
@param params 包含查询参数的map包括column
@return 包含分组统计值的map列表
-->
<select id="selectGroup" resultType="map">
SELECT ${params.column}, count(1) AS total FROM yonghu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
GROUP BY ${params.column} <!-- 按column分组统计每个组的记录数 --> group by ${params.column}
LIMIT 10 <!-- 限制结果集最多返回10条记录 --> limit 10
</select> </select>
</mapper> </mapper>

@ -7,7 +7,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>问卷调查系统</title> <title>基于j2ee的问卷调查系统</title>
<link rel="stylesheet" href="./layui/css/layui.css"> <link rel="stylesheet" href="./layui/css/layui.css">
<!-- 主题(主要颜色设置) --> <!-- 主题(主要颜色设置) -->
<link rel="stylesheet" href="./css/theme.css" /> <link rel="stylesheet" href="./css/theme.css" />

@ -1,5 +1,5 @@
var projectName = '问卷调查系统'; var projectName = '基于j2ee的问卷调查系统';
/** /**
* 轮播图配置 * 轮播图配置
*/ */

@ -60,7 +60,7 @@
<div id="login" class="login" :style='{"minHeight":"100vh","width":"100%","alignItems":"flex-start","background":"url(http://codegen.caihongy.cn/20230207/860aeea5c04f45119e98c796e63dee11.jpg) no-repeat right bottom / 100% auto,#fff","justifyContent":"flex-end","display":"flex"}'> <div id="login" class="login" :style='{"minHeight":"100vh","width":"100%","alignItems":"flex-start","background":"url(http://codegen.caihongy.cn/20230207/860aeea5c04f45119e98c796e63dee11.jpg) no-repeat right bottom / 100% auto,#fff","justifyContent":"flex-end","display":"flex"}'>
<form id="loginForm" class="layui-form login-form" :style='{"border":"8px outset #bcdbdf","padding":"20px 20px 20px","boxShadow":"inset 0px 0px 0px 0px #666","margin":"5% 7% 0 0","borderRadius":"0px","flexWrap":"wrap","background":"rgba(255,255,255,.9)","display":"flex","width":"800px","position":"relative","justifyContent":"center","height":"auto"}'> <form id="loginForm" class="layui-form login-form" :style='{"border":"8px outset #bcdbdf","padding":"20px 20px 20px","boxShadow":"inset 0px 0px 0px 0px #666","margin":"5% 7% 0 0","borderRadius":"0px","flexWrap":"wrap","background":"rgba(255,255,255,.9)","display":"flex","width":"800px","position":"relative","justifyContent":"center","height":"auto"}'>
<div v-if="true" :style='{"margin":"0 0 4px","color":"#555","textAlign":"center","display":"none","width":"62%","lineHeight":"44px","fontSize":"24px","textShadow":"0px 0px 0px rgba(64, 158, 255, .5)"}'>USER / LOGIN</div> <div v-if="true" :style='{"margin":"0 0 4px","color":"#555","textAlign":"center","display":"none","width":"62%","lineHeight":"44px","fontSize":"24px","textShadow":"0px 0px 0px rgba(64, 158, 255, .5)"}'>USER / LOGIN</div>
<div v-if="true" :style='{"boxShadow":"inset 0px 0px 0px 0px #c5f1c0","margin":"4px 0 40px","borderColor":"#bdefb6","color":"#333","textAlign":"center","borderRadius":"0px","background":"url(http://codegen.caihongy.cn/20230204/13e68e581e9e42b7a53fd23ab9faef74.png) no-repeat left top /100% 100%,#d7eef2","borderWidth":"0px","width":"100%","lineHeight":"44px","fontSize":"16px","borderStyle":"solid","textShadow":"0px 0px 0px rgba(64, 158, 255, .5)"}'>问卷调查系统</div> <div v-if="true" :style='{"boxShadow":"inset 0px 0px 0px 0px #c5f1c0","margin":"4px 0 40px","borderColor":"#bdefb6","color":"#333","textAlign":"center","borderRadius":"0px","background":"url(http://codegen.caihongy.cn/20230204/13e68e581e9e42b7a53fd23ab9faef74.png) no-repeat left top /100% 100%,#d7eef2","borderWidth":"0px","width":"100%","lineHeight":"44px","fontSize":"16px","borderStyle":"solid","textShadow":"0px 0px 0px rgba(64, 158, 255, .5)"}'>基于j2ee的问卷调查系统</div>
<div :style='{"width":"80%","margin":"0 0 20px","flexWrap":"wrap","display":"flex"}' class="form-item"> <div :style='{"width":"80%","margin":"0 0 20px","flexWrap":"wrap","display":"flex"}' class="form-item">
<div class="layui-form-label" v-if="false" :style='{"width":"64px","padding":"0 10px 0 0","lineHeight":"44px","fontSize":"14px","color":"#333"}'>账号</div> <div class="layui-form-label" v-if="false" :style='{"width":"64px","padding":"0 10px 0 0","lineHeight":"44px","fontSize":"14px","color":"#333"}'>账号</div>
<input :style='{"padding":"0 10px","boxShadow":"inset 0px 0px 0px 0px #c5f1c0","borderColor":"#eee","color":"#333","outline":"0px solid #efefef","outlineOffset":"4px","borderRadius":"0px","flex":"1","borderWidth":"1px","background":"#fff","width":"100%","fontSize":"14px","borderStyle":"solid","height":"40px"}' type="text" name="username" required lay-verify="required" placeholder="请输入账号" autocomplete="off" class="layui-input"> <input :style='{"padding":"0 10px","boxShadow":"inset 0px 0px 0px 0px #c5f1c0","borderColor":"#eee","color":"#333","outline":"0px solid #efefef","outlineOffset":"4px","borderRadius":"0px","flex":"1","borderWidth":"1px","background":"#fff","width":"100%","fontSize":"14px","borderStyle":"solid","height":"40px"}' type="text" name="username" required lay-verify="required" placeholder="请输入账号" autocomplete="off" class="layui-input">

@ -116,7 +116,7 @@
<!-- Main Content --> <!-- Main Content -->
<div id="home-container"> <div id="home-container">
<div class="home-container-title">欢迎使用&nbsp;问卷调查系统</div> <div class="home-container-title">欢迎使用&nbsp;基于j2ee的问卷调查系统</div>
<div class="cards" :style='{"margin":"20px 0 20px 0","alignItems":"center","justifyContent":"center","display":"flex"}'> <div class="cards" :style='{"margin":"20px 0 20px 0","alignItems":"center","justifyContent":"center","display":"flex"}'>
<div class="item" :style='{"boxShadow":"0 0px 0px rgba(0,0,0,.3)","margin":"0 10px","borderRadius":"4px","display":"flex"}' v-if="crossBtnControl2('yonghu','首页总数')"> <div class="item" :style='{"boxShadow":"0 0px 0px rgba(0,0,0,.3)","margin":"0 10px","borderRadius":"4px","display":"flex"}' v-if="crossBtnControl2('yonghu','首页总数')">

@ -3,7 +3,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>问卷调查系统</title> <title>基于j2ee的问卷调查系统</title>
<!-- Fav Icon Link --> <!-- Fav Icon Link -->
<link rel="shortcut icon" type="image/png" href="${pageContext.request.contextPath}/resources/images/fav.png"> <link rel="shortcut icon" type="image/png" href="${pageContext.request.contextPath}/resources/images/fav.png">
<!-- Bootstrap core CSS --> <!-- Bootstrap core CSS -->

@ -161,7 +161,7 @@
} }
</style> </style>
<div id="top-container"> <div id="top-container">
<a class="top-title" href="${pageContext.request.contextPath}/index.jsp">问卷调查系统</a> <a class="top-title" href="${pageContext.request.contextPath}/index.jsp">基于j2ee的问卷调查系统</a>
<ul class="top-nav"> <ul class="top-nav">
<li class="nav-item-full"> <li class="nav-item-full">
<a class="nav-link"> <a class="nav-link">

@ -1,7 +1,7 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" <%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%> pageEncoding="UTF-8"%>
var baseUrl = "http://localhost:8080/jspm0c59i/"; var baseUrl = "http://localhost:8080/jspm0c59i/";
var projectName = "问卷调查系统" var projectName = "基于j2ee的问卷调查系统"
/** /**
* 网络请求 * 网络请求

Loading…
Cancel
Save