Compare commits

...

28 Commits

Author SHA1 Message Date
meyum3vjr e709fc57c3 Merge pull request '注释代码' (#6) from wujiamei_branch into main
9 months ago
wjm d9fc767866 注释代码
9 months ago
p4vkf3rot f5115f4838 Merge pull request '注 释' (#5) from zhangshuting_branch into main
9 months ago
2593162056@qq.com 9bc35e6eed zhushi
9 months ago
2593162056@qq.com a24b27043f Merge branch 'zhangshuting_branch' of https://bdgit.educoder.net/p4vkf3rot/j2ee1 into zhangshuting_branch
9 months ago
2593162056@qq.com 67db8bec6c zhushi
9 months ago
2593162056@qq.com 212cfb6588 zhushi
9 months ago
pfwt7cxhv b739ab322f Merge pull request '注释' (#1) from hujiali_branch into main
9 months ago
p4vkf3rot dabcfbea94 Update SystemintroController.java
9 months ago
2593162056@qq.com 6836490617 注释
9 months ago
2593162056@qq.com 966162e4d8 注释。
9 months ago
2593162056@qq.com e43f48d102 注释
9 months ago
hjl defa99ff6e 注释
9 months ago
hjl 3972facc96 注释
9 months ago
hjl b218c34cc3 注释
9 months ago
wjm 2d3fe8c5d3 注释代码
9 months ago
wjm d68ef9898b 注释代码
9 months ago
wjm 3af043d946 注释代码
9 months ago
wjm a37a7c23e4 注释代码
9 months ago
wjm d26a7e0ec4 注释代码
9 months ago
wjm b723657e0a 注释代码
9 months ago
hjl 8945f4a85a 注释
9 months ago
2593162056@qq.com 3cb4760892 注 释
9 months ago
2593162056@qq.com e2500511a4 注 释
9 months ago
2593162056@qq.com bcea284632 注释.
9 months ago
2593162056@qq.com a8a302077b 注释..
9 months ago
2593162056@qq.com c9f4acb5ba 注释.
9 months ago
2593162056@qq.com 0ecf6a84c1 注释
9 months ago

@ -42,214 +42,310 @@ import com.utils.CommonUtil;
/**
* 线
*
* @author
* @email
* @author
* @email
* @date 2023-02-21 09:46:06
*/
@RestController
@RequestMapping("/chat")
public class ChatController {
// 自动注入ChatService实例用于处理与聊天相关的业务逻辑
@Autowired
private ChatService chatService;
/**
*
*
* @param params Map
* @param chat ChatEntity
* @param request HttpServletRequest
* @return R
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,ChatEntity chat,
HttpServletRequest request){
if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
chat.setUserid((Long)request.getSession().getAttribute("userId"));
public R page(@RequestParam Map<String, Object> params, ChatEntity chat,
HttpServletRequest request) {
// 如果当前用户不是管理员角色,设置查询条件,只查询当前用户的聊天记录
if (!request.getSession().getAttribute("role").toString().equals("管理员")) {
chat.setUserid((Long) request.getSession().getAttribute("userId"));
}
// 创建一个EntityWrapper对象用于构建MyBatis Plus的查询条件
EntityWrapper<ChatEntity> ew = new EntityWrapper<ChatEntity>();
// 调用chatService的queryPage方法进行分页查询传入构建好的查询条件和参数
PageUtils page = chatService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, chat), params), params));
// 将查询结果设置到请求属性中,可能用于在后续的视图渲染中使用
request.setAttribute("data", page);
// 返回包含查询结果的R对象通常R对象用于统一封装返回结果的状态和数据
return R.ok().put("data", page);
}
/**
*
*
* @param params Map
* @param chat ChatEntity
* @param request HttpServletRequest
* @return R
*/
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,ChatEntity chat,
HttpServletRequest request){
if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
chat.setUserid((Long)request.getSession().getAttribute("userId"));
public R list(@RequestParam Map<String, Object> params, ChatEntity chat,
HttpServletRequest request) {
// 如果当前用户不是管理员角色,设置查询条件,只查询当前用户的聊天记录
if (!request.getSession().getAttribute("role").toString().equals("管理员")) {
chat.setUserid((Long) request.getSession().getAttribute("userId"));
}
// 创建一个EntityWrapper对象用于构建MyBatis Plus的查询条件
EntityWrapper<ChatEntity> ew = new EntityWrapper<ChatEntity>();
// 调用chatService的queryPage方法进行分页查询传入构建好的查询条件和参数
PageUtils page = chatService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, chat), params), params));
// 将查询结果设置到请求属性中,可能用于在后续的视图渲染中使用
request.setAttribute("data", page);
// 返回包含查询结果的R对象通常R对象用于统一封装返回结果的状态和数据
return R.ok().put("data", page);
}
/**
*
* ChatEntity
* @param chat ChatEntity
* @return R
*/
@RequestMapping("/lists")
public R list( ChatEntity chat){
public R list(ChatEntity chat) {
// 创建一个EntityWrapper对象用于构建MyBatis Plus的查询条件
EntityWrapper<ChatEntity> ew = new EntityWrapper<ChatEntity>();
ew.allEq(MPUtil.allEQMapPre( chat, "chat"));
// 根据传入的ChatEntity对象构建等值查询条件
ew.allEq(MPUtil.allEQMapPre(chat, "chat"));
// 调用chatService的selectListView方法进行查询并返回结果
return R.ok().put("data", chatService.selectListView(ew));
}
/**
*
* 线
* @param chat ChatEntity
* @return R线
*/
@RequestMapping("/query")
public R query(ChatEntity chat){
EntityWrapper< ChatEntity> ew = new EntityWrapper< ChatEntity>();
ew.allEq(MPUtil.allEQMapPre( chat, "chat"));
public R query(ChatEntity chat) {
// 创建一个EntityWrapper对象用于构建MyBatis Plus的查询条件
EntityWrapper<ChatEntity> ew = new EntityWrapper<ChatEntity>();
// 根据传入的ChatEntity对象构建等值查询条件
ew.allEq(MPUtil.allEQMapPre(chat, "chat"));
// 调用chatService的selectView方法进行查询获取ChatView对象可能是包含详细信息的视图对象
ChatView chatView = chatService.selectView(ew);
// 返回包含查询结果的R对象以及提示信息和查询到的详细信息视图
return R.ok("查询在线咨询成功").put("data", chatView);
}
/**
*
* ID
* @param id ID
* @return R
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
public R info(@PathVariable("id") Long id) {
// 调用chatService的selectById方法根据ID查询聊天记录
ChatEntity chat = chatService.selectById(id);
// 返回包含查询结果的R对象
return R.ok().put("data", chat);
}
/**
*
* @IgnoreAuth
* @param id ID
* @return R
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
public R detail(@PathVariable("id") Long id) {
// 调用chatService的selectById方法根据ID查询聊天记录
ChatEntity chat = chatService.selectById(id);
// 返回包含查询结果的R对象
return R.ok().put("data", chat);
}
/**
*
*
* @param chat ChatEntity
* @param request HttpServletRequest
* @return R
*/
@RequestMapping("/save")
public R save(@RequestBody ChatEntity chat, HttpServletRequest request){
chat.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
public R save(@RequestBody ChatEntity chat, HttpServletRequest request) {
// 设置聊天记录的ID由当前时间戳加上一个随机数生成
chat.setId(new Date().getTime() + new Double(Math.floor(Math.random() * 1000)).longValue());
// 此处原本可能用于验证ChatEntity对象的合法性但被注释掉了
//ValidatorUtils.validateEntity(chat);
if(StringUtils.isNotBlank(chat.getAsk())) {
// 如果聊天记录的提问内容不为空
if (StringUtils.isNotBlank(chat.getAsk())) {
// 更新当前用户的未回复状态为0表示有新提问
chatService.updateForSet("isreply=0", new EntityWrapper<ChatEntity>().eq("userid", request.getSession().getAttribute("userId")));
chat.setUserid((Long)request.getSession().getAttribute("userId"));
// 设置聊天记录的用户ID为当前用户ID
chat.setUserid((Long) request.getSession().getAttribute("userId"));
// 设置回复状态为1表示已提问等待回复
chat.setIsreply(1);
}
if(StringUtils.isNotBlank(chat.getReply())) {
// 如果聊天记录的回复内容不为空
if (StringUtils.isNotBlank(chat.getReply())) {
// 更新当前用户提问用户的未回复状态为0表示有新回复
chatService.updateForSet("isreply=0", new EntityWrapper<ChatEntity>().eq("userid", chat.getUserid()));
chat.setAdminid((Long)request.getSession().getAttribute("userId"));
// 设置聊天记录的管理员ID为当前用户ID可能表示回复的管理员
chat.setAdminid((Long) request.getSession().getAttribute("userId"));
}
// 调用chatService的insert方法插入新的聊天记录
chatService.insert(chat);
// 返回表示保存成功的R对象
return R.ok();
}
/**
*
*
* @param chat ChatEntity
* @param request HttpServletRequest
* @return R
*/
@RequestMapping("/add")
public R add(@RequestBody ChatEntity chat, HttpServletRequest request){
chat.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(chat);
chat.setUserid((Long)request.getSession().getAttribute("userId"));
if(StringUtils.isNotBlank(chat.getAsk())) {
public R add(@RequestBody ChatEntity chat, HttpServletRequest request) {
// 设置聊天记录的ID由当前时间戳加上一个随机数生成
chat.setId(new Date().getTime() + new Double(Math.floor(Math.random() * 1000)).longValue());
// 设置聊天记录的用户ID为当前用户ID
chat.setUserid((Long) request.getSession().getAttribute("userId"));
// 如果聊天记录的提问内容不为空
if (StringUtils.isNotBlank(chat.getAsk())) {
// 更新当前用户的未回复状态为0表示有新提问
chatService.updateForSet("isreply=0", new EntityWrapper<ChatEntity>().eq("userid", request.getSession().getAttribute("userId")));
chat.setUserid((Long)request.getSession().getAttribute("userId"));
// 设置聊天记录的用户ID为当前用户ID
chat.setUserid((Long) request.getSession().getAttribute("UserId"));
// 设置回复状态为1表示已提问等待回复
chat.setIsreply(1);
}
if(StringUtils.isNotBlank(chat.getReply())) {
// 如果聊天记录的回复内容不为空
if (StringUtils.isNotBlank(chat.getReply())) {
// 更新当前用户提问用户的未回复状态为0表示有新回复
chatService.updateForSet("isreply=0", new EntityWrapper<ChatEntity>().eq("userid", chat.getUserid()));
chat.setAdminid((Long)request.getSession().getAttribute("userId"));
// 设置聊天记录的管理员ID为当前用户ID可能表示回复的管理员
chat.setAdminid((Long) request.getSession().getAttribute("UserId"));
}
// 调用chatService的insert方法插入新的聊天记录
chatService.insert(chat);
// 返回表示保存成功的R对象
return R.ok();
}
/**
*
*
* @param chat ChatEntity
* @param request HttpServletRequest
* @return R
*/
@RequestMapping("/update")
@Transactional
public R update(@RequestBody ChatEntity chat, HttpServletRequest request){
public R update(@RequestBody ChatEntity chat, HttpServletRequest request) {
// 此处原本可能用于验证ChatEntity对象的合法性但被注释掉了
//ValidatorUtils.validateEntity(chat);
chatService.updateById(chat);//全部更新
// 调用chatService的updateById方法根据ID更新聊天记录
chatService.updateById(chat); //全部更新
// 返回表示修改成功的R对象
return R.ok();
}
/**
*
* ID
* @param ids ID
* @return R
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
public R delete(@RequestBody Long[] ids) {
// 调用chatService的deleteBatchIds方法批量删除指定ID的聊天记录
chatService.deleteBatchIds(Arrays.asList(ids));
// 返回表示删除成功的R对象
return R.ok();
}
/**
*
*
* @param columnName
* @param request HttpServletRequest
* @param type
* @param map Map
* @return R
*/
@RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type,@RequestParam Map<String, Object> map) {
@PathVariable("type") String type, @RequestParam Map<String, Object> map) {
// 将列名和类型添加到查询条件Map中
map.put("column", columnName);
map.put("type", type);
if(type.equals("2")) {
// 如果提醒类型为2
if (type.equals("2")) {
// 创建SimpleDateFormat对象用于日期格式化
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
// 获取Calendar实例用于日期计算
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
if(map.get("remindstart")!=null) {
// 如果查询条件Map中包含remindstart开始提醒时间
if (map.get("remindstart")!= null) {
// 将remindstart转换为整数表示要添加的天数
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
// 设置当前日期为基础日期
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
// 根据提醒开始天数添加到当前日期上
c.add(Calendar.DAY_OF_MONTH, remindStart);
// 获取计算后的提醒开始日期
remindStartDate = c.getTime();
// 将提醒开始日期格式化为指定格式并更新到查询条件Map中
map.put("remindstart", sdf.format(remindStartDate));
}
if(map.get("remindend")!=null) {
// 如果查询条件Map中包含remindend结束提醒时间
if (map.get("remindend")!= null) {
// 将remindend转换为整数表示要添加的天数
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
// 设置当前日期为基础日期
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
// 根据提醒结束天数添加到当前日期上
c.add(Calendar.DAY_OF_MONTH, remindEnd);
// 获取计算后的提醒结束日期
remindEndDate = c.getTime();
// 将提醒结束日期格式化为指定格式并更新到查询条件Map中
map.put("remindend", sdf.format(remindEndDate));
}
}
// 创建一个EntityWrapper对象用于构建MyBatis Plus的查询条件
Wrapper<ChatEntity> wrapper = new EntityWrapper<ChatEntity>();
if(map.get("remindstart")!=null) {
// 如果查询条件Map中包含remindstart开始提醒时间添加大于等于条件到查询条件中
if (map.get("remindstart")!= null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
// 如果查询条件Map中包含remindend结束提醒时间添加小于等于条件到查询条件中
if (map.get("remindend")!= null) {
wrapper.le(columnName, map.get("remindend"));
}
// 调用chatService的selectCount方法根据构建好的查询条件统计符合条件的聊天记录数量
int count = chatService.selectCount(wrapper);
// 返回包含统计结果的R对象
return R.ok().put("count", count);
}
}

@ -28,74 +28,107 @@ import com.baidu.aip.face.MatchRequest;
import com.baidu.aip.util.Base64Util;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.ConfigEntity;
// 导入相关的服务类和工具类
import com.service.CommonService;
import com.service.ConfigService;
import com.utils.BaiduUtil;
import com.utils.FileUtil;
import com.utils.R;
import com.utils.CommonUtil;
/**
*
* SpringRestController
*
*/
@RestController
public class CommonController{
public class CommonController {
// 自动注入CommonService用于处理通用的业务逻辑
@Autowired
private CommonService commonService;
// 定义百度AI人脸识别客户端对象初始化为null
private static AipFace client = null;
// 自动注入ConfigService可能用于获取配置相关信息
@Autowired
private ConfigService configService;
/**
* tablecolumn()
* @param table
* @param column
* @return
* tablecolumn
*
*
* @param tableName
* @param columnName
* @param conditionColumn
* @param conditionValue conditionColumn使
* @param level
* @param parent
* @return RR
*/
@RequestMapping("/option/{tableName}/{columnName}")
@IgnoreAuth
public R getOption(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName,@RequestParam(required = false) String conditionColumn,@RequestParam(required = false) String conditionValue,String level,String parent) {
public R getOption(@PathVariable("tableName") String tableName, @PathVariable("tableName") String columnName,
@RequestParam(required = false) String conditionColumn,
@RequestParam(required = false) String conditionValue, String level, String parent) {
// 创建一个用于存储参数的Map对象
Map<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName);
params.put("column", columnName);
if(StringUtils.isNotBlank(level)) {
if (StringUtils.isNotBlank(level)) {
params.put("level", level);
}
if(StringUtils.isNotBlank(parent)) {
if (StringUtils.isNotBlank(parent)) {
params.put("parent", parent);
}
if(StringUtils.isNotBlank(conditionColumn)) {
if (StringUtils.isNotBlank(conditionColumn)) {
params.put("conditionColumn", conditionColumn);
}
if(StringUtils.isNotBlank(conditionValue)) {
if (StringUtils.isNotBlank(conditionValue)) {
params.put("conditionValue", conditionValue);
}
// 调用commonService的getOption方法获取数据列表
List<String> data = commonService.getOption(params);
// 返回包含数据列表的R对象结果状态为成功
return R.ok().put("data", data);
}
/**
* tablecolumn
* @param table
* @param column
* @return
*
*
* @param tableName
* @param columnName
* @param columnValue
* @return R
*/
@RequestMapping("/follow/{tableName}/{columnName}")
@IgnoreAuth
public R getFollowByOption(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName, @RequestParam String columnValue) {
public R getFollowByOption(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName,
@RequestParam String columnValue) {
// 创建一个用于存储参数的Map对象
Map<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName);
params.put("column", columnName);
params.put("columnValue", columnValue);
// 调用commonService的getFollowByOption方法获取单条记录数据
Map<String, Object> result = commonService.getFollowByOption(params);
// 返回包含单条记录数据的R对象结果状态为成功
return R.ok().put("data", result);
}
/**
* tablesfsh
* @param table
* @param map
* @return
* MapcommonServiceshsfsh
*
* @param tableName
* @param map Map
* @return R
*/
@RequestMapping("/sh/{tableName}")
public R sh(@PathVariable("tableName") String tableName, @RequestBody Map<String, Object> map) {
@ -106,47 +139,58 @@ public class CommonController{
/**
*
* @param tableName
* @param columnName
* @param type 1: 2:
* @param map
* @return
* Map
* 2
*
* @param tableName
* @param columnName
* @param type 12
* @param map Maptype2
* @return R
*/
@RequestMapping("/remind/{tableName}/{columnName}/{type}")
@IgnoreAuth
public R remindCount(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName,
@PathVariable("type") String type,@RequestParam Map<String, Object> map) {
@PathVariable("type") String type, @RequestParam Map<String, Object> map) {
map.put("table", tableName);
map.put("column", columnName);
map.put("type", type);
if(type.equals("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) {
if (map.get("remindstart")!= null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
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());
if (map.get("remindend")!= null) {
Integer recommendEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
c.add(Calendar.DAY_OF_MONTH, recommendEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
}
}
// 调用commonService的remindCount方法获取需要提醒的记录数
int count = commonService.remindCount(map);
// 返回包含记录数的R对象结果状态为成功
return R.ok().put("count", count);
}
/**
*
* commonServiceselectCal
*
* @param tableName
* @param columnName
* @return R
*/
@RequestMapping("/cal/{tableName}/{columnName}")
@IgnoreAuth
@ -154,12 +198,22 @@ public class CommonController{
Map<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName);
params.put("column", columnName);
// 调用commonService的selectCal方法进行求和操作并获取结果
Map<String, Object> result = commonService.selectCal(params);
// 返回包含求和结果的R对象结果状态为成功
return R.ok().put("data", result);
}
/**
*
* commonServiceselectGroup
*
*
* @param tableName
@param columnName
* @return R
*/
@RequestMapping("/group/{tableName}/{columnName}")
@IgnoreAuth
@ -167,63 +221,93 @@ public class CommonController{
Map<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName);
params.put("column", columnName);
// 调用commonService的selectGroup方法进行分组统计操作并获取结果
List<Map<String, Object>> result = commonService.selectGroup(params);
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)));
}
}
}
// 返回包含分组统计结果的R对象结果状态为成功
return R.ok().put("data", result);
}
/**
*
* xycommonServiceselectValue
*
*
* @param tableName
* @param yColumnName y
* @param xColumnName x
* @return R
*/
@RequestMapping("/value/{tableName}/{xColumnName}/{yColumnName}")
@IgnoreAuth
public R value(@PathVariable("tableName") String tableName, @PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName) {
public R value(@PathVariable("tableName") String tableName, @PathVariable("yColumnName") String yColumnName,
@PathVariable("xColumnName") String xColumnName) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName);
params.put("xColumn", xColumnName);
params.put("yColumn", yColumnName);
List<Map<String, Object>> result = commonService.selectValue(params);
// 调用commonService的selectValue方法进行按值统计操作并获取结果
List<Map<String, Object> > result = commonService.selectValue(params);
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)));
}
}
}
// 返回包含按值统计结果的R对象结果状态为成功
return R.ok().put("data", result);
}
/**
*
* xycommonServiceselectTimeStatValue
*
*
* @param tableName
* @param yColumnName y
* @param xColumnName x
* @param timeStatType
* @return R
*/
@IgnoreAuth
@RequestMapping("/value/{tableName}/{xColumnName}/{yColumnName}/{timeStatType}")
public R valueDay(@PathVariable("tableName") String tableName, @PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName, @PathVariable("timeStatType") String timeStatType) {
@IgnoreAuth
public R valueDay(@PathVariable("tableName") String tableName, @PathVariable("yColumnName") String yColumnName,
@PathVariable("xColumnName") String xColumnName, @PathVariable("timeStatType") String timeStatType) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName);
params.put("xColumn", xColumnName);
params.put("yColumn", yColumnName);
params.put("timeStatType", timeStatType);
List<Map<String, Object>> result = commonService.selectTimeStatValue(params);
// 调用commonService的selectTimeStatValue方法进行按值统计操作并获取结果
List<Map<String, Object> > result = commonService.selectTimeStatValue(params);
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)));
}
}
}
// 返回包含按值统计结果的R对象结果状态为成功
return R.ok().put("data", result);
}
}

