Compare commits

..

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

@ -42,310 +42,214 @@ import com.utils.CommonUtil;
/** /**
* 线 * 线
* *
* @author * @author
* @email * @email
* @date 2023-02-21 09:46:06 * @date 2023-02-21 09:46:06
*/ */
@RestController @RestController
@RequestMapping("/chat") @RequestMapping("/chat")
public class ChatController { public class ChatController {
// 自动注入ChatService实例用于处理与聊天相关的业务逻辑
@Autowired @Autowired
private ChatService chatService; private ChatService chatService;
/** /**
* *
*
* @param params Map
* @param chat ChatEntity
* @param request HttpServletRequest
* @return R
*/ */
@RequestMapping("/page") @RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, ChatEntity chat, public R page(@RequestParam Map<String, Object> params,ChatEntity chat,
HttpServletRequest request) { HttpServletRequest request){
// 如果当前用户不是管理员角色,设置查询条件,只查询当前用户的聊天记录 if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
if (!request.getSession().getAttribute("role").toString().equals("管理员")) { chat.setUserid((Long)request.getSession().getAttribute("userId"));
}
chat.setUserid((Long) request.getSession().getAttribute("userId"));
}
// 创建一个EntityWrapper对象用于构建MyBatis Plus的查询条件
EntityWrapper<ChatEntity> ew = new EntityWrapper<ChatEntity>(); EntityWrapper<ChatEntity> ew = new EntityWrapper<ChatEntity>();
// 调用chatService的queryPage方法进行分页查询传入构建好的查询条件和参数 PageUtils page = chatService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, chat), params), params));
PageUtils page = chatService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, chat), params), params)); request.setAttribute("data", page);
// 将查询结果设置到请求属性中,可能用于在后续的视图渲染中使用
request.setAttribute("data", page);
// 返回包含查询结果的R对象通常R对象用于统一封装返回结果的状态和数据
return R.ok().put("data", page); return R.ok().put("data", page);
} }
/** /**
* *
*
* @param params Map
* @param chat ChatEntity
* @param request HttpServletRequest
* @return R
*/ */
@RequestMapping("/list") @RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params, ChatEntity chat, public R list(@RequestParam Map<String, Object> params,ChatEntity chat,
HttpServletRequest request) { HttpServletRequest request){
// 如果当前用户不是管理员角色,设置查询条件,只查询当前用户的聊天记录 if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
if (!request.getSession().getAttribute("role").toString().equals("管理员")) { chat.setUserid((Long)request.getSession().getAttribute("userId"));
}
chat.setUserid((Long) request.getSession().getAttribute("userId"));
}
// 创建一个EntityWrapper对象用于构建MyBatis Plus的查询条件
EntityWrapper<ChatEntity> ew = new EntityWrapper<ChatEntity>(); EntityWrapper<ChatEntity> ew = new EntityWrapper<ChatEntity>();
// 调用chatService的queryPage方法进行分页查询传入构建好的查询条件和参数 PageUtils page = chatService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, chat), params), params));
PageUtils page = chatService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, chat), params), params)); request.setAttribute("data", page);
// 将查询结果设置到请求属性中,可能用于在后续的视图渲染中使用
request.setAttribute("data", page);
// 返回包含查询结果的R对象通常R对象用于统一封装返回结果的状态和数据
return R.ok().put("data", page); return R.ok().put("data", page);
} }
/** /**
* *
* ChatEntity
* @param chat ChatEntity
* @return R
*/ */
@RequestMapping("/lists") @RequestMapping("/lists")
public R list(ChatEntity chat) { public R list( ChatEntity chat){
// 创建一个EntityWrapper对象用于构建MyBatis Plus的查询条件 EntityWrapper<ChatEntity> ew = new EntityWrapper<ChatEntity>();
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)); return R.ok().put("data", chatService.selectListView(ew));
} }
/** /**
* *
* 线
* @param chat ChatEntity
* @return R线
*/ */
@RequestMapping("/query") @RequestMapping("/query")
public R query(ChatEntity chat) { public R query(ChatEntity chat){
// 创建一个EntityWrapper对象用于构建MyBatis Plus的查询条件 EntityWrapper< ChatEntity> ew = new EntityWrapper< ChatEntity>();
EntityWrapper<ChatEntity> ew = new EntityWrapper<ChatEntity>(); ew.allEq(MPUtil.allEQMapPre( chat, "chat"));
// 根据传入的ChatEntity对象构建等值查询条件 ChatView chatView = chatService.selectView(ew);
ew.allEq(MPUtil.allEQMapPre(chat, "chat")); return R.ok("查询在线咨询成功").put("data", chatView);
// 调用chatService的selectView方法进行查询获取ChatView对象可能是包含详细信息的视图对象
ChatView chatView = chatService.selectView(ew);
// 返回包含查询结果的R对象以及提示信息和查询到的详细信息视图
return R.ok("查询在线咨询成功").put("data", chatView);
} }
/** /**
* *
* ID
* @param id ID
* @return R
*/ */
@RequestMapping("/info/{id}") @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); ChatEntity chat = chatService.selectById(id);
// 返回包含查询结果的R对象
return R.ok().put("data", chat); return R.ok().put("data", chat);
} }
/** /**
* *
* @IgnoreAuth
* @param id ID
* @return R
*/ */
@IgnoreAuth @IgnoreAuth
@RequestMapping("/detail/{id}") @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); ChatEntity chat = chatService.selectById(id);
// 返回包含查询结果的R对象
return R.ok().put("data", chat); return R.ok().put("data", chat);
} }
/** /**
* *
*
* @param chat ChatEntity
* @param request HttpServletRequest
* @return R
*/ */
@RequestMapping("/save") @RequestMapping("/save")
public R save(@RequestBody ChatEntity chat, HttpServletRequest request) { public R save(@RequestBody ChatEntity chat, HttpServletRequest request){
// 设置聊天记录的ID由当前时间戳加上一个随机数生成 chat.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
chat.setId(new Date().getTime() + new Double(Math.floor(Math.random() * 1000)).longValue()); //ValidatorUtils.validateEntity(chat);
// 此处原本可能用于验证ChatEntity对象的合法性但被注释掉了 if(StringUtils.isNotBlank(chat.getAsk())) {
//ValidatorUtils.validateEntity(chat); chatService.updateForSet("isreply=0", new EntityWrapper<ChatEntity>().eq("userid", request.getSession().getAttribute("userId")));
// 如果聊天记录的提问内容不为空 chat.setUserid((Long)request.getSession().getAttribute("userId"));
if (StringUtils.isNotBlank(chat.getAsk())) { chat.setIsreply(1);
// 更新当前用户的未回复状态为0表示有新提问 }
chatService.updateForSet("isreply=0", new EntityWrapper<ChatEntity>().eq("userid", request.getSession().getAttribute("userId"))); if(StringUtils.isNotBlank(chat.getReply())) {
// 设置聊天记录的用户ID为当前用户ID chatService.updateForSet("isreply=0", new EntityWrapper<ChatEntity>().eq("userid", chat.getUserid()));
chat.setUserid((Long) request.getSession().getAttribute("userId")); chat.setAdminid((Long)request.getSession().getAttribute("userId"));
// 设置回复状态为1表示已提问等待回复 }
chat.setIsreply(1);
}
// 如果聊天记录的回复内容不为空
if (StringUtils.isNotBlank(chat.getReply())) {
// 更新当前用户提问用户的未回复状态为0表示有新回复
chatService.updateForSet("isreply=0", new EntityWrapper<ChatEntity>().eq("userid", chat.getUserid()));
// 设置聊天记录的管理员ID为当前用户ID可能表示回复的管理员
chat.setAdminid((Long) request.getSession().getAttribute("userId"));
}
// 调用chatService的insert方法插入新的聊天记录
chatService.insert(chat); chatService.insert(chat);
// 返回表示保存成功的R对象
return R.ok(); return R.ok();
} }
/** /**
* *
*
* @param chat ChatEntity
* @param request HttpServletRequest
* @return R
*/ */
@RequestMapping("/add") @RequestMapping("/add")
public R add(@RequestBody ChatEntity chat, HttpServletRequest request) { public R add(@RequestBody ChatEntity chat, HttpServletRequest request){
// 设置聊天记录的ID由当前时间戳加上一个随机数生成 chat.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
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())) {
// 设置聊天记录的用户ID为当前用户ID chatService.updateForSet("isreply=0", new EntityWrapper<ChatEntity>().eq("userid", request.getSession().getAttribute("userId")));
chat.setUserid((Long) request.getSession().getAttribute("userId")); chat.setUserid((Long)request.getSession().getAttribute("userId"));
// 如果聊天记录的提问内容不为空 chat.setIsreply(1);
if (StringUtils.isNotBlank(chat.getAsk())) { }
// 更新当前用户的未回复状态为0表示有新提问 if(StringUtils.isNotBlank(chat.getReply())) {
chatService.updateForSet("isreply=0", new EntityWrapper<ChatEntity>().eq("userid", request.getSession().getAttribute("userId"))); chatService.updateForSet("isreply=0", new EntityWrapper<ChatEntity>().eq("userid", chat.getUserid()));
// 设置聊天记录的用户ID为当前用户ID chat.setAdminid((Long)request.getSession().getAttribute("userId"));
chat.setUserid((Long) request.getSession().getAttribute("UserId")); }
// 设置回复状态为1表示已提问等待回复
chat.setIsreply(1);
}
// 如果聊天记录的回复内容不为空
if (StringUtils.isNotBlank(chat.getReply())) {
// 更新当前用户提问用户的未回复状态为0表示有新回复
chatService.updateForSet("isreply=0", new EntityWrapper<ChatEntity>().eq("userid", chat.getUserid()));
// 设置聊天记录的管理员ID为当前用户ID可能表示回复的管理员
chat.setAdminid((Long) request.getSession().getAttribute("UserId"));
}
// 调用chatService的insert方法插入新的聊天记录
chatService.insert(chat); chatService.insert(chat);
// 返回表示保存成功的R对象
return R.ok(); return R.ok();
} }
/** /**
* *
*
* @param chat ChatEntity
* @param request HttpServletRequest
* @return R
*/ */
@RequestMapping("/update") @RequestMapping("/update")
@Transactional @Transactional
public R update(@RequestBody ChatEntity chat, HttpServletRequest request) { public R update(@RequestBody ChatEntity chat, HttpServletRequest request){
// 此处原本可能用于验证ChatEntity对象的合法性但被注释掉了
//ValidatorUtils.validateEntity(chat); //ValidatorUtils.validateEntity(chat);
// 调用chatService的updateById方法根据ID更新聊天记录 chatService.updateById(chat);//全部更新
chatService.updateById(chat); //全部更新
// 返回表示修改成功的R对象
return R.ok(); return R.ok();
} }
/** /**
* *
* ID
* @param ids ID
* @return R
*/ */
@RequestMapping("/delete") @RequestMapping("/delete")
public R delete(@RequestBody Long[] ids) { public R delete(@RequestBody Long[] ids){
// 调用chatService的deleteBatchIds方法批量删除指定ID的聊天记录
chatService.deleteBatchIds(Arrays.asList(ids)); chatService.deleteBatchIds(Arrays.asList(ids));
// 返回表示删除成功的R对象
return R.ok(); return R.ok();
} }
/** /**
* *
*
* @param columnName
* @param request HttpServletRequest
* @param type
* @param map Map
* @return R
*/ */
@RequestMapping("/remind/{columnName}/{type}") @RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type, @RequestParam Map<String, Object> map) { @PathVariable("type") String type,@RequestParam Map<String, Object> map) {
// 将列名和类型添加到查询条件Map中 map.put("column", columnName);
map.put("column", columnName); map.put("type", type);
map.put("type", type);
if(type.equals("2")) {
// 如果提醒类型为2 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
if (type.equals("2")) { Calendar c = Calendar.getInstance();
// 创建SimpleDateFormat对象用于日期格式化 Date remindStartDate = null;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date remindEndDate = null;
// 获取Calendar实例用于日期计算 if(map.get("remindstart")!=null) {
Calendar c = Calendar.getInstance(); Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
Date remindStartDate = null; c.setTime(new Date());
Date remindEndDate = null; c.add(Calendar.DAY_OF_MONTH,remindStart);
// 如果查询条件Map中包含remindstart开始提醒时间 remindStartDate = c.getTime();
if (map.get("remindstart")!= null) { map.put("remindstart", sdf.format(remindStartDate));
// 将remindstart转换为整数表示要添加的天数 }
Integer remindStart = Integer.parseInt(map.get("remindstart").toString()); if(map.get("remindend")!=null) {
// 设置当前日期为基础日期 Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date()); c.setTime(new Date());
// 根据提醒开始天数添加到当前日期上 c.add(Calendar.DAY_OF_MONTH,remindEnd);
c.add(Calendar.DAY_OF_MONTH, remindStart); remindEndDate = c.getTime();
// 获取计算后的提醒开始日期 map.put("remindend", sdf.format(remindEndDate));
remindStartDate = c.getTime(); }
// 将提醒开始日期格式化为指定格式并更新到查询条件Map中 }
map.put("remindstart", sdf.format(remindStartDate));
} Wrapper<ChatEntity> wrapper = new EntityWrapper<ChatEntity>();
// 如果查询条件Map中包含remindend结束提醒时间 if(map.get("remindstart")!=null) {
if (map.get("remindend")!= null) { wrapper.ge(columnName, map.get("remindstart"));
// 将remindend转换为整数表示要添加的天数 }
Integer remindEnd = Integer.parseInt(map.get("remindend").toString()); if(map.get("remindend")!=null) {
// 设置当前日期为基础日期 wrapper.le(columnName, map.get("remindend"));
c.setTime(new Date()); }
// 根据提醒结束天数添加到当前日期上
c.add(Calendar.DAY_OF_MONTH, remindEnd);
// 获取计算后的提醒结束日期 int count = chatService.selectCount(wrapper);
remindEndDate = c.getTime(); return R.ok().put("count", count);
// 将提醒结束日期格式化为指定格式并更新到查询条件Map中 }
map.put("remindend", sdf.format(remindEndDate));
}
}
// 创建一个EntityWrapper对象用于构建MyBatis Plus的查询条件
Wrapper<ChatEntity> wrapper = new EntityWrapper<ChatEntity>();
// 如果查询条件Map中包含remindstart开始提醒时间添加大于等于条件到查询条件中
if (map.get("remindstart")!= null) {
wrapper.ge(columnName, map.get("remindstart"));
}
// 如果查询条件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,286 +28,202 @@ import com.baidu.aip.face.MatchRequest;
import com.baidu.aip.util.Base64Util; import com.baidu.aip.util.Base64Util;
import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.ConfigEntity; import com.entity.ConfigEntity;
// 导入相关的服务类和工具类
import com.service.CommonService; import com.service.CommonService;
import com.service.ConfigService; import com.service.ConfigService;
import com.utils.BaiduUtil; import com.utils.BaiduUtil;
import com.utils.FileUtil; import com.utils.FileUtil;
import com.utils.R; import com.utils.R;
import com.utils.CommonUtil; import com.utils.CommonUtil;
/** /**
* *
* SpringRestController
*
*/ */
@RestController @RestController
public class CommonController { public class CommonController{
@Autowired
// 自动注入CommonService用于处理通用的业务逻辑 private CommonService commonService;
@Autowired
private CommonService commonService;
// 定义百度AI人脸识别客户端对象初始化为null
private static AipFace client = null; private static AipFace client = null;
// 自动注入ConfigService可能用于获取配置相关信息
@Autowired @Autowired
private ConfigService configService; private ConfigService configService;
/**
/** * tablecolumn()
* tablecolumn * @param table
* * @param column
* * @return
* @param tableName */
* @param columnName @RequestMapping("/option/{tableName}/{columnName}")
* @param conditionColumn @IgnoreAuth
* @param conditionValue conditionColumn使 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) {
* @param level Map<String, Object> params = new HashMap<String, Object>();
* @param parent params.put("table", tableName);
* @return RR params.put("column", columnName);
*/ if(StringUtils.isNotBlank(level)) {
@RequestMapping("/option/{tableName}/{columnName}") params.put("level", level);
@IgnoreAuth }
public R getOption(@PathVariable("tableName") String tableName, @PathVariable("tableName") String columnName, if(StringUtils.isNotBlank(parent)) {
@RequestParam(required = false) String conditionColumn, params.put("parent", parent);
@RequestParam(required = false) String conditionValue, String level, String parent) { }
// 创建一个用于存储参数的Map对象 if(StringUtils.isNotBlank(conditionColumn)) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName);
params.put("column", columnName);
if (StringUtils.isNotBlank(level)) {
params.put("level", level);
}
if (StringUtils.isNotBlank(parent)) {
params.put("parent", parent);
}
if (StringUtils.isNotBlank(conditionColumn)) {
params.put("conditionColumn", conditionColumn); params.put("conditionColumn", conditionColumn);
} }
if (StringUtils.isNotBlank(conditionValue)) { if(StringUtils.isNotBlank(conditionValue)) {
params.put("conditionValue", conditionValue); params.put("conditionValue", conditionValue);
} }
List<String> data = commonService.getOption(params);
// 调用commonService的getOption方法获取数据列表 return R.ok().put("data", data);
List<String> data = commonService.getOption(params); }
// 返回包含数据列表的R对象结果状态为成功 /**
return R.ok().put("data", data); * tablecolumn
} * @param table
* @param column
/** * @return
* tablecolumn */
* @RequestMapping("/follow/{tableName}/{columnName}")
* @IgnoreAuth
* @param tableName public R getFollowByOption(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName, @RequestParam String columnValue) {
* @param columnName Map<String, Object> params = new HashMap<String, Object>();
* @param columnValue params.put("table", tableName);
* @return R params.put("column", columnName);
*/ params.put("columnValue", columnValue);
@RequestMapping("/follow/{tableName}/{columnName}") Map<String, Object> result = commonService.getFollowByOption(params);
@IgnoreAuth return R.ok().put("data", result);
public R getFollowByOption(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName, }
@RequestParam String columnValue) {
// 创建一个用于存储参数的Map对象 /**
Map<String, Object> params = new HashMap<String, Object>(); * tablesfsh
params.put("table", tableName); * @param table
params.put("column", columnName); * @param map
params.put("columnValue", columnValue); * @return
*/
// 调用commonService的getFollowByOption方法获取单条记录数据 @RequestMapping("/sh/{tableName}")
Map<String, Object> result = commonService.getFollowByOption(params); public R sh(@PathVariable("tableName") String tableName, @RequestBody Map<String, Object> map) {
map.put("table", tableName);
// 返回包含单条记录数据的R对象结果状态为成功 commonService.sh(map);
return R.ok().put("data", result); return R.ok();
} }
/** /**
* tablesfsh *
* MapcommonServiceshsfsh * @param tableName
* * @param columnName
* @param tableName * @param type 1: 2:
* @param map Map * @param map
* @return R * @return
*/ */
@RequestMapping("/sh/{tableName}") @RequestMapping("/remind/{tableName}/{columnName}/{type}")
public R sh(@PathVariable("tableName") String tableName, @RequestBody Map<String, Object> map) { @IgnoreAuth
map.put("table", tableName); public R remindCount(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName,
commonService.sh(map); @PathVariable("type") String type,@RequestParam Map<String, Object> map) {
return R.ok(); map.put("table", tableName);
} map.put("column", columnName);
map.put("type", type);
/**
* if(type.equals("2")) {
* Map SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
* 2 Calendar c = Calendar.getInstance();
* Date remindStartDate = null;
* @param tableName Date remindEndDate = null;
* @param columnName if(map.get("remindstart")!=null) {
* @param type 12 Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
* @param map Maptype2 c.setTime(new Date());
* @return R c.add(Calendar.DAY_OF_MONTH,remindStart);
*/ remindStartDate = c.getTime();
@RequestMapping("/remind/{tableName}/{columnName}/{type}") map.put("remindstart", sdf.format(remindStartDate));
@IgnoreAuth }
public R remindCount(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName, if(map.get("remindend")!=null) {
@PathVariable("type") String type, @RequestParam Map<String, Object> map) { Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
map.put("table", tableName); c.setTime(new Date());
map.put("column", columnName); c.add(Calendar.DAY_OF_MONTH,remindEnd);
map.put("type", type); remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
if (type.equals("2")) { }
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); }
Calendar c = Calendar.getInstance();
Date remindStartDate = null; int count = commonService.remindCount(map);
Date remindEndDate = null; return R.ok().put("count", count);
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)); @RequestMapping("/cal/{tableName}/{columnName}")
} @IgnoreAuth
if (map.get("remindend")!= null) { public R cal(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName) {
Integer recommendEnd = Integer.parseInt(map.get("remindend").toString()); Map<String, Object> params = new HashMap<String, Object>();
c.setTime(new Date()); params.put("table", tableName);
c.add(Calendar.DAY_OF_MONTH, recommendEnd); params.put("column", columnName);
remindEndDate = c.getTime(); Map<String, Object> result = commonService.selectCal(params);
map.put("remindend", sdf.format(remindEndDate)); return R.ok().put("data", result);
} }
}
/**
// 调用commonService的remindCount方法获取需要提醒的记录数 *
int count = commonService.remindCount(map); */
@RequestMapping("/group/{tableName}/{columnName}")
// 返回包含记录数的R对象结果状态为成功 @IgnoreAuth
return R.ok().put("count", count); public R group(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName) {
} Map<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName);
/** params.put("column", columnName);
* List<Map<String, Object>> result = commonService.selectGroup(params);
* commonServiceselectCal SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
* for(Map<String, Object> m : result) {
* @param tableName for(String k : m.keySet()) {
* @param columnName if(m.get(k) instanceof Date) {
* @return R m.put(k, sdf.format((Date)m.get(k)));
*/ }
@RequestMapping("/cal/{tableName}/{columnName}") }
@IgnoreAuth }
public R cal(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName) { return R.ok().put("data", result);
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); @RequestMapping("/value/{tableName}/{xColumnName}/{yColumnName}")
@IgnoreAuth
// 返回包含求和结果的R对象结果状态为成功 public R value(@PathVariable("tableName") String tableName, @PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName) {
return R.ok().put("data", result); 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);
* commonServiceselectGroup SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
* for(Map<String, Object> m : result) {
* for(String k : m.keySet()) {
* @param tableName if(m.get(k) instanceof Date) {
@param columnName m.put(k, sdf.format((Date)m.get(k)));
* @return R }
*/ }
@RequestMapping("/group/{tableName}/{columnName}") }
@IgnoreAuth return R.ok().put("data", result);
public R group(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName) { }
Map<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName); /**
params.put("column", columnName); *
*/
// 调用commonService的selectGroup方法进行分组统计操作并获取结果 @IgnoreAuth
List<Map<String, Object>> result = commonService.selectGroup(params); @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) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Map<String, Object> params = new HashMap<String, Object>();
for (Map<String, Object> m : result) { params.put("table", tableName);
for (String k : m.keySet()) { params.put("xColumn", xColumnName);
if (m.get(k) instanceof Date) { params.put("yColumn", yColumnName);
m.put(k, sdf.format((Date) m.get(k))); params.put("timeStatType", timeStatType);
} 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()) {
// 返回包含分组统计结果的R对象结果状态为成功 if(m.get(k) instanceof Date) {
return R.ok().put("data", result); m.put(k, sdf.format((Date)m.get(k)));
} }
}
/** }
* 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) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName);
params.put("xColumn", xColumnName);
params.put("yColumn", yColumnName);
// 调用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)));
}
}
}
// 返回包含按值统计结果的R对象结果状态为成功
return R.ok().put("data", result);
}
/**
*
* xycommonServiceselectTimeStatValue
*
*
* @param tableName
* @param yColumnName y
* @param xColumnName x
* @param timeStatType
* @return R
*/
@RequestMapping("/value/{tableName}/{xColumnName}/{yColumnName}/{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);
// 调用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)));
}
}
}
// 返回包含按值统计结果的R对象结果状态为成功
return R.ok().put("data", result);
}
}

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

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

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

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

