Compare commits

..

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

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

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

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

@ -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);
} }

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

@ -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);
} }

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

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

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

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

@ -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);
} }

@ -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);
} }

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

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

@ -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

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

@ -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

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

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

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

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

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

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

@ -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);
} }

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

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

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

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

@ -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);
} }
} }

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

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

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

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

@ -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,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;
} }
} }

@ -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());
} }
} }
} }

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

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

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

@ -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>

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

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

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

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

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

@ -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