@ -1,7 +1,5 @@
package com.controller;
import java.util.Arrays;
import java.util.Map;
@ -14,10 +12,10 @@ 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.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;
@ -25,88 +23,106 @@ import com.utils.ValidatorUtils;
/**
*
*/
@RequestMapping("config")
@RestController
public class ConfigController{
@RequestMapping("config") // 设置基本请求路径为"/config"
@RestController // 标记为REST风格的控制器
public class ConfigController {
@Autowired
@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));
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));
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"));
@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);//全部更新
@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();
}
}

@ -10,14 +10,14 @@ import javax.servlet.http.HttpServletResponse;
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.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;
import org.springframework.web.multipart.MultipartFile;
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.annotation.IgnoreAuth; // 导入自定义注解,表示忽略身份验证
import com.baomidou.mybatisplus.mapper.EntityWrapper; // 导入MyBatis-Plus的EntityWrapper用于构建查询条件
import com.entity.ConfigEntity;
import com.entity.EIException;
import com.service.ConfigService;
@ -26,65 +26,84 @@ 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;
/**
*
* @param file
* @param type
* @param request HttpServletRequest
* @return
*/
@RequestMapping("/upload")
@IgnoreAuth
public R upload(@RequestParam("file") MultipartFile file, String type,HttpServletRequest request) throws Exception {
@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);
// 获取文件扩展名
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
*
* 使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")) {
// 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();
if (configEntity == null) {
configEntity = new ConfigEntity(); // 创建新的配置实体
configEntity.setName("faceFile");
configEntity.setValue(fileName);
} else {
configEntity.setValue(fileName);
}
configService.insertOrUpdate(configEntity);
configService.insertOrUpdate(configEntity); // 保存或更新配置
}
return R.ok().put("file", fileName);
return R.ok().put("file", fileName); // 返回上传结果,包含文件名
}
/**
*
* @param fileName
* @param request HttpServletRequest
* @param response HttpServletResponse
*/
@IgnoreAuth
@RequestMapping("/download")
@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);
// 定义文件的完整路径
File file = new File(request.getSession().getServletContext().getRealPath("/upload") + "/" + fileName);
// 检查文件是否存在
if (file.exists()) {
response.reset();
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName+"\"");
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");
response.setContentType("application/octet-stream; charset=UTF-8"); // 设置内容类型
// 将文件内容写入响应输出流
IOUtils.write(FileUtils.readFileToByteArray(file), response.getOutputStream());
}
} catch (IOException e) {
e.printStackTrace();
e.printStackTrace(); // 打印异常信息
}
}
}

@ -2,41 +2,41 @@ package com.controller;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.text.ParseException;
import java.text.ParseException; // 导入解析异常
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Arrays; // 导入Arrays工具类
import java.util.Calendar;
import java.util.Map;
import java.util.Map; // 导入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 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.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 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.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);
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);
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);
}
/**
*
*
* @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);
@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);
@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); // 返回论坛信息及子项
}
/**
*
* @param forum
* @return
*/
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;
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);
forum.setChilds(childs); // 设置子项
for (ForumEntity forumEntity : childs) {
getChilds(forumEntity); // 递归获取每个子项的子项
}
return forum;
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);
@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}")
@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);
@PathVariable("type") String type, @RequestParam Map<String, Object> map) {
map.put("column", columnName); // 将列名放入请求参数
map.put("type", type); // 将类型放入请求参数
if(type.equals("2")) {
// 如果类型为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) {
if (map.get("remindstart") != null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
c.add(Calendar.DAY_OF_MONTH, remindStart); // 加上提醒天数
remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate));
map.put("remindstart", sdf.format(remindStartDate)); // 格式化日期并放入请求参数
}
if(map.get("remindend")!=null) {
if (map.get("remindend") != null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
c.add(Calendar.DAY_OF_MONTH, remindEnd); // 加上提醒天数
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
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("remindstart") != null) {
wrapper.ge(columnName, map.get("remindstart")); // 大于等于开始日期
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
if (map.get("remindend") != null) {
wrapper.le(columnName, map.get("remindend")); // 小于等于结束日期
}
int count = forumService.selectCount(wrapper);
return R.ok().put("count", count);
int count = forumService.selectCount(wrapper); // 查询数量
return R.ok().put("count", count); // 返回数量
}
}

@ -1,6 +1,6 @@
package com.controller;
import java.math.BigDecimal;
import java.math.BigDecimal; // 导入BigDecimal以处理高精度数值
import java.text.SimpleDateFormat;
import java.text.ParseException;
import java.util.ArrayList;
@ -8,35 +8,35 @@ 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 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.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.RequestParam; // 导入请求参数注解
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
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.view.LeixingView; // 导入类型视图类
import com.service.LeixingService;
import com.service.LeixingService; // 导入类型服务类
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
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,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);
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>();
@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);
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);
@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);
@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);
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);
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);//全部更新
@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));
@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}")
@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);
@PathVariable("type") String type, @RequestParam Map<String, Object> map) {
map.put("column", columnName); // 将列名放入请求参数
map.put("type", type); // 将类型放入请求参数
if(type.equals("2")) {
// 如果类型为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) {
// 处理提醒开始时间
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));
c.add(Calendar.DAY_OF_MONTH, remindStart); // 添加提醒天数
remindStartDate = c.getTime(); // 获取新的开始日期
map.put("remindstart", sdf.format(remindStartDate)); // 格式化并放入请求参数
}
if(map.get("remindend")!=null) {
// 处理提醒结束时间
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));
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("remindstart") != null) {
wrapper.ge(columnName, map.get("remindstart")); // 大于等于开始日期
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
if (map.get("remindend") != null) {
wrapper.le(columnName, map.get("remindend")); // 小于等于结束日期
}
int count = leixingService.selectCount(wrapper);
return R.ok().put("count", count);
int count = leixingService.selectCount(wrapper); // 查询数量
return R.ok().put("count", count); // 返回数量
}
}

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

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

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

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