@ -1,28 +1,36 @@
package com.controller; package com.controller;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.text.ParseException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Map;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest; 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;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth; import com.annotation.IgnoreAuth;
import com.entity.WenjuandafuEntity; import com.entity.WenjuandafuEntity;
import com.entity.view.WenjuandafuView; import com.entity.view.WenjuandafuView;
import com.service.WenjuandafuService; import com.service.WenjuandafuService;
import com.service.TokenService; import com.service.TokenService;
import com.utils.PageUtils; import com.utils.PageUtils;
@ -32,7 +40,11 @@ import com.utils.MPUtil;
import com.utils.CommonUtil; import com.utils.CommonUtil;
/** /**
* *
*
* @author
* @email
* @date 2023-02-21 09:46:06
*/ */
@RestController @RestController
@RequestMapping("/wenjuandafu") @RequestMapping("/wenjuandafu")
@ -40,57 +52,66 @@ public class WenjuandafuController {
@Autowired @Autowired
private WenjuandafuService wenjuandafuService; private WenjuandafuService wenjuandafuService;
/** /**
* *
* @param params
* @param wenjuandafu
* @param request HTTP
* @return
*/ */
@RequestMapping("/page") @RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, WenjuandafuEntity wenjuandafu, HttpServletRequest request){ public R page(@RequestParam Map<String, Object> params,WenjuandafuEntity wenjuandafu,
String tableName = request.getSession().getAttribute("tableName").toString(); HttpServletRequest request){
if(tableName.equals("yonghu")) {
wenjuandafu.setZhanghao((String)request.getSession().getAttribute("username")); String tableName = request.getSession().getAttribute("tableName").toString();
} if(tableName.equals("yonghu")) {
wenjuandafu.setZhanghao((String)request.getSession().getAttribute("username"));
}
EntityWrapper<WenjuandafuEntity> ew = new EntityWrapper<WenjuandafuEntity>(); 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); 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); return R.ok().put("data", page);
} }
/** /**
* *
* @param params
* @param wenjuandafu
* @param request HTTP
* @return
*/ */
@IgnoreAuth @IgnoreAuth
@RequestMapping("/list") @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>(); 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); 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); return R.ok().put("data", page);
} }
/** /**
* *
* @param wenjuandafu
* @return
*/ */
@RequestMapping("/lists") @RequestMapping("/lists")
public R lists(WenjuandafuEntity wenjuandafu){ public R list( WenjuandafuEntity wenjuandafu){
EntityWrapper<WenjuandafuEntity> ew = new EntityWrapper<WenjuandafuEntity>(); EntityWrapper<WenjuandafuEntity> ew = new EntityWrapper<WenjuandafuEntity>();
ew.allEq(MPUtil.allEQMapPre( wenjuandafu, "wenjuandafu")); ew.allEq(MPUtil.allEQMapPre( wenjuandafu, "wenjuandafu"));
return R.ok().put("data", wenjuandafuService.selectListView(ew)); 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}") @RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){ public R info(@PathVariable("id") Long id){
@ -99,126 +120,112 @@ public class WenjuandafuController {
} }
/** /**
* *
* @param id ID
* @return
*/ */
@IgnoreAuth @IgnoreAuth
@RequestMapping("/detail/{id}") @RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){ public R detail(@PathVariable("id") Long id){
WenjuandafuEntity wenjuandafu = wenjuandafuService.selectById(id); WenjuandafuEntity wenjuandafu = wenjuandafuService.selectById(id);
return R.ok().put("data", wenjuandafu); return R.ok().put("data", wenjuandafu);
} }
/** /**
* *
* @param wenjuandafu
* @param request HTTP
* @return
*/ */
@RequestMapping("/save") @RequestMapping("/save")
public R save(@RequestBody WenjuandafuEntity wenjuandafu, HttpServletRequest request){ public R save(@RequestBody WenjuandafuEntity wenjuandafu, HttpServletRequest request){
wenjuandafu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); wenjuandafu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(wenjuandafu); // 验证实体对象(注释掉) //ValidatorUtils.validateEntity(wenjuandafu);
wenjuandafuService.insert(wenjuandafu); wenjuandafuService.insert(wenjuandafu);
return R.ok(); return R.ok();
} }
/** /**
* *
* @param wenjuandafu
* @param request HTTP
* @return
*/ */
@RequestMapping("/add") @RequestMapping("/add")
public R add(@RequestBody WenjuandafuEntity wenjuandafu, HttpServletRequest request){ public R add(@RequestBody WenjuandafuEntity wenjuandafu, HttpServletRequest request){
wenjuandafu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); wenjuandafu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(wenjuandafu); // 验证实体对象(注释掉) //ValidatorUtils.validateEntity(wenjuandafu);
wenjuandafuService.insert(wenjuandafu); wenjuandafuService.insert(wenjuandafu);
return R.ok(); return R.ok();
} }
/** /**
* *
* @param wenjuandafu
* @param request HTTP
* @return
*/ */
@RequestMapping("/update") @RequestMapping("/update")
@Transactional @Transactional
public R update(@RequestBody WenjuandafuEntity wenjuandafu, HttpServletRequest request){ public R update(@RequestBody WenjuandafuEntity wenjuandafu, HttpServletRequest request){
//ValidatorUtils.validateEntity(wenjuandafu); // 验证实体对象(注释掉) //ValidatorUtils.validateEntity(wenjuandafu);
wenjuandafuService.updateById(wenjuandafu); //更新全部字段 wenjuandafuService.updateById(wenjuandafu);//全部更新
return R.ok(); return R.ok();
} }
/** /**
* *
* @param ids ID
* @return
*/ */
@RequestMapping("/delete") @RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){ public R delete(@RequestBody Long[] ids){
wenjuandafuService.deleteBatchIds(Arrays.asList(ids)); wenjuandafuService.deleteBatchIds(Arrays.asList(ids));
return R.ok(); return R.ok();
} }
/** /**
* *
* @param columnName
* @param type 2
* @param request HTTP
* @param map
* @return
*/ */
@RequestMapping("/remind/{columnName}/{type}") @RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, @PathVariable("type") String type, HttpServletRequest request, @RequestParam Map<String, Object> map) { public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
map.put("column", columnName); @PathVariable("type") String type,@RequestParam Map<String, Object> map) {
map.put("type", type); map.put("column", columnName);
map.put("type", type);
if(type.equals("2")) { // 如果类型是日期范围
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); if(type.equals("2")) {
Calendar c = Calendar.getInstance(); // 获取当前日期实例 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//初始话开始和结束日期 Calendar c = Calendar.getInstance();
Date remindStartDate = null; Date remindStartDate = null;
Date remindEndDate = null; Date remindEndDate = null;
if(map.get("remindstart")!=null) {
if(map.get("remindstart") != null) { // 如果请求参数中包含开始日期 Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
Integer remindStart = Integer.parseInt(map.get("remindstart").toString()); // 获取开始日期天数差值 c.setTime(new Date());
c.setTime(new Date()); // 设置当前日期时间 c.add(Calendar.DAY_OF_MONTH,remindStart);
c.add(Calendar.DAY_OF_MONTH, remindStart); // 根据天数差值计算开始日期 remindStartDate = c.getTime();
remindStartDate = c.getTime(); map.put("remindstart", sdf.format(remindStartDate));
map.put("remindstart", sdf.format(remindStartDate)); // 将开始日期格式化并放入请求参数中 }
} if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
if(map.get("remindend") != null) { // 如果请求参数中包含结束日期 c.setTime(new Date());
Integer remindEnd = Integer.parseInt(map.get("remindend").toString()); // 获取结束日期天数差值 c.add(Calendar.DAY_OF_MONTH,remindEnd);
c.setTime(new Date()); // 设置当前日期时间 remindEndDate = c.getTime();
c.add(Calendar.DAY_OF_MONTH, remindEnd); map.put("remindend", sdf.format(remindEndDate));
remindEndDate = c.getTime(); // 获取计算后的结束日期 }
map.put("remindend", sdf.format(remindEndDate)); // 将结束日期格式化并放入请求参数中 }
}
} Wrapper<WenjuandafuEntity> wrapper = new EntityWrapper<WenjuandafuEntity>();
if(map.get("remindstart")!=null) {
String tableName = request.getSession().getAttribute("tableName").toString(); // 获取表名 wrapper.ge(columnName, map.get("remindstart"));
if(tableName.equals("yonghu")) { // 如果表名是用户表 }
map.put("zhanghao", (String)request.getSession().getAttribute("username")); // 添加用户名到请求参数中作为过滤条件 if(map.get("remindend")!=null) {
} wrapper.le(columnName, map.get("remindend"));
}
Wrapper<WenjuandafuEntity> wrapper = new EntityWrapper<WenjuandafuEntity>(); // 创建查询包装器实例
String tableName = request.getSession().getAttribute("tableName").toString();
if(map.get("remindstart") != null) { if(tableName.equals("yonghu")) {
wrapper.ge(columnName, map.get("remindstart")); // 添加大于等于开始日期的条件到查询包装器中 wrapper.eq("zhanghao", (String)request.getSession().getAttribute("username"));
} }
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); // 返回符合条件的记录数响应
}
}
@ -228,136 +235,94 @@ public class WenjuandafuController {
/** /**
* *
*/ */
@RequestMapping("/value/{xColumnName}/{yColumnName}") @RequestMapping("/value/{xColumnName}/{yColumnName}")
public R value(@PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName, HttpServletRequest request) { public R value(@PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName,HttpServletRequest request) {
// 创建参数映射,用于存储请求中的列名 Map<String, Object> params = new HashMap<String, Object>();
Map<String, Object> params = new HashMap<String, Object>(); params.put("xColumn", xColumnName);
params.put("xColumn", xColumnName); params.put("yColumn", yColumnName);
params.put("yColumn", yColumnName); EntityWrapper<WenjuandafuEntity> ew = new EntityWrapper<WenjuandafuEntity>();
String tableName = request.getSession().getAttribute("tableName").toString();
// 创建实体包装器,用于构建查询条件 if(tableName.equals("yonghu")) {
EntityWrapper<WenjuandafuEntity> ew = new EntityWrapper<WenjuandafuEntity>(); ew.eq("zhanghao", (String)request.getSession().getAttribute("username"));
}
// 获取当前会话中的表名 List<Map<String, Object>> result = wenjuandafuService.selectValue(params, ew);
String tableName = request.getSession().getAttribute("tableName").toString(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for(Map<String, Object> m : result) {
// 如果表名为"yonghu",则添加用户账号作为查询条件 for(String k : m.keySet()) {
if (tableName.equals("yonghu")) { if(m.get(k) instanceof Date) {
ew.eq("zhanghao", (String) request.getSession().getAttribute("username")); m.put(k, sdf.format((Date)m.get(k)));
} }
// 调用服务层方法进行数据查询
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)));
} }
} }
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) {
* Map<String, Object> params = new HashMap<String, Object>();
*/ params.put("xColumn", xColumnName);
@RequestMapping("/value/{xColumnName}/{yColumnName}/{timeStatType}") params.put("yColumn", yColumnName);
public R valueDay(@PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName, @PathVariable("timeStatType") String timeStatType, HttpServletRequest request) { params.put("timeStatType", timeStatType);
// 创建参数映射,用于存储请求中的列名和时间统计类型 EntityWrapper<WenjuandafuEntity> ew = new EntityWrapper<WenjuandafuEntity>();
Map<String, Object> params = new HashMap<String, Object>(); String tableName = request.getSession().getAttribute("tableName").toString();
params.put("xColumn", xColumnName); if(tableName.equals("yonghu")) {
params.put("yColumn", yColumnName); ew.eq("zhanghao", (String)request.getSession().getAttribute("username"));
params.put("timeStatType", timeStatType); }
List<Map<String, Object>> result = wenjuandafuService.selectTimeStatValue(params, ew);
// 创建实体包装器,用于构建查询条件 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
EntityWrapper<WenjuandafuEntity> ew = new EntityWrapper<WenjuandafuEntity>(); for(Map<String, Object> m : result) {
for(String k : m.keySet()) {
// 获取当前会话中的表名 if(m.get(k) instanceof Date) {
String tableName = request.getSession().getAttribute("tableName").toString(); m.put(k, sdf.format((Date)m.get(k)));
}
// 如果表名为"yonghu",则添加用户账号作为查询条件 }
if (tableName.equals("yonghu")) { }
ew.eq("zhanghao", (String) request.getSession().getAttribute("username")); return R.ok().put("data", result);
} }
// 调用服务层方法进行数据查询 /**
List<Map<String, Object>> result = wenjuandafuService.selectTimeStatValue(params, ew); *
*/
// 格式化日期对象为字符串 @RequestMapping("/group/{columnName}")
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); public R group(@PathVariable("columnName") String columnName,HttpServletRequest request) {
for (Map<String, Object> m : result) { Map<String, Object> params = new HashMap<String, Object>();
for (String k : m.keySet()) { params.put("column", columnName);
if (m.get(k) instanceof Date) { EntityWrapper<WenjuandafuEntity> ew = new EntityWrapper<WenjuandafuEntity>();
m.put(k, sdf.format((Date) m.get(k))); String tableName = request.getSession().getAttribute("tableName").toString();
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)));
}
} }
} }
return R.ok().put("data", result);
} }
// 返回封装好的响应结果
return R.ok().put("data", result);
}
/**
*
*/
@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();
// 如果表名为"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()) { @RequestMapping("/count")
if (m.get(k) instanceof Date) { public R count(@RequestParam Map<String, Object> params,WenjuandafuEntity wenjuandafu, HttpServletRequest request){
m.put(k, sdf.format((Date) m.get(k))); String tableName = request.getSession().getAttribute("tableName").toString();
} 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);
} }
// 返回封装好的响应结果
return R.ok().put("data", result);
}
/**
*
*/
@RequestMapping("/count")
public R count(@RequestParam Map<String, Object> params, WenjuandafuEntity wenjuandafu, HttpServletRequest request) {
// 获取当前会话中的表名
String tableName = request.getSession().getAttribute("tableName").toString();
// 如果表名为"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);
} }

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

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

