Merge pull request '注释' (#1) from hujiali_branch into main

main
pfwt7cxhv 8 months ago
commit b739ab322f

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

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

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

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

@ -52,331 +52,240 @@ import com.entity.StoreupEntity;
@RequestMapping("/wenjuandiaocha")
public class WenjuandiaochaController {
@Autowired
private WenjuandiaochaService wenjuandiaochaService;
private WenjuandiaochaService wenjuandiaochaService; // 注入问卷调查服务
@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("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type, @RequestParam Map<String, Object> map) {
// 将列名和类型添加到 map 中
map.put("column", columnName);
map.put("type", type);
// 如果类型为 "2",处理日期范围
if (type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); // 定义日期格式
Calendar c = Calendar.getInstance(); // 获取当前日期时间
Date remindStartDate = null;
Date remindEndDate = null;
// 处理 remindstart 参数
if (map.get("remindstart") != null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString()); // 将 remindstart 转换为整数
c.setTime(new Date()); // 设置当前时间
c.add(Calendar.DAY_OF_MONTH, remindStart); // 添加 remindStart 天
remindStartDate = c.getTime(); // 获取新的开始日期
map.put("remindstart", sdf.format(remindStartDate)); // 格式化并添加到 map 中
}
// 处理 remindend 参数
if (map.get("remindend") != null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString()); // 将 remindend 转换为整数
c.setTime(new Date()); // 设置当前时间
c.add(Calendar.DAY_OF_MONTH, remindEnd); // 添加 remindEnd 天
remindEndDate = c.getTime(); // 获取新的结束日期
map.put("remindend", sdf.format(remindEndDate)); // 格式化并添加到 map 中
}
}
// 创建 EntityWrapper 对象,用于构建查询条件
Wrapper<WenjuandiaochaEntity> wrapper = new EntityWrapper<WenjuandiaochaEntity>();
if (map.get("remindstart") != null) {
wrapper.ge(columnName, map.get("remindstart")); // 大于等于 remindstart
}
if (map.get("remindend") != null) {
wrapper.le(columnName, map.get("remindend")); // 小于等于 remindend
}
/**
*
*/
@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);
// 查询符合条件的记录数
int count = wenjuandiaochaService.selectCount(wrapper);
return R.ok().put("count", count); // 返回记录数
}
/**
*
*/
@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}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type,@RequestParam Map<String, Object> map) {
map.put("column", columnName);
map.put("type", type);
if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
if(map.get("remindstart")!=null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate));
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
}
}
Wrapper<WenjuandiaochaEntity> wrapper = new EntityWrapper<WenjuandiaochaEntity>();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
int count = wenjuandiaochaService.selectCount(wrapper);
return R.ok().put("count", count);
}
/**
*
*/
@IgnoreAuth
@IgnoreAuth // 忽略认证
@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>();
Map<String, Object> newMap = new HashMap<String, Object>();
Map<String, Object> param = new HashMap<String, Object>();
Iterator<Map.Entry<String, Object>> it = param.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, Object> entry = it.next();
String key = entry.getKey();
String newKey = entry.getKey();
if (pre.endsWith(".")) {
newMap.put(pre + newKey, entry.getValue());
} else if (StringUtils.isEmpty(pre)) {
newMap.put(newKey, entry.getValue());
} else {
newMap.put(pre + "." + newKey, entry.getValue());
}
}
params.put("sort", "clicktime");
Iterator<Map.Entry<String, Object>> it = param.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, Object> entry = it.next();
String key = entry.getKey();
String newKey = entry.getKey();
// 处理 pre 参数
if (pre.endsWith(".")) {
newMap.put(pre + newKey, entry.getValue());
} else if (StringUtils.isEmpty(pre)) {
newMap.put(newKey, entry.getValue());
} else {
newMap.put(pre + "." + newKey, entry.getValue());
}
}
// 设置排序条件
params.put("sort", "clicktime");
params.put("order", "desc");
PageUtils page = wenjuandiaochaService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wenjuandiaocha), params), params));
return R.ok().put("data", page);
// 查询分页数据
PageUtils page = wenjuandiaochaService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wenjuandiaocha), params), params));
return R.ok().put("data", page); // 返回分页数据
}
/**
*
*/
@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 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<String> inteltypes = new ArrayList<String>();
Integer limit = params.get("limit")==null?10:Integer.parseInt(params.get("limit").toString());
Integer limit = params.get("limit") == null ? 10 : Integer.parseInt(params.get("limit").toString()); // 设置限制数量,默认为 10
List<WenjuandiaochaEntity> wenjuandiaochaList = new ArrayList<WenjuandiaochaEntity>();
//去重
if(storeups!=null && storeups.size()>0) {
for(StoreupEntity s : storeups) {
// 去重
if (storeups != null && storeups.size() > 0) {
for (StoreupEntity s : storeups) {
wenjuandiaochaList.addAll(wenjuandiaochaService.selectList(new EntityWrapper<WenjuandiaochaEntity>().eq(inteltypeColumn, s.getInteltype())));
}
}
// 创建 EntityWrapper 对象,用于构建查询条件
EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>();
params.put("sort", "id");
params.put("order", "desc");
// 查询分页数据
PageUtils page = wenjuandiaochaService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wenjuandiaocha), params), params));
List<WenjuandiaochaEntity> pageList = (List<WenjuandiaochaEntity>)page.getList();
if(wenjuandiaochaList.size()<limit) {
int toAddNum = (limit-wenjuandiaochaList.size())<=pageList.size()?(limit-wenjuandiaochaList.size()):pageList.size();
for(WenjuandiaochaEntity o1 : pageList) {
List<WenjuandiaochaEntity> pageList = (List<WenjuandiaochaEntity>) page.getList();
// 如果结果数量小于限制数量,则从分页数据中添加
if (wenjuandiaochaList.size() < limit) {
int toAddNum = (limit - wenjuandiaochaList.size()) <= pageList.size() ? (limit - wenjuandiaochaList.size()) : pageList.size();
for (WenjuandiaochaEntity o1 : pageList) {
boolean addFlag = true;
for(WenjuandiaochaEntity o2 : wenjuandiaochaList) {
if(o1.getId().intValue()==o2.getId().intValue()) {
for (WenjuandiaochaEntity o2 : wenjuandiaochaList) {
if (o1.getId().intValue() == o2.getId().intValue()) {
addFlag = false;
break;
}
}
if(addFlag) {
if (addFlag) {
wenjuandiaochaList.add(o1);
if(--toAddNum==0) break;
if (--toAddNum == 0) break;
}
}
} else if(wenjuandiaochaList.size()>limit) {
wenjuandiaochaList = wenjuandiaochaList.subList(0, limit);
} else if (wenjuandiaochaList.size() > limit) {
wenjuandiaochaList = wenjuandiaochaList.subList(0, limit); // 如果结果数量大于限制数量,则截取前 limit 个
}
page.setList(wenjuandiaochaList);
return R.ok().put("data", page);
page.setList(wenjuandiaochaList); // 设置新的列表
return R.ok().put("data", page); // 返回分页数据
}
/**
*
*/
@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>();
params.put("xColumn", xColumnName);
params.put("yColumn", yColumnName);
// 创建 EntityWrapper 对象,用于构建查询条件
EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>();
// 查询统计结果
List<Map<String, Object>> result = wenjuandiaochaService.selectValue(params, ew);
// 处理日期格式
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for(Map<String, Object> m : result) {
for(String k : m.keySet()) {
if(m.get(k) instanceof Date) {
m.put(k, sdf.format((Date)m.get(k)));
for (Map<String, Object> m : result) {
for (String k : m.keySet()) {
if (m.get(k) instanceof Date) {
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}")
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>();
params.put("xColumn", xColumnName);
params.put("yColumn", yColumnName);
params.put("timeStatType", timeStatType);
// 创建 EntityWrapper 对象,用于构建查询条件
EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>();
// 查询时间统计结果
List<Map<String, Object>> result = wenjuandiaochaService.selectTimeStatValue(params, ew);
// 处理日期格式
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for(Map<String, Object> m : result) {
for(String k : m.keySet()) {
if(m.get(k) instanceof Date) {
m.put(k, sdf.format((Date)m.get(k)));
for (Map<String, Object> m : result) {
for (String k : m.keySet()) {
if (m.get(k) instanceof Date) {
m.put(k, sdf.format((Date) m.get(k)));
}
}
}
return R.ok().put("data", result);
return R.ok().put("data", result); // 返回时间统计结果
}
/**
*
*/
@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>();
params.put("column", columnName);
// 创建 EntityWrapper 对象,用于构建查询条件
EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>();
// 查询分组统计结果
List<Map<String, Object>> result = wenjuandiaochaService.selectGroup(params, ew);
// 处理日期格式
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for(Map<String, Object> m : result) {
for(String k : m.keySet()) {
if(m.get(k) instanceof Date) {
m.put(k, sdf.format((Date)m.get(k)));
for (Map<String, Object> m : result) {
for (String k : m.keySet()) {
if (m.get(k) instanceof Date) {
m.put(k, sdf.format((Date) m.get(k)));
}
}
}
return R.ok().put("data", result);
return R.ok().put("data", result); // 返回分组统计结果
}
/**
*
*/
@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>();
// 查询符合条件的记录数
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); // 返回记录数
}
}

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

@ -1,35 +1,59 @@
package com.dao;
import com.entity.ForumEntity;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import java.util.List;
import java.util.Map;
import com.entity.ForumEntity; // 导入论坛实体类
import com.baomidou.mybatisplus.mapper.BaseMapper; // 导入MyBatis-Plus的BaseMapper接口
import java.util.List;
import java.util.Map;
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 com.entity.vo.ForumVO;
import com.entity.view.ForumView;
import com.entity.vo.ForumVO; // 导入论坛VO类
import com.entity.view.ForumView; // 导入论坛视图类
/**
*
* DAO
* 访ForumEntity
*
* @author
* @email
* @date 2023-02-21 09:46:06
*/
public interface ForumDao extends BaseMapper<ForumEntity> {
List<ForumVO> selectListVO(@Param("ew") Wrapper<ForumEntity> wrapper);
ForumVO selectVO(@Param("ew") Wrapper<ForumEntity> wrapper);
List<ForumView> selectListView(@Param("ew") Wrapper<ForumEntity> wrapper);
List<ForumView> selectListView(Pagination page,@Param("ew") Wrapper<ForumEntity> wrapper);
ForumView selectView(@Param("ew") Wrapper<ForumEntity> wrapper);
/**
* VO
* @param wrapper
* @return VO
*/
List<ForumVO> selectListVO(@Param("ew") Wrapper<ForumEntity> wrapper);
/**
* VO
* @param wrapper
* @return VO
*/
ForumVO selectVO(@Param("ew") Wrapper<ForumEntity> wrapper);
/**
*
* @param wrapper
* @return
*/
List<ForumView> selectListView(@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);
}

@ -1,35 +1,59 @@
package com.dao;
import com.entity.LeixingEntity;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.LeixingEntity;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
import org.apache.ibatis.annotations.Param;
import com.entity.vo.LeixingVO;
import com.entity.view.LeixingView;
import org.apache.ibatis.annotations.Param;
import com.entity.vo.LeixingVO; // 导入类型VO类
import com.entity.view.LeixingView;
/**
*
* DAO
* LeixingEntity
*
* @author
* @email
* @date 2023-02-21 09:46:06
*/
public interface LeixingDao extends BaseMapper<LeixingEntity> {
List<LeixingVO> selectListVO(@Param("ew") Wrapper<LeixingEntity> wrapper);
LeixingVO selectVO(@Param("ew") Wrapper<LeixingEntity> wrapper);
List<LeixingView> selectListView(@Param("ew") Wrapper<LeixingEntity> wrapper);
List<LeixingView> selectListView(Pagination page,@Param("ew") Wrapper<LeixingEntity> wrapper);
LeixingView selectView(@Param("ew") Wrapper<LeixingEntity> wrapper);
/**
* VO
* @param wrapper
* @return VO
*/
List<LeixingVO> selectListVO(@Param("ew") Wrapper<LeixingEntity> wrapper);
/**
* VO
* @param wrapper
* @return VO
*/
LeixingVO selectVO(@Param("ew") Wrapper<LeixingEntity> wrapper);
/**
*
* @param wrapper
* @return
*/
List<LeixingView> selectListView(@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);
}

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

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

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

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

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

@ -1,157 +1,144 @@
package com.entity.model;
import com.entity.ForumEntity;
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;
import com.entity.ForumEntity;
import java.io.Serializable; // 导入可序列化接口
/**
*
*
* entity
* ModelAndView model
* entity
* ModelAndViewmodel
*
* @author
* @email
* @date 2023-02-21 09:46:06
*/
public class ForumModel implements Serializable {
private static final long serialVersionUID = 1L;
public class ForumModel implements Serializable {
private static final long serialVersionUID = 1L; // 版本控制
/**
*
*/
private String content; // 存放帖子内容
private String content;
/**
* id
*/
private Long parentid; // 存放父节点ID
private Long parentid;
/**
* 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) {
this.content = content;
this.content = content; // 设置帖子内容
}
/**
*
* @return
*/
public String getContent() {
return content;
return content;
}
/**
* id
* @param parentid ID
*/
public void setParentid(Long parentid) {
this.parentid = parentid;
this.parentid = parentid; // 设置父节点ID
}
/**
* id
* @return ID
*/
public Long getParentid() {
return parentid;
return parentid; // 返回父节点ID
}
/**
* id
* @param userid ID
*/
public void setUserid(Long userid) {
this.userid = userid;
this.userid = userid; // 设置用户ID
}
/**
* id
* @return ID
*/
public Long getUserid() {
return userid;
}
/**
*
* @param username
*/
public void setUsername(String username) {
this.username = username;
this.username = username; // 设置用户名
}
/**
*
* @return
*/
public String getUsername() {
return username;
return username;
}
/**
*
* @param avatarurl URL
*/
public void setAvatarurl(String avatarurl) {
this.avatarurl = avatarurl;
this.avatarurl = avatarurl; // 设置头像URL
}
/**
*
* @return URL
*/
public String getAvatarurl() {
return avatarurl;
return avatarurl;
}
/**
*
* @param isdone
*/
public void setIsdone(String isdone) {
this.isdone = isdone;
this.isdone = isdone; // 设置帖子状态
}
/**
*
* @return
*/
public String getIsdone() {
return isdone;
return isdone;
}
}

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

@ -1,227 +1,195 @@
package com.entity.model;
import com.entity.WenjuandiaochaEntity;
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
* ModelAndView model
* @author
* @email
*
*
* ModelAndViewmodel
* @author
* @email
* @date 2023-02-21 09:46:06
*/
public class WenjuandiaochaModel implements Serializable {
public class WenjuandiaochaModel implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
private String fengmiantupian;
/**
*
*/
private String leixing;
/**
*
*/
private String wentiyi;
/**
*
*/
private String wentier;
/**
*
*/
private String wentisan;
/**
*
*/
private String wentisi;
/**
*
*/
private String wentiwu;
/**
*
*/
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat
private Date faburiqi;
/**
*
*/
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat
private Date clicktime;
/**
*
*/
public void setFengmiantupian(String fengmiantupian) {
this.fengmiantupian = fengmiantupian;
}
/**
*
*/
public String getFengmiantupian() {
return fengmiantupian;
}
/**
*
*/
public void setLeixing(String leixing) {
this.leixing = leixing;
}
/**
*
*/
public String getLeixing() {
return leixing;
}
/**
*
*/
public void setWentiyi(String wentiyi) {
this.wentiyi = wentiyi;
}
/**
*
*/
public String getWentiyi() {
return wentiyi;
}
/**
*
*/
public void setWentier(String wentier) {
this.wentier = wentier;
}
/**
*
*/
public String getWentier() {
return wentier;
}
/**
*
*/
public void setWentisan(String wentisan) {
this.wentisan = wentisan;
}
/**
*
*/
public String getWentisan() {
return wentisan;
}
/**
*
*/
public void setWentisi(String wentisi) {
this.wentisi = wentisi;
}
/**
*
*/
public String getWentisi() {
return wentisi;
}
/**
*
*/
public void setWentiwu(String wentiwu) {
this.wentiwu = wentiwu;
}
/**
*
*/
public String getWentiwu() {
return wentiwu;
}
/**
*
*/
public void setFaburiqi(Date faburiqi) {
this.faburiqi = faburiqi;
}
/**
*
*/
public Date getFaburiqi() {
return faburiqi;
}
/**
*
*/
public void setClicktime(Date clicktime) {
this.clicktime = clicktime;
}
/**
*
*/
public Date getClicktime() {
return clicktime;
}
}

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

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

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

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

@ -3,8 +3,8 @@ package com.service;
import java.util.Map;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.service.IService;
import com.baomidou.mybatisplus.mapper.Wrapper;// 导入MyBatis-Plus的Wrapper接口用于构建查询条件
import com.baomidou.mybatisplus.service.IService;// 导入MyBatis-Plus的服务接口
import com.entity.ConfigEntity;
import com.utils.PageUtils;
@ -13,5 +13,12 @@ import com.utils.PageUtils;
*
*/
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,14 +3,12 @@ package com.service;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.service.IService;
import com.utils.PageUtils;
import com.entity.ForumEntity;
import com.entity.ForumEntity; // 导入论坛实体类
import java.util.List;
import java.util.Map;
import com.entity.vo.ForumVO;
import com.entity.vo.ForumVO;// 导入论坛VO类
import org.apache.ibatis.annotations.Param;
import com.entity.view.ForumView;
import com.entity.view.ForumView;v// 导入论坛视图类
/**
*
*
@ -20,18 +18,47 @@ import com.entity.view.ForumView;
*/
public interface ForumService extends IService<ForumEntity> {
/**
*
* @param params
* @return
*/
PageUtils queryPage(Map<String, Object> params);
List<ForumVO> selectListVO(Wrapper<ForumEntity> wrapper);
ForumVO selectVO(@Param("ew") Wrapper<ForumEntity> wrapper);
List<ForumView> selectListView(Wrapper<ForumEntity> wrapper);
ForumView selectView(@Param("ew") Wrapper<ForumEntity> wrapper);
PageUtils queryPage(Map<String, Object> params,Wrapper<ForumEntity> wrapper);
/**
* VO
* @param wrapper
* @return ForumVO
*/
List<ForumVO> selectListVO(Wrapper<ForumEntity> wrapper);
/**
* VO
* @param wrapper
* @return ForumVO
*/
ForumVO selectVO(@Param("ew") Wrapper<ForumEntity> wrapper);
/**
*
* @param wrapper
* @return ForumView
*/
List<ForumView> selectListView(Wrapper<ForumEntity> wrapper);
/**
*
* @param wrapper
* @return ForumView
*/
ForumView selectView(@Param("ew") 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.service.IService;
import com.utils.PageUtils;
import com.entity.LeixingEntity;
import com.entity.LeixingEntity; // 导入类型实体类
import java.util.List;
import java.util.Map;
import com.entity.vo.LeixingVO;
import org.apache.ibatis.annotations.Param;
import com.entity.view.LeixingView;
import com.entity.view.LeixingView;// 导入类型视图类
/**
@ -20,18 +20,47 @@ import com.entity.view.LeixingView;
*/
public interface LeixingService extends IService<LeixingEntity> {
/**
*
* @param params
* @return
*/
PageUtils queryPage(Map<String, Object> params);
List<LeixingVO> selectListVO(Wrapper<LeixingEntity> wrapper);
LeixingVO selectVO(@Param("ew") Wrapper<LeixingEntity> wrapper);
List<LeixingView> selectListView(Wrapper<LeixingEntity> wrapper);
LeixingView selectView(@Param("ew") Wrapper<LeixingEntity> wrapper);
PageUtils queryPage(Map<String, Object> params,Wrapper<LeixingEntity> wrapper);
/**
* VO
* @param wrapper
* @return LeixingVO
*/
List<LeixingVO> selectListVO(Wrapper<LeixingEntity> wrapper);
/**
* VO
* @param wrapper
* @return LeixingVO
*/
LeixingVO selectVO(@Param("ew") Wrapper<LeixingEntity> wrapper);
/**
*
* @param wrapper
* @return LeixingView
*/
List<LeixingView> selectListView(Wrapper<LeixingEntity> wrapper);
/**
*
* @param wrapper
* @return LeixingView
*/
LeixingView selectView(@Param("ew") Wrapper<LeixingEntity> wrapper);
/**
*
* @param params
* @param wrapper
* @return
*/
PageUtils queryPage(Map<String, Object> params, Wrapper<LeixingEntity> wrapper);
}

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

@ -10,36 +10,80 @@ import com.entity.vo.WenjuandiaochaVO;
import org.apache.ibatis.annotations.Param;
import com.entity.view.WenjuandiaochaView;
/**
*
*
*
* @author
* @email
* @author
* @email
* @date 2023-02-21 09:46:06
*/
public interface WenjuandiaochaService extends IService<WenjuandiaochaEntity> {
/**
*
* @param params
* @return
*/
PageUtils queryPage(Map<String, Object> params);
List<WenjuandiaochaVO> selectListVO(Wrapper<WenjuandiaochaEntity> wrapper);
/**
*
* @param wrapper
* @return
*/
List<WenjuandiaochaVO> selectListVO(Wrapper<WenjuandiaochaEntity> wrapper);
WenjuandiaochaVO selectVO(@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper);
/**
*
* @param wrapper
* @return
*/
WenjuandiaochaVO selectVO(@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper);
List<WenjuandiaochaView> selectListView(Wrapper<WenjuandiaochaEntity> wrapper);
/**
*
* @param wrapper
* @return
*/
List<WenjuandiaochaView> selectListView(Wrapper<WenjuandiaochaEntity> wrapper);
WenjuandiaochaView selectView(@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper);
/**
*
* @param wrapper
* @return
*/
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
* @param wrapper
* @return
*/
List<Map<String, Object>> selectValue(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper);
List<Map<String, Object>> selectTimeStatValue(Map<String, Object> params,Wrapper<WenjuandiaochaEntity> wrapper);
/**
*
* @param params
* @param wrapper
* @return
*/
List<Map<String, Object>> selectTimeStatValue(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper);
List<Map<String, Object>> selectGroup(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 {
@Override
public PageUtils queryPage(Map<String, Object> params, Wrapper<ConfigEntity> wrapper) {
// 使用MyBatis-Plus的selectPage方法进行分页查询
Page<ConfigEntity> page = this.selectPage(
new Query<ConfigEntity>(params).getPage(),
wrapper
new Query<ConfigEntity>(params).getPage(), // 获取分页参数
wrapper // 查询条件
);
return new PageUtils(page);
}
return new PageUtils(page); // 返回分页结果
}

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

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

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

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

@ -3,38 +3,109 @@
<mapper namespace="com.dao.ChatDao">
<!-- 可根据自己的需求,是否要使用 -->
<!--
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.ChatEntity的属性
-->
<resultMap type="com.entity.ChatEntity" id="chatMap">
<result property="userid" column="userid"/>
<result property="adminid" column="adminid"/>
<result property="ask" column="ask"/>
<result property="reply" column="reply"/>
<result property="isreply" column="isreply"/>
<result property="userid" column="userid"/> <!-- 将数据库列userid映射到ChatEntity的属性userid -->
<result property="adminid" column="adminid"/> <!-- 将数据库列adminid映射到ChatEntity的属性adminid -->
<result property="ask" column="ask"/> <!-- 将数据库列ask映射到ChatEntity的属性ask -->
<result property="reply" column="reply"/> <!-- 将数据库列reply映射到ChatEntity的属性reply -->
<result property="isreply" column="isreply"/> <!-- 将数据库列isreply映射到ChatEntity的属性isreply -->
</resultMap>
<select id="selectListVO"
resultType="com.entity.vo.ChatVO" >
SELECT * FROM chat chat
<!--
分页查询Chat的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.ChatVO
-->
<select id="selectListVO"
resultType="com.entity.vo.ChatVO">
SELECT * FROM chat chat
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<select id="selectVO"
resultType="com.entity.vo.ChatVO" >
SELECT chat.* FROM chat chat
<where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
<!--
查询单个Chat的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.ChatVO
-->
<select id="selectVO"
resultType="com.entity.vo.ChatVO">
SELECT chat.* FROM chat chat
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
分页查询Chat的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.ChatView
-->
<select id="selectListView"
resultType="com.entity.view.ChatView" >
resultType="com.entity.view.ChatView">
SELECT chat.* FROM chat chat
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
查询单个Chat的视图记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.ChatView
-->
<select id="selectView"
resultType="com.entity.view.ChatView">
SELECT * FROM chat chat
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
SELECT chat.* FROM chat chat
<!--
查询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>
<!--
查询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>
</select>
<select id="selectView"
resultType="com.entity.view.ChatView" >
SELECT * FROM chat chat <where> 1=1 ${ew.sqlSegment}</where>
</select>
GROUP BY isreply <!-- 按isreply字段分组统计每个分组的聊天记录数 -->
</select>
</mapper>

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

@ -1,5 +1,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">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.ConfigDao">
</mapper>
<!-- 定义Mapper的命名空间对应于ConfigDao接口 -->
</mapper>

@ -1,42 +1,71 @@
<?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.ForumDao">
<!-- 定义Mapper的命名空间对应于ForumDao接口 -->
<!-- 可根据自己的需求,是否要使用 -->
<!--
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.ForumEntity的属性
-->
<resultMap type="com.entity.ForumEntity" id="forumMap">
<result property="title" column="title"/>
<result property="content" column="content"/>
<result property="parentid" column="parentid"/>
<result property="userid" column="userid"/>
<result property="username" column="username"/>
<result property="avatarurl" column="avatarurl"/>
<result property="isdone" column="isdone"/>
<result property="title" column="title"/> <!-- 将数据库列title映射到ForumEntity的属性title -->
<result property="content" column="content"/> <!-- 将数据库列content映射到ForumEntity的属性content -->
<result property="parentid" column="parentid"/> <!-- 将数据库列parentid映射到ForumEntity的属性parentid -->
<result property="userid" column="userid"/> <!-- 将数据库列userid映射到ForumEntity的属性userid -->
<result property="username" column="username"/> <!-- 将数据库列username映射到ForumEntity的属性username -->
<result property="avatarurl" column="avatarurl"/> <!-- 将数据库列avatarurl映射到ForumEntity的属性avatarurl -->
<result property="isdone" column="isdone"/> <!-- 将数据库列isdone映射到ForumEntity的属性isdone -->
</resultMap>
<select id="selectListVO"
resultType="com.entity.vo.ForumVO" >
SELECT * FROM forum forum
<!--
分页查询Forum的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.ForumVO
-->
<select id="selectListVO"
resultType="com.entity.vo.ForumVO">
SELECT * FROM forum forum
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<select id="selectVO"
resultType="com.entity.vo.ForumVO" >
SELECT forum.* FROM forum forum
<where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
<!--
查询单个Forum的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.ForumVO
-->
<select id="selectVO"
resultType="com.entity.vo.ForumVO">
SELECT forum.* FROM forum forum
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
分页查询Forum的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.ForumView
-->
<select id="selectListView"
resultType="com.entity.view.ForumView" >
SELECT forum.* FROM forum forum
resultType="com.entity.view.ForumView">
SELECT forum.* FROM forum forum
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
查询单个Forum的视图记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.ForumView
-->
<select id="selectView"
resultType="com.entity.view.ForumView">
SELECT * FROM forum forum
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<select id="selectView"
resultType="com.entity.view.ForumView" >
SELECT * FROM forum forum <where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
</mapper>

@ -1,36 +1,108 @@
<?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"/>
<result property="leixing" column="leixing"/> <!-- 将数据库列leixing映射到LeixingEntity的属性leixing -->
</resultMap>
<select id="selectListVO"
resultType="com.entity.vo.LeixingVO" >
SELECT * FROM leixing leixing
<!--
分页查询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>
</select>
<select id="selectVO"
resultType="com.entity.vo.LeixingVO" >
SELECT leixing.* FROM leixing leixing
<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>
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<select id="selectListView"
resultType="com.entity.view.LeixingView" >
当然,我会在你的代码中添加详细的注释,以确保每个部分的功能和参数都能被详细理解。以下是添加了注释的代码:
```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接口 -->
SELECT leixing.* FROM leixing leixing
<!--
可根据自己的需求,是否要使用
定义一个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>
</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"
resultType="com.entity.view.LeixingView">
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="selectView"
resultType="com.entity.view.LeixingView">
SELECT * FROM leixing leixing
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<select id="selectView"
resultType="com.entity.view.LeixingView" >
SELECT * FROM leixing leixing <where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
</mapper>

@ -1,39 +1,68 @@
<?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.NewsDao">
<!-- 定义Mapper的命名空间对应于NewsDao接口 -->
<!-- 可根据自己的需求,是否要使用 -->
<!--
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.NewsEntity的属性
-->
<resultMap type="com.entity.NewsEntity" id="newsMap">
<result property="title" column="title"/>
<result property="introduction" column="introduction"/>
<result property="picture" column="picture"/>
<result property="content" column="content"/>
<result property="title" column="title"/> <!-- 将数据库列title映射到NewsEntity的属性title -->
<result property="introduction" column="introduction"/> <!-- 将数据库列introduction映射到NewsEntity的属性introduction -->
<result property="picture" column="picture"/> <!-- 将数据库列picture映射到NewsEntity的属性picture -->
<result property="content" column="content"/> <!-- 将数据库列content映射到NewsEntity的属性content -->
</resultMap>
<select id="selectListVO"
resultType="com.entity.vo.NewsVO" >
SELECT * FROM news news
<!--
分页查询News的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.NewsVO
-->
<select id="selectListVO"
resultType="com.entity.vo.NewsVO">
SELECT * FROM news news
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<select id="selectVO"
resultType="com.entity.vo.NewsVO" >
SELECT news.* FROM news news
<where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
<!--
查询单个News的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.NewsVO
-->
<select id="selectVO"
resultType="com.entity.vo.NewsVO">
SELECT news.* FROM news news
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
分页查询News的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.NewsView
-->
<select id="selectListView"
resultType="com.entity.view.NewsView" >
SELECT news.* FROM news news
resultType="com.entity.view.NewsView">
SELECT news.* FROM news news
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
查询单个News的视图记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.NewsView
-->
<select id="selectView"
resultType="com.entity.view.NewsView">
SELECT * FROM news news
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<select id="selectView"
resultType="com.entity.view.NewsView" >
SELECT * FROM news news <where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
</mapper>

@ -1,43 +1,72 @@
<?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.StoreupDao">
<!-- 定义Mapper的命名空间对应于StoreupDao接口 -->
<!-- 可根据自己的需求,是否要使用 -->
<!--
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.StoreupEntity的属性
-->
<resultMap type="com.entity.StoreupEntity" id="storeupMap">
<result property="userid" column="userid"/>
<result property="refid" column="refid"/>
<result property="tablename" column="tablename"/>
<result property="name" column="name"/>
<result property="picture" column="picture"/>
<result property="type" column="type"/>
<result property="inteltype" column="inteltype"/>
<result property="remark" column="remark"/>
<result property="userid" column="userid"/> <!-- 将数据库列userid映射到StoreupEntity的属性userid -->
<result property="refid" column="refid"/> <!-- 将数据库列refid映射到StoreupEntity的属性refid -->
<result property="tablename" column="tablename"/> <!-- 将数据库列tablename映射到StoreupEntity的属性tablename -->
<result property="name" column="name"/> <!-- 将数据库列name映射到StoreupEntity的属性name -->
<result property="picture" column="picture"/> <!-- 将数据库列picture映射到StoreupEntity的属性picture -->
<result property="type" column="type"/> <!-- 将数据库列type映射到StoreupEntity的属性type -->
<result property="inteltype" column="inteltype"/> <!-- 将数据库列inteltype映射到StoreupEntity的属性inteltype -->
<result property="remark" column="remark"/> <!-- 将数据库列remark映射到StoreupEntity的属性remark -->
</resultMap>
<select id="selectListVO"
resultType="com.entity.vo.StoreupVO" >
SELECT * FROM storeup storeup
<!--
分页查询Storeup的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.StoreupVO
-->
<select id="selectListVO"
resultType="com.entity.vo.StoreupVO">
SELECT * FROM storeup storeup
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<select id="selectVO"
resultType="com.entity.vo.StoreupVO" >
SELECT storeup.* FROM storeup storeup
<where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
<!--
查询单个Storeup的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.StoreupVO
-->
<select id="selectVO"
resultType="com.entity.vo.StoreupVO">
SELECT storeup.* FROM storeup storeup
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
分页查询Storeup的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.StoreupView
-->
<select id="selectListView"
resultType="com.entity.view.StoreupView" >
SELECT storeup.* FROM storeup storeup
resultType="com.entity.view.StoreupView">
SELECT storeup.* FROM storeup storeup
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
查询单个Storeup的视图记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.StoreupView
-->
<select id="selectView"
resultType="com.entity.view.StoreupView">
SELECT * FROM storeup storeup
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<select id="selectView"
resultType="com.entity.view.StoreupView" >
SELECT * FROM storeup storeup <where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
</mapper>

@ -1,41 +1,70 @@
<?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.SystemintroDao">
<!-- 定义Mapper的命名空间对应于SystemintroDao接口 -->
<!-- 可根据自己的需求,是否要使用 -->
<!--
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.SystemintroEntity的属性
-->
<resultMap type="com.entity.SystemintroEntity" id="systemintroMap">
<result property="title" column="title"/>
<result property="subtitle" column="subtitle"/>
<result property="content" column="content"/>
<result property="picture1" column="picture1"/>
<result property="picture2" column="picture2"/>
<result property="picture3" column="picture3"/>
<result property="title" column="title"/> <!-- 将数据库列title映射到SystemintroEntity的属性title -->
<result property="subtitle" column="subtitle"/> <!-- 将数据库列subtitle映射到SystemintroEntity的属性subtitle -->
<result property="content" column="content"/> <!-- 将数据库列content映射到SystemintroEntity的属性content -->
<result property="picture1" column="picture1"/> <!-- 将数据库列picture1映射到SystemintroEntity的属性picture1 -->
<result property="picture2" column="picture2"/> <!-- 将数据库列picture2映射到SystemintroEntity的属性picture2 -->
<result property="picture3" column="picture3"/> <!-- 将数据库列picture3映射到SystemintroEntity的属性picture3 -->
</resultMap>
<select id="selectListVO"
resultType="com.entity.vo.SystemintroVO" >
SELECT * FROM systemintro systemintro
<!--
分页查询Systemintro的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.SystemintroVO
-->
<select id="selectListVO"
resultType="com.entity.vo.SystemintroVO">
SELECT * FROM systemintro systemintro
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<select id="selectVO"
resultType="com.entity.vo.SystemintroVO" >
SELECT systemintro.* FROM systemintro systemintro
<where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
<!--
查询单个Systemintro的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.SystemintroVO
-->
<select id="selectVO"
resultType="com.entity.vo.SystemintroVO">
SELECT systemintro.* FROM systemintro systemintro
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
分页查询Systemintro的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.SystemintroView
-->
<select id="selectListView"
resultType="com.entity.view.SystemintroView" >
SELECT systemintro.* FROM systemintro systemintro
resultType="com.entity.view.SystemintroView">
SELECT systemintro.* FROM systemintro systemintro
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
查询单个Systemintro的视图记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.SystemintroView
-->
<select id="selectView"
resultType="com.entity.view.SystemintroView">
SELECT * FROM systemintro systemintro
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<select id="selectView"
resultType="com.entity.view.SystemintroView" >
SELECT * FROM systemintro systemintro <where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
</mapper>

@ -1,13 +1,21 @@
<?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.TokenDao">
<!-- 定义Mapper的命名空间对应于TokenDao接口 -->
<!--
分页查询Token的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.TokenEntity
-->
<select id="selectListView"
resultType="com.entity.TokenEntity" >
SELECT t.* FROM token t
resultType="com.entity.TokenEntity" >
SELECT t.* FROM token t
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
</mapper>
</mapper>

@ -1,13 +1,21 @@
<?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.UsersDao">
<!-- 定义Mapper的命名空间对应于UsersDao接口 -->
<!--
分页查询Users的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.UsersEntity
-->
<select id="selectListView"
resultType="com.entity.UsersEntity" >
SELECT u.* FROM users u
resultType="com.entity.UsersEntity" >
SELECT u.* FROM users u
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
</mapper>

@ -1,84 +1,138 @@
<?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.WenjuandafuDao">
<!-- 定义Mapper的命名空间对应于WenjuandafuDao接口 -->
<!-- 可根据自己的需求,是否要使用 -->
<!--
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.WenjuandafuEntity的属性
-->
<resultMap type="com.entity.WenjuandafuEntity" id="wenjuandafuMap">
<result property="wenjuanbiaoti" column="wenjuanbiaoti"/>
<result property="leixing" column="leixing"/>
<result property="wentiyi" column="wentiyi"/>
<result property="dafuyi" column="dafuyi"/>
<result property="wentier" column="wentier"/>
<result property="dafuer" column="dafuer"/>
<result property="wentisan" column="wentisan"/>
<result property="dafusan" column="dafusan"/>
<result property="wentisi" column="wentisi"/>
<result property="dafusi" column="dafusi"/>
<result property="wentiwu" column="wentiwu"/>
<result property="dafuwu" column="dafuwu"/>
<result property="zhanghao" column="zhanghao"/>
<result property="xingming" column="xingming"/>
<result property="tijiaoriqi" column="tijiaoriqi"/>
<result property="wenjuanbiaoti" column="wenjuanbiaoti"/> <!-- 将数据库列wenjuanbiaoti映射到WenjuandafuEntity的属性wenjuanbiaoti -->
<result property="leixing" column="leixing"/> <!-- 将数据库列leixing映射到WenjuandafuEntity的属性leixing -->
<result property="wentiyi" column="wentiyi"/> <!-- 将数据库列wentiyi映射到WenjuandafuEntity的属性wentiyi -->
<result property="dafuyi" column="dafuyi"/> <!-- 将数据库列dafuyi映射到WenjuandafuEntity的属性dafuyi -->
<result property="wentier" column="wentier"/> <!-- 将数据库列wentier映射到WenjuandafuEntity的属性wentier -->
<result property="dafuer" column="dafuer"/> <!-- 将数据库列dafuer映射到WenjuandafuEntity的属性dafuer -->
<result property="wentisan" column="wentisan"/> <!-- 将数据库列wentisan映射到WenjuandafuEntity的属性wentisan -->
<result property="dafusan" column="dafusan"/> <!-- 将数据库列dafusan映射到WenjuandafuEntity的属性dafusan -->
<result property="wentisi" column="wentisi"/> <!-- 将数据库列wentisi映射到WenjuandafuEntity的属性wentisi -->
<result property="dafusi" column="dafusi"/> <!-- 将数据库列dafusi映射到WenjuandafuEntity的属性dafusi -->
<result property="wentiwu" column="wentiwu"/> <!-- 将数据库列wentiwu映射到WenjuandafuEntity的属性wentiwu -->
<result property="dafuwu" column="dafuwu"/> <!-- 将数据库列dafuwu映射到WenjuandafuEntity的属性dafuwu -->
<result property="zhanghao" column="zhanghao"/> <!-- 将数据库列zhanghao映射到WenjuandafuEntity的属性zhanghao -->
<result property="xingming" column="xingming"/> <!-- 将数据库列xingming映射到WenjuandafuEntity的属性xingming -->
<result property="tijiaoriqi" column="tijiaoriqi"/> <!-- 将数据库列tijiaoriqi映射到WenjuandafuEntity的属性tijiaoriqi -->
</resultMap>
<select id="selectListVO"
resultType="com.entity.vo.WenjuandafuVO" >
SELECT * FROM wenjuandafu wenjuandafu
<!--
分页查询Wenjuandafu的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.WenjuandafuVO
-->
<select id="selectListVO"
resultType="com.entity.vo.WenjuandafuVO">
SELECT * FROM wenjuandafu wenjuandafu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<select id="selectVO"
resultType="com.entity.vo.WenjuandafuVO" >
SELECT wenjuandafu.* FROM wenjuandafu wenjuandafu
<where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
<!--
查询单个Wenjuandafu的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.WenjuandafuVO
-->
<select id="selectVO"
resultType="com.entity.vo.WenjuandafuVO">
SELECT wenjuandafu.* FROM wenjuandafu wenjuandafu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
分页查询Wenjuandafu的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.WenjuandafuView
-->
<select id="selectListView"
resultType="com.entity.view.WenjuandafuView" >
SELECT wenjuandafu.* FROM wenjuandafu wenjuandafu
resultType="com.entity.view.WenjuandafuView">
SELECT wenjuandafu.* FROM wenjuandafu wenjuandafu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<select id="selectView"
resultType="com.entity.view.WenjuandafuView" >
SELECT * FROM wenjuandafu wenjuandafu <where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
<!--
查询单个Wenjuandafu的视图记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.WenjuandafuView
-->
<select id="selectView"
resultType="com.entity.view.WenjuandafuView">
SELECT * FROM wenjuandafu wenjuandafu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<select id="selectValue" resultType="map" >
SELECT ${params.xColumn}, sum(${params.yColumn}) total FROM wenjuandafu
<!--
查询Wenjuandafu的统计值
使用${ew.sqlSegment}来动态拼接SQL条件
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>
group by ${params.xColumn}
limit 10
GROUP BY ${params.xColumn} <!-- 按xColumn分组统计每个组的yColumn总和 -->
LIMIT 10 <!-- 限制结果集最多返回10条记录 -->
</select>
<select id="selectTimeStatValue" resultType="map" >
<if test = 'params.timeStatType == "日"'>
SELECT DATE_FORMAT(${params.xColumn},'%Y-%m-%d') ${params.xColumn}, sum(${params.yColumn}) total FROM wenjuandafu
<where> 1=1 ${ew.sqlSegment}</where>
group by DATE_FORMAT(${params.xColumn},'%Y-%m-%d')
<!--
查询Wenjuandafu的时间统计值
使用${ew.sqlSegment}来动态拼接SQL条件
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>
GROUP BY DATE_FORMAT(${params.xColumn}, '%Y-%m-%d') <!-- 按日分组统计每个组的yColumn总和 -->
</if>
<if test = 'params.timeStatType == "月"'>
SELECT DATE_FORMAT(${params.xColumn},'%Y-%m') ${params.xColumn}, sum(${params.yColumn}) total FROM wenjuandafu
<where> 1=1 ${ew.sqlSegment}</where>
group by DATE_FORMAT(${params.xColumn},'%Y-%m')
<if test='params.timeStatType == "月"'>
SELECT DATE_FORMAT(${params.xColumn}, '%Y-%m') AS ${params.xColumn}, sum(${params.yColumn}) AS total FROM wenjuandafu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE_FORMAT(${params.xColumn}, '%Y-%m') <!-- 按月分组统计每个组的yColumn总和 -->
</if>
<if test = 'params.timeStatType == "年"'>
SELECT DATE_FORMAT(${params.xColumn},'%Y') ${params.xColumn}, sum(${params.yColumn}) total FROM wenjuandafu
<where> 1=1 ${ew.sqlSegment}</where>
group by DATE_FORMAT(${params.xColumn},'%Y')
<if test='params.timeStatType == "年"'>
SELECT DATE_FORMAT(${params.xColumn}, '%Y') AS ${params.xColumn}, sum(${params.yColumn}) AS total FROM wenjuandafu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE_FORMAT(${params.xColumn}, '%Y') <!-- 按年分组统计每个组的yColumn总和 -->
</if>
</select>
<select id="selectGroup" resultType="map" >
SELECT ${params.column} , count(1) total FROM wenjuandafu
<!--
查询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>
group by ${params.column}
limit 10
GROUP BY ${params.column} <!-- 按column分组统计每个组的记录数 -->
LIMIT 10 <!-- 限制结果集最多返回10条记录 -->
</select>
</mapper>

@ -1,79 +1,133 @@
<?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.WenjuandiaochaDao">
<!-- 定义Mapper的命名空间对应于WenjuandiaochaDao接口 -->
<!-- 可根据自己的需求,是否要使用 -->
<!--
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.WenjuandiaochaEntity的属性
-->
<resultMap type="com.entity.WenjuandiaochaEntity" id="wenjuandiaochaMap">
<result property="wenjuanbiaoti" column="wenjuanbiaoti"/>
<result property="fengmiantupian" column="fengmiantupian"/>
<result property="leixing" column="leixing"/>
<result property="wentiyi" column="wentiyi"/>
<result property="wentier" column="wentier"/>
<result property="wentisan" column="wentisan"/>
<result property="wentisi" column="wentisi"/>
<result property="wentiwu" column="wentiwu"/>
<result property="faburiqi" column="faburiqi"/>
<result property="clicktime" column="clicktime"/>
<result property="wenjuanbiaoti" column="wenjuanbiaoti"/> <!-- 将数据库列wenjuanbiaoti映射到WenjuandiaochaEntity的属性wenjuanbiaoti -->
<result property="fengmiantupian" column="fengmiantupian"/> <!-- 将数据库列fengmiantupian映射到WenjuandiaochaEntity的属性fengmiantupian -->
<result property="leixing" column="leixing"/> <!-- 将数据库列leixing映射到WenjuandiaochaEntity的属性leixing -->
<result property="wentiyi" column="wentiyi"/> <!-- 将数据库列wentiyi映射到WenjuandiaochaEntity的属性wentiyi -->
<result property="wentier" column="wentier"/> <!-- 将数据库列wentier映射到WenjuandiaochaEntity的属性wentier -->
<result property="wentisan" column="wentisan"/> <!-- 将数据库列wentisan映射到WenjuandiaochaEntity的属性wentisan -->
<result property="wentisi" column="wentisi"/> <!-- 将数据库列wentisi映射到WenjuandiaochaEntity的属性wentisi -->
<result property="wentiwu" column="wentiwu"/> <!-- 将数据库列wentiwu映射到WenjuandiaochaEntity的属性wentiwu -->
<result property="faburiqi" column="faburiqi"/> <!-- 将数据库列faburiqi映射到WenjuandiaochaEntity的属性faburiqi -->
<result property="clicktime" column="clicktime"/> <!-- 将数据库列clicktime映射到WenjuandiaochaEntity的属性clicktime -->
</resultMap>
<select id="selectListVO"
resultType="com.entity.vo.WenjuandiaochaVO" >
SELECT * FROM wenjuandiaocha wenjuandiaocha
<!--
分页查询Wenjuandiaocha的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.WenjuandiaochaVO
-->
<select id="selectListVO"
resultType="com.entity.vo.WenjuandiaochaVO">
SELECT * FROM wenjuandiaocha wenjuandiaocha
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<select id="selectVO"
resultType="com.entity.vo.WenjuandiaochaVO" >
SELECT wenjuandiaocha.* FROM wenjuandiaocha wenjuandiaocha
<where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
<!--
查询单个Wenjuandiaocha的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.WenjuandiaochaVO
-->
<select id="selectVO"
resultType="com.entity.vo.WenjuandiaochaVO">
SELECT wenjuandiaocha.* FROM wenjuandiaocha wenjuandiaocha
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
分页查询Wenjuandiaocha的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.WenjuandiaochaView
-->
<select id="selectListView"
resultType="com.entity.view.WenjuandiaochaView" >
SELECT wenjuandiaocha.* FROM wenjuandiaocha wenjuandiaocha
resultType="com.entity.view.WenjuandiaochaView">
SELECT wenjuandiaocha.* FROM wenjuandiaocha wenjuandiaocha
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<select id="selectView"
resultType="com.entity.view.WenjuandiaochaView" >
SELECT * FROM wenjuandiaocha wenjuandiaocha <where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
<!--
查询单个Wenjuandiaocha的视图记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.WenjuandiaochaView
-->
<select id="selectView"
resultType="com.entity.view.WenjuandiaochaView">
SELECT * FROM wenjuandiaocha wenjuandiaocha
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<select id="selectValue" resultType="map" >
SELECT ${params.xColumn}, sum(${params.yColumn}) total FROM wenjuandiaocha
<!--
查询Wenjuandiaocha的统计值
使用${ew.sqlSegment}来动态拼接SQL条件
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>
group by ${params.xColumn}
limit 10
GROUP BY ${params.xColumn} <!-- 按xColumn分组统计每个组的yColumn总和 -->
LIMIT 10 <!-- 限制结果集最多返回10条记录 -->
</select>
<select id="selectTimeStatValue" resultType="map" >
<if test = 'params.timeStatType == "日"'>
SELECT DATE_FORMAT(${params.xColumn},'%Y-%m-%d') ${params.xColumn}, sum(${params.yColumn}) total FROM wenjuandiaocha
<where> 1=1 ${ew.sqlSegment}</where>
group by DATE_FORMAT(${params.xColumn},'%Y-%m-%d')
<!--
查询Wenjuandiaocha的时间统计值
使用${ew.sqlSegment}来动态拼接SQL条件
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>
GROUP BY DATE_FORMAT(${params.xColumn}, '%Y-%m-%d') <!-- 按日分组统计每个组的yColumn总和 -->
</if>
<if test = 'params.timeStatType == "月"'>
SELECT DATE_FORMAT(${params.xColumn},'%Y-%m') ${params.xColumn}, sum(${params.yColumn}) total FROM wenjuandiaocha
<where> 1=1 ${ew.sqlSegment}</where>
group by DATE_FORMAT(${params.xColumn},'%Y-%m')
<if test='params.timeStatType == "月"'>
SELECT DATE_FORMAT(${params.xColumn}, '%Y-%m') AS ${params.xColumn}, sum(${params.yColumn}) AS total FROM wenjuandiaocha
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE_FORMAT(${params.xColumn}, '%Y-%m') <!-- 按月分组统计每个组的yColumn总和 -->
</if>
<if test = 'params.timeStatType == "年"'>
SELECT DATE_FORMAT(${params.xColumn},'%Y') ${params.xColumn}, sum(${params.yColumn}) total FROM wenjuandiaocha
<where> 1=1 ${ew.sqlSegment}</where>
group by DATE_FORMAT(${params.xColumn},'%Y')
<if test='params.timeStatType == "年"'>
SELECT DATE_FORMAT(${params.xColumn}, '%Y') AS ${params.xColumn}, sum(${params.yColumn}) AS total FROM wenjuandiaocha
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE_FORMAT(${params.xColumn}, '%Y') <!-- 按年分组统计每个组的yColumn总和 -->
</if>
</select>
<select id="selectGroup" resultType="map" >
SELECT ${params.column} , count(1) total FROM wenjuandiaocha
<!--
查询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>
group by ${params.column}
limit 10
GROUP BY ${params.column} <!-- 按column分组统计每个组的记录数 -->
LIMIT 10 <!-- 限制结果集最多返回10条记录 -->
</select>
</mapper>

@ -1,76 +1,130 @@
<?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.YonghuDao">
<!-- 定义Mapper的命名空间对应于YonghuDao接口 -->
<!-- 可根据自己的需求,是否要使用 -->
<!--
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.YonghuEntity的属性
-->
<resultMap type="com.entity.YonghuEntity" id="yonghuMap">
<result property="zhanghao" column="zhanghao"/>
<result property="mima" column="mima"/>
<result property="xingming" column="xingming"/>
<result property="xingbie" column="xingbie"/>
<result property="youxiang" column="youxiang"/>
<result property="shoujihaoma" column="shoujihaoma"/>
<result property="touxiang" column="touxiang"/>
<result property="zhanghao" column="zhanghao"/> <!-- 将数据库列zhanghao映射到YonghuEntity的属性zhanghao -->
<result property="mima" column="mima"/> <!-- 将数据库列mima映射到YonghuEntity的属性mima -->
<result property="xingming" column="xingming"/> <!-- 将数据库列xingming映射到YonghuEntity的属性xingming -->
<result property="xingbie" column="xingbie"/> <!-- 将数据库列xingbie映射到YonghuEntity的属性xingbie -->
<result property="youxiang" column="youxiang"/> <!-- 将数据库列youxiang映射到YonghuEntity的属性youxiang -->
<result property="shoujihaoma" column="shoujihaoma"/> <!-- 将数据库列shoujihaoma映射到YonghuEntity的属性shoujihaoma -->
<result property="touxiang" column="touxiang"/> <!-- 将数据库列touxiang映射到YonghuEntity的属性touxiang -->
</resultMap>
<select id="selectListVO"
resultType="com.entity.vo.YonghuVO" >
SELECT * FROM yonghu yonghu
<!--
分页查询Yonghu的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.YonghuVO
-->
<select id="selectListVO"
resultType="com.entity.vo.YonghuVO">
SELECT * FROM yonghu yonghu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<select id="selectVO"
resultType="com.entity.vo.YonghuVO" >
SELECT yonghu.* FROM yonghu yonghu
<where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
<!--
查询单个Yonghu的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.YonghuVO
-->
<select id="selectVO"
resultType="com.entity.vo.YonghuVO">
SELECT yonghu.* FROM yonghu yonghu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
分页查询Yonghu的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.YonghuView
-->
<select id="selectListView"
resultType="com.entity.view.YonghuView" >
SELECT yonghu.* FROM yonghu yonghu
resultType="com.entity.view.YonghuView">
SELECT yonghu.* FROM yonghu yonghu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<select id="selectView"
resultType="com.entity.view.YonghuView" >
SELECT * FROM yonghu yonghu <where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
<!--
查询单个Yonghu的视图记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.YonghuView
-->
<select id="selectView"
resultType="com.entity.view.YonghuView">
SELECT * FROM yonghu yonghu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<select id="selectValue" resultType="map" >
SELECT ${params.xColumn}, sum(${params.yColumn}) total FROM yonghu
<!--
查询Yonghu的统计值
使用${ew.sqlSegment}来动态拼接SQL条件
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>
group by ${params.xColumn}
limit 10
GROUP BY ${params.xColumn} <!-- 按xColumn分组统计每个组的yColumn总和 -->
LIMIT 10 <!-- 限制结果集最多返回10条记录 -->
</select>
<select id="selectTimeStatValue" resultType="map" >
<if test = 'params.timeStatType == "日"'>
SELECT DATE_FORMAT(${params.xColumn},'%Y-%m-%d') ${params.xColumn}, sum(${params.yColumn}) total FROM yonghu
<where> 1=1 ${ew.sqlSegment}</where>
group by DATE_FORMAT(${params.xColumn},'%Y-%m-%d')
<!--
查询Yonghu的时间统计值
使用${ew.sqlSegment}来动态拼接SQL条件
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>
GROUP BY DATE_FORMAT(${params.xColumn}, '%Y-%m-%d') <!-- 按日分组统计每个组的yColumn总和 -->
</if>
<if test = 'params.timeStatType == "月"'>
SELECT DATE_FORMAT(${params.xColumn},'%Y-%m') ${params.xColumn}, sum(${params.yColumn}) total FROM yonghu
<where> 1=1 ${ew.sqlSegment}</where>
group by DATE_FORMAT(${params.xColumn},'%Y-%m')
<if test='params.timeStatType == "月"'>
SELECT DATE_FORMAT(${params.xColumn}, '%Y-%m') AS ${params.xColumn}, sum(${params.yColumn}) AS total FROM yonghu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE_FORMAT(${params.xColumn}, '%Y-%m') <!-- 按月分组统计每个组的yColumn总和 -->
</if>
<if test = 'params.timeStatType == "年"'>
SELECT DATE_FORMAT(${params.xColumn},'%Y') ${params.xColumn}, sum(${params.yColumn}) total FROM yonghu
<where> 1=1 ${ew.sqlSegment}</where>
group by DATE_FORMAT(${params.xColumn},'%Y')
<if test='params.timeStatType == "年"'>
SELECT DATE_FORMAT(${params.xColumn}, '%Y') AS ${params.xColumn}, sum(${params.yColumn}) AS total FROM yonghu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE_FORMAT(${params.xColumn}, '%Y') <!-- 按年分组统计每个组的yColumn总和 -->
</if>
</select>
<select id="selectGroup" resultType="map" >
SELECT ${params.column} , count(1) total FROM yonghu
<!--
查询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>
group by ${params.column}
limit 10
GROUP BY ${params.column} <!-- 按column分组统计每个组的记录数 -->
LIMIT 10 <!-- 限制结果集最多返回10条记录 -->
</select>
</mapper>

Loading…
Cancel
Save