@ -1,36 +1,28 @@
package com.controller;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import java.util.Map;
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 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 com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth;
import com.entity.WenjuandafuEntity;
import com.entity.view.WenjuandafuView;
import com.service.WenjuandafuService;
import com.service.TokenService;
import com.utils.PageUtils;
@ -40,11 +32,7 @@ import com.utils.MPUtil;
import com.utils.CommonUtil;
/**
*
*
* @author
* @email
* @date 2023-02-21 09:46:06
*
*/
@RestController
@RequestMapping("/wenjuandafu")
@ -52,66 +40,57 @@ public class WenjuandafuController {
@Autowired
private WenjuandafuService wenjuandafuService;
/**
*
*
* @param params
* @param wenjuandafu
* @param request HTTP
* @return
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,WenjuandafuEntity wenjuandafu,
HttpServletRequest request){
public R page(@RequestParam Map<String, Object> params, WenjuandafuEntity wenjuandafu, HttpServletRequest request){
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("yonghu")) {
wenjuandafu.setZhanghao((String)request.getSession().getAttribute("username"));
}
EntityWrapper<WenjuandafuEntity> ew = new EntityWrapper<WenjuandafuEntity>();
PageUtils page = wenjuandafuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wenjuandafu), params), params));
request.setAttribute("data", page);
return R.ok().put("data", page);
}
/**
*
*
* @param params
* @param wenjuandafu
* @param request HTTP
* @return
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,WenjuandafuEntity wenjuandafu,
HttpServletRequest request){
public R list(@RequestParam Map<String, Object> params, WenjuandafuEntity wenjuandafu, HttpServletRequest request){
EntityWrapper<WenjuandafuEntity> ew = new EntityWrapper<WenjuandafuEntity>();
PageUtils page = wenjuandafuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wenjuandafu), params), params));
request.setAttribute("data", page);
return R.ok().put("data", page);
}
/**
*
*
* @param wenjuandafu
* @return
*/
@RequestMapping("/lists")
public R list( WenjuandafuEntity wenjuandafu){
public R lists(WenjuandafuEntity wenjuandafu){
EntityWrapper<WenjuandafuEntity> ew = new EntityWrapper<WenjuandafuEntity>();
ew.allEq(MPUtil.allEQMapPre( wenjuandafu, "wenjuandafu"));
return R.ok().put("data", wenjuandafuService.selectListView(ew));
}
/**
*
*/
@RequestMapping("/query")
public R query(WenjuandafuEntity wenjuandafu){
EntityWrapper< WenjuandafuEntity> ew = new EntityWrapper< WenjuandafuEntity>();
ew.allEq(MPUtil.allEQMapPre( wenjuandafu, "wenjuandafu"));
WenjuandafuView wenjuandafuView = wenjuandafuService.selectView(ew);
return R.ok("查询问卷答复成功").put("data", wenjuandafuView);
}
/**
*
*
* @param id ID
* @return
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
@ -120,7 +99,9 @@ public class WenjuandafuController {
}
/**
*
*
* @param id ID
* @return
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
@ -129,49 +110,52 @@ public class WenjuandafuController {
return R.ok().put("data", wenjuandafu);
}
/**
*
*
* @param wenjuandafu
* @param request HTTP
* @return
*/
@RequestMapping("/save")
public R save(@RequestBody WenjuandafuEntity wenjuandafu, HttpServletRequest request){
wenjuandafu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(wenjuandafu);
//ValidatorUtils.validateEntity(wenjuandafu); // 验证实体对象(注释掉)
wenjuandafuService.insert(wenjuandafu);
return R.ok();
}
/**
*
*
* @param wenjuandafu
* @param request HTTP
* @return
*/
@RequestMapping("/add")
public R add(@RequestBody WenjuandafuEntity wenjuandafu, HttpServletRequest request){
wenjuandafu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(wenjuandafu);
//ValidatorUtils.validateEntity(wenjuandafu); // 验证实体对象(注释掉)
wenjuandafuService.insert(wenjuandafu);
return R.ok();
}
/**
*
*
* @param wenjuandafu
* @param request HTTP
* @return
*/
@RequestMapping("/update")
@Transactional
public R update(@RequestBody WenjuandafuEntity wenjuandafu, HttpServletRequest request){
//ValidatorUtils.validateEntity(wenjuandafu);
wenjuandafuService.updateById(wenjuandafu);//全部更新
//ValidatorUtils.validateEntity(wenjuandafu); // 验证实体对象(注释掉)
wenjuandafuService.updateById(wenjuandafu); //更新全部字段
return R.ok();
}
/**
*
*
* @param ids ID
* @return
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
@ -181,50 +165,59 @@ public class WenjuandafuController {
/**
*
* @param columnName
* @param type 2
* @param request HTTP
* @param map
* @return
*/
@RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type,@RequestParam Map<String, Object> map) {
public R remindCount(@PathVariable("columnName") String columnName, @PathVariable("type") String type, HttpServletRequest request, @RequestParam Map<String, Object> map) {
map.put("column", columnName);
map.put("type", type);
if(type.equals("2")) {
if(type.equals("2")) { // 如果类型是日期范围
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
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);
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));
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));
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<WenjuandafuEntity> wrapper = new EntityWrapper<WenjuandafuEntity>();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
String tableName = request.getSession().getAttribute("tableName").toString(); // 获取表名
if(tableName.equals("yonghu")) { // 如果表名是用户表
map.put("zhanghao", (String)request.getSession().getAttribute("username")); // 添加用户名到请求参数中作为过滤条件
}
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("yonghu")) {
wrapper.eq("zhanghao", (String)request.getSession().getAttribute("username"));
Wrapper<WenjuandafuEntity> wrapper = new EntityWrapper<WenjuandafuEntity>(); // 创建查询包装器实例
if(map.get("remindstart") != null) {
wrapper.ge(columnName, map.get("remindstart")); // 添加大于等于开始日期的条件到查询包装器中
}
if(map.get("remindend") != null) {
wrapper.le(columnName, map.get("remindend"));
}
int count = wenjuandafuService.selectCount(wrapper);
return R.ok().put("count", count);
int count = wenjuandafuService.selectCount(wrapper); // 根据查询包装器统计符合条件的记录数
return R.ok().put("count", count); // 返回符合条件的记录数响应
}
}
@ -236,93 +229,135 @@ public class WenjuandafuController {
*
*/
@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<WenjuandafuEntity> ew = new EntityWrapper<WenjuandafuEntity>();
// 获取当前会话中的表名
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("yonghu")) {
ew.eq("zhanghao", (String)request.getSession().getAttribute("username"));
// 如果表名为"yonghu",则添加用户账号作为查询条件
if (tableName.equals("yonghu")) {
ew.eq("zhanghao", (String) request.getSession().getAttribute("username"));
}
// 调用服务层方法进行数据查询
List<Map<String, Object>> result = wenjuandafuService.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);
}
}
/**
/**
*
*/
@RequestMapping("/value/{xColumnName}/{yColumnName}/{timeStatType}")
public R valueDay(@PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName, @PathVariable("timeStatType") String timeStatType,HttpServletRequest request) {
@RequestMapping("/value/{xColumnName}/{yColumnName}/{timeStatType}")
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<WenjuandafuEntity> ew = new EntityWrapper<WenjuandafuEntity>();
// 获取当前会话中的表名
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("yonghu")) {
ew.eq("zhanghao", (String)request.getSession().getAttribute("username"));
// 如果表名为"yonghu",则添加用户账号作为查询条件
if (tableName.equals("yonghu")) {
ew.eq("zhanghao", (String) request.getSession().getAttribute("username"));
}
// 调用服务层方法进行数据查询
List<Map<String, Object>> result = wenjuandafuService.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);
}
}
/**
/**
*
*/
@RequestMapping("/group/{columnName}")
public R group(@PathVariable("columnName") String columnName,HttpServletRequest request) {
@RequestMapping("/group/{columnName}")
public R group(@PathVariable("columnName") String columnName, HttpServletRequest request) {
// 创建参数映射,用于存储请求中的列名
Map<String, Object> params = new HashMap<String, Object>();
params.put("column", columnName);
// 创建实体包装器,用于构建查询条件
EntityWrapper<WenjuandafuEntity> ew = new EntityWrapper<WenjuandafuEntity>();
// 获取当前会话中的表名
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("yonghu")) {
ew.eq("zhanghao", (String)request.getSession().getAttribute("username"));
// 如果表名为"yonghu",则添加用户账号作为查询条件
if (tableName.equals("yonghu")) {
ew.eq("zhanghao", (String) request.getSession().getAttribute("username"));
}
// 调用服务层方法进行数据查询
List<Map<String, Object>> result = wenjuandafuService.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,WenjuandafuEntity wenjuandafu, HttpServletRequest request){
@RequestMapping("/count")
public R count(@RequestParam Map<String, Object> params, WenjuandafuEntity wenjuandafu, HttpServletRequest request) {
// 获取当前会话中的表名
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("yonghu")) {
wenjuandafu.setZhanghao((String)request.getSession().getAttribute("username"));
// 如果表名为"yonghu",则添加用户账号作为查询条件
if (tableName.equals("yonghu")) {
wenjuandafu.setZhanghao((String) request.getSession().getAttribute("username"));
}
// 创建实体包装器,用于构建查询条件
EntityWrapper<WenjuandafuEntity> ew = new EntityWrapper<WenjuandafuEntity>();
int count = wenjuandafuService.selectCount(MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wenjuandafu), params), params));
return R.ok().put("data", count);
}
// 调用服务层方法进行数据查询并计算总数
int count = wenjuandafuService.selectCount(MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wenjuandafu), params), params));
// 返回封装好的响应结果
return R.ok().put("data", count);
}

@ -52,187 +52,68 @@ import com.entity.StoreupEntity;
@RequestMapping("/wenjuandiaocha")
public class WenjuandiaochaController {
@Autowired
private WenjuandiaochaService wenjuandiaochaService;
private WenjuandiaochaService wenjuandiaochaService; // 注入问卷调查服务
@Autowired
private StoreupService storeupService;
/**
*
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,WenjuandiaochaEntity wenjuandiaocha,
HttpServletRequest request){
EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>();
PageUtils page = wenjuandiaochaService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wenjuandiaocha), params), params));
request.setAttribute("data", page);
return R.ok().put("data", page);
}
/**
*
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,WenjuandiaochaEntity wenjuandiaocha,
HttpServletRequest request){
EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>();
PageUtils page = wenjuandiaochaService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wenjuandiaocha), params), params));
request.setAttribute("data", page);
return R.ok().put("data", page);
}
/**
*
*/
@RequestMapping("/lists")
public R list( WenjuandiaochaEntity wenjuandiaocha){
EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>();
ew.allEq(MPUtil.allEQMapPre( wenjuandiaocha, "wenjuandiaocha"));
return R.ok().put("data", wenjuandiaochaService.selectListView(ew));
}
/**
*
*/
@RequestMapping("/query")
public R query(WenjuandiaochaEntity wenjuandiaocha){
EntityWrapper< WenjuandiaochaEntity> ew = new EntityWrapper< WenjuandiaochaEntity>();
ew.allEq(MPUtil.allEQMapPre( wenjuandiaocha, "wenjuandiaocha"));
WenjuandiaochaView wenjuandiaochaView = wenjuandiaochaService.selectView(ew);
return R.ok("查询问卷调查成功").put("data", wenjuandiaochaView);
}
/**
*
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
WenjuandiaochaEntity wenjuandiaocha = wenjuandiaochaService.selectById(id);
wenjuandiaocha.setClicktime(new Date());
wenjuandiaochaService.updateById(wenjuandiaocha);
return R.ok().put("data", wenjuandiaocha);
}
/**
*
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
WenjuandiaochaEntity wenjuandiaocha = wenjuandiaochaService.selectById(id);
wenjuandiaocha.setClicktime(new Date());
wenjuandiaochaService.updateById(wenjuandiaocha);
return R.ok().put("data", wenjuandiaocha);
}
/**
*
*/
@RequestMapping("/save")
public R save(@RequestBody WenjuandiaochaEntity wenjuandiaocha, HttpServletRequest request){
wenjuandiaocha.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(wenjuandiaocha);
wenjuandiaochaService.insert(wenjuandiaocha);
return R.ok();
}
/**
*
*/
@RequestMapping("/add")
public R add(@RequestBody WenjuandiaochaEntity wenjuandiaocha, HttpServletRequest request){
wenjuandiaocha.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(wenjuandiaocha);
wenjuandiaochaService.insert(wenjuandiaocha);
return R.ok();
}
/**
*
*/
@RequestMapping("/update")
@Transactional
public R update(@RequestBody WenjuandiaochaEntity wenjuandiaocha, HttpServletRequest request){
//ValidatorUtils.validateEntity(wenjuandiaocha);
wenjuandiaochaService.updateById(wenjuandiaocha);//全部更新
return R.ok();
}
/**
*
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
wenjuandiaochaService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
private StoreupService storeupService; // 注入收藏服务
/**
*
*/
@RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type,@RequestParam Map<String, Object> map) {
@PathVariable("type") String type, @RequestParam Map<String, Object> map) {
// 将列名和类型添加到 map 中
map.put("column", columnName);
map.put("type", type);
if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
// 如果类型为 "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));
// 处理 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 中
}
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));
// 处理 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"));
if (map.get("remindstart") != null) {
wrapper.ge(columnName, map.get("remindstart")); // 大于等于 remindstart
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
if (map.get("remindend") != null) {
wrapper.le(columnName, map.get("remindend")); // 小于等于 remindend
}
// 查询符合条件的记录数
int count = wenjuandiaochaService.selectCount(wrapper);
return R.ok().put("count", count);
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>();
@ -241,6 +122,8 @@ public class WenjuandiaochaController {
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)) {
@ -249,134 +132,160 @@ public class WenjuandiaochaController {
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);
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); // 返回记录数
}
}

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