@ -5,69 +5,24 @@ import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* *
*/ */
public interface CommonDao { public interface CommonDao{
List<String> getOption(Map<String, Object> params);
/**
* Map<String, Object> getFollowByOption(Map<String, Object> params);
* @param params
* @return List<String> getFollowByOption2(Map<String, Object> params);
*/
List<String> getOption(Map<String, Object> params); void sh(Map<String, Object> params);
/** int remindCount(Map<String, Object> params);
*
* @param params Map<String, Object> selectCal(Map<String, Object> params);
* @return
*/ List<Map<String, Object>> selectGroup(Map<String, Object> params);
Map<String, Object> getFollowByOption(Map<String, Object> params);
List<Map<String, Object>> selectValue(Map<String, Object> params);
/**
* List<Map<String, Object>> selectTimeStatValue(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,15 +1,12 @@
package com.dao; package com.dao;
import com.baomidou.mybatisplus.mapper.BaseMapper; // 导入MyBatis-Plus的BaseMapper接口 import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.entity.ConfigEntity; // 导入配置实体类 import com.entity.ConfigEntity;
/** /**
* DAO *
* 访ConfigEntity
*/ */
public interface ConfigDao extends BaseMapper<ConfigEntity> { public interface ConfigDao extends BaseMapper<ConfigEntity> {
// ConfigDao接口继承了BaseMapper接口意味着它自动获得了CRUD方法
// 可以根据需要在此处添加自定义的方法
} }

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

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

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

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

@ -6,37 +6,38 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import com.baomidou.mybatisplus.mapper.Wrapper; import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.pagination.Pagination; import com.baomidou.mybatisplus.plugins.pagination.Pagination;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.entity.vo.YonghuVO; import com.entity.vo.YonghuVO;
import com.entity.view.YonghuView; import com.entity.view.YonghuView;
/** /**
* 访MyBatis-PlusBaseMapper *
* YonghuEntity *
* @author
* @email
* @date 2023-02-21 09:46:06
*/ */
public interface YonghuDao extends BaseMapper<YonghuEntity> { public interface YonghuDao extends BaseMapper<YonghuEntity> {
// 根据条件查询用户视图对象列表 List<YonghuVO> selectListVO(@Param("ew") Wrapper<YonghuEntity> wrapper);
List<YonghuVO> selectListVO(@Param("ew") Wrapper<YonghuEntity> wrapper);
YonghuVO selectVO(@Param("ew") Wrapper<YonghuEntity> wrapper);
// 根据条件查询单个用户视图对象
YonghuVO selectVO(@Param("ew") Wrapper<YonghuEntity> wrapper); List<YonghuView> selectListView(@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);
// 根据条件查询单个用户视图对象
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>> 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>> selectGroup(@Param("params") Map<String, Object> params, @Param("ew") Wrapper<YonghuEntity> wrapper);
} }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -10,62 +10,28 @@ import com.entity.vo.ChatVO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.entity.view.ChatView; import com.entity.view.ChatView;
/** /**
* 线线 * 线
* IService<ChatEntity> MyBatis-Plus CRUD *
*
* @author * @author
* @email * @email
* @date 2023-02-21 09:46:06 * @date 2023-02-21 09:46:06
*/ */
public interface ChatService extends IService<ChatEntity> { public interface ChatService extends IService<ChatEntity> {
/**
*
*
* @param params
* @return PageUtils
*/
PageUtils queryPage(Map<String, Object> params); PageUtils queryPage(Map<String, Object> params);
/** List<ChatVO> selectListVO(Wrapper<ChatEntity> wrapper);
*
* ChatVO selectVO(@Param("ew") Wrapper<ChatEntity> wrapper);
* @param wrapper
* @return List<ChatView> selectListView(Wrapper<ChatEntity> wrapper);
*/
List<ChatVO> selectListVO(Wrapper<ChatEntity> wrapper); ChatView selectView(@Param("ew") Wrapper<ChatEntity> wrapper);
/** PageUtils queryPage(Map<String, Object> params,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);
/**
*
*
* @param params
* @param wrapper
* @return PageUtils
*/
PageUtils queryPage(Map<String, Object> params, Wrapper<ChatEntity> wrapper);
} }

@ -3,63 +3,20 @@ package com.service;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/**
* CommonService
*/
public interface CommonService { public interface CommonService {
List<String> getOption(Map<String, Object> params);
/**
* Map<String, Object> getFollowByOption(Map<String, Object> params);
* @param params
* @return void sh(Map<String, Object> params);
*/
List<String> getOption(Map<String, Object> params); int remindCount(Map<String, Object> params);
/** Map<String, Object> selectCal(Map<String, Object> params);
*
* @param params List<Map<String, Object>> selectGroup(Map<String, Object> params);
* @return
*/ List<Map<String, Object>> selectValue(Map<String, Object> params);
Map<String, Object> getFollowByOption(Map<String, Object> params);
List<Map<String, Object>> selectTimeStatValue(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 java.util.Map;
import com.baomidou.mybatisplus.mapper.Wrapper;// 导入MyBatis-Plus的Wrapper接口用于构建查询条件 import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.service.IService;// 导入MyBatis-Plus的服务接口 import com.baomidou.mybatisplus.service.IService;
import com.entity.ConfigEntity; import com.entity.ConfigEntity;
import com.utils.PageUtils; import com.utils.PageUtils;
@ -13,12 +13,5 @@ import com.utils.PageUtils;
* *
*/ */
public interface ConfigService extends IService<ConfigEntity> { public interface ConfigService extends IService<ConfigEntity> {
PageUtils queryPage(Map<String, Object> params,Wrapper<ConfigEntity> wrapper);
/**
*
* @param params
* @param wrapper
* @return
*/
PageUtils queryPage(Map<String, Object> params, Wrapper<ConfigEntity> wrapper);
} }

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

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

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

@ -10,90 +10,36 @@ import com.entity.vo.YonghuVO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.entity.view.YonghuView; import com.entity.view.YonghuView;
/** /**
* *
* IService<YonghuEntity> CRUD *
*
*
* @author * @author
* @email * @email
* @date 2023-02-21 09:46:06 * @date 2023-02-21 09:46:06
*/ */
public interface YonghuService extends IService<YonghuEntity> { public interface YonghuService extends IService<YonghuEntity> {
/**
*
*
* @param params
* @return PageUtils
*/
PageUtils queryPage(Map<String, Object> params); PageUtils queryPage(Map<String, Object> params);
/** List<YonghuVO> selectListVO(Wrapper<YonghuEntity> wrapper);
*
* YonghuVO selectVO(@Param("ew") Wrapper<YonghuEntity> wrapper);
* @param wrapper
* @return List<YonghuView> selectListView(Wrapper<YonghuEntity> wrapper);
*/
List<YonghuVO> selectListVO(Wrapper<YonghuEntity> wrapper); YonghuView selectView(@Param("ew") Wrapper<YonghuEntity> wrapper);
/** PageUtils queryPage(Map<String, Object> params,Wrapper<YonghuEntity> wrapper);
*
*
* @param wrapper List<Map<String, Object>> selectValue(Map<String, Object> params,Wrapper<YonghuEntity> wrapper);
* @return
*/ List<Map<String, Object>> selectTimeStatValue(Map<String, Object> params,Wrapper<YonghuEntity> wrapper);
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);
/**
*
*
* @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);
/** List<Map<String, Object>> selectGroup(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,6 +11,7 @@ import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.utils.PageUtils; import com.utils.PageUtils;
import com.utils.Query; import com.utils.Query;
import com.dao.ChatDao; import com.dao.ChatDao;
import com.entity.ChatEntity; import com.entity.ChatEntity;
import com.service.ChatService; import com.service.ChatService;
@ -20,81 +21,43 @@ import com.entity.view.ChatView;
@Service("chatService") @Service("chatService")
public class ChatServiceImpl extends ServiceImpl<ChatDao, ChatEntity> implements ChatService { public class ChatServiceImpl extends ServiceImpl<ChatDao, ChatEntity> implements ChatService {
/**
* ChatEntity
* @param params Map
* @return PageUtils
*/
@Override @Override
public PageUtils queryPage(Map<String, Object> params) { public PageUtils queryPage(Map<String, Object> params) {
// 使用Query类获取分页信息并调用selectPage方法进行数据库查询
Page<ChatEntity> page = this.selectPage( Page<ChatEntity> page = this.selectPage(
new Query<ChatEntity>(params).getPage(), new Query<ChatEntity>(params).getPage(),
new EntityWrapper<ChatEntity>() new EntityWrapper<ChatEntity>()
); );
// 将查询结果封装到PageUtils对象中并返回
return new PageUtils(page); 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));
// 将查询结果封装到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 @Override
public ChatVO selectVO(Wrapper<ChatEntity> wrapper) { public PageUtils queryPage(Map<String, Object> params, Wrapper<ChatEntity> wrapper) {
// 调用自定义的selectVO方法进行数据库查询并返回结果 Page<ChatView> page =new Query<ChatView>(params).getPage();
return baseMapper.selectVO(wrapper); page.setRecords(baseMapper.selectListView(page,wrapper));
} PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
/**
* @param wrapper
* @return ChatView
*/
// 调用自定义的selectListView方法进行数据库查询并返回结果
@Override @Override
public List<ChatView> selectListView(Wrapper<ChatEntity> wrapper) { public List<ChatVO> selectListVO(Wrapper<ChatEntity> wrapper) {
return baseMapper.selectListVO(wrapper);
return baseMapper.selectListView(wrapper); }
}
@Override
public ChatVO selectVO(Wrapper<ChatEntity> wrapper) {
return baseMapper.selectVO(wrapper);
}
@Override
public List<ChatView> selectListView(Wrapper<ChatEntity> wrapper) {
return baseMapper.selectListView(wrapper);
}
@Override
public ChatView selectView(Wrapper<ChatEntity> wrapper) {
return baseMapper.selectView(wrapper);
}
/**
* ChatView
* @param wrapper
* @return ChatView
*/
@Override
public ChatView selectView(Wrapper<ChatEntity> wrapper) {
// 调用自定义的selectView方法进行数据库查询并返回结果
return baseMapper.selectView(wrapper);
}
} }

@ -1,5 +1,7 @@
package com.service.impl; package com.service.impl;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -9,53 +11,54 @@ import org.springframework.stereotype.Service;
import com.dao.CommonDao; import com.dao.CommonDao;
import com.service.CommonService; import com.service.CommonService;
/** /**
* *
*/ */
@Service("commonService") @Service("commonService")
public class CommonServiceImpl implements CommonService { public class CommonServiceImpl implements CommonService {
@Autowired @Autowired
private CommonDao commonDao; // 自动注入数据访问对象 private CommonDao commonDao;
@Override @Override
public List<String> getOption(Map<String, Object> params) { public List<String> getOption(Map<String, Object> params) {
return commonDao.getOption(params); // 获取选项列表 return commonDao.getOption(params);
} }
@Override @Override
public Map<String, Object> getFollowByOption(Map<String, Object> params) { public Map<String, Object> getFollowByOption(Map<String, Object> params) {
return commonDao.getFollowByOption(params); // 根据选项获取关注信息 return commonDao.getFollowByOption(params);
} }
@Override @Override
public void sh(Map<String, Object> params) { public void sh(Map<String, Object> params) {
commonDao.sh(params); // 执行某种操作(具体操作未明) commonDao.sh(params);
} }
@Override @Override
public int remindCount(Map<String, Object> params) { public int remindCount(Map<String, Object> params) {
return commonDao.remindCount(params); // 获取提醒数量 return commonDao.remindCount(params);
} }
@Override @Override
public Map<String, Object> selectCal(Map<String, Object> params) { public Map<String, Object> selectCal(Map<String, Object> params) {
return commonDao.selectCal(params); // 选择并计算某些值 return commonDao.selectCal(params);
} }
@Override @Override
public List<Map<String, Object>> selectGroup(Map<String, Object> params) { public List<Map<String, Object>> selectGroup(Map<String, Object> params) {
return commonDao.selectGroup(params); // 按组选择数据 return commonDao.selectGroup(params);
} }
@Override @Override
public List<Map<String, Object>> selectValue(Map<String, Object> params) { public List<Map<String, Object>> selectValue(Map<String, Object> params) {
return commonDao.selectValue(params); // 选择特定值 return commonDao.selectValue(params);
} }
@Override @Override
public List<Map<String, Object>> selectTimeStatValue(Map<String, Object> params) { 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 { public class ConfigServiceImpl extends ServiceImpl<ConfigDao, ConfigEntity> implements ConfigService {
@Override @Override
public PageUtils queryPage(Map<String, Object> params, Wrapper<ConfigEntity> wrapper) { public PageUtils queryPage(Map<String, Object> params, Wrapper<ConfigEntity> wrapper) {
// 使用MyBatis-Plus的selectPage方法进行分页查询
Page<ConfigEntity> page = this.selectPage( Page<ConfigEntity> page = this.selectPage(
new Query<ConfigEntity>(params).getPage(), // 获取分页参数 new Query<ConfigEntity>(params).getPage(),
wrapper // 查询条件 wrapper
); );
return new PageUtils(page); // 返回分页结果 return new PageUtils(page);
}
} }

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -6,67 +6,38 @@ import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware; import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
* Spring Context SpringBean * Spring Context
*/ */
@Component @Component
public class SpringContextUtils implements ApplicationContextAware { public class SpringContextUtils implements ApplicationContextAware {
// 静态变量保存Spring应用上下文 public static ApplicationContext applicationContext;
public static ApplicationContext applicationContext;
@Override
/** public void setApplicationContext(ApplicationContext applicationContext)
* ApplicationContextAwareSpring throws BeansException {
* @param applicationContext Spring SpringContextUtils.applicationContext = applicationContext;
* @throws BeansException }
*/
@Override public static Object getBean(String name) {
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { return applicationContext.getBean(name);
SpringContextUtils.applicationContext = applicationContext; }
}
public static <T> T getBean(String name, Class<T> requiredType) {
/** return applicationContext.getBean(name, requiredType);
* BeanBean }
* @param name Bean
* @return Bean public static boolean containsBean(String name) {
*/ return applicationContext.containsBean(name);
public static Object getBean(String name) { }
return applicationContext.getBean(name);
} public static boolean isSingleton(String name) {
return applicationContext.isSingleton(name);
/** }
* BeanBean
* @param name Bean public static Class<? extends Object> getType(String name) {
* @param requiredType Bean return applicationContext.getType(name);
* @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,19 +1,21 @@
package com.utils; package com.utils;
import java.util.Set; import java.util.Set;
import javax.validation.ConstraintViolation; import javax.validation.ConstraintViolation;
import javax.validation.Validation; import javax.validation.Validation;
import javax.validation.Validator; import javax.validation.Validator;
import com.entity.EIException; import com.entity.EIException;
/** /**
* hibernate-validator * hibernate-validator
*/ */
public class ValidatorUtils { public class ValidatorUtils {
// 静态变量,用于存储验证器实例
private static Validator validator; private static Validator validator;
// 在静态块中初始化验证器实例
static { static {
validator = Validation.buildDefaultValidatorFactory().getValidator(); validator = Validation.buildDefaultValidatorFactory().getValidator();
} }
@ -24,15 +26,14 @@ public class ValidatorUtils {
* @param groups * @param groups
* @throws EIException EIException * @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); Set<ConstraintViolation<Object>> constraintViolations = validator.validate(object, groups);
// 如果存在违反约束的情况
if (!constraintViolations.isEmpty()) { if (!constraintViolations.isEmpty()) {
// 获取第一个违反约束的信息 ConstraintViolation<Object> constraint = (ConstraintViolation<Object>)constraintViolations.iterator().next();
ConstraintViolation<Object> constraint = (ConstraintViolation<Object>)constraintViolations.iterator().next();
// 抛出自定义异常,并传递错误信息
throw new EIException(constraint.getMessage()); throw new EIException(constraint.getMessage());
} }
} }
} }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -1,207 +1,242 @@
<!DOCTYPE html> <%@ page language="java" contentType="text/html; charset=UTF-8"
<html lang="en"> pageEncoding="UTF-8"%>
<head> <%@ page isELIgnored="true" %>
<meta charset="UTF-8">
<title>轮播图管理</title>
<!-- 样式 -->
<link rel="stylesheet" href="../../layui/css/layui.css">
<!-- 主题(主要颜色设置) -->
<link rel="stylesheet" href="../../css/theme.css">
<!-- 通用的css -->
<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">
<img :src="item.img" />
</div>
</div>
</div>
<div id="breadcrumb">
<span class="en">DATA SHOW</span>
<span class="cn">轮播图管理展示</span>
</div>
<!-- 图文列表 -->
<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-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 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 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":"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.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>
<div class="pager" id="pager"></div>
</div>
<!-- layui -->
<!-- vue -->
<!-- 组件配置信息 -->
<!-- 扩展插件配置信息 -->
<!-- 工具方法 -->
<script>
var vue = new Vue({
el: '#app',
data: {
// 轮播图
swiperList: [{
img: '../../img/banner.jpg'
}],
baseurl: '',
dataList: []
},
methods: {
isAuth(tablename, button) {
return isFrontAuth(tablename, button)
},
jump(url) {
jump(url)
}
}
})
</script>
</body>
</html>
<!-- 轮播图管理 -->
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html>
<head> <head>
<meta charset="UTF-8"> <meta charset="utf-8">
<title>Layui Example</title> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<!-- 引入layui的CSS文件 --> <title>轮播图管理</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/layui@2.7.6/dist/css/layui.css"> <link rel="stylesheet" href="../../layui/css/layui.css">
</head> <!-- 样式 -->
<body> <link rel="stylesheet" href="../../css/style.css" />
<div id="app"> <!-- 主题(主要颜色设置) -->
<!-- 轮播图容器 --> <link rel="stylesheet" href="../../css/theme.css" />
<div id="layui-carousel" class="layui-carousel" lay-filter="carousel"></div> <!-- 通用的css -->
<link rel="stylesheet" href="../../css/common.css" />
<!-- 搜索框和按钮 --> </head>
<div style="margin: 15px;"> <style>
<input type="text" id="name" placeholder="请输入名称" class="layui-input"> .layui-form .layui-form-item .layui-form-select .layui-input {
<button id="btn-search" class="layui-btn">搜索</button> border: 1px solid #eee;
</div> border-radius: 30px;
padding: 0 30px 0 10px;
<!-- 列表容器 --> box-shadow: 0px 0px 0px #ccc;
<div id="list-container"></div> margin: 0;
outline: none;
<!-- 分页容器 --> color: #666;
<div id="pager"></div> width: 120px;
</div> font-size: 14px;
line-height: 40px;
<!-- 引入layui的JS文件 --> height: 40px;
<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() { /* lists */
var form = layui.form; .lists .animation-box {
var layer = layui.layer; transform: rotate(0deg) scale(1) skew(0deg, 0deg) translate3d(0px, 0px, 0px);
var element = layui.element; }
var carousel = layui.carousel;
var laypage = layui.laypage; .lists .animation-box:hover {
var http = layui.http; transform: translate3d(0px, 0px, 0px);
var jquery = layui.jquery; -webkit-perspective: 1000px;
var laydate = layui.laydate; perspective: 1000px;
var slider = layui.slider; transition: 0.3s;
var limit = 12; }
vue.baseurl = http.baseurl;
// 获取轮播图数据 .lists img {
http.request('config/list', 'get', { transform: rotate(0deg) scale(1) skew(0deg, 0deg) translate3d(0px, 0px, 0px);
page: 1, }
limit: 3
}, function(res) { .lists img:hover {
if (res.data.list.length > 0) { -webkit-perspective: 1000px;
let swiperList = []; perspective: 1000px;
res.data.list.forEach(element => { transition: 0.3s;
if (element.value != null) { }
swiperList.push({ /* lists */
img: http.baseurl + element.value </style>
}); <body>
} <div id="app">
}); <!-- 轮播图 -->
vue.swiperList = swiperList; <div id="layui-carousel" class="layui-carousel">
<div carousel-item>
vue.$nextTick(() => { <div class="layui-carousel-item" v-for="(item,index) in swiperList" :key="index">
carousel.render({ <img :src="item.img" />
elem: '#layui-carousel', </div>
width: '100%', </div>
height: '680px', </div>
anim: 'default', <!-- 轮播图 -->
autoplay: 'true',
interval: '5000', <div id="breadcrumb">
arrow: 'none', <span class="en">DATA SHOW</span>
indicator: 'inside' <span class="cn">轮播图管理展示</span>
}); </div>
})
} <!-- 图文列表 -->
}); <div class="recommend" :style='{"padding":"0","margin":"0px auto","flexWrap":"wrap","background":"none","display":"flex","width":"100%","position":"relative"}'>
// 分页列表
pageList(); <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='{"alignItems":"center","margin":"0 4px 0 0","display":"flex"}' class="item-list">
jquery('#btn-search').click(function(e) { <div class="lable" :style='{"width":"auto","padding":"0 10px","lineHeight":"42px"}'>名称</div>
pageList(); <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>
function pageList() { <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">
var param = { <i :style='{"color":"#fff","margin":"0 10px 0 0","fontSize":"14px"}' class="layui-icon layui-icon-search"></i>搜索
page: 1, </button>
limit: limit <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>
if (jquery('#name').val()) { </form>
param['name'] = jquery('#name').val() ? '%' + jquery('#name').val() + '%' : '';
} <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":"0px","flexWrap":"wrap","background":"none","display":"flex","width":"100%","justifyContent":"space-between","height":"auto"}' class="list list-2">
http.request('config/list', 'get', param, function(res) { <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">
vue.dataList = res.data.list; <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 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>
laypage.render({ <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>
elem: 'pager', <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>
count: res.data.total, </div>
limit: limit, </div>
groups: 5, </div>
layout: ["count", "prev", "page", "next", "limit", "skip"], </div>
prev: '上一页',
next: '下一页',
jump: function(obj, first) { <div class="pager" id="pager"></div>
param.page = obj.curr;
// 首次不执行 </div>
if (!first) { </div>
http.request('config/list', 'get', param, function(res) {
vue.dataList = res.data.list;
}); <!-- layui -->
} <script src="../../layui/layui.js"></script>
} <!-- vue -->
}); <script src="../../js/vue.js"></script>
}); <!-- 组件配置信息 -->
} <script src="../../js/config.js"></script>
}); <!-- 扩展插件配置信息 -->
</script> <script src="../../modules/config.js"></script>
</body> <!-- 工具方法 -->
<script src="../../js/utils.js"></script>
<script type="text/javascript" src="../../js/jquery.js"></script>
<script>
var vue = new Vue({
el: '#app',
data: {
// 轮播图
swiperList: [{
img: '../../img/banner.jpg'
}],
baseurl: '',
dataList: []
},
methods: {
isAuth(tablename, button) {
return isFrontAuth(tablename, button)
},
jump(url) {
jump(url)
}
}
})
layui.use(['form', 'layer', 'element', 'carousel', 'laypage', 'http', 'jquery','laydate', 'slider'], function() {
var form = layui.form;
var layer = layui.layer;
var element = layui.element;
var carousel = layui.carousel;
var laypage = layui.laypage;
var http = layui.http;
var jquery = layui.jquery;
var laydate = layui.laydate;
var slider = layui.slider;
var limit = 12;
vue.baseurl = http.baseurl;
// 获取轮播图 数据
http.request('config/list', 'get', {
page: 1,
limit: 3
}, function(res) {
if (res.data.list.length > 0) {
let swiperList = [];
res.data.list.forEach(element => {
if (element.value != null) {
swiperList.push({
img: http.baseurl+element.value
});
}
});
vue.swiperList = swiperList;
vue.$nextTick(() => {
carousel.render({
elem: '#layui-carousel',
width: '100%',
height: '680px',
anim: 'default',
autoplay: 'true',
interval: '5000',
arrow: 'none',
indicator: 'inside'
});
})
}
});
// 分页列表
pageList();
// 搜索按钮
jquery('#btn-search').click(function(e) {
pageList();
});
function pageList() {
var param = {
page: 1,
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
// 分页
laypage.render({
elem: 'pager',
count: res.data.total,
limit: limit,
groups: 5,
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
})
}
}
});
})
}
});
</script>
</body>
</html> </html>

@ -1,4 +1,6 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="true" %> <%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page isELIgnored="true" %>
<!-- 论坛中心 --> <!-- 论坛中心 -->
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
@ -14,10 +16,18 @@
<!-- 通用的css --> <!-- 通用的css -->
<link rel="stylesheet" href="../../css/common.css" /> <link rel="stylesheet" href="../../css/common.css" />
</head> </head>
<style>
.layui-laypage .layui-laypage-count {
padding: 0 10px;
}
.layui-laypage .layui-laypage-skip {
padding-left: 10px;
}
</style>
<body> <body>
<div id="app"> <div id="app">
<!-- 轮播图 --> <!-- 轮播图 -->
<div id="layui-carousel" class="layui-carousel" lay-filter="carousel"> <div id="layui-carousel" class="layui-carousel">
<div carousel-item> <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" /> <img :src="item.img" />
@ -25,14 +35,17 @@
</div> </div>
</div> </div>
<!-- 轮播图 -->
<!-- 标题 --> <!-- 标题 -->
<div id="breadcrumb"> <div id="breadcrumb">
<span class="en">FORUM / INFORMATION</span> <span class="en">FORUM / INFORMATION</span>
<span class="cn">我的发布</span> <span class="cn">我的发布</span>
</div> </div>
<!-- 标题 -->
<div class="forum-container"> <div class="forum-container">
<table class="layui-table nob" lay-skin="line"> <table class="layui-table" lay-skin="nob">
<thead> <thead>
<tr> <tr>
<th>标题</th> <th>标题</th>
@ -41,84 +54,89 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr v-for="(item,index) in dataList" v-key="index"> <tr v-for="(item,index) in dataList" v-bind:key="index">
<td @click="jump('../forum/detail.jsp?id='+item.id);" style="text-align:left">{{item.title}}</td> <td @click="jump('../forum/detail.jsp?id='+item.id);" style="text-align:left">{{item.title}}</td>
<td style="text-align:left">{{item.addtime}}</td> <td style="text-align:left">{{item.addtime}}</td>
<td style="text-align:left"> <td style="text-align:left">
<button @click="jump('../forum/update.jsp?id='+item.id);" type="button" class="layui-btn layui-btn-radius btn-warm"> <button @click="jump('../forum/update.jsp?id='+item.id);" type="button" class="layui-btn layui-btn-radius btn-warm">
修改 修改
</button> </button>
<button @click="deleteClick(item.id)" type="button" class="layui-btn layui-btn-radius btn-theme"> <button @click="deleteClick(item.id)" type="button" class="layui-btn layui-btn-radius btn-theme">
删除 删除
</button> </button>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<div class="pager" id="pager"></div> <div class="pager" id="pager"></div>
</div> </div>
</div>
<!-- layui --> </div>
<script src="../../layui/layui.js"></script>
<!-- vue --> <!-- layui -->
<script src="../../js/vue.js"></script> <script src="../../layui/layui.js"></script>
<!-- 组件配置信息 --> <!-- vue -->
<script src="../../js/component.js"></script> <script src="../../js/vue.js"></script>
<!-- 扩展插件配置信息 --> <!-- 组件配置信息 -->
<script src="../../js/extend.js"></script> <script src="../../js/config.js"></script>
<!-- 工具方法 --> <!-- 扩展插件配置信息 -->
<script src="../../js/tool.js"></script> <script src="../../modules/config.js"></script>
<script> <!-- 工具方法 -->
var vue = new Vue({ <script src="../../js/utils.js"></script>
el: '#app',
// 轮播图 <script>
data: { var vue = new Vue({
// 轮播图 el: '#app',
swiperList: [], data: {
// 列表数据 // 轮播图
dataList: [] swiperList: [{
}, img: '../../img/banner.jpg'
filters: { }],
newsDesc: function(val) { dataList: []
if (val) { },
if (val.length > 200) { filters: {
return val.substring(0, 200) + '...'; newsDesc: function(val) {
} else { if (val) {
return val.replace(/<\/?[^>]+>/g, '').replace(/undefined/g, ''); if (val.length > 200) {
} return val.substring(0, 200).replace(/<[^>]*>/g).replace(/undefined/g, '');
} } else {
return ''; return val.replace(/<[^>]*>/g).replace(/undefined/g, '');
} }
}, }
methods: { return '';
jump(url) { }
jump(url) },
}, methods: {
deleteClick(id) { jump(url) {
layui.layer.confirm('是否确认删除?', { jump(url)
btn: ['删除', '取消'] //按钮 },
}, function() { deleteClick(id) {
layui.http.requestJson(`forum/delete`, 'post', [id], function() { layui.layer.confirm('是否确认删除?', {
layer.msg('删除成功', { btn: ['删除', '取消'] //按钮
time: 2000, }, function() {
icon: 6, layui.http.requestJson(`forum/delete`, 'post', [id], function(res) {
}, function() { layer.msg('删除成功', {
window.location.reload(); time: 2000,
}); icon: 6
}) }, function(res) {
}); window.location.reload();
} });
} })
}); });
layui.use(['layer', 'element', 'carousel', 'laypage', 'http', 'jquery'], function() { }
var layer = layui.layer; }
var element = layui.element; })
var carousel = layui.carousel;
var laypage = layui.laypage; layui.use(['layer', 'element', 'carousel', 'laypage', 'http', 'jquery'], function() {
var http = layui.http; var layer = layui.layer;
var jquery = layui.jquery; var element = layui.element;
var carousel = layui.carousel;
var laypage = layui.laypage;
var http = layui.http;
var jquery = layui.jquery;
var limit = 10;
var limit = 10;
// 获取轮播图 数据 // 获取轮播图 数据
http.request('config/list', 'get', { http.request('config/list', 'get', {
page: 1, page: 1,
@ -127,11 +145,11 @@
if (res.data.list.length > 0) { if (res.data.list.length > 0) {
let swiperList = []; let swiperList = [];
res.data.list.forEach(element => { res.data.list.forEach(element => {
if (element.value != null) { if (element.value != null) {
swiperList.push({ swiperList.push({
img: httpbaseurl+element.value img: http.baseurl+element.value
}); });
} }
}); });
vue.swiperList = swiperList; vue.swiperList = swiperList;
@ -149,35 +167,37 @@
}) })
} }
}); });
// 获取列表数据
http.request('forum/page?parentid=0&sort=addtime&order=desc', 'get', { // 获取列表数据
page: 1, http.request('forum/page?parentid=0&sort=addtime&order=desc', 'get', {
page: 1,
limit: limit limit: limit
}, function(res) { }, function(res) {
vue.dataList = res.data.list; vue.dataList = res.data.list
// 分页 // 分页
laypage.render({ laypage.render({
elem: 'pager', elem: 'pager',
count: res.data.total, count: res.data.total,
limit: limit, limit: limit,
groups: 5, groups: 5,
layout: ["count","prev","page","next","limit","skip"], layout: ["count","prev","page","next","limit","skip"],
prev: '上一页', prev: '上一页',
next: '下一页', next: '下一页',
jump: function(obj, first) { jump: function(obj, first) {
//首次不执行 //首次不执行
if (!first) { if (!first) {
http.request('forum/page?parentid=0&sort=addtime&order=desc', 'get', { http.request('forum/page?parentid=0&sort=addtime&order=desc', 'get', {
page: obj.curr, page: obj.curr,
limit: obj.limit limit: obj.limit
}, function(res) { }, function(res) {
vue.dataList = res.data.list; vue.dataList = res.data.list
}); })
} }
} }
}); });
}); })
});
</script> });
</body> </script>
</body>
</html> </html>

@ -1,191 +1,203 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="true" %> <%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page isELIgnored="true" %>
<!-- 论坛中心 --> <!-- 论坛中心 -->
<!DOCTYPE html> <!DOCTYPE html>
<meta charset="utf-8"> <html>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <head>
<title>论坛</title> <meta charset="utf-8">
<!-- 样式 --> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="../../layui/css/layui.css"> <title>论坛</title>
<!-- 主题颜色(主要颜色设置) --> <link rel="stylesheet" href="../../layui/css/layui.css">
<link rel="stylesheet" href="../../css/theme.css" /> <!-- 样式 -->
<!-- 通用的css --> <link rel="stylesheet" href="../../css/style.css" />
<link rel="stylesheet" href="../../css/common.css" /> <!-- 主题(主要颜色设置) -->
<style> <link rel="stylesheet" href="../../css/theme.css" />
.forum-container .btn-container { <!-- 通用的css -->
display: flex; <link rel="stylesheet" href="../../css/common.css" />
align-items: center; </head>
box-sizing: border-box; <style>
width: 100%; .forum-container .btn-container {
} display: flex;
align-items: center;
.forum-container .btn-container #title { box-sizing: border-box;
padding: 0 10px; width: 100%;
flex: 1; }
margin-right: 10px;
} .forum-container .btn-container #title {
padding: 0 10px;
.forum-container .btn-container button { flex: 1;
height: 38px; margin-right: 10px;
line-height: 38px; }
width: auto;
margin: 0 0 0 10px; .forum-container .btn-container button {
} height: 38px;
</style> line-height: 38px;
</head> width: auto;
<body> margin: 0 0 0 10px;
<div id="app"> }
<!-- 轮播图 --> </style>
<div id="layui-carousel" class="layui-carousel"> <body>
<div carousel-item> <div id="app">
<div class="layui-carousel-item" v-for="(item,index) in swiperList" key="index"> <!-- 轮播图 -->
<img :src="item.img" /> <div id="layui-carousel" class="layui-carousel">
<div carousel-item>
<div class="layui-carousel-item" v-for="(item,index) in swiperList" :key="index">
<img :src="item.img" />
</div>
</div>
</div> </div>
</div> <!-- 轮播图 -->
</div>
<!-- 轮播图 -->
<!-- 标题 --> <!-- 标题 -->
<div id="breadcrumb"> <div id="breadcrumb">
<span class="en">FORUM / INFORMATION</span> <span class="en">FORUM / INFORMATION</span>
<span class="cn">论坛</span> <span class="cn">论坛</span>
</div> </div>
<!-- 标题 --> <!-- 标题 -->
<div class="forum-container"> <div class="forum-container">
<div class="btn-container"> <div class="btn-container">
<input type="text" name="title" id="title" placeholder="请输入标题" autocomplete="off" class="layui-input"> <input type="text" name="title" id="title" placeholder="标题" autocomplete="off" class="layui-input">
<button id="btn-search" type="button" class="layui-btn layui-btn-normal"> <button id="btn-search" type="button" class="layui-btn layui-btn-normal">
<i class="layui-icon layui-icon-search"></i>搜索 <i class="layui-icon layui-icon-search"></i>搜索
</button> </button>
<button @click="jump('../forum/add.jsp')" type="button" class="layui-btn btn-theme"> <button @click="jump('../forum/add.jsp')" type="button" class="layui-btn btn-theme">
<i class="layui-icon">&#xe654;</i> 发布帖子 <i class="layui-icon">&#xe654;</i> 发布帖子
</button> </button>
</div>
<div class="forum-list">
<div v-for="(item,index) in dataList" v-bind:key="index" href="void(0);" @click="jump('../forum/detail.jsp?id='+item.id)" class="forum-item">
<h2 class="h2">{{item.title}}(发布人:{{item.username}}</h2>
<div class="create-time">
{{item.addtime}}
</div> </div>
<div class="forum-list">
<div v-for="(item,index) in dataList" v-bind:key="index" href="javascript:void(0);" @click="jump('../forum/detail.jsp?id='+item.id);" class="forum-item">
<h2 class="h2">{{item.title}}(发布人:{{item.username}}</h2>
<div class="create-time">
{{item.addtime}}
</div>
</div>
</div>
<div class="pager" id="pager"></div>
</div> </div>
</div> </div>
<div class="pager" id="pager"></div>
</div>
</div>
<!-- 轮播图 -->
<!-- 标题 -->
<!-- 组件配置信息 -->
<!-- 扩展插件配置信息 -->
<!-- 工具方法 -->
<script> <!-- layui -->
var vue = new Vue({ <script src="../../layui/layui.js"></script>
el: '#app', <!-- vue -->
data: { <script src="../../js/vue.js"></script>
// 轮播图 <!-- 组件配置信息 -->
swiperList: [{ <script src="../../js/config.js"></script>
img: '../../img/banner.jpg' <!-- 扩展插件配置信息 -->
}], <script src="../../modules/config.js"></script>
dataList: [] <!-- 工具方法 -->
}, <script src="../../js/utils.js"></script>
filters: {
newsDesc: function(val) {
if (val) {
if (val.length > 200) {
return val.substring(0, 200).replace(/<[^>]*>/g).replace(/undefined/g, '');
} else {
return val.replace(/<[^>]*>/g).replace(/undefined/g, '');
}
}
return '';
}
},
methods: {
jump(url) {
jump(url)
}
}
})
layui.use(['layer', 'element', 'carousel', 'laypage', 'http', 'jquery'], function() {
var layer = layui.layer;
var element = layui.element;
var carousel = layui.carousel;
var laypage = layui.laypage;
var http = layui.http;
var jquery = layui.jquery;
var limit = 10; <script>
var vue = new Vue({
el: '#app',
data: {
// 轮播图
swiperList: [{
img: '../../img/banner.jpg'
}],
dataList: []
},
filters: {
newsDesc: function(val) {
if (val) {
if (val.length > 200) {
return val.substring(0, 200).replace(/<[^>]*>/g).replace(/undefined/g, '');
} else {
return val.replace(/<[^>]*>/g).replace(/undefined/g, '');
}
}
return '';
}
},
methods: {
jump(url) {
jump(url)
}
}
})
// 获取轮播图 数据 layui.use(['layer', 'element', 'carousel', 'laypage', 'http', 'jquery'], function() {
http.request('config/list', 'get', { var layer = layui.layer;
page: 1, var element = layui.element;
limit: 3 var carousel = layui.carousel;
}, function(res) { var laypage = layui.laypage;
if (res.data.list.length > 0) { var http = layui.http;
let swiperList = []; var jquery = layui.jquery;
res.data.list.forEach(element => {
if (element.value != null) {
swiperList.push({
img: http.baseurl+element.value
});
}
});
vue.swiperList = swiperList;
vue.$nextTick(() => { var limit = 10;
carousel.render({
elem: '#layui-carousel',
width: '100%',
height: '680px',
anim: 'default',
autoplay: 'true',
interval: '5000',
arrow: 'none',
indicator: 'inside'
});
})
}
});
pageList(); // 获取轮播图 数据
http.request('config/list', 'get', {
page: 1,
limit: 3
}, function(res) {
if (res.data.list.length > 0) {
let swiperList = [];
res.data.list.forEach(element => {
if (element.value != null) {
swiperList.push({
img: http.baseurl+element.value
});
}
});
vue.swiperList = swiperList;
// 搜索按钮 vue.$nextTick(() => {
jquery('#btn-search').click(function(e) { carousel.render({
pageList(); elem: '#layui-carousel',
}); width: '100%',
function pageList() { height: '680px',
// 获取列表数据 anim: 'default',
http.request('forum/flist?isdone=开放&sort=addtime&order=desc', 'get', { autoplay: 'true',
page: 1, interval: '5000',
limit: limit, arrow: 'none',
title: '%' + jquery('#title').val() + '%', indicator: 'inside'
}, function(res) { });
vue.dataList = res.data.list })
// 分页
laypage.render({
elem: 'pager',
count: res.data.total,
limit: limit,
groups: 5,
layout: ["count","prev","page","next","limit","skip"],
prev: '上一页',
next: '下一页',
jump: function(obj, first) {
//首次不执行
if (!first) {
http.request('forum/flist?isdone=开放&sort=addtime&order=desc', 'get', {
page: obj.curr,
limit: obj.limit
}, function(res) {
vue.dataList = res.data.list
})
}
} }
}); });
})
} pageList();
});
</script> // 搜索按钮
</body> jquery('#btn-search').click(function(e) {
pageList();
});
function pageList() {
// 获取列表数据
http.request('forum/flist?isdone=开放&sort=addtime&order=desc', 'get', {
page: 1,
limit: limit,
title: '%' + jquery('#title').val() + '%',
}, function(res) {
vue.dataList = res.data.list
// 分页
laypage.render({
elem: 'pager',
count: res.data.total,
limit: limit,
groups: 5,
layout: ["count","prev","page","next","limit","skip"],
prev: '上一页',
next: '下一页',
jump: function(obj, first) {
//首次不执行
if (!first) {
http.request('forum/flist?isdone=开放&sort=addtime&order=desc', 'get', {
page: obj.curr,
limit: obj.limit
}, function(res) {
vue.dataList = res.data.list
})
}
}
});
})
}
});
</script>
</body>
</html> </html>