@ -21,9 +21,9 @@ import com.entity.view.ChatView;
*/
public interface ChatDao extends BaseMapper<ChatEntity> {
List<ChatVO> selectListVO(@Param("ew") Wrapper<ChatEntity> wrapper);
List<ChatVO> selectListVO(@Param("ew") Wrapper<ChatEntity> wrapper);//根据给定的条件包装器Wrapper查询并返回符合条件的ChatVO列表
ChatVO selectVO(@Param("ew") Wrapper<ChatEntity> wrapper);
ChatVO selectVO(@Param("ew") Wrapper<ChatEntity> wrapper);//根据给定的条件包装器Wrapper查询并返回符合条件的ChatView列表
List<ChatView> selectListView(@Param("ew") Wrapper<ChatEntity> wrapper);

@ -5,24 +5,69 @@ import java.util.List;
import java.util.Map;
/**
*
*
*/
public interface CommonDao {
/**
*
* @param params
* @return
*/
public interface CommonDao{
List<String> getOption(Map<String, Object> params);
/**
*
* @param params
* @return
*/
Map<String, Object> getFollowByOption(Map<String, Object> params);
/**
*
* @param params
* @return
*/
List<String> getFollowByOption2(Map<String, Object> params);
/**
*
* @param params
*/
void sh(Map<String, Object> params);
/**
*
* @param params
* @return
*/
int remindCount(Map<String, Object> params);
/**
*
* @param params
* @return
*/
Map<String, Object> selectCal(Map<String, Object> params);
/**
*
* @param params
* @return
*/
List<Map<String, Object>> selectGroup(Map<String, Object> params);
/**
*
* @param params
* @return
*/
List<Map<String, Object>> selectValue(Map<String, Object> params);
/**
*
* @param params
* @return
*/
List<Map<String, Object>> selectTimeStatValue(Map<String, Object> params);
}

@ -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,19 +1,19 @@
package com.dao;
import com.entity.ForumEntity;
import com.baomidou.mybatisplus.mapper.BaseMapper;
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 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
@ -21,15 +21,39 @@ import com.entity.view.ForumView;
*/
public interface ForumDao extends BaseMapper<ForumEntity> {
/**
* 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);
List<ForumView> selectListView(Pagination page,@Param("ew") Wrapper<ForumEntity> wrapper);
/**
*
* @param page
* @param wrapper
* @return
*/
List<ForumView> selectListView(Pagination page, @Param("ew") Wrapper<ForumEntity> wrapper);
/**
*
* @param wrapper
* @return
*/
ForumView selectView(@Param("ew") Wrapper<ForumEntity> wrapper);
}

@ -8,12 +8,12 @@ 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.vo.LeixingVO; // 导入类型VO类
import com.entity.view.LeixingView;
/**
*
* DAO
* LeixingEntity
*
* @author
* @email
@ -21,15 +21,39 @@ import com.entity.view.LeixingView;
*/
public interface LeixingDao extends BaseMapper<LeixingEntity> {
/**
* 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);
List<LeixingView> selectListView(Pagination page,@Param("ew") Wrapper<LeixingEntity> wrapper);
/**
*
* @param page
* @param wrapper
* @return
*/
List<LeixingView> selectListView(Pagination page, @Param("ew") Wrapper<LeixingEntity> wrapper);
/**
*
* @param wrapper
* @return
*/
LeixingView selectView(@Param("ew") Wrapper<LeixingEntity> wrapper);
}

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

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

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

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

@ -1,4 +1,4 @@
package com.dao;
ppackage com.dao;
import com.entity.WenjuandafuEntity;
import com.baomidou.mybatisplus.mapper.BaseMapper;
@ -11,33 +11,70 @@ import org.apache.ibatis.annotations.Param;
import com.entity.vo.WenjuandafuVO;
import com.entity.view.WenjuandafuView;
/**
*
*
* @author
* @email
* @date 2023-02-21 09:46:06
* 访
*
* 使MyBatis-Plus
*/
public interface WenjuandafuDao extends BaseMapper<WenjuandafuEntity> {
/**
* VO
* @param wrapper
* @return VO
*/
List<WenjuandafuVO> selectListVO(@Param("ew") Wrapper<WenjuandafuEntity> wrapper);
/**
* VO
* @param wrapper
* @return VO
*/
WenjuandafuVO selectVO(@Param("ew") Wrapper<WenjuandafuEntity> wrapper);
/**
*
* @param wrapper
* @return
*/
List<WenjuandafuView> selectListView(@Param("ew") Wrapper<WenjuandafuEntity> wrapper);
/**
*
* @param page
* @param wrapper
* @return
*/
List<WenjuandafuView> selectListView(Pagination page,@Param("ew") Wrapper<WenjuandafuEntity> wrapper);
/**
*
* @param wrapper
* @return
*/
WenjuandafuView selectView(@Param("ew") Wrapper<WenjuandafuEntity> wrapper);
/**
*
* @param params
* @param wrapper
* @return
*/
List<Map<String, Object>> selectValue(@Param("params") Map<String, Object> params,@Param("ew") Wrapper<WenjuandafuEntity> wrapper);
/**
*
* @param params
* @param wrapper
* @return
*/
List<Map<String, Object>> selectTimeStatValue(@Param("params") Map<String, Object> params,@Param("ew") Wrapper<WenjuandafuEntity> wrapper);
/**
*
* @param params
* @param wrapper
* @return
*/
List<Map<String, Object>> selectGroup(@Param("params") Map<String, Object> params,@Param("ew") Wrapper<WenjuandafuEntity> 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);
/**
* WenjuandiaochaVO
* @param ew
* @return VO
*/
List<WenjuandiaochaVO> selectListVO(@Param("ew") Wrapper<WenjuandiaochaEntity> ew);
WenjuandiaochaView selectView(@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper);
/**
* WenjuandiaochaVO
* @param ew
* @return VO
*/
WenjuandiaochaVO selectVO(@Param("ew") Wrapper<WenjuandiaochaEntity> ew);
/**
* WenjuandiaochaView
* @param ew
* @return View
*/
List<WenjuandiaochaView> selectListView(@Param("ew") Wrapper<WenjuandiaochaEntity> ew);
List<Map<String, Object>> selectValue(@Param("params") Map<String, Object> params,@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper);
/**
* WenjuandiaochaView
* @param page
* @param ew
* @return View
*/
List<WenjuandiaochaView> selectListView(Pagination page, @Param("ew") Wrapper<WenjuandiaochaEntity> ew);
List<Map<String, Object>> selectTimeStatValue(@Param("params") Map<String, Object> params,@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper);
/**
* WenjuandiaochaView
* @param ew
* @return View
*/
WenjuandiaochaView selectView(@Param("ew") Wrapper<WenjuandiaochaEntity> ew);
List<Map<String, Object>> selectGroup(@Param("params") Map<String, Object> params,@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper);
/**
* 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);
}

@ -6,38 +6,37 @@ 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.YonghuVO;
import com.entity.view.YonghuView;
/**
*
*
* @author
* @email
* @date 2023-02-21 09:46:06
* 访MyBatis-PlusBaseMapper
* YonghuEntity
*/
public interface YonghuDao extends BaseMapper<YonghuEntity> {
// 根据条件查询用户视图对象列表
List<YonghuVO> selectListVO(@Param("ew") Wrapper<YonghuEntity> wrapper);
// 根据条件查询单个用户视图对象
YonghuVO selectVO(@Param("ew") Wrapper<YonghuEntity> wrapper);
// 根据条件查询用户视图对象列表
List<YonghuView> selectListView(@Param("ew") Wrapper<YonghuEntity> wrapper);
List<YonghuView> selectListView(Pagination page,@Param("ew") Wrapper<YonghuEntity> wrapper);
// 根据分页信息和条件查询用户视图对象列表
List<YonghuView> selectListView(Pagination page, @Param("ew") Wrapper<YonghuEntity> wrapper);
// 根据条件查询单个用户视图对象
YonghuView selectView(@Param("ew") Wrapper<YonghuEntity> wrapper);
// 根据参数和条件查询值映射列表
List<Map<String, Object>> selectValue(@Param("params") Map<String, Object> params, @Param("ew") Wrapper<YonghuEntity> wrapper);
List<Map<String, Object>> selectValue(@Param("params") Map<String, Object> params,@Param("ew") Wrapper<YonghuEntity> wrapper);
List<Map<String, Object>> selectTimeStatValue(@Param("params") Map<String, Object> params,@Param("ew") Wrapper<YonghuEntity> wrapper);
List<Map<String, Object>> selectGroup(@Param("params") Map<String, Object> params,@Param("ew") Wrapper<YonghuEntity> wrapper);
// 根据参数和条件查询时间统计值映射列表
List<Map<String, Object>> selectTimeStatValue(@Param("params") Map<String, Object> params, @Param("ew") Wrapper<YonghuEntity> wrapper);
// 根据参数和条件分组查询映射列表
List<Map<String, Object>> selectGroup(@Param("params") Map<String, Object> params, @Param("ew") Wrapper<YonghuEntity> wrapper);
}

@ -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 {
}
// 接收ForumEntity对象的构造函数
public ForumEntity(T t) {
try {
// 复制属性,将传入对象的属性复制到当前对象
BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block
// 异常处理,打印堆栈信息
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
}
/**
*

@ -5,14 +5,11 @@ 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;
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;
@ -32,16 +29,13 @@ import com.baomidou.mybatisplus.enums.IdType;
public class StoreupEntity<T> implements Serializable {
private static final long serialVersionUID = 1L;
public StoreupEntity() {
}
public StoreupEntity(T t) {
try {
BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@ -54,52 +48,43 @@ public class StoreupEntity<T> implements Serializable {
/**
* id
*/
private Long userid;
/**
* id
*/
private Long refid;
/**
*
*/
private String tablename;
/**
*
*/
private String name;
/**
*
*/
private String picture;
/**
* (1:,21:,22:,31:,41:)
*/
private String type;
/**
*
*/
private String inteltype;
/**
*
*/
private String remark;
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat
private Date addtime;
@ -214,5 +199,4 @@ public class StoreupEntity<T> implements Serializable {
public String getRemark() {
return remark;
}
}

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

@ -12,8 +12,6 @@ import java.io.Serializable;
/**
* 线
*
* entity
* ModelAndView model
* @author
* @email
* @date 2023-02-21 09:46:06

@ -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 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;
private static final long serialVersionUID = 1L; // 版本控制
/**
*
*/
private String content;
private String content; // 存放帖子内容
/**
* id
*/
private Long parentid;
private Long parentid; // 存放父节点ID
/**
* id
*/
private Long userid;
private Long userid; // 存放用户ID
/**
*
*/
private String username;
private String username; // 存放用户名
/**
*
*/
private String avatarurl;
private String avatarurl; // 存放用户头像URL
/**
*
*/
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;
}
/**
* 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;
}
/**
*
* @param avatarurl URL
*/
public void setAvatarurl(String avatarurl) {
this.avatarurl = avatarurl;
this.avatarurl = avatarurl; // 设置头像URL
}
/**
*
* @return URL
*/
public String getAvatarurl() {
return avatarurl;
}
/**
*
* @param isdone
*/
public void setIsdone(String isdone) {
this.isdone = isdone;
this.isdone = isdone; // 设置帖子状态
}
/**
*
* @return
*/
public String getIsdone() {
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;// 版本控制
// 可以根据需求定义属性,例如类型的名称、描述等
}

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

@ -1,90 +1,75 @@
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 {
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")
@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")
@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;
}
@ -96,11 +81,9 @@ public class WenjuandiaochaModel implements Serializable {
return fengmiantupian;
}
/**
*
*/
public void setLeixing(String leixing) {
this.leixing = leixing;
}
@ -112,11 +95,9 @@ public class WenjuandiaochaModel implements Serializable {
return leixing;
}
/**
*
*/
public void setWentiyi(String wentiyi) {
this.wentiyi = wentiyi;
}
@ -128,11 +109,9 @@ public class WenjuandiaochaModel implements Serializable {
return wentiyi;
}
/**
*
*/
public void setWentier(String wentier) {
this.wentier = wentier;
}
@ -144,11 +123,9 @@ public class WenjuandiaochaModel implements Serializable {
return wentier;
}
/**
*
*/
public void setWentisan(String wentisan) {
this.wentisan = wentisan;
}
@ -160,11 +137,9 @@ public class WenjuandiaochaModel implements Serializable {
return wentisan;
}
/**
*
*/
public void setWentisi(String wentisi) {
this.wentisi = wentisi;
}
@ -176,11 +151,9 @@ public class WenjuandiaochaModel implements Serializable {
return wentisi;
}
/**
*
*/
public void setWentiwu(String wentiwu) {
this.wentiwu = wentiwu;
}
@ -192,11 +165,9 @@ public class WenjuandiaochaModel implements Serializable {
return wentiwu;
}
/**
*
*/
public void setFaburiqi(Date faburiqi) {
this.faburiqi = faburiqi;
}
@ -208,11 +179,9 @@ public class WenjuandiaochaModel implements Serializable {
return faburiqi;
}
/**
*
*/
public void setClicktime(Date clicktime) {
this.clicktime = clicktime;
}
@ -223,5 +192,4 @@ public class WenjuandiaochaModel implements Serializable {
public Date getClicktime() {
return clicktime;
}
}

@ -12,7 +12,6 @@ import java.io.Serializable;
/**
*
*
* entity
* ModelAndView model
* @author
* @email

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

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

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

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

@ -1,36 +1,35 @@
package com.entity.view;
import com.entity.WenjuandafuEntity;
import com.baomidou.mybatisplus.annotations.TableName;
import org.apache.commons.beanutils.BeanUtils;
import java.lang.reflect.InvocationTargetException;
import java.io.Serializable;
/**
*
*
* 使
* @author
* @email
* @date 2023-02-21 09:46:06
*
*
* WenjuandafuEntity Serializable
*/
@TableName("wenjuandafu")
public class WenjuandafuView extends WenjuandafuEntity implements Serializable {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L; // 序列化版本号
public WenjuandafuView(){
// 无参构造函数
public WenjuandafuView() {
}
public WenjuandafuView(WenjuandafuEntity wenjuandafuEntity){
/**
* WenjuandafuEntity WenjuandafuView
* @param wenjuandafuEntity WenjuandafuEntity
*/
public WenjuandafuView(WenjuandafuEntity wenjuandafuEntity) {
try {
// 使用 BeanUtils 工具类将 wenjuandafuEntity 的属性值复制到当前对象中
BeanUtils.copyProperties(this, wenjuandafuEntity);
} 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 WenjuandiaochaView(){
/**
*
*/
public WenjuandiaochaView() {
}
public WenjuandiaochaView(WenjuandiaochaEntity wenjuandiaochaEntity){
/**
* WenjuandiaochaEntityWenjuandiaochaView
* @param wenjuandiaochaEntity
*/
public WenjuandiaochaView(WenjuandiaochaEntity wenjuandiaochaEntity) {
try {
BeanUtils.copyProperties(this, wenjuandiaochaEntity);
} catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block
// 打印堆栈跟踪信息以便调试
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;// 版本控制,用于序列化
}

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

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

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

@ -10,9 +10,9 @@ import com.entity.vo.ChatVO;
import org.apache.ibatis.annotations.Param;
import com.entity.view.ChatView;
/**
* 线
* 线线
* IService<ChatEntity> MyBatis-Plus CRUD
*
* @author
* @email
@ -20,18 +20,52 @@ import com.entity.view.ChatView;
*/
public interface ChatService extends IService<ChatEntity> {
/**
*
*
* @param params
* @return PageUtils
*/
PageUtils queryPage(Map<String, Object> params);
/**
*
*
* @param wrapper
* @return
*/
List<ChatVO> selectListVO(Wrapper<ChatEntity> wrapper);
/**
*
*
* @param wrapper
* @return
*/
ChatVO selectVO(@Param("ew") Wrapper<ChatEntity> wrapper);
/**
*
*
* @param wrapper
* @return
*/
List<ChatView> selectListView(Wrapper<ChatEntity> wrapper);
/**
*
*
* @param wrapper
* @return
*/
ChatView selectView(@Param("ew") Wrapper<ChatEntity> wrapper);
PageUtils queryPage(Map<String, Object> params,Wrapper<ChatEntity> wrapper);
/**
*
*
* @param params
* @param wrapper
* @return PageUtils
*/
PageUtils queryPage(Map<String, Object> params, Wrapper<ChatEntity> wrapper);
}

@ -3,20 +3,63 @@ package com.service;
import java.util.List;
import java.util.Map;
/**
* CommonService
*/
public interface CommonService {
/**
*
* @param params
* @return
*/
List<String> getOption(Map<String, Object> params);
/**
*
* @param params
* @return
*/
Map<String, Object> getFollowByOption(Map<String, Object> params);
/**
*
* @param params
*/
void sh(Map<String, Object> params);
/**
*
* @param params
* @return
*/
int remindCount(Map<String, Object> params);
/**
*
* @param params
* @return
*/
Map<String, Object> selectCal(Map<String, Object> params);
/**
*
* @param params
* @return
*/
List<Map<String, Object>> selectGroup(Map<String, Object> params);
/**
*
* @param params
* @return
*/
List<Map<String, Object>> selectValue(Map<String, Object> params);
/**
*
* @param params
* @return
*/
List<Map<String, Object>> selectTimeStatValue(Map<String, Object> params);
}

@ -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);
/**
* 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);
PageUtils queryPage(Map<String, Object> params,Wrapper<ForumEntity> wrapper);
/**
*
* @param params
* @param wrapper
* @return
*/
PageUtils queryPage(Map<String, Object> params, Wrapper<ForumEntity> wrapper);
}

@ -3,12 +3,12 @@ package com.service;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.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);
/**
* 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);
PageUtils queryPage(Map<String, Object> params,Wrapper<LeixingEntity> wrapper);
/**
*
* @param params
* @param wrapper
* @return
*/
PageUtils queryPage(Map<String, Object> params, Wrapper<LeixingEntity> wrapper);
}

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

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

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

@ -11,15 +11,15 @@ import com.baomidou.mybatisplus.service.IService;
import com.entity.UsersEntity;
import com.utils.PageUtils;
/**
*
*/
public interface UsersService extends IService<UsersEntity> {
PageUtils queryPage(Map<String, Object> params);
public interface UsersService extends IService<UsersEntity> { // 声明一个接口,扩展 IService用于基本的 CRUD 操作
List<UsersEntity> selectListView(Wrapper<UsersEntity> wrapper);
PageUtils queryPage(Map<String, Object> params); // 根据传入的参数进行分页查询,并返回分页结果
PageUtils queryPage(Map<String, Object> params,Wrapper<UsersEntity> wrapper);
List<UsersEntity> selectListView(Wrapper<UsersEntity> wrapper); // 根据条件包装器查询并返回 UsersEntity 列表
PageUtils queryPage(Map<String, Object> params, Wrapper<UsersEntity> 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);
/**
* VO
* @param wrapper
* @return VO
*/
List<WenjuandafuVO> selectListVO(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);
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);
List<Map<String, Object>> selectGroup(Map<String, Object> params,Wrapper<WenjuandafuEntity> wrapper);
/**
*
* @param params
* @param wrapper
* @return
*/
PageUtils queryPage(Map<String, Object> params, Wrapper<WenjuandafuEntity> wrapper);
/**
* Map
* @param params
* @param wrapper
* @return Map
*/
List<Map<String, Object>> selectValue(Map<String, Object> params, Wrapper<WenjuandafuEntity> wrapper);
/**
*
* @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);
/**
*
* @param wrapper
* @return
*/
List<WenjuandiaochaVO> selectListVO(Wrapper<WenjuandiaochaEntity> wrapper);
/**
*
* @param wrapper
* @return
*/
WenjuandiaochaVO selectVO(@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper);
/**
*
* @param wrapper
* @return
*/
List<WenjuandiaochaView> selectListView(Wrapper<WenjuandiaochaEntity> wrapper);
/**
*
* @param wrapper
* @return
*/
WenjuandiaochaView selectView(@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper);
PageUtils queryPage(Map<String, Object> params,Wrapper<WenjuandiaochaEntity> wrapper);
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
*/
PageUtils queryPage(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>> selectValue(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper);
/**
*
* @param params
* @param wrapper
* @return
*/
List<Map<String, Object>> selectTimeStatValue(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper);
/**
*
* @param params
* @param wrapper
* @return
*/
List<Map<String, Object>> selectGroup(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper);
}

@ -10,9 +10,10 @@ import com.entity.vo.YonghuVO;
import org.apache.ibatis.annotations.Param;
import com.entity.view.YonghuView;
/**
*
*
* IService<YonghuEntity> CRUD
*
*
* @author
* @email
@ -20,26 +21,79 @@ import com.entity.view.YonghuView;
*/
public interface YonghuService extends IService<YonghuEntity> {
/**
*
*
* @param params
* @return PageUtils
*/
PageUtils queryPage(Map<String, Object> params);
/**
*
*
* @param wrapper
* @return
*/
List<YonghuVO> selectListVO(Wrapper<YonghuEntity> wrapper);
/**
*
*
* @param wrapper
* @return
*/
YonghuVO selectVO(@Param("ew") Wrapper<YonghuEntity> wrapper);
/**
*
*
* @param wrapper
* @return
*/
List<YonghuView> selectListView(Wrapper<YonghuEntity> wrapper);
/**
*
*
* @param wrapper
* @return
*/
YonghuView selectView(@Param("ew") Wrapper<YonghuEntity> wrapper);
PageUtils queryPage(Map<String, Object> params,Wrapper<YonghuEntity> wrapper);
List<Map<String, Object>> selectValue(Map<String, Object> params,Wrapper<YonghuEntity> wrapper);
List<Map<String, Object>> selectTimeStatValue(Map<String, Object> params,Wrapper<YonghuEntity> wrapper);
List<Map<String, Object>> selectGroup(Map<String, Object> params,Wrapper<YonghuEntity> wrapper);
/**
*
*
* @param params
* @param wrapper
* @return PageUtils
*/
PageUtils queryPage(Map<String, Object> params, Wrapper<YonghuEntity> wrapper);
/**
*
*
* @param params
* @param wrapper
* @return
*/
List<Map<String, Object>> selectValue(Map<String, Object> params, Wrapper<YonghuEntity> wrapper);
/**
*
*
* @param params
* @param wrapper
* @return
*/
List<Map<String, Object>> selectTimeStatValue(Map<String, Object> params, Wrapper<YonghuEntity> wrapper);
/**
*
*
* @param params
* @param wrapper
* @return
*/
List<Map<String, Object>> selectGroup(Map<String, Object> params, Wrapper<YonghuEntity> wrapper);
}

@ -11,7 +11,6 @@ import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.utils.PageUtils;
import com.utils.Query;
import com.dao.ChatDao;
import com.entity.ChatEntity;
import com.service.ChatService;
@ -21,43 +20,81 @@ import com.entity.view.ChatView;
@Service("chatService")
public class ChatServiceImpl extends ServiceImpl<ChatDao, ChatEntity> implements ChatService {
/**
* ChatEntity
* @param params Map
* @return PageUtils
*/
@Override
public PageUtils queryPage(Map<String, Object> params) {
// 使用Query类获取分页信息并调用selectPage方法进行数据库查询
Page<ChatEntity> page = this.selectPage(
new Query<ChatEntity>(params).getPage(),
new EntityWrapper<ChatEntity>()
);
// 将查询结果封装到PageUtils对象中并返回
return new PageUtils(page);
}
/**
* ChatView
* @param params Map
* @param wrapper
* @return PageUtils
*/
// 使用Query类获取分页信息调用自定义的selectListView方法进行数据库查询并将结果设置到page对象中
@Override
public PageUtils queryPage(Map<String, Object> params, Wrapper<ChatEntity> wrapper) {
Page<ChatView> page =new Query<ChatView>(params).getPage();
page.setRecords(baseMapper.selectListView(page,wrapper));
Page<ChatView> page = new Query<ChatView>(params).getPage();
page.setRecords(baseMapper.selectListView(page, wrapper));
// 将查询结果封装到PageUtils对象中并返回
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
/**
* ChatVO
* @param wrapper
* @return ChatVO
*/
@Override
public List<ChatVO> selectListVO(Wrapper<ChatEntity> wrapper) {
// 调用自定义的selectListVO方法进行数据库查询并返回结果
return baseMapper.selectListVO(wrapper);
}
/**
* ChatVO
* @param wrapper
* @return ChatVO
*/
@Override
public ChatVO selectVO(Wrapper<ChatEntity> wrapper) {
// 调用自定义的selectVO方法进行数据库查询并返回结果
return baseMapper.selectVO(wrapper);
}
/**
* @param wrapper
* @return ChatView
*/
// 调用自定义的selectListView方法进行数据库查询并返回结果
@Override
public List<ChatView> selectListView(Wrapper<ChatEntity> wrapper) {
return baseMapper.selectListView(wrapper);
}
/**
* ChatView
* @param wrapper
* @return ChatView
*/
@Override
public ChatView selectView(Wrapper<ChatEntity> wrapper) {
// 调用自定义的selectView方法进行数据库查询并返回结果
return baseMapper.selectView(wrapper);
}
}

@ -1,7 +1,5 @@
package com.service.impl;
import java.util.List;
import java.util.Map;
@ -11,54 +9,53 @@ import org.springframework.stereotype.Service;
import com.dao.CommonDao;
import com.service.CommonService;
/**
*
*
*/
@Service("commonService")
public class CommonServiceImpl implements CommonService {
@Autowired
private CommonDao commonDao;
private CommonDao commonDao; // 自动注入数据访问对象
@Override
public List<String> getOption(Map<String, Object> params) {
return commonDao.getOption(params);
return commonDao.getOption(params); // 获取选项列表
}
@Override
public Map<String, Object> getFollowByOption(Map<String, Object> params) {
return commonDao.getFollowByOption(params);
return commonDao.getFollowByOption(params); // 根据选项获取关注信息
}
@Override
public void sh(Map<String, Object> params) {
commonDao.sh(params);
commonDao.sh(params); // 执行某种操作(具体操作未明)
}
@Override
public int remindCount(Map<String, Object> params) {
return commonDao.remindCount(params);
return commonDao.remindCount(params); // 获取提醒数量
}
@Override
public Map<String, Object> selectCal(Map<String, Object> params) {
return commonDao.selectCal(params);
return commonDao.selectCal(params); // 选择并计算某些值
}
@Override
public List<Map<String, Object>> selectGroup(Map<String, Object> params) {
return commonDao.selectGroup(params);
return commonDao.selectGroup(params); // 按组选择数据
}
@Override
public List<Map<String, Object>> selectValue(Map<String, Object> params) {
return commonDao.selectValue(params);
return commonDao.selectValue(params); // 选择特定值
}
@Override
public List<Map<String, Object>> selectTimeStatValue(Map<String, Object> params) {
return commonDao.selectTimeStatValue(params);
return commonDao.selectTimeStatValue(params); // 选择并统计时间相关的值
}
}

@ -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;
// 创建分页对象
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);
return baseMapper.selectListVO(wrapper); // 调用数据访问对象方法返回VO对象列表
}
/**
* VO
* @param wrapper
* @return VO
*/
@Override
public ForumVO selectVO(Wrapper<ForumEntity> wrapper) {
return baseMapper.selectVO(wrapper);
return baseMapper.selectVO(wrapper); // 调用数据访问对象方法返回单个VO对象
}
/**
*
* @param wrapper
* @return
*/
@Override
public List<ForumView> selectListView(Wrapper<ForumEntity> wrapper) {
return baseMapper.selectListView(wrapper);
return baseMapper.selectListView(wrapper); // 调用数据访问对象方法,返回视图对象列表
}
/**
*
* @param wrapper
* @return
*/
@Override
public ForumView selectView(Wrapper<ForumEntity> wrapper) {
return baseMapper.selectView(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;
// 创建分页对象
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);
return baseMapper.selectListVO(wrapper); // 调用数据访问对象方法返回VO对象列表
}
/**
* VO
* @param wrapper
* @return VO
*/
@Override
public LeixingVO selectVO(Wrapper<LeixingEntity> wrapper) {
return baseMapper.selectVO(wrapper);
return baseMapper.selectVO(wrapper); // 调用数据访问对象方法返回单个VO对象
}
/**
*
* @param wrapper
* @return
*/
@Override
public List<LeixingView> selectListView(Wrapper<LeixingEntity> wrapper) {
return baseMapper.selectListView(wrapper);
return baseMapper.selectListView(wrapper); // 调用数据访问对象方法,返回视图对象列表
}
/**
*
* @param wrapper
* @return
*/
@Override
public LeixingView selectView(Wrapper<LeixingEntity> wrapper) {
return baseMapper.selectView(wrapper);
return baseMapper.selectView(wrapper); // 调用数据访问对象方法,返回单个视图对象
}
}

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

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

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

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

@ -11,7 +11,6 @@ import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.utils.PageUtils;
import com.utils.Query;
import com.dao.WenjuandafuDao;
import com.entity.WenjuandafuEntity;
import com.service.WenjuandafuService;
@ -21,7 +20,11 @@ import com.entity.view.WenjuandafuView;
@Service("wenjuandafuService")
public class WenjuandafuServiceImpl extends ServiceImpl<WenjuandafuDao, WenjuandafuEntity> implements WenjuandafuService {
/**
*
* @param params
* @return PageUtils
*/
@Override
public PageUtils queryPage(Map<String, Object> params) {
Page<WenjuandafuEntity> page = this.selectPage(
@ -31,50 +34,90 @@ public class WenjuandafuServiceImpl extends ServiceImpl<WenjuandafuDao, Wenjuand
return new PageUtils(page);
}
/**
*
* @param params
* @param wrapper
* @return PageUtils
*/
@Override
public PageUtils queryPage(Map<String, Object> params, Wrapper<WenjuandafuEntity> wrapper) {
Page<WenjuandafuView> page =new Query<WenjuandafuView>(params).getPage();
page.setRecords(baseMapper.selectListView(page,wrapper));
Page<WenjuandafuView> page = new Query<WenjuandafuView>(params).getPage();
page.setRecords(baseMapper.selectListView(page, wrapper));
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
/**
*
* @param wrapper
* @return
*/
@Override
public List<WenjuandafuVO> selectListVO(Wrapper<WenjuandafuEntity> wrapper) {
return baseMapper.selectListVO(wrapper);
}
/**
*
* @param wrapper
* @return
*/
@Override
public WenjuandafuVO selectVO(Wrapper<WenjuandafuEntity> wrapper) {
return baseMapper.selectVO(wrapper);
}
/**
*
* @param wrapper
* @return
*/
@Override
public List<WenjuandafuView> selectListView(Wrapper<WenjuandafuEntity> wrapper) {
return baseMapper.selectListView(wrapper);
}
/**
*
* @param wrapper
* @return
*/
@Override
public WenjuandafuView selectView(Wrapper<WenjuandafuEntity> wrapper) {
return baseMapper.selectView(wrapper);
}
/**
*
* @param params
* @param wrapper
* @return
*/
@Override
public List<Map<String, Object>> selectValue(Map<String, Object> params, Wrapper<WenjuandafuEntity> wrapper) {
return baseMapper.selectValue(params, wrapper);
}
/**
*
* @param params
* @param wrapper
* @return
*/
@Override
public List<Map<String, Object>> selectTimeStatValue(Map<String, Object> params, Wrapper<WenjuandafuEntity> wrapper) {
return baseMapper.selectTimeStatValue(params, wrapper);
}
/**
*
* @param params
* @param wrapper
* @return
*/
@Override
public List<Map<String, Object>> selectGroup(Map<String, Object> params, Wrapper<WenjuandafuEntity> wrapper) {
return baseMapper.selectGroup(params, 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));
// 创建分页对象
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);
}
}

@ -11,7 +11,6 @@ import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.utils.PageUtils;
import com.utils.Query;
import com.dao.YonghuDao;
import com.entity.YonghuEntity;
import com.service.YonghuService;
@ -21,7 +20,7 @@ import com.entity.view.YonghuView;
@Service("yonghuService")
public class YonghuServiceImpl extends ServiceImpl<YonghuDao, YonghuEntity> implements YonghuService {
// 分页查询用户信息
@Override
public PageUtils queryPage(Map<String, Object> params) {
Page<YonghuEntity> page = this.selectPage(
@ -31,50 +30,54 @@ public class YonghuServiceImpl extends ServiceImpl<YonghuDao, YonghuEntity> impl
return new PageUtils(page);
}
// 分页查询用户视图信息
@Override
public PageUtils queryPage(Map<String, Object> params, Wrapper<YonghuEntity> wrapper) {
Page<YonghuView> page =new Query<YonghuView>(params).getPage();
page.setRecords(baseMapper.selectListView(page,wrapper));
Page<YonghuView> page = new Query<YonghuView>(params).getPage();
page.setRecords(baseMapper.selectListView(page, wrapper));
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
// 查询用户值对象列表
@Override
public List<YonghuVO> selectListVO(Wrapper<YonghuEntity> wrapper) {
return baseMapper.selectListVO(wrapper);
}
// 查询单个用户值对象
@Override
public YonghuVO selectVO(Wrapper<YonghuEntity> wrapper) {
return baseMapper.selectVO(wrapper);
}
// 查询用户视图列表
@Override
public List<YonghuView> selectListView(Wrapper<YonghuEntity> wrapper) {
return baseMapper.selectListView(wrapper);
}
// 查询单个用户视图
@Override
public YonghuView selectView(Wrapper<YonghuEntity> wrapper) {
return baseMapper.selectView(wrapper);
}
// 根据条件查询特定值
@Override
public List<Map<String, Object>> selectValue(Map<String, Object> params, Wrapper<YonghuEntity> wrapper) {
return baseMapper.selectValue(params, wrapper);
}
// 根据条件查询时间统计值
@Override
public List<Map<String, Object>> selectTimeStatValue(Map<String, Object> params, Wrapper<YonghuEntity> wrapper) {
return baseMapper.selectTimeStatValue(params, wrapper);
}
// 根据条件分组查询数据
@Override
public List<Map<String, Object>> selectGroup(Map<String, Object> params, Wrapper<YonghuEntity> wrapper) {
return baseMapper.selectGroup(params, wrapper);
}
}

@ -135,11 +135,11 @@ public class BaiduUtil {
if(jsonObject == null){
return "";
}
// 检查 JSON 对象中是否包含 "words_result" 和 "words_result_num" 键
if(jsonObject.has("words_result") && jsonObject.has("words_result_num")){
int wordsResultNum = jsonObject.getInt("words_result_num");
if(wordsResultNum > 0){
StringBuilder sb = new StringBuilder();
StringBuilder sb = new StringBuilder();// 用于拼接字符串
JSONArray jsonArray = jsonObject.getJSONArray("words_result");
int len = jsonArray.length();
@ -193,4 +193,7 @@ public class BaiduUtil {
return res;
}
}

@ -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 {
/**
*
* @param file
* @return
* @throws IOException
*/
public static byte[] FileToByte(File file) throws IOException {
// 将数据转为流
@SuppressWarnings("resource")
InputStream content = new FileInputStream(file);
ByteArrayOutputStream swapStream = new ByteArrayOutputStream();
// 将文件数据转为输入
@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);
swapStream.write(buff, 0, rc); // 将读取的数据写入字节数组输出流
}
// 获得二进制数组
return swapStream.toByteArray();
}
}

@ -5,38 +5,45 @@ import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
/**
* HttpClient
*/
public class HttpClientUtils {
/**
* @param uri
* @return String
* @description get
* GET
* @param uri URL
* @return
* @description 使GETHTTP
* @author: long.he01
*/
public static String doGet(String uri) {
// 用于存储响应结果的StringBuilder对象
StringBuilder result = new StringBuilder();
try {
// 初始化一个空字符串用于存储每一行读取的内容
String res = "";
// 创建URL对象
URL url = new URL(uri);
// 打开连接
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
// 设置请求方法为GET
conn.setRequestMethod("GET");
// 获取输入流并包装成BufferedReader
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
String line;
// 逐行读取响应内容
while ((line = in.readLine()) != null) {
res += line+"\n";
}
res += line + "\n";
// 关闭BufferedReader
in.close();
// 返回完整的响应内容
return res;
}catch (Exception e) {
} catch (Exception e) {
// 捕获异常并打印堆栈信息
e.printStackTrace();
return null;
}
}
}

@ -1,54 +1,68 @@
package com.utils;
public class JQPageInfo{
public class JQPageInfo {
// 当前页码
private Integer page;
// 每页显示的记录数
private Integer limit;
// 排序字段
private String sidx;
// 排序方式(升序或降序)
private String order;
// 偏移量,用于计算分页查询时的起始位置
private Integer offset;
// 获取当前页码
public Integer getPage() {
return page;
}
// 设置当前页码
public void setPage(Integer page) {
this.page = page;
}
// 获取每页显示的记录数
public Integer getLimit() {
return limit;
}
// 设置每页显示的记录数
public void setLimit(Integer limit) {
this.limit = limit;
}
// 获取排序字段
public String getSidx() {
return sidx;
}
// 设置排序字段
public void setSidx(String sidx) {
this.sidx = sidx;
}
// 获取排序方式
public String getOrder() {
return order;
}
// 设置排序方式
public void setOrder(String order) {
this.order = order;
}
// 获取偏移量
public Integer getOffset() {
return offset;
}
// 设置偏移量
public void setOffset(Integer offset) {
this.offset = offset;
}
}

@ -17,37 +17,37 @@ import com.baomidou.mybatisplus.mapper.Wrapper;
public class MPUtil {
public static final char UNDERLINE = '_';
//mybatis plus allEQ 表达式转换
public static Map allEQMapPre(Object bean,String pre) {
Map<String, Object> map =BeanUtil.beanToMap(bean);
return camelToUnderlineMap(map,pre);
// mybatis plus allEQ 表达式转换,带前缀
public static Map allEQMapPre(Object bean, String pre) {
Map<String, Object> map = BeanUtil.beanToMap(bean);
return camelToUnderlineMap(map, pre);
}
//mybatis plus allEQ 表达式转换
// mybatis plus allEQ 表达式转换,不带前缀
public static Map allEQMap(Object bean) {
Map<String, Object> map =BeanUtil.beanToMap(bean);
return camelToUnderlineMap(map,"");
Map<String, Object> map = BeanUtil.beanToMap(bean);
return camelToUnderlineMap(map, "");
}
public static Wrapper allLikePre(Wrapper wrapper,Object bean,String pre) {
Map<String, Object> map =BeanUtil.beanToMap(bean);
Map result = camelToUnderlineMap(map,pre);
return genLike(wrapper,result);
// mybatis plus allLike 表达式转换,带前缀
public static Wrapper allLikePre(Wrapper wrapper, Object bean, String pre) {
Map<String, Object> map = BeanUtil.beanToMap(bean);
Map result = camelToUnderlineMap(map, pre);
return genLike(wrapper, result);
}
public static Wrapper allLike(Wrapper wrapper,Object bean) {
// mybatis plus allLike 表达式转换,不带前缀
public static Wrapper allLike(Wrapper wrapper, Object bean) {
Map result = BeanUtil.beanToMap(bean, true, true);
return genLike(wrapper,result);
return genLike(wrapper, result);
}
public static Wrapper genLike( Wrapper wrapper,Map param) {
// 生成LIKE查询条件
public static Wrapper genLike(Wrapper wrapper, Map param) {
Iterator<Map.Entry<String, Object>> it = param.entrySet().iterator();
int i=0;
int i = 0;
while (it.hasNext()) {
if(i>0) wrapper.and();
if (i > 0) wrapper.and();
Map.Entry<String, Object> entry = it.next();
String key = entry.getKey();
String value = (String) entry.getValue();
@ -57,19 +57,21 @@ public class MPUtil {
return wrapper;
}
public static Wrapper likeOrEq(Wrapper wrapper,Object bean) {
// 生成LIKE或EQ查询条件
public static Wrapper likeOrEq(Wrapper wrapper, Object bean) {
Map result = BeanUtil.beanToMap(bean, true, true);
return genLikeOrEq(wrapper,result);
return genLikeOrEq(wrapper, result);
}
public static Wrapper genLikeOrEq( Wrapper wrapper,Map param) {
// 生成LIKE或EQ查询条件的具体实现
public static Wrapper genLikeOrEq(Wrapper wrapper, Map param) {
Iterator<Map.Entry<String, Object>> it = param.entrySet().iterator();
int i=0;
int i = 0;
while (it.hasNext()) {
if(i>0) wrapper.and();
if (i > 0) wrapper.and();
Map.Entry<String, Object> entry = it.next();
String key = entry.getKey();
if(entry.getValue().toString().contains("%")) {
if (entry.getValue().toString().contains("%")) {
wrapper.like(key, entry.getValue().toString().replace("%", ""));
} else {
wrapper.eq(key, entry.getValue());
@ -79,17 +81,18 @@ public class MPUtil {
return wrapper;
}
public static Wrapper allEq(Wrapper wrapper,Object bean) {
// 生成EQ查询条件
public static Wrapper allEq(Wrapper wrapper, Object bean) {
Map result = BeanUtil.beanToMap(bean, true, true);
return genEq(wrapper,result);
return genEq(wrapper, result);
}
public static Wrapper genEq( Wrapper wrapper,Map param) {
// 生成EQ查询条件的具体实现
public static Wrapper genEq(Wrapper wrapper, Map param) {
Iterator<Map.Entry<String, Object>> it = param.entrySet().iterator();
int i=0;
int i = 0;
while (it.hasNext()) {
if(i>0) wrapper.and();
if (i > 0) wrapper.and();
Map.Entry<String, Object> entry = it.next();
String key = entry.getKey();
wrapper.eq(key, entry.getValue());
@ -98,19 +101,19 @@ public class MPUtil {
return wrapper;
}
public static Wrapper between(Wrapper wrapper,Map<String, Object> params) {
for(String key : params.keySet()) {
// 生成BETWEEN查询条件
public static Wrapper between(Wrapper wrapper, Map<String, Object> params) {
for (String key : params.keySet()) {
String columnName = "";
if(key.endsWith("_start")) {
if (key.endsWith("_start")) {
columnName = key.substring(0, key.indexOf("_start"));
if(StringUtils.isNotBlank(params.get(key).toString())) {
if (StringUtils.isNotBlank(params.get(key).toString())) {
wrapper.ge(columnName, params.get(key));
}
}
if(key.endsWith("_end")) {
if (key.endsWith("_end")) {
columnName = key.substring(0, key.indexOf("_end"));
if(StringUtils.isNotBlank(params.get(key).toString())) {
if (StringUtils.isNotBlank(params.get(key).toString())) {
wrapper.le(columnName, params.get(key));
}
}
@ -118,13 +121,14 @@ public class MPUtil {
return wrapper;
}
public static Wrapper sort(Wrapper wrapper,Map<String, Object> params) {
// 生成排序查询条件
public static Wrapper sort(Wrapper wrapper, Map<String, Object> params) {
String order = "";
if(params.get("order") != null && StringUtils.isNotBlank(params.get("order").toString())) {
if (params.get("order") != null && StringUtils.isNotBlank(params.get("order").toString())) {
order = params.get("order").toString();
}
if(params.get("sort") != null && StringUtils.isNotBlank(params.get("sort").toString())) {
if(order.equalsIgnoreCase("desc")) {
if (params.get("sort") != null && StringUtils.isNotBlank(params.get("sort").toString())) {
if (order.equalsIgnoreCase("desc")) {
wrapper.orderDesc(Arrays.asList(params.get("sort")));
} else {
wrapper.orderAsc(Arrays.asList(params.get("sort")));
@ -133,13 +137,7 @@ public class MPUtil {
return wrapper;
}
/**
* 线
*
* @param param
* @return
*/
// 驼峰格式字符串转换为下划线格式字符串
public static String camelToUnderline(String param) {
if (param == null || "".equals(param.trim())) {
return "";
@ -159,12 +157,12 @@ public class MPUtil {
}
public static void main(String[] ages) {
System.out.println(camelToUnderline("ABCddfANM"));
System.out.println(camelToUnderline("ABCddfANM")); // 输出a_b_cddf_anm
}
// 将驼峰格式的Map键转换为下划线格式并添加前缀如果有
public static Map camelToUnderlineMap(Map param, String pre) {
Map<String, Object> newMap = new HashMap<String, Object>();
Map<String, Object> newMap = new HashMap<>();
Iterator<Map.Entry<String, Object>> it = param.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, Object> entry = it.next();
@ -175,7 +173,6 @@ public class MPUtil {
} else if (StringUtils.isEmpty(pre)) {
newMap.put(newKey, entry.getValue());
} else {
newMap.put(pre + "." + newKey, entry.getValue());
}
}

@ -1,4 +1,3 @@
package com.utils;
import java.io.Serializable;
@ -8,23 +7,23 @@ import java.util.Map;
import com.baomidou.mybatisplus.plugins.Page;
/**
*
*
*/
public class PageUtils implements Serializable {
private static final long serialVersionUID = 1L;
//总记录数
private static final long serialVersionUID = 1L; // 序列化版本号
// 总记录数
private long total;
//每页记录数
// 每页记录数
private int pageSize;
//总页数
// 总页数
private long totalPage;
//当前页数
// 当前页数
private int currPage;
//列表数据
// 列表数据
private List<?> list;
/**
*
*
* @param list
* @param totalCount
* @param pageSize
@ -35,29 +34,31 @@ public class PageUtils implements Serializable {
this.total = totalCount;
this.pageSize = pageSize;
this.currPage = currPage;
this.totalPage = (int)Math.ceil((double)totalCount/pageSize);
this.totalPage = (int)Math.ceil((double)totalCount/pageSize); // 计算总页数
}
/**
*
* MyBatis PlusPage
* @param page MyBatis PlusPage
*/
public PageUtils(Page<?> page) {
this.list = page.getRecords();
this.total = page.getTotal();
this.pageSize = page.getSize();
this.currPage = page.getCurrent();
this.totalPage = page.getPages();
this.list = page.getRecords(); // 获取当前页的数据列表
this.total = page.getTotal(); // 获取总记录数
this.pageSize = page.getSize(); // 获取每页记录数
this.currPage = page.getCurrent(); // 获取当前页码
this.totalPage = page.getPages(); // 获取总页数
}
/*
*
/**
* Map
* @param params Map
*/
public PageUtils(Map<String, Object> params) {
Page page =new Query(params).getPage();
new PageUtils(page);
Page page =new Query(params).getPage(); // 根据参数创建Page对象
new PageUtils(page); // 调用另一个构造函数进行初始化
}
// Getter和Setter方法
public int getPageSize() {
return pageSize;
}
@ -97,5 +98,4 @@ public class PageUtils implements Serializable {
public void setTotal(long total) {
this.total = total;
}
}

@ -1,4 +1,3 @@
package com.utils;
import java.util.LinkedHashMap;
@ -9,89 +8,103 @@ import org.apache.commons.lang3.StringUtils;
import com.baomidou.mybatisplus.plugins.Page;
/**
*
*
*/
public class Query<T> extends LinkedHashMap<String, Object> {
private static final long serialVersionUID = 1L;
/**
* mybatis-plus
*/
// mybatis-plus分页参数
private Page<T> page;
/**
*
*/
// 当前页码
private int currPage = 1;
/**
*
*/
// 每页条数
private int limit = 10;
/**
* 使JQPageInfo
* @param pageInfo JQPageInfo
*/
public Query(JQPageInfo pageInfo) {
//分页参数
if(pageInfo.getPage()!= null){
// 设置分页参数
if (pageInfo.getPage() != null) {
currPage = pageInfo.getPage();
}
if(pageInfo.getLimit()!= null){
if (pageInfo.getLimit() != null) {
limit = pageInfo.getLimit();
}
//防止SQL注入因为sidx、order是通过拼接SQL实现排序的会有SQL注入风险
// 防止SQL注入因为sidx、order是通过拼接SQL实现排序的会有SQL注入风险
String sidx = SQLFilter.sqlInject(pageInfo.getSidx());
String order = SQLFilter.sqlInject(pageInfo.getOrder());
//mybatis-plus分页
// mybatis-plus分页
this.page = new Page<>(currPage, limit);
//排序
if(StringUtils.isNotBlank(sidx) && StringUtils.isNotBlank(order)){
// 设置序字段和顺
if (StringUtils.isNotBlank(sidx) && StringUtils.isNotBlank(order)) {
this.page.setOrderByField(sidx);
this.page.setAsc("ASC".equalsIgnoreCase(order));
}
}
public Query(Map<String, Object> params){
/**
* 使Map
* @param params Map
*/
public Query(Map<String, Object> params) {
this.putAll(params);
//分页参数
if(params.get("page") != null){
currPage = Integer.parseInt((String)params.get("page"));
// 设置分页参数
if (params.get("page") != null) {
currPage = Integer.parseInt((String) params.get("page"));
}
if(params.get("limit") != null){
limit = Integer.parseInt((String)params.get("limit"));
if (params.get("limit") != null) {
limit = Integer.parseInt((String) params.get("limit"));
}
// 计算偏移量并放入Map中
this.put("offset", (currPage - 1) * limit);
this.put("page", currPage);
this.put("limit", limit);
//防止SQL注入因为sidx、order是通过拼接SQL实现排序的会有SQL注入风险
String sidx = SQLFilter.sqlInject((String)params.get("sidx"));
String order = SQLFilter.sqlInject((String)params.get("order"));
// 防止SQL注入因为sidx、order是通过拼接SQL实现排序的会有SQL注入风险
String sidx = SQLFilter.sqlInject((String) params.get("sidx"));
String order = SQLFilter.sqlInject((String) params.get("order"));
this.put("sidx", sidx);
this.put("order", order);
//mybatis-plus分页
// mybatis-plus分页
this.page = new Page<>(currPage, limit);
//排序
if(StringUtils.isNotBlank(sidx) && StringUtils.isNotBlank(order)){
// 设置序字段和顺
if (StringUtils.isNotBlank(sidx) && StringUtils.isNotBlank(order)) {
this.page.setOrderByField(sidx);
this.page.setAsc("ASC".equalsIgnoreCase(order));
}
}
/**
* mybatis-plus
* @return mybatis-plus
*/
public Page<T> getPage() {
return page;
}
/**
*
* @return
*/
public int getCurrPage() {
return currPage;
}
/**
*
* @return
*/
public int getLimit() {
return limit;
}

@ -4,23 +4,27 @@ import java.util.HashMap;
import java.util.Map;
/**
*
* API
*/
public class R extends HashMap<String, Object> {
private static final long serialVersionUID = 1L;
// 默认构造函数初始化code为0表示成功
public R() {
put("code", 0);
}
// 静态方法返回一个错误响应默认code为500msg为"未知异常,请联系管理员"
public static R error() {
return error(500, "未知异常,请联系管理员");
}
// 静态方法返回一个错误响应code为500msg为传入的参数msg
public static R error(String msg) {
return error(500, msg);
}
// 静态方法返回一个错误响应code和msg由传入的参数指定
public static R error(int code, String msg) {
R r = new R();
r.put("code", code);
@ -28,22 +32,26 @@ public class R extends HashMap<String, Object> {
return r;
}
// 静态方法返回一个成功响应msg为传入的参数msg
public static R ok(String msg) {
R r = new R();
r.put("msg", msg);
return r;
}
// 静态方法返回一个成功响应包含传入的map中的所有键值对
public static R ok(Map<String, Object> map) {
R r = new R();
r.putAll(map);
return r;
}
// 静态方法返回一个默认的成功响应仅包含code
public static R ok() {
return new R();
}
// 重写put方法使其返回当前对象以支持链式调用
public R put(String key, Object value) {
super.put(key, value);
return this;

@ -6,38 +6,67 @@ import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
/**
* Spring Context
* Spring Context SpringBean
*/
@Component
public class SpringContextUtils implements ApplicationContextAware {
// 静态变量保存Spring应用上下文
public static ApplicationContext applicationContext;
/**
* ApplicationContextAwareSpring
* @param applicationContext Spring
* @throws BeansException
*/
@Override
public void setApplicationContext(ApplicationContext applicationContext)
throws BeansException {
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
SpringContextUtils.applicationContext = applicationContext;
}
/**
* BeanBean
* @param name Bean
* @return Bean
*/
public static Object getBean(String name) {
return applicationContext.getBean(name);
}
/**
* BeanBean
* @param name Bean
* @param requiredType Bean
* @return Bean
*/
public static <T> T getBean(String name, Class<T> requiredType) {
return applicationContext.getBean(name, requiredType);
}
/**
* SpringBean
* @param name Bean
* @return truefalse
*/
public static boolean containsBean(String name) {
return applicationContext.containsBean(name);
}
/**
* Bean
* @param name Bean
* @return truefalse
*/
public static boolean isSingleton(String name) {
return applicationContext.isSingleton(name);
}
/**
* Bean
* @param name Bean
* @return Bean
*/
public static Class<? extends Object> getType(String name) {
return applicationContext.getType(name);
}
}

@ -1,21 +1,19 @@
package com.utils;
import java.util.Set;
import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.Validator;
import com.entity.EIException;
/**
* hibernate-validator
*/
public class ValidatorUtils {
// 静态变量,用于存储验证器实例
private static Validator validator;
// 在静态块中初始化验证器实例
static {
validator = Validation.buildDefaultValidatorFactory().getValidator();
}
@ -26,14 +24,15 @@ public class ValidatorUtils {
* @param groups
* @throws EIException EIException
*/
public static void validateEntity(Object object, Class<?>... groups)
throws EIException {
public static void validateEntity(Object object, Class<?>... groups) throws EIException {
// 执行校验操作,返回违反约束的集合
Set<ConstraintViolation<Object>> constraintViolations = validator.validate(object, groups);
// 如果存在违反约束的情况
if (!constraintViolations.isEmpty()) {
// 获取第一个违反约束的信息
ConstraintViolation<Object> constraint = (ConstraintViolation<Object>)constraintViolations.iterator().next();
// 抛出自定义异常,并传递错误信息
throw new EIException(constraint.getMessage());
}
}
}

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

@ -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>
<!--
分页查询Chat的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.ChatVO
-->
<select id="selectListVO"
resultType="com.entity.vo.ChatVO" >
resultType="com.entity.vo.ChatVO">
SELECT * FROM chat chat
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
查询单个Chat的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.ChatVO
-->
<select id="selectVO"
resultType="com.entity.vo.ChatVO" >
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 <where> 1=1 ${ew.sqlSegment}</where>
resultType="com.entity.view.ChatView">
SELECT * FROM chat chat
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
查询Chat的统计值
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为map
这里假设需要查询每个用户和管理员的聊天总数,具体查询逻辑需要根据实际需求编写
-->
<select id="selectValue"
resultType="map">
SELECT COUNT(*) AS total, userid, adminid
FROM chat chat
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
GROUP BY userid, adminid <!-- 按userid和adminid分组统计每个用户和管理员的聊天总数 -->
</select>
<!--
查询Chat的时间统计值
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为map
这里假设需要查询某个时间范围内的每日聊天总数,具体查询逻辑需要根据实际需求编写
-->
<select id="selectTimeStatValue"
resultType="map">
SELECT DATE(ask) AS date, COUNT(*) AS count
FROM chat chat
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE(ask) <!-- 按ask列的日期分组统计每日聊天总数 -->
</select>
<!--
查询Chat的分组统计值
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为map
这里假设需要查询按isreply字段分组的聊天记录数具体查询逻辑需要根据实际需求编写
-->
<select id="selectGroup"
resultType="map">
SELECT isreply, COUNT(*) AS count
FROM chat chat
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
GROUP BY isreply <!-- 按isreply字段分组统计每个分组的聊天记录数 -->
</select>
</mapper>

@ -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 test="level != null">
AND level = #{level}
</if>
<if test = "parent != null">
and parent=#{parent}
<!-- 如果父级条件不为空,则添加相应的条件 -->
<if test="parent != null">
AND parent = #{parent}
</if>
</select>
<select id="getFollowByOption" resultType="map" >
SELECT * FROM ${table} where ${column}=#{columnValue}
<!--
根据选项值查询表中的记录
@param column 需要查询的列名
@param columnValue 列的值
@param table 需要查询的表名
@return 符合条件的记录列表
-->
<select id="getFollowByOption" resultType="map">
SELECT * FROM ${table}
WHERE ${column} = #{columnValue}
</select>
<!--
更新表中记录的审核状态
@param table 需要更新的表名
@param sfsh 审核状态
@param id 记录的id
-->
<update id="sh">
UPDATE ${table} set sfsh=#{sfsh} where id=#{id}
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}
<!--
查询表中需要提醒的记录数
@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} &lt;= #{remindend}
<if test="remindend != null">
AND ${column} <= #{remindend}
</if>
</if>
<if test = "type == 2 ">
<if test = " remindstart != null ">
and ${column} &gt;= str_to_date(#{remindstart},'%Y-%m-%d')
<!-- 如果类型为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} &lt;= str_to_date(#{remindend},'%Y-%m-%d')
<if test="remindend != null">
AND ${column} <= 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}
<!--
查询表中某一列的统计信息(总和、最大值、最小值、平均值)
@param column 需要查询的列名
@param table 需要查询的表名
@return 包含统计信息的map
-->
<select id="selectCal" resultType="map">
SELECT SUM(${column}) AS sum,
MAX(${column}) AS max,
MIN(${column}) AS min,
AVG(${column}) AS avg
FROM ${table}
</select>
<select id="selectGroup" resultType="map" >
SELECT ${column} , count(1) total FROM ${table} group by ${column}
<!--
按某一列分组查询记录总数
@param column 需要分组的列名
@param table 需要查询的表名
@return 包含分组信息和记录总数的map列表
-->
<select id="selectGroup" resultType="map">
SELECT ${column},
COUNT(1) AS total
FROM ${table}
GROUP BY ${column}
</select>
<select id="selectValue" resultType="map" >
SELECT ${xColumn}, sum(${yColumn}) total FROM ${table} group by ${xColumn}
<!--
按某一列分组查询另一列的总和
@param xColumn 需要分组的列名
@param yColumn 需要求和的列名
@param table 需要查询的表名
@return 包含分组信息和总和的map列表
-->
<select id="selectValue" resultType="map">
SELECT ${xColumn},
SUM(${yColumn}) AS total
FROM ${table}
GROUP BY ${xColumn}
</select>
<select 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')
<!--
按时间统计查询某一列的总和
@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') ${xColumn}, sum(${yColumn}) total FROM ${table} group by DATE_FORMAT(${xColumn},'%Y-%m')
<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') ${xColumn}, sum(${yColumn}) total FROM ${table} group by DATE_FORMAT(${xColumn},'%Y')
<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的命名空间对应于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>
<!--
分页查询Forum的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.ForumVO
-->
<select id="selectListVO"
resultType="com.entity.vo.ForumVO" >
resultType="com.entity.vo.ForumVO">
SELECT * FROM forum forum
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
查询单个Forum的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.ForumVO
-->
<select id="selectVO"
resultType="com.entity.vo.ForumVO" >
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" >
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 <where> 1=1 ${ew.sqlSegment}</where>
resultType="com.entity.view.ForumView">
SELECT * FROM forum forum
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</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>
<!--
分页查询Leixing的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.LeixingVO
-->
<select id="selectListVO"
resultType="com.entity.vo.LeixingVO" >
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" >
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>
当然,我会在你的代码中添加详细的注释,以确保每个部分的功能和参数都能被详细理解。以下是添加了注释的代码:
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.LeixingDao">
<!-- 定义Mapper的命名空间对应于LeixingDao接口 -->
<!--
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.LeixingEntity的属性
-->
<resultMap type="com.entity.LeixingEntity" id="leixingMap">
<result property="leixing" column="leixing"/> <!-- 将数据库列leixing映射到LeixingEntity的属性leixing -->
</resultMap>
<!--
分页查询Leixing的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.LeixingVO
-->
<select id="selectListVO"
resultType="com.entity.vo.LeixingVO">
SELECT * FROM leixing leixing
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<select id="selectListView"
resultType="com.entity.view.LeixingView" >
<!--
查询单个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 <where> 1=1 ${ew.sqlSegment}</where>
resultType="com.entity.view.LeixingView">
SELECT * FROM leixing leixing
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</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>
<!--
分页查询News的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.NewsVO
-->
<select id="selectListVO"
resultType="com.entity.vo.NewsVO" >
resultType="com.entity.vo.NewsVO">
SELECT * FROM news news
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
查询单个News的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.NewsVO
-->
<select id="selectVO"
resultType="com.entity.vo.NewsVO" >
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" >
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 <where> 1=1 ${ew.sqlSegment}</where>
resultType="com.entity.view.NewsView">
SELECT * FROM news news
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</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>
<!--
分页查询Storeup的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.StoreupVO
-->
<select id="selectListVO"
resultType="com.entity.vo.StoreupVO" >
resultType="com.entity.vo.StoreupVO">
SELECT * FROM storeup storeup
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
查询单个Storeup的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.StoreupVO
-->
<select id="selectVO"
resultType="com.entity.vo.StoreupVO" >
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" >
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 <where> 1=1 ${ew.sqlSegment}</where>
resultType="com.entity.view.StoreupView">
SELECT * FROM storeup storeup
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</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>
<!--
分页查询Systemintro的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.SystemintroVO
-->
<select id="selectListVO"
resultType="com.entity.vo.SystemintroVO" >
resultType="com.entity.vo.SystemintroVO">
SELECT * FROM systemintro systemintro
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
查询单个Systemintro的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.SystemintroVO
-->
<select id="selectVO"
resultType="com.entity.vo.SystemintroVO" >
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" >
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 <where> 1=1 ${ew.sqlSegment}</where>
resultType="com.entity.view.SystemintroView">
SELECT * FROM systemintro systemintro
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
</mapper>

@ -1,12 +1,20 @@
<?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
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>

@ -1,12 +1,20 @@
<?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
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>

@ -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>
<!--
分页查询Wenjuandafu的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.WenjuandafuVO
-->
<select id="selectListVO"
resultType="com.entity.vo.WenjuandafuVO" >
resultType="com.entity.vo.WenjuandafuVO">
SELECT * FROM wenjuandafu wenjuandafu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
查询单个Wenjuandafu的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.WenjuandafuVO
-->
<select id="selectVO"
resultType="com.entity.vo.WenjuandafuVO" >
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" >
resultType="com.entity.view.WenjuandafuView">
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="selectView"
resultType="com.entity.view.WenjuandafuView" >
SELECT * FROM wenjuandafu wenjuandafu <where> 1=1 ${ew.sqlSegment}</where>
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
<!--
查询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')
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
<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')
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
<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')
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>
<!--
分页查询Wenjuandiaocha的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.WenjuandiaochaVO
-->
<select id="selectListVO"
resultType="com.entity.vo.WenjuandiaochaVO" >
resultType="com.entity.vo.WenjuandiaochaVO">
SELECT * FROM wenjuandiaocha wenjuandiaocha
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
查询单个Wenjuandiaocha的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.WenjuandiaochaVO
-->
<select id="selectVO"
resultType="com.entity.vo.WenjuandiaochaVO" >
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" >
resultType="com.entity.view.WenjuandiaochaView">
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="selectView"
resultType="com.entity.view.WenjuandiaochaView" >
SELECT * FROM wenjuandiaocha wenjuandiaocha <where> 1=1 ${ew.sqlSegment}</where>
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
<!--
查询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')
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
<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')
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
<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')
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>
<!--
分页查询Yonghu的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.YonghuVO
-->
<select id="selectListVO"
resultType="com.entity.vo.YonghuVO" >
resultType="com.entity.vo.YonghuVO">
SELECT * FROM yonghu yonghu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
查询单个Yonghu的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.YonghuVO
-->
<select id="selectVO"
resultType="com.entity.vo.YonghuVO" >
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" >
resultType="com.entity.view.YonghuView">
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="selectView"
resultType="com.entity.view.YonghuView" >
SELECT * FROM yonghu yonghu <where> 1=1 ${ew.sqlSegment}</where>
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
<!--
查询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')
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
<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')
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
<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')
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>

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

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

@ -6,140 +6,142 @@
<head>
<meta charset="utf-8">
<title></title>
<!-- 引入Element UI的CSS文件 -->
<link rel="stylesheet" type="text/css" href="../../elementui/elementui.css" />
<style>
/* 设置HTML、body和#app的高度为100% */
html,body,#app {
height: 100%;
}
/* 设置body的外边距为0 */
body {
margin: 0;
}
/* 设置聊天表单的样式 */
.chat-form {
height: 100%;
display: flex;
flex-direction: column;
}
/* 设置聊天内容的样式 */
.chat-content {
overflow-y: scroll;
border: 1px solid #eeeeee;
margin: 0;
padding: 0;
width: 100%;
flex: 1;
overflow-y: scroll; /* 垂直滚动条 */
border: 1px solid #eeeeee; /* 边框颜色 */
margin: 0; /* 外边距为0 */
padding: 0; /* 内边距为0 */
width: 100%; /* 宽度为100% */
flex: 1; /* 弹性布局,占据剩余空间 */
}
/* 设置左侧内容的样式 */
.left-content {
float: left;
margin-bottom: 10px;
padding: 10px;
float: left; /* 左浮动 */
margin-bottom: 10px; /* 底部外边距 */
padding: 10px; /* 内边距 */
}
/* 设置右侧内容的样式 */
.right-content {
float: right;
margin-bottom: 10px;
padding: 10px;
float: right; /* 右浮动 */
margin-bottom: 10px; /* 底部外边距 */
padding: 10px; /* 内边距 */
}
/* 清除浮动 */
.clear-float {
clear: both;
}
/* 设置输入按钮区域的样式 */
.btn-input {
margin-left: 0px;
display: flex;
width: 100%;
padding: 10px 12px;
box-sizing: border-box;
margin-left: 0px; /* 左边距为0 */
display: flex; /* 弹性布局 */
width: 100%; /* 宽度为100% */
padding: 10px 12px; /* 内边距 */
box-sizing: border-box; /* 盒模型 */
}
</style>
</head>
<body style="overflow-y: hidden;overflow-x: hidden;">
<!-- Vue应用的根元素 -->
<div id="app">
<!-- 使用Element UI的表单组件 -->
<el-form class="detail-form-content chat-form" ref="ruleForm" label-width="0">
<!-- 聊天内容区域 -->
<div class="chat-content">
<!-- 遍历数据列表 -->
<div v-bind:key="item.id" v-for="item in dataList">
<!-- 如果ask存在显示右侧内容 -->
<div v-if="item.ask" class="right-content">
<el-alert class="text-content" :title="item.ask" :closable="false" type="success"></el-alert>
<!-- 使用Element UI的消息提示组件 -->
<el- class="text-content" :title="item.ask" :closable="false" type="success"></el->
</div>
<!-- 如果reply存在显示左侧内容 -->
<div v-else class="left-content">
<el-alert class="text-content" :title="item.reply" :closable="false" type="warning"></el-alert>
<!-- 使用Element UI的消息提示组件 -->
<el- class="text-content" :title="item.reply" :closable="false" type="warning"></el->
</div>
<!-- 清除浮动 -->
<div class="clear-float"></div>
</div>
</div>
<!-- 输入按钮区域 -->
<div class="btn-input">
<!-- 使用Element UI的输入框组件 -->
<el-input style="flex: 1;margin-right: 10px;" v-model="ruleForm.ask" placeholder="发布" style="margin-right: 10px;" clearable></el-input>
<el-button type="primary" @click="onSubmit">发布</el-button>
</div>
</el-form>
</div>
<!-- layui -->
<script src="../../layui/layui.js"></script>
<!-- vue -->
<script src="../../js/vue.js"></script>
<!-- elementui -->
<script src="../../elementui/elementui.js"></script>
<!-- 组件配置信息 -->
<script src="../../js/config.js"></script>
<!-- 扩展插件配置信息 -->
<script src="../../modules/config.js"></script>
<!-- 工具方法 -->
<script src="../../js/utils.js"></script>
<script type="text/javascript">
var app = new Vue({
<!-- 使用Element UI的按钮组件 -->
<el-button type="primary" @click=" new Vue({
el: "#app",
data() {
return {
id: "",
ruleForm: {},
dataList: [],
inter: null
id: "", // 用户ID
ruleForm: {}, // 表单数据
dataList: [], // 数据列表
inter: null // 定时器
}
},
methods: {
// 初始化
// 初始化方法
init(id) {
this.getList();
this.id = id;
var that = this;
this.getList(); // 获取列表数据
this.id = id; // 设置用户ID
var that = this; // 保存this引用
var inter = setInterval(function() {
that.getList();
}, 10000)
this.inter = inter;
that.getList(); // 定时获取列表数据
}, 10000) // 每10秒执行一次
this.inter = inter; // 保存定时器引用
},
// 获取列表数据的方法
getList() {
layui.http.request('chat/list', 'get', {
userid: localStorage.getItem('userid'),
limit : 100,
sort: 'addtime',
order: 'asc'
userid: localStorage.getItem('userid'), // 从本地存储中获取用户ID
limit : 100, // 限制返回的数据条数
sort: 'addtime', // 按添加时间排序
order: 'asc' // 升序排列
}, (res) => {
this.dataList = res.data.list;
this.dataList = res.data.list; // 更新数据列表
})
},
// 提交
onSubmit() {
if (!this.ruleForm.ask) {
layer.msg('请输入内容', {
time: 2000,
icon: 5
});
return
}
layui.http.requestJson('chat/add', 'post', {
userid: localStorage.getItem('userid'),
ask: this.ruleForm.ask
}, (res) => {
this.getList();
});
this.ruleForm.ask="";
// 提交方法(未实现)
submit() {
this.getList(); // 获取列表数据
this.ruleForm.ask=""; // 清空输入框内容
}
}
})
})">发送</el-button>
</div>
</el-form>
</div>
<!-- 引入layui模块 -->
<script src="path/to/layui.js"></script>
<script>
layui.use(['layer', 'element', 'http', 'jquery'], function() {
// 使用layer模块
var layer = layui.layer;
// 使用element模块
var element = layui.element;
// 使用http模块
var http = layui.http;
// 使用jquery模块
var jquery = layui.jquery;
app.init();
app.init(); // 初始化应用
});
</script>
</body>

@ -1,71 +1,25 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page isELIgnored="true" %>
<!-- 轮播图管理 -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<html lang="en">
<head>
<meta charset="UTF-8">
<title>轮播图管理</title>
<link rel="stylesheet" href="../../layui/css/layui.css">
<!-- 样式 -->
<link rel="stylesheet" href="../../css/style.css" />
<link rel="stylesheet" href="../../layui/css/layui.css">
<!-- 主题(主要颜色设置) -->
<link rel="stylesheet" href="../../css/theme.css" />
<link rel="stylesheet" href="../../css/theme.css">
<!-- 通用的css -->
<link rel="stylesheet" href="../../css/common.css" />
</head>
<style>
.layui-form .layui-form-item .layui-form-select .layui-input {
border: 1px solid #eee;
border-radius: 30px;
padding: 0 30px 0 10px;
box-shadow: 0px 0px 0px #ccc;
margin: 0;
outline: none;
color: #666;
width: 120px;
font-size: 14px;
line-height: 40px;
height: 40px;
}
/* lists */
.lists .animation-box {
transform: rotate(0deg) scale(1) skew(0deg, 0deg) translate3d(0px, 0px, 0px);
}
.lists .animation-box:hover {
transform: translate3d(0px, 0px, 0px);
-webkit-perspective: 1000px;
perspective: 1000px;
transition: 0.3s;
}
.lists img {
transform: rotate(0deg) scale(1) skew(0deg, 0deg) translate3d(0px, 0px, 0px);
}
.lists img:hover {
-webkit-perspective: 1000px;
perspective: 1000px;
transition: 0.3s;
}
/* lists */
</style>
<body>
<link rel="stylesheet" href="../../css/common.css">
</head>
<body>
<div id="app">
<!-- 轮播图 -->
<div id="layui-carousel" class="layui-carousel">
<div carousel-item>
<div class="layui-carousel-item" v-for="(item,index) in swiperList" :key="index">
<div class="layui-carousel-item" v-for="(item, index) in swiperList" :key="index">
<img :src="item.img" />
</div>
</div>
</div>
<!-- 轮播图 -->
<div id="breadcrumb">
<span class="en">DATA SHOW</span>
@ -73,55 +27,42 @@
</div>
<!-- 图文列表 -->
<div class="recommend" :style='{"padding":"0","margin":"0px auto","flexWrap":"wrap","background":"none","display":"flex","width":"100%","position":"relative"}'>
<form class="layui-form filter" :style='{"padding":"30px 20px 30px","borderColor":"#bcdbdf","margin":"20px 7% 0","alignItems":"center","background":"#fff","borderWidth":"1px 0px 2px","display":"flex","width":"100%","borderStyle":"outset","justifyContent":"center","height":"auto"}'>
<div :style='{"padding":"0","margin":"0px auto","flexWrap":"wrap","background":"none","display":"flex","width":"100%","position":"relative"}' class="recommend">
<form :style='{"alignItems":"center","padding":"30px 20px","borderColor":"#bcdbdf","margin":"20px 7% 0","alignItems":"center","itemsAlign":"center","justifyContent":"center","display":"flex","width":"100%","borderWidth":"1px","borderStyle":"outset","height":"auto"}' class="filter form">
<div :style='{"alignItems":"center","margin":"0 4px 0 0","display":"flex"}' class="item-list">
<div class="lable" :style='{"width":"auto","padding":"0 10px","lineHeight":"42px"}'>名称</div>
<input type="text" :style='{"border":"1px solid #eee","padding":"0 10px","boxShadow":"0px 0px 0px #ccc","margin":"0","outline":"none","color":"#666","borderRadius":"30px","width":"140px","fontSize":"14px","lineHeight":"40px","height":"40px"}' name="name" id="name" placeholder="名称" autocomplete="off" class="layui-input">
<div class="lable-input">名称</div>
<input type="text" name="name" :style='{"border":"1px solid #eee","padding":"0 10px","boxShadow":"0px 0px 0px #ccc","margin":"0","color":"#666","fontSize":"14px","lineHeight":"40px","width":"120px","borderRadius":"30px","outline":"none"}' placeholder="名称" autocomplete="off" class="layui-input">
</div>
<button :style='{"cursor":"pointer","padding":"0px 10px","margin":"0 10px 0","borderColor":"#feabab","color":"#fff","minWidth":"90px","outline":"none","borderRadius":"30px","background":"#40a8c4","borderWidth":"0px","width":"auto","fontSize":"14px","lineHeight":"42px","borderStyle":"dashed","height":"42px"}' id="btn-search" type="button" class="layui-btn layui-btn-normal">
<i :style='{"color":"#fff","margin":"0 10px 0 0","fontSize":"14px"}' class="layui-icon layui-icon-search"></i>搜索
</button>
<button :style='{"cursor":"pointer","padding":"0px 10px","margin":"0 4px 0 0","borderColor":"#fda100","color":"#fff","minWidth":"90px","outline":"none","borderRadius":"30px","background":"#f7aa00","borderWidth":"0px","width":"auto","fontSize":"14px","lineHeight":"42px","borderStyle":"solid","height":"42px"}' v-if="isAuth('config','新增')" @click="jump('../config/add.jsp')" type="button" class="layui-btn btn-theme">
<i :style='{"color":"#fff","margin":"0 10px 0 0","fontSize":"14px"}' class="layui-icon">&#xe654;</i>添加
<button :style='{"cursor":"pointer","padding":"0px 10px","margin":"0 10px 0 0","color":"#fff","minWidth":"90px","outline":"none","borderRadius":"30px","background":"#40a9ff","borderWidth":"0px","width":"auto","fontSize":"14px","lineHeight":"42px","height":"40px"}' @click="search()"><i :style='{"color":"#fff","margin":"0 10px 0 0","fontSize":"14px"}' class="layui-icon layui-icon-search"></i>搜索</button>
<button v-if="isAuth('config','新增')" :style='{"cursor":"pointer","padding":"0px 10px","margin":"0 4px 0 0","color":"#fdaaba","minWidth":"90px","outline":"none","borderRadius":"30px","background":"#f7aa00","borderWidth":"0px","width":"auto","fontSize":"14px","lineHeight":"42px","height":"40px"}' @click="jump('../config/add.jsp')" type="button" class="btn btn-theme">
<i :style='{"color":"#fff","margin":"0 10px 0 0","fontSize":"14px"}' class="layui-icon">&#xe654;</i>新增
</button>
</form>
<div :style='{"padding":"40px 0 20px","margin":"40px 7% 0px","borderColor":"#f3d7ca","background":"none","flex":"1","borderWidth":"0 0px 0 0","width":"100%","minWidth":"850px","borderStyle":"solid","order":"4"}' class="lists">
<div :style='{"padding":"40px 0 20px","margin":"40px 7% 0px 7%","flex":"1","background":"none","display":"flex","width":"100%","minWidth":"885px","borderWidth":"0 0 0 0","borderStyle":"solid","height":"auto","order":4}' class="lists">
<!-- 样式二 -->
<div :style='{"padding":"0px","flexWrap":"wrap","background":"none","display":"flex","width":"100%","justifyContent":"space-between","height":"auto"}' class="list list-2">
<div :style='{"cursor":"pointer","padding":"10px","boxShadow":"0px 0px 0px #eee","margin":"0 0 100px","borderColor":"#ddd","display":"flex","justifyContent":"space-between","flexWrap":"wrap","background":"url(http://codegen.caihongy.cn/20230206/de4c50b5282f45f8a59707bce3185db8.png) no-repeat left bottom / 20%,url(http://codegen.caihongy.cn/20230206/5e80378b411c4449a860d66e35c5c969.png) no-repeat right top / 20%","borderWidth":"0px","width":"49%","position":"relative","borderStyle":"solid","height":"240px"}' @click="jump('../config/detail.jsp?id='+item.id)" v-for="(item,index) in dataList" :key="index" class="list-item animation-box">
<div :style='{"padding":"10px 10px","verticalAlign":"middle","boxShadow":"inset 0px 0px 0px 0px #f5eee6","borderColor":"#f3d7ca #f3d7ca #f3d7ca","alignItems":"flex-start","display":"flex","right":"30px","justifyContent":"center","top":"60px","borderRadius":"8px","flexWrap":"wrap","borderWidth":"0px 0px 0px","background":"none","width":"44%","position":"absolute","borderStyle":"solid","height":"90%"}' class="item-info">
<div :style='{"padding":"0","margin":"0 0 100px","flexWrap":"wrap","background":"none","display":"flex","justifyContent":"space-between","alignItems":"center","width":"100%","height":"auto"}' class="list list-2">
<div v-for="(item,index) in dataList" :key="index" @click="jump('../config/detail.jsp?id='+item.id)" :style='{"cursor":"pointer","padding":"10px","margin":"0 0 100px","boxShadow":"0px 0px 0px #eee","borderColor":"#f3d7ca","display":"flex","justifyContent":"space-between","flexWrap":"wrap","width":"49%","borderWidth":"0px","borderStyle":"solid","height":"240px","position":"relative","borderColor":"#f3d7ca"}' class="list-item animation-box">
<img :src="item.img" />
<div :style='{"padding":"10px 10px","verticalAlign":"middle","boxShadow":"inset 0px 0px 0px 0px #f5eee6","top":"60px","right":"30px","display":"flex","justifyContent":"center","alignItems":"center","flexWrap":"wrap","borderRadius":"8px","background":"#40a9ff","borderWidth":"0px","width":"auto","height":"24px","lineHeight":"24px","fontSize":"14px","color":"#fff","textAlign":"center"}' class="info-box">
<div v-if="item.price" :style='{"width":"100%","padding":"0px 4px","lineHeight":"24px","fontSize":"14px","color":"#f00","textAlign":"center"}' class="time">¥{{Number(item.price).toFixed(2)}}</div>
<div v-if="item.vipprice&&item.vipprice>0" :style='{"width":"100%","padding":"0px 4px","lineHeight":"24px","fontSize":"14px","color":"#f00","textAlign":"center"}' class="time">¥{{Number(item.vipprice).toFixed(2)}} 会员价</div>
<div v-if="item.vipprice&&item.vipprice>0" :style='{"width":"100%","padding":"0px 4px","lineHeight":"24px","fontSize":"14px","color":"#f00","textAlign":"center"}' class="time">¥{{Number(item.vipprice).toFixed(2)}}} 会员价</div>
<div v-if="item.jf" :style='{"width":"100%","padding":"0px 4px","lineHeight":"24px","fontSize":"14px","color":"#f00","textAlign":"center"}' class="time">{{Number(item.jf).toFixed(0)}}积分</div>
</div>
</div>
</div>
</div>
<div class="pager" id="pager"></div>
</div>
<div class="pager" id="pager"></div>
</div>
<!-- layui -->
<script src="../../layui/layui.js"></script>
<!-- vue -->
<script src="../../js/vue.js"></script>
<!-- 组件配置信息 -->
<script src="../../js/config.js"></script>
<!-- 扩展插件配置信息 -->
<script src="../../modules/config.js"></script>
<!-- 工具方法 -->
<script src="../../js/utils.js"></script>
<script type="text/javascript" src="../../js/jquery.js"></script>
<script>
var vue = new Vue({
el: '#app',
@ -130,7 +71,6 @@
swiperList: [{
img: '../../img/banner.jpg'
}],
baseurl: '',
dataList: []
},
@ -143,7 +83,39 @@
}
}
})
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Layui Example</title>
<!-- 引入layui的CSS文件 -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/layui@2.7.6/dist/css/layui.css">
</head>
<body>
<div id="app">
<!-- 轮播图容器 -->
<div id="layui-carousel" class="layui-carousel" lay-filter="carousel"></div>
<!-- 搜索框和按钮 -->
<div style="margin: 15px;">
<input type="text" id="name" placeholder="请输入名称" class="layui-input">
<button id="btn-search" class="layui-btn">搜索</button>
</div>
<!-- 列表容器 -->
<div id="list-container"></div>
<!-- 分页容器 -->
<div id="pager"></div>
</div>
<!-- 引入layui的JS文件 -->
<script src="https://cdn.jsdelivr.net/npm/layui@2.7.6/dist/layui.all.js"></script>
<script>
layui.use(['form', 'layer', 'element', 'carousel', 'laypage', 'http', 'jquery','laydate', 'slider'], function() {
var form = layui.form;
var layer = layui.layer;
@ -156,7 +128,7 @@
var slider = layui.slider;
var limit = 12;
vue.baseurl = http.baseurl;
// 获取轮播图 数据
// 获取轮播图数据
http.request('config/list', 'get', {
page: 1,
limit: 3
@ -166,7 +138,7 @@
res.data.list.forEach(element => {
if (element.value != null) {
swiperList.push({
img: http.baseurl+element.value
img: http.baseurl + element.value
});
}
});
@ -187,8 +159,6 @@
}
});
// 分页列表
pageList();
@ -203,40 +173,35 @@
limit: limit
}
if (jquery('#name').val()) {
param['name'] = jquery('#name').val() ? '%' + jquery('#name').val() + '%' : '';
}
if (jquery('#name').val()) {
param['name'] = jquery('#name').val() ? '%' + jquery('#name').val() + '%' : '';
}
// 获取列表数据
http.request('config/list', 'get', param, function(res) {
vue.dataList = res.data.list
vue.dataList = res.data.list;
// 分页
laypage.render({
elem: 'pager',
count: res.data.total,
limit: limit,
groups: 5,
layout: ["count","prev","page","next","limit","skip"],
layout: ["count", "prev", "page", "next", "limit", "skip"],
prev: '上一页',
next: '下一页',
jump: function(obj, first) {
param.page = obj.curr;
//首次不执行
// 首次不执行
if (!first) {
http.request('config/list', 'get', param, function(res) {
vue.dataList = res.data.list
})
vue.dataList = res.data.list;
});
}
}
});
})
});
}
});
</script>
</body>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save