@ -9,7 +9,6 @@
//清空上次查选的痕迹 //清空上次查选的痕迹
editor.firstForSR = 0; editor.firstForSR = 0;
editor.currentRangeForSR = null; editor.currentRangeForSR = null;
//给tab注册切换事件 //给tab注册切换事件
/** /**
* tab点击处理事件 * tab点击处理事件
@ -17,53 +16,51 @@ editor.currentRangeForSR = null;
* @param tabBodys * @param tabBodys
* @param obj * @param obj
*/ */
function clickHandler(tabHeads, tabBodys, obj) { function clickHandler( tabHeads,tabBodys,obj ) {
//head样式更改 //head样式更改
for (var k = 0, len = tabHeads.length; k < len; k++) { for ( var k = 0, len = tabHeads.length; k < len; k++ ) {
tabHeads[k].className = ""; tabHeads[k].className = "";
} }
obj.className = "focus"; obj.className = "focus";
//body显隐 //body显隐
var tabSrc = obj.getAttribute("tabSrc"); var tabSrc = obj.getAttribute( "tabSrc" );
for (var j = 0, length = tabBodys.length; j < length; j++) { for ( var j = 0, length = tabBodys.length; j < length; j++ ) {
var body = tabBodys[j], var body = tabBodys[j],
id = body.getAttribute("id"); id = body.getAttribute( "id" );
if (id != tabSrc) { if ( id != tabSrc ) {
body.style.zIndex = 1; body.style.zIndex = 1;
} else { } else {
body.style.zIndex = 200; body.style.zIndex = 200;
} }
} }
} }
/** /**
* TAB切换 * TAB切换
* @param tabParentId tab的父节点ID或者对象本身 * @param tabParentId tab的父节点ID或者对象本身
*/ */
function switchTab(tabParentId) { function switchTab( tabParentId ) {
var tabElements = $G(tabParentId).children, var tabElements = $G( tabParentId ).children,
tabHeads = tabElements[0].children, tabHeads = tabElements[0].children,
tabBodys = tabElements[1].children; tabBodys = tabElements[1].children;
for (var i = 0, length = tabHeads.length; i < length; i++) { for ( var i = 0, length = tabHeads.length; i < length; i++ ) {
var head = tabHeads[i]; var head = tabHeads[i];
if (head.className === "focus") clickHandler(tabHeads, tabBodys, head); if ( head.className === "focus" )clickHandler(tabHeads,tabBodys, head );
head.onclick = function () { head.onclick = function () {
clickHandler(tabHeads, tabBodys, this); clickHandler(tabHeads,tabBodys,this);
}; }
} }
} }
$G('searchtab').onmousedown = function(){
$G('searchtab').onclick = function () {
$G('search-msg').innerHTML = ''; $G('search-msg').innerHTML = '';
$G('replace-msg').innerHTML = ''; $G('replace-msg').innerHTML = ''
}; }
//是否区分大小写 //是否区分大小写
function getMatchCase(id) { function getMatchCase(id) {
return $G(id).checked ? true : false; return $G(id).checked ? true : false;
} }
//查找 //查找
$G("nextFindBtn").onclick = function (txt, dir, mcase) { $G("nextFindBtn").onclick = function (txt, dir, mcase) {
var findtxt = $G("findtxt").value, obj; var findtxt = $G("findtxt").value, obj;
@ -71,58 +68,56 @@ $G("nextFindBtn").onclick = function (txt, dir, mcase) {
return false; return false;
} }
obj = { obj = {
searchStr: findtxt, searchStr:findtxt,
dir: 1, dir:1,
casesensitive: getMatchCase("matchCase") casesensitive:getMatchCase("matchCase")
}; };
if (!frCommond(obj)) { if (!frCommond(obj)) {
var bk = editor.selection.getRange().createBookmark(); var bk = editor.selection.getRange().createBookmark();
$G('search-msg').innerHTML = lang.getEnd; $G('search-msg').innerHTML = lang.getEnd;
editor.selection.getRange().moveToBookmark(bk).select(); editor.selection.getRange().moveToBookmark(bk).select();
} }
}; };
$G("nextReplaceBtn").onclick = function (txt, dir, mcase) { $G("nextReplaceBtn").onclick = function (txt, dir, mcase) {
var findtxt = $G("findtxt1").value, obj; var findtxt = $G("findtxt1").value, obj;
if (!findtxt) { if (!findtxt) {
return false; return false;
} }
obj = { obj = {
searchStr: findtxt, searchStr:findtxt,
dir: 1, dir:1,
casesensitive: getMatchCase("matchCase1") casesensitive:getMatchCase("matchCase1")
}; };
frCommond(obj); frCommond(obj);
}; };
$G("preFindBtn").onclick = function (txt, dir, mcase) { $G("preFindBtn").onclick = function (txt, dir, mcase) {
var findtxt = $G("findtxt").value, obj; var findtxt = $G("findtxt").value, obj;
if (!findtxt) { if (!findtxt) {
return false; return false;
} }
obj = { obj = {
searchStr: findtxt, searchStr:findtxt,
dir: -1, dir:-1,
casesensitive: getMatchCase("matchCase") casesensitive:getMatchCase("matchCase")
}; };
if (!frCommond(obj)) { if (!frCommond(obj)) {
$G('search-msg').innerHTML = lang.getStart; $G('search-msg').innerHTML = lang.getStart;
} }
}; };
$G("preReplaceBtn").onclick = function (txt, dir, mcase) { $G("preReplaceBtn").onclick = function (txt, dir, mcase) {
var findtxt = $G("findtxt1").value, obj; var findtxt = $G("findtxt1").value, obj;
if (!findtxt) { if (!findtxt) {
return false; return false;
} }
obj = { obj = {
searchStr: findtxt, searchStr:findtxt,
dir: -1, dir:-1,
casesensitive: getMatchCase("matchCase1") casesensitive:getMatchCase("matchCase1")
}; };
frCommond(obj); frCommond(obj);
}; };
//替换 //替换
$G("repalceBtn").onclick = function () { $G("repalceBtn").onclick = function () {
var findtxt = $G("findtxt1").value.replace(/^\s|\s$/g, ""), obj, var findtxt = $G("findtxt1").value.replace(/^\s|\s$/g, ""), obj,
@ -134,14 +129,13 @@ $G("repalceBtn").onclick = function () {
return false; return false;
} }
obj = { obj = {
searchStr: findtxt, searchStr:findtxt,
dir: 1, dir:1,
casesensitive: getMatchCase("matchCase1"), casesensitive:getMatchCase("matchCase1"),
replaceStr: replacetxt replaceStr:replacetxt
}; };
frCommond(obj); frCommond(obj);
}; };
//全部替换 //全部替换
$G("repalceAllBtn").onclick = function () { $G("repalceAllBtn").onclick = function () {
var findtxt = $G("findtxt1").value.replace(/^\s|\s$/g, ""), obj, var findtxt = $G("findtxt1").value.replace(/^\s|\s$/g, ""), obj,
@ -153,20 +147,18 @@ $G("repalceAllBtn").onclick = function () {
return false; return false;
} }
obj = { obj = {
searchStr: findtxt, searchStr:findtxt,
casesensitive: getMatchCase("matchCase1"), casesensitive:getMatchCase("matchCase1"),
replaceStr: replacetxt, replaceStr:replacetxt,
all: true all:true
}; };
var num = frCommond(obj); var num = frCommond(obj);
if (num) { if (num) {
$G('replace-msg').innerHTML = lang.countMsg.replace("{#count}", num); $G('replace-msg').innerHTML = lang.countMsg.replace("{#count}", num);
} }
}; };
//执行 //执行
var frCommond = function (obj) { var frCommond = function (obj) {
return editor.execCommand("searchreplace", obj); return editor.execCommand("searchreplace", obj);
}; };
switchTab("searchtab");
switchTab("searchtab"); //注释代码
Loading…
Cancel
Save