diff --git a/z/src/main/java/com/controller/NewsController.java b/z/src/main/java/com/controller/NewsController.java new file mode 100644 index 0000000..285a7dd --- /dev/null +++ b/z/src/main/java/com/controller/NewsController.java @@ -0,0 +1,266 @@ +package com.controller; +// 定义控制器所在的包名 + +import java.math.BigDecimal; // 导入BigDecimal类,用于进行高精度的数学运算 +import java.text.SimpleDateFormat; // 导入SimpleDateFormat类,用于格式化和解析日期 +import java.text.ParseException; // 导入ParseException类,用于处理日期解析异常 +import java.util.ArrayList; // 导入ArrayList类,用于创建动态数组 +import java.util.Arrays; // 导入Arrays类,提供了对数组操作的工具方法 +import java.util.Calendar; // 导入Calendar类,用于日期时间的操作 +import java.util.Map; // 导入Map接口,用于键值对集合 +import java.util.HashMap; // 导入HashMap类,基于哈希表的Map实现 +import java.util.Iterator; // 导入Iterator接口,用于遍历集合 +import java.util.Date; // 导入Date类,用于日期时间的表示 +import java.util.List; // 导入List接口,用于列表集合 + +import javax.servlet.http.HttpServletRequest; // 导入HttpServletRequest接口,用于访问HTTP请求信息 +import java.io.IOException; // 导入IOException类,用于处理IO异常 + +import com.utils.ValidatorUtils; // 导入自定义的ValidatorUtils工具类,用于数据验证 +import org.apache.commons.lang3.StringUtils; // 导入Apache Commons Lang库的StringUtils类,用于字符串操作 +import org.springframework.beans.factory.annotation.Autowired; // 导入Spring的Autowired注解,用于自动注入依赖 +import org.springframework.transaction.annotation.Transactional; // 导入Spring的Transactional注解,用于声明事务 +import org.springframework.format.annotation.DateTimeFormat; // 导入Spring的DateTimeFormat注解,用于日期格式注解 +import org.springframework.web.bind.annotation.PathVariable; // 导入Spring的PathVariable注解,用于将URL中的参数绑定到控制器方法的参数上 +import org.springframework.web.bind.annotation.RequestBody; // 导入Spring的RequestBody注解,用于将HTTP请求的body部分绑定到控制器方法的参数上 +import org.springframework.web.bind.annotation.RequestMapping; // 导入Spring的RequestMapping注解,用于定义请求映射 +import org.springframework.web.bind.annotation.RequestParam; // 导入Spring的RequestParam注解,用于将请求参数绑定到控制器方法的参数上 +import org.springframework.web.bind.annotation.RestController; // 导入Spring的RestController注解,用于定义REST风格的控制器 + +import com.baomidou.mybatisplus.mapper.EntityWrapper; // 导入MyBatis Plus的EntityWrapper类,用于构建查询条件 +import com.baomidou.mybatisplus.mapper.Wrapper; // 导入MyBatis Plus的Wrapper接口,EntityWrapper实现该接口 +import com.annotation.IgnoreAuth; // 导入自定义的IgnoreAuth注解,用于忽略权限验证 + +import com.entity.NewsEntity; // 导入新闻实体类 +import com.entity.view.NewsView; // 导入新闻视图类 +import com.service.NewsService; // 导入新闻服务类 +import com.service.TokenService; // 导入Token服务类 +import com.utils.PageUtils; // 导入自定义的PageUtils工具类,用于分页处理 +import com.utils.R; // 导入自定义的R类,用于封装响应结果 +import com.utils.MD5Util; // 导入自定义的MD5Util工具类,用于MD5加密 +import com.utils.MPUtil; // 导入自定义的MPUtil工具类,提供MyBatis Plus工具方法 +import com.utils.CommonUtil; // 导入自定义的CommonUtil工具类,提供常用方法 + + +/** + * 公告信息 + * 后端接口 + * @author + * @email + * @date 2023-02-21 09:46:06 + */ +@RestController +@RequestMapping("/news") +public class NewsController { + @Autowired + private NewsService newsService;//注入新闻服务类 + + /** + * 后端列表 + */ + @RequestMapping("/page") + public R page(@RequestParam Map params, NewsEntity news, HttpServletRequest request) { + // 创建一个EntityWrapper对象,用于构建查询条件 + EntityWrapper ew = new EntityWrapper(); + + // 使用MPUtil工具类对查询条件进行排序和分页处理 + PageUtils page = newsService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, news), params), params)); + + // 将分页结果设置到request对象中 + request.setAttribute("data", page); + + // 返回成功响应,包含分页结果 + return R.ok().put("data", page); + } + + /** + * 前端列表 + */ + @IgnoreAuth + @RequestMapping("/list") + public R list(@RequestParam Map params, NewsEntity news, HttpServletRequest request) { + // 创建一个EntityWrapper对象,用于构建查询条件 + EntityWrapper ew = new EntityWrapper(); + + // 使用MPUtil工具类对查询条件进行排序和分页处理 + PageUtils page = newsService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, news), params), params)); + + // 将分页结果设置到request对象中 + request.setAttribute("data", page); + + // 返回成功响应,包含分页结果 + return R.ok().put("data", page); + } + + /** + * 列表 + */ + @RequestMapping("/lists") + //一个Spring MVC的注解,用于将HTTP请求映射到 list 方法。当客户端发送一个HTTP请求到 /lists 路径时,Spring MVC会调用 list 方法来处理这个请求 + public R list(NewsEntity news) //NewsEntity news 参数表示要查询的 NewsEntity 对象 + { + // 创建一个EntityWrapper对象,用于构建查询条件 + EntityWrapper ew = new EntityWrapper(); + + // 使用MPUtil工具类对查询条件进行排序和分页处理 + ew.allEq(MPUtil.allEQMapPre(news, "news")); + + // 返回成功响应,包含查询结果 + return R.ok().put("data", newsService.selectListView(ew)); + //这行代码返回一个表示请求成功的响应对象,并将 newsService.selectListView(ew) 的结果添加到响应对象中,键为 "data"。 + //newsService.selectListView(ew) 方法用于查询满足 ew 对象的查询条件的记录,并返回一个包含查询结果的列表。 + } + + /** + * 查询 + */ + @RequestMapping("/query") + public R query(NewsEntity news) { + // 创建一个EntityWrapper对象,用于构建查询条件 + EntityWrapper ew = new EntityWrapper(); + + // 使用MPUtil工具类对查询条件进行排序和分页处理 + 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}") + public R info(@PathVariable("id") Long id) { + // 根据ID查询并返回结果 + NewsEntity news = newsService.selectById(id); + //调用 newsService 对象的 selectById 方法,根据 id 参数的值查询数据库中的记录,并返回一个 NewsEntity 对象。 + return R.ok().put("data", news); //将 news 对象添加到响应对象中,键为 "data" + } + /** + * 前端详情 + */ + @IgnoreAuth + @RequestMapping("/detail/{id}") + public R detail(@PathVariable("id") Long id) { + // 根据ID查询并返回结果 + NewsEntity news = newsService.selectById(id); + return R.ok().put("data", news); + } + + /** + * 后端保存 + */ + @RequestMapping("/save") + public R save(@RequestBody NewsEntity news, HttpServletRequest request) { + // 设置ID为当前时间戳加上一个随机数 + news.setId(new Date().getTime() + new Double(Math.floor(Math.random() * 1000)).longValue()); + + // 验证实体对象,如果需要验证,可以取消注释 + // ValidatorUtils.validateEntity(news); + + // 插入数据,将 news 对象插入到数据库中 + newsService.insert(news); + //返回一个表示请求成功的响应对象 + return R.ok(); + } + + /** + * 前端保存 + */ + @RequestMapping("/add") + public R add(@RequestBody NewsEntity news, HttpServletRequest request) { + // 设置ID为当前时间戳加上一个随机数 + news.setId(new Date().getTime() + new Double(Math.floor(Math.random() * 1000)).longValue()); + + // 验证实体对象,如果需要验证,可以取消注释 + // ValidatorUtils.validateEntity(news); + + // 插入数据 + newsService.insert(news); + return R.ok(); + } + + /** + * 修改 + */ + @RequestMapping("/update") + @Transactional + public R update(@RequestBody NewsEntity news, HttpServletRequest request) { + // 验证实体对象,如果需要验证,可以取消注释 + // ValidatorUtils.validateEntity(news); + + // 更新数据 + newsService.updateById(news); + return R.ok(); + } + + /** + * 删除 + */ + @RequestMapping("/delete")//这是一个Spring MVC的注解,用于将HTTP请求映射到 delete方法上 + public R delete(@RequestBody Long[] ids) { + // 批量删除数据 + newsService.deleteBatchIds(Arrays.asList(ids)); + return R.ok();//R.ok() 方法通常表示请求成功,并返回一个默认的成功响应。 + } + + /** + * 提醒接口 + */ + @RequestMapping("/remind/{columnName}/{type}") + //这是一个Spring MVC的注解,用于将HTTP请求映射到 remindCount 方法。当客户端发送一个HTTP请求到 /remind/{columnName}/{type} 路径时,Spring MVC会调用 remindCount 方法来处理这个请求。 + public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, + @PathVariable("type") String type, @RequestParam Map map) { + // 将列名和类型添加到map中,@PathVariable 注解表示 columnName 和 type 参数的值将从URL路径中获取 + map.put("column", columnName);//将 columnName 参数的值添加到 map 中,键为 "column"。 + map.put("type", type); + + if (type.equals("2")) //如果 type 参数的值为 "2" + { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + //创建一个 SimpleDateFormat 对象sdf,用于将日期格式化为 "yyyy-MM-dd" 格式。 + Calendar c = Calendar.getInstance(); + //创建一个 Calendar 对象,用于处理日期和时间。Calendar.getInstance() 方法返回一个表示当前日期和时间的 Calendar 对象。 + Date remindStartDate = null;//声明一个变量 remindStartDate,初始化为 null,这个变量将用于存储提醒开始日期。 + Date remindEndDate = null; + + if (map.get("remindstart") != null)//如果 map 中存在键为 "remindstart" 的元素 + { + Integer remindStart = Integer.parseInt(map.get("remindstart").toString()); + //将 map 中键为 "remindstart" 的元素的值转换为 Integer 类型,并赋值给 remindStart + c.setTime(new Date());//setTime(new Date()) 方法将 Calendar 对象c的时间设置为当前时间。 + c.add(Calendar.DAY_OF_MONTH, remindStart);//将 Calendar 对象的时间增加 remindStart 天。 + remindStartDate = c.getTime();//返回一个表示 Calendar 对象当前时间的 Date 对象,并将其赋值给 remindStartDate。 + map.put("remindstart", sdf.format(remindStartDate));//将 remindStartDate 格式化为 "yyyy-MM-dd" 格式,并将其作为 map 中键为 "remindstart" 的元素的值。 + } + + if (map.get("remindend") != null) + { + Integer remindEnd = Integer.parseInt(map.get("remindend").toString()); + c.setTime(new Date());//c 的时间设置为当前时间 + c.add(Calendar.DAY_OF_MONTH, remindEnd);//c 的时间增加 remindStart 天 + remindEndDate = c.getTime(); + map.put("remindend", sdf.format(remindEndDate)); + } + } + + // 创建一个EntityWrapper对象,用于构建查询条件 + Wrapper wrapper = new EntityWrapper();//创建一个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 对象(请求成功的响应对象) + } +} \ No newline at end of file diff --git a/z/src/main/java/com/controller/StoreupController.java b/z/src/main/java/com/controller/StoreupController.java new file mode 100644 index 0000000..c2620db --- /dev/null +++ b/z/src/main/java/com/controller/StoreupController.java @@ -0,0 +1,222 @@ +package com.controller; +import java.math.BigDecimal; // 导入BigDecimal类,用于高精度的数学计算 +import java.text.SimpleDateFormat; // 导入SimpleDateFormat类,用于日期格式化 +import java.text.ParseException; // 导入ParseException类,用于处理日期解析异常 +import java.util.ArrayList; // 导入ArrayList类,用于创建动态数组 +import java.util.Arrays; // 导入Arrays类,提供对数组操作的工具方法 +import java.util.Calendar; // 导入Calendar类,用于日期时间操作 +import java.util.Map; // 导入Map接口,用于键值对集合 +import java.util.HashMap; // 导入HashMap类,基于哈希表的Map实现 +import java.util.Iterator; // 导入Iterator接口,用于遍历集合 +import java.util.Date; // 导入Date类,用于日期时间表示 +import java.util.List; // 导入List接口,用于列表集合 +import javax.servlet.http.HttpServletRequest; // 导入HttpServletRequest接口,用于访问HTTP请求信息 +import java.io.IOException; // 导入IOException类,用于处理输入输出异常 + +import com.utils.ValidatorUtils; // 导入ValidatorUtils工具类,用于实体验证 +import org.apache.commons.lang3.StringUtils; // 导入StringUtils类,提供字符串操作的工具方法 +import org.springframework.beans.factory.annotation.Autowired; // 导入Autowired注解,用于自动注入依赖 +import org.springframework.transaction.annotation.Transactional; // 导入Transactional注解,用于声明事务管理 +import org.springframework.format.annotation.DateTimeFormat; // 导入DateTimeFormat注解,用于日期时间格式化 +import org.springframework.web.bind.annotation.PathVariable; // 导入PathVariable注解,用于将URL中的参数绑定到控制器方法的参数上 +import org.springframework.web.bind.annotation.RequestBody; // 导入RequestBody注解,用于将HTTP请求体绑定到控制器方法的参数上 +import org.springframework.web.bind.annotation.RequestMapping; // 导入RequestMapping注解,用于映射HTTP请求到控制器方法 +import org.springframework.web.bind.annotation.RequestParam; // 导入RequestParam注解,用于将请求参数绑定到控制器方法的参数上 +import org.springframework.web.bind.annotation.RestController; // 导入RestController注解,用于声明一个REST风格的控制器 + +import com.baomidou.mybatisplus.mapper.EntityWrapper; // 导入EntityWrapper类,用于构建查询条件 +import com.baomidou.mybatisplus.mapper.Wrapper; // 导入Wrapper接口,用于封装查询条件 + +import com.annotation.IgnoreAuth; // 导入IgnoreAuth注解,用于标记不需要认证的接口 + +import com.entity.StoreupEntity; // 导入StoreupEntity实体类,代表存储数据 +import com.entity.view.StoreupView; // 导入StoreupView视图类,用于展示存储数据 + +import com.service.StoreupService; // 导入StoreupService接口,用于存储业务操作 +import com.service.TokenService; // 导入TokenService接口,用于令牌操作(未使用) +import com.utils.PageUtils; // 导入PageUtils工具类,用于分页处理 +import com.utils.R; // 导入R工具类,用于构建统一的响应格式 +import com.utils.MD5Util; // 导入MD5Util工具类,用于MD5加密(未使用) +import com.utils.MPUtil; // 导入MPUtil工具类,提供MyBatis Plus操作的工具方法 +import com.utils.CommonUtil; // 导入CommonUtil工具类,提供通用的工具方法 + +/** + * 收藏表 + * 后端接口 + * @author + * @email + * @date 2023-02-21 09:46:06 + */ +@RestController +@RequestMapping("/storeup") +public class StoreupController { + @Autowired + private StoreupService storeupService; + + /** + * 后端列表 + */ + @RequestMapping("/page")//定义了一个处理HTTP请求的映射,当请求路径为/page时,会调用这个方法 + public R page(@RequestParam Map params,StoreupEntity storeup,HttpServletRequest request) + {//定义了一个公共方法,接收请求参数、实体对象和HTTP请求对象 + if(!request.getSession().getAttribute("role").toString().equals("管理员")) + {//检查当前用户的角色是否为管理员,如果不是管理员,则设置用户ID + storeup.setUserid((Long)request.getSession().getAttribute("userId"));//设置用户ID + } + EntityWrapper ew = new EntityWrapper();//创建一个实体包装器对象,用于构建查询条件 + PageUtils page = storeupService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, storeup), params), params));//调用storeupService的queryPage方法,根据查询条件和分页参数进行分页查询,并返回分页结果 + request.setAttribute("data", page);//将分页结果设置到HTTP请求对象中 + return R.ok().put("data", page);//返回一个包含分页结果的响应对象 + } + /** + * 前端列表 + */ + @IgnoreAuth//定义了一个注解,用于标记不需要权限认证的接口 + @RequestMapping("/list")//定义了一个处理HTTP请求的映射,当请求路径为/list时,会调用这个方法 + public R list(@RequestParam Map params,StoreupEntity storeup,HttpServletRequest request) + { + EntityWrapper ew = new EntityWrapper();//创建一个实体包装器对象,用于构建查询条件 + PageUtils page = storeupService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, storeup), params), params));//调用storeupService的queryPage方法,根据查询条件和分页参数进行分页查询,并返回分页结果 + request.setAttribute("data", page);//将分页查询结果设置到HTTP请求对象中 + return R.ok().put("data", page);//返回一个包含分页查询结果的响应对象 + } + + /** + * 列表 + */ + @RequestMapping("/lists") + public R list( StoreupEntity storeup)//定义了一个公共方法,接收实体对象 + { + EntityWrapper ew = new EntityWrapper();//创建一个实体包装器对象,用于构建查询条件 + ew.allEq(MPUtil.allEQMapPre( storeup, "storeup")); //使用allEq方法设置查询条件,MPUtil.allEQMapPre方法将实体对象的属性转换为Map,并添加前缀"storeup",allEq方法将Map中的键值对作为查询条件,查询出符合条件的实体对象 + return R.ok().put("data", storeupService.selectListView(ew));//根据查询条件查询出符合条件的实体对象列表,并返回一个包含实体对象列表的响应对象 + } + + /** + * 查询 + */ + @RequestMapping("/query")//定义了一个处理HTTP请求的映射,当请求路径为/query时,会调用这个方法。 + public R query(StoreupEntity storeup) + { + EntityWrapper< StoreupEntity> ew = new EntityWrapper< StoreupEntity>(); + //创建一个实体包装器,用于构建查询条件 + ew.allEq(MPUtil.allEQMapPre( storeup, "storeup")); + //使用allEq方法设置查询条件,MPUtil.allEQMapPre方法将实体对象的属性转换为Map,并添加前缀"storeup",allEq方法将Map中的键值对作为查询条件,查询出符合条件的实体对象。 + StoreupView storeupView = storeupService.selectView(ew); + //调用服务层的方法查询单个数据,并返回视图对象 + return R.ok("查询收藏表成功").put("data", storeupView); + //返回一个包含查询结果的响应对象,并附带成功消息 + } + + /** + * 后端详情 + */ + @RequestMapping("/info/{id}")// 定义一个请求映射,当访问 /info/{id} 路径时,会调用这个方法 + public R info(@PathVariable("id") Long id)// 定义一个方法,接收一个路径变量 id,类型为 Long + { + StoreupEntity storeup = storeupService.selectById(id);//调用服务层的方法根据ID查询数据,并返回实体对象 + return R.ok().put("data", storeup);//返回一个包含查询结果的 R 对象,其中包含键 "data" 和对应的 storeup 实体对象 + } + /** + * 前端详情 + */ + @IgnoreAuth//定义了一个注解,用于标记不需要权限认证的接口 + @RequestMapping("/detail/{id}")//定义了一个处理HTTP请求的映射,当请求路径为/detail/{id}时,会调用这个方法 + public R detail(@PathVariable("id") Long id)//定义了一个方法,接收一个路径变量 id,类型为 Long + { + StoreupEntity storeup = storeupService.selectById(id);//调用服务层的方法根据ID查询数据,并返回实体对象 + return R.ok().put("data", storeup);//返回一个包含查询结果的响应对象,并附带成功消息 + } + /** + * 后端保存 + */ + @RequestMapping("/save")//定义了一个处理HTTP请求的映射,当请求路径为/save时,会调用这个方法 + public R save(@RequestBody StoreupEntity storeup, HttpServletRequest request)//定义了一个方法,接收一个JSON格式的请求体,类型为 StoreupEntity,并接收一个 HttpServletRequest 对象 + { + storeup.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); + //ValidatorUtils.validateEntity(storeup); + storeup.setUserid((Long)request.getSession().getAttribute("userId"));//从请求的 session 中获取用户ID,并设置到 storeup 实体对象中 + storeupService.insert(storeup);//调用服务层的方法将 storeup 实体对象插入数据库 + return R.ok();//返回一个包含成功信息的 R 对象 + } + + /** + * 前端保存 + */ + @RequestMapping("/add")//定义了一个处理HTTP请求的映射,当请求路径为/add时,会调用这个方法 + public R add(@RequestBody StoreupEntity storeup, HttpServletRequest request) //定义一个方法,接收一个请求体中的 StoreupEntity 对象和 HttpServletRequest 对象 + { + storeup.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());//生成一个新的唯一ID,由当前时间戳加上一个随机数 + //ValidatorUtils.validateEntity(storeup); + storeupService.insert(storeup);//调用服务层的方法将 storeup 实体对象插入数据库 + return R.ok(); + } + /** + * 修改 + */ + @RequestMapping("/update") + @Transactional//定义了一个事务注解,表示该方法中的数据库操作应该在一个事务中执行 + public R update(@RequestBody StoreupEntity storeup, HttpServletRequest request)//定义了一个方法,接收一个请求体中的 StoreupEntity 对象和 HttpServletRequest 对象 + { + //ValidatorUtils.validateEntity(storeup); + storeupService.updateById(storeup);//调用服务层的方法根据 ID 更新 storeup 实体对象的所有字段 + return R.ok();//返回一个包含成功信息的 R 对象 + } + + /** + * 删除 + */ + @RequestMapping("/delete") + public R delete(@RequestBody Long[] ids)// 定义一个方法,接收一个请求体中的 Long 数组,类型为 Long[] + { + storeupService.deleteBatchIds(Arrays.asList(ids));//调用服务层的方法,根据传入的 ID 数组批量删除数据 + return R.ok();//返回一个包含成功信息的 R 对象 R.ok()函数是R工具类中的一个静态方法,用于创建一个包含成功信息的响应对象 + } + + /** + * 提醒接口 + */ + @RequestMapping("/remind/{columnName}/{type}") // 定义一个请求映射,当访问 /remind/{columnName}/{type} 路径时,会调用这个方法 + public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, + @PathVariable("type") String type,@RequestParam Map map) { // 定义一个方法,接收一个路径变量 columnName 和 type,类型为 String,以及一个请求参数 map,类型为 Map + map.put("column", columnName); // 将 columnName 添加到 map 中,键为 "column" + map.put("type", type); // 将 type 添加到 map 中,键为 "type" + + if(type.equals("2")) { // 如果 type 等于 "2" + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); // 创建一个日期格式化对象,格式为 "yyyy-MM-dd" + Calendar c = Calendar.getInstance(); // 创建一个日历对象,获取当前时间 + Date remindStartDate = null; // 创建一个日期对象,用于存储提醒开始时间 + Date remindEndDate = null; // 创建一个日期对象,用于存储提醒结束时间 + if(map.get("remindstart")!=null) { // 如果 map 中存在 "remindstart" 键 + Integer remindStart = Integer.parseInt(map.get("remindstart").toString()); // 将 "remindstart" 键对应的值转换为整数 + c.setTime(new Date()); // 设置日历对象的时间为当前时间 + c.add(Calendar.DAY_OF_MONTH,remindStart); // 将日历对象的时间增加 remindStart 天 + remindStartDate = c.getTime(); // 获取增加后的时间,并赋值给 remindStartDate + map.put("remindstart", sdf.format(remindStartDate)); // 将 remindStartDate 格式化为 "yyyy-MM-dd" 格式,并添加到 map 中,键为 "remindstart" + } + if(map.get("remindend")!=null) { // 如果 map 中存在 "remindend" 键 + Integer remindEnd = Integer.parseInt(map.get("remindend").toString()); // 将 "remindend" 键对应的值转换为整数 + c.setTime(new Date()); // 设置日历对象的时间为当前时间 + c.add(Calendar.DAY_OF_MONTH,remindEnd); // 将日历对象的时间增加 remindEnd 天 + remindEndDate = c.getTime(); // 获取增加后的时间,并赋值给 remindEndDate + map.put("remindend", sdf.format(remindEndDate)); // 将 remindEndDate 格式化为 "yyyy-MM-dd" 格式,并添加到 map 中,键为 "remindend" + } + } + + Wrapper wrapper = new EntityWrapper(); // 创建一个实体包装器对象,用于构建查询条件 + if(map.get("remindstart")!=null) { // 如果 map 中存在 "remindstart" 键 + wrapper.ge(columnName, map.get("remindstart")); // 设置查询条件,查询 columnName 字段大于等于 "remindstart" 键对应的值 + } + if(map.get("remindend")!=null) { // 如果 map 中存在 "remindend" 键 + wrapper.le(columnName, map.get("remindend")); // 设置查询条件,查询 columnName 字段小于等于 "remindend" 键对应的值 + } + if(!request.getSession().getAttribute("role").toString().equals("管理员")) { // 如果当前用户的角色不是管理员 + wrapper.eq("userid", (Long)request.getSession().getAttribute("userId")); // 设置查询条件,查询 userid 字段等于当前用户的 ID + } + + int count = storeupService.selectCount(wrapper); // 调用服务层的方法,根据查询条件查询符合条件的记录数,并赋值给 count + return R.ok().put("count", count); // 返回一个包含查询结果的响应对象,其中包含键 "count" 和对应的 count 值 + } + + +} diff --git a/z/src/main/java/com/controller/SystemintroController.java b/z/src/main/java/com/controller/SystemintroController.java new file mode 100644 index 0000000..0b3a5b2 --- /dev/null +++ b/z/src/main/java/com/controller/SystemintroController.java @@ -0,0 +1,212 @@ +package com.controller; // 定义一个包,用于组织和管理类 + +import java.math.BigDecimal; // 导入BigDecimal类,用于高精度的数学计算 +import java.text.SimpleDateFormat; // 导入SimpleDateFormat类,用于日期格式化 +import java.text.ParseException; // 导入ParseException类,用于处理日期解析异常 +import java.util.ArrayList; // 导入ArrayList类,用于创建动态数组 +import java.util.Arrays; // 导入Arrays类,提供对数组操作的工具方法 +import java.util.Calendar; // 导入Calendar类,用于日期时间操作 +import java.util.Map; // 导入Map接口,用于键值对集合 +import java.util.HashMap; // 导入HashMap类,基于哈希表的Map实现 +import java.util.Iterator; // 导入Iterator接口,用于遍历集合 +import java.util.Date; // 导入Date类,用于日期时间表示 +import java.util.List; // 导入List接口,用于列表集合 +import javax.servlet.http.HttpServletRequest; // 导入HttpServletRequest接口,用于访问HTTP请求信息 +import java.io.IOException; // 导入IOException类,用于处理输入输出异常 + +import com.utils.ValidatorUtils; // 导入ValidatorUtils工具类,用于实体验证 +import org.apache.commons.lang3.StringUtils; // 导入StringUtils类,提供字符串操作的工具方法 +import org.springframework.beans.factory.annotation.Autowired; // 导入Autowired注解,用于自动注入依赖 +import org.springframework.transaction.annotation.Transactional; // 导入Transactional注解,用于声明事务管理 +import org.springframework.format.annotation.DateTimeFormat; // 导入DateTimeFormat注解,用于日期时间格式化 +import org.springframework.web.bind.annotation.PathVariable; // 导入PathVariable注解,用于将URL中的参数绑定到控制器方法的参数上 +import org.springframework.web.bind.annotation.RequestBody; // 导入RequestBody注解,用于将HTTP请求体绑定到控制器方法的参数上 +import org.springframework.web.bind.annotation.RequestMapping; // 导入RequestMapping注解,用于映射HTTP请求到控制器方法 +import org.springframework.web.bind.annotation.RequestParam; // 导入RequestParam注解,用于将请求参数绑定到控制器方法的参数上 +import org.springframework.web.bind.annotation.RestController; // 导入RestController注解,用于声明一个REST风格的控制器 + +import com.baomidou.mybatisplus.mapper.EntityWrapper; // 导入EntityWrapper类,用于构建查询条件 +import com.baomidou.mybatisplus.mapper.Wrapper; // 导入Wrapper接口,用于封装查询条件 + +import com.annotation.IgnoreAuth; // 导入IgnoreAuth注解,用于标记不需要认证的接口 + +import com.entity.SystemintroEntity; // 导入SystemintroEntity实体类,代表存储数据 +import com.entity.view.SystemintroView; // 导入SystemintroView视图类,用于展示存储数据 + +import com.service.SystemintroService; // 导入SystemintroService接口,用于存储业务操作 +import com.service.TokenService; // 导入TokenService接口,用于令牌操作(未使用) +import com.utils.PageUtils; // 导入PageUtils工具类,用于分页处理 +import com.utils.R; // 导入R工具类,用于构建统一的响应格式 +import com.utils.MD5Util; // 导入MD5Util工具类,用于MD5加密(未使用) +import com.utils.MPUtil; // 导入MPUtil工具类,提供MyBatis Plus操作的工具方法 +import com.utils.CommonUtil; // 导入CommonUtil工具类,提供通用的工具方法 + +/** + * 关于我们 + * 后端接口 + * @author + * @email + * @date 2023-02-21 09:46:06 + */ +@RestController // 声明一个REST风格的控制器 +@RequestMapping("/systemintro") // 定义一个请求映射,当访问 /systemintro 路径时,会调用这个控制器 +public class SystemintroController { + @Autowired // 自动注入依赖 + private SystemintroService systemintroService; // 声明一个SystemintroService对象,用于存储业务操作 + + /** + * 后端列表 + */ + @RequestMapping("/page") // 定义一个请求映射,当访问 /page 路径时,会调用这个方法 + public R page(@RequestParam Map params,SystemintroEntity systemintro, + HttpServletRequest request){ // 定义一个方法,接收请求参数、实体对象和HTTP请求对象 + EntityWrapper ew = new EntityWrapper(); // 创建一个实体包装器对象,用于构建查询条件 + PageUtils page = systemintroService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, systemintro), params), params)); // 调用服务层的方法,根据查询条件和分页参数进行分页查询,并返回分页结果 + request.setAttribute("data", page); // 将分页结果设置到HTTP请求对象中 + return R.ok().put("data", page); // 返回一个包含分页结果的响应对象 + } + + /** + * 前端列表 + */ + @IgnoreAuth // 定义了一个注解,用于标记不需要权限认证的接口 + @RequestMapping("/list") // 定义一个请求映射,当访问 /list 路径时,会调用这个方法 + public R list(@RequestParam Map params,SystemintroEntity systemintro, + HttpServletRequest request){ // 定义一个方法,接收请求参数、实体对象和HTTP请求对象 + EntityWrapper ew = new EntityWrapper(); // 创建一个实体包装器对象,用于构建查询条件 + PageUtils page = systemintroService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, systemintro), params), params)); // 调用服务层的方法,根据查询条件和分页参数进行分页查询,并返回分页结果 + request.setAttribute("data", page); // 将分页结果设置到HTTP请求对象中 + return R.ok().put("data", page); // 返回一个包含分页结果的响应对象 + } + + /** + * 列表 + */ + @RequestMapping("/lists") // 定义一个请求映射,当访问 /lists 路径时,会调用这个方法 + public R list( SystemintroEntity systemintro){ // 定义一个方法,接收实体对象 + EntityWrapper ew = new EntityWrapper(); // 创建一个实体包装器对象,用于构建查询条件 + ew.allEq(MPUtil.allEQMapPre( systemintro, "systemintro")); // 使用allEq方法设置查询条件,MPUtil.allEQMapPre方法将实体对象的属性转换为Map,并添加前缀"systemintro",allEq方法将Map中的键值对作为查询条件,查询出符合条件的实体对象 + return R.ok().put("data", systemintroService.selectListView(ew)); // 根据查询条件查询出符合条件的实体对象列表,并返回一个包含实体对象列表的响应对象 + } + + /** + * 查询 + */ + @RequestMapping("/query") // 定义一个请求映射,当访问 /query 路径时,会调用这个方法 + public R query(SystemintroEntity systemintro){ // 定义一个方法,接收实体对象 + EntityWrapper< SystemintroEntity> ew = new EntityWrapper< SystemintroEntity>(); // 创建一个实体包装器对象,用于构建查询条件 + ew.allEq(MPUtil.allEQMapPre( systemintro, "systemintro")); // 使用allEq方法设置查询条件,MPUtil.allEQMapPre方法将实体对象的属性转换为Map,并添加前缀"systemintro",allEq方法将Map中的键值对作为查询条件,查询出符合条件的实体对象 + SystemintroView systemintroView = systemintroService.selectView(ew); // 调用服务层的方法查询单个数据,并返回视图对象 + return R.ok("查询关于我们成功").put("data", systemintroView); // 返回一个包含查询结果的响应对象,并附带成功消息 + } + + /** + * 后端详情 + */ + @RequestMapping("/info/{id}") // 定义一个请求映射,当访问 /info/{id} 路径时,会调用这个方法 + public R info(@PathVariable("id") Long id){ // 定义一个方法,接收一个路径变量 id,类型为 Long + SystemintroEntity systemintro = systemintroService.selectById(id); // 调用服务层的方法根据ID查询数据,并返回实体对象 + return R.ok().put("data", systemintro); // 返回一个包含查询结果的 R 对象,其中包含键 "data" 和对应的 systemintro 实体对象 + } + + /** + * 前端详情 + */ + @IgnoreAuth // 定义了一个注解,用于标记不需要权限认证的接口 + @RequestMapping("/detail/{id}") // 定义一个请求映射,当访问 /detail/{id} 路径时,会调用这个方法 + public R detail(@PathVariable("id") Long id){ // 定义一个方法,接收一个路径变量 id,类型为 Long + SystemintroEntity systemintro = systemintroService.selectById(id); // 调用服务层的方法根据ID查询数据,并返回实体对象 + return R.ok().put("data", systemintro); // 返回一个包含查询结果的响应对象,并附带成功消息 + } + + + + + /** + * 后端保存 + */ + @RequestMapping("/save") // 定义一个请求映射,当访问 /save 路径时,会调用这个方法 + public R save(@RequestBody SystemintroEntity systemintro, HttpServletRequest request){ // 定义一个方法,接收一个JSON格式的请求体,类型为 SystemintroEntity,并接收一个 HttpServletRequest 对象 + systemintro.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); // 生成一个新的唯一ID,由当前时间戳加上一个随机数 + //ValidatorUtils.validateEntity(systemintro); // 注释掉的代码,用于验证 systemintro 实体对象是否符合要求 + systemintroService.insert(systemintro); // 调用服务层的方法将 systemintro 实体对象插入数据库 + return R.ok(); // 返回一个包含成功信息的 R 对象 + } + + /** + * 前端保存 + */ + @RequestMapping("/add") // 定义一个请求映射,当访问 /add 路径时,会调用这个方法 + public R add(@RequestBody SystemintroEntity systemintro, HttpServletRequest request){ // 定义一个方法,接收一个请求体中的 SystemintroEntity 对象和 HttpServletRequest 对象 + systemintro.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); // 生成一个新的唯一ID,由当前时间戳加上一个随机数 + //ValidatorUtils.validateEntity(systemintro); // 注释掉的代码,用于验证 systemintro 实体对象是否符合要求 + systemintroService.insert(systemintro); // 调用服务层的方法将 systemintro 实体对象插入数据库 + return R.ok(); // 返回一个包含成功信息的 R 对象 + } + + + /** + * 修改 + */ + @RequestMapping("/update") // 定义一个请求映射,当访问 /update 路径时,会调用这个方法 + @Transactional // 定义了一个事务注解,表示该方法中的数据库操作应该在一个事务中执行 + public R update(@RequestBody SystemintroEntity systemintro, HttpServletRequest request){ // 定义一个方法,接收一个请求体中的 SystemintroEntity 对象和 HttpServletRequest 对象 + //ValidatorUtils.validateEntity(systemintro); // 注释掉的代码,用于验证 systemintro 实体对象是否符合要求 + systemintroService.updateById(systemintro); // 调用服务层的方法根据 ID 更新 systemintro 实体对象的所有字段 + return R.ok(); // 返回一个包含成功信息的 R 对象 + } + + + + /** + * 删除 + */ + @RequestMapping("/delete") // 定义一个请求映射,当访问 /delete 路径时,会调用这个方法 + public R delete(@RequestBody Long[] ids){ // 定义一个方法,接收一个请求体中的 Long 数组,类型为 Long[] + systemintroService.deleteBatchIds(Arrays.asList(ids)); // 调用服务层的方法,根据传入的 ID 数组批量删除数据 + return R.ok(); // 返回一个包含成功信息的 R 对象 + } + + /** + * 提醒接口 + */ + @RequestMapping("/remind/{columnName}/{type}") // 定义一个请求映射,当访问 /remind/{columnName}/{type} 路径时,会调用这个方法 + public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, + @PathVariable("type") String type,@RequestParam Map map) { // 定义一个方法,接收一个路径变量 columnName 和 type,类型为 String,以及一个请求参数 map,类型为 Map + map.put("column", columnName); // 将 columnName 添加到 map 中,键为 "column" + map.put("type", type); // 将 type 添加到 map 中,键为 "type" + + if(type.equals("2")) { // 如果 type 等于 "2" + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); // 创建一个日期格式化对象,格式为 "yyyy-MM-dd" + Calendar c = Calendar.getInstance(); // 创建一个日历对象,获取当前时间 + Date remindStartDate = null; // 创建一个日期对象,用于存储提醒开始时间 + Date remindEndDate = null; // 创建一个日期对象,用于存储提醒结束时间 + if(map.get("remindstart")!=null) { // 如果 map 中存在 "remindstart" 键 + Integer remindStart = Integer.parseInt(map.get("remindstart").toString()); // 将 "remindstart" 键对应的值转换为整数 + c.setTime(new Date()); // 设置日历对象的时间为当前时间 + c.add(Calendar.DAY_OF_MONTH,remindStart); // 将日历对象的时间增加 remindStart 天 + remindStartDate = c.getTime(); // 获取增加后的时间,并赋值给 remindStartDate + map.put("remindstart", sdf.format(remindStartDate)); // 将 remindStartDate 格式化为 "yyyy-MM-dd" 格式,并添加到 map 中,键为 "remindstart" + } + if(map.get("remindend")!=null) { // 如果 map 中存在 "remindend" 键 + Integer remindEnd = Integer.parseInt(map.get("remindend").toString()); // 将 "remindend" 键对应的值转换为整数 + c.setTime(new Date()); // 设置日历对象的时间为当前时间 + c.add(Calendar.DAY_OF_MONTH,remindEnd); // 将日历对象的时间增加 remindEnd 天 + remindEndDate = c.getTime(); // 获取增加后的时间,并赋值给 remindEndDate + map.put("remindend", sdf.format(remindEndDate)); // 将 remindEndDate 格式化为 "yyyy-MM-dd" 格式,并添加到 map 中,键为 "remindend" + } + } + + Wrapper wrapper = new EntityWrapper(); // 创建一个实体包装器对象,用于构建查询条件 + if(map.get("remindstart")!=null) { // 如果 map 中存在 "remindstart" 键 + wrapper.ge(columnName, map.get("remindstart")); // 设置查询条件,查询 columnName 字段大于等于 "remindstart" 键对应的值 + } + if(map.get("remindend")!=null) { // 如果 map 中存在 "remindend" 键 + wrapper.le(columnName, map.get("remindend")); // 设置查询条件,查询 columnName 字段小于等于 "remindend" 键对应的值 + } + + + int count = systemintroService.selectCount(wrapper); // 调用服务层的方法,根据查询条件查询符合条件的记录数,并赋值给 count + return R.ok().put("count", count); // 返回一个包含查询结果的响应对象,其中包含键 "count" 和对应的 count 值 + } +} diff --git a/z/src/main/java/com/controller/UsersController.java b/z/src/main/java/com/controller/UsersController.java new file mode 100644 index 0000000..6e9af25 --- /dev/null +++ b/z/src/main/java/com/controller/UsersController.java @@ -0,0 +1,179 @@ + +package com.controller; + + +import java.util.Arrays; +import java.util.Calendar; +import java.util.Date; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; + +import com.annotation.IgnoreAuth; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.entity.TokenEntity; +import com.entity.UsersEntity; +import com.service.TokenService; +import com.service.UsersService; +import com.utils.CommonUtil; +import com.utils.MPUtil; +import com.utils.PageUtils; +import com.utils.R; +import com.utils.ValidatorUtils; + +/** + * 登录相关 + */ +@RequestMapping("users") // 定义请求路径的基础 URL 为 "users" +@RestController // 标明该类是一个控制器,返回的对象直接作为 JSON 响应 +public class UsersController { + + @Autowired // 自动注入 UsersService 依赖 + private UsersService userService; + + @Autowired // 自动注入 TokenService 依赖 + private TokenService tokenService; + + /** + * 登录 + */ + @IgnoreAuth // 忽略认证,允许未登录用户访问 + @PostMapping(value = "/login") // 处理 POST 请求,路径为 "users/login" + public R login(String username, String password, String captcha, HttpServletRequest request) { + // 根据用户名查询用户 + UsersEntity user = userService.selectOne(new EntityWrapper().eq("username", username)); + // 检查用户是否存在且密码是否匹配 + if(user == null || !user.getPassword().equals(password)) { + return R.error("账号或密码不正确"); // 返回错误信息 + } + // 生成用户的 token + String token = tokenService.generateToken(user.getId(), username, "users", user.getRole()); + return R.ok().put("token", token); // 返回成功信息和 token + } + + /** + * 注册 + */ + @IgnoreAuth // 忽略认证,允许未登录用户访问 + @PostMapping(value = "/register") // 处理 POST 请求,路径为 "users/register" + public R register(@RequestBody UsersEntity user) { + // 校验用户是否已存在 + if(userService.selectOne(new EntityWrapper().eq("username", user.getUsername())) != null) { + 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("退出成功"); // 返回成功信息 + } + + /** + * 密码重置 + */ + @IgnoreAuth // 忽略认证,允许未登录用户访问 + @RequestMapping(value = "/resetPass") // 处理请求,路径为 "users/resetPass" + public R resetPass(String username, HttpServletRequest request){ + // 根据用户名查询用户 + UsersEntity user = userService.selectOne(new EntityWrapper().eq("username", username)); + if(user == null) { + return R.error("账号不存在"); // 返回账号不存在的错误信息 + } + user.setPassword("123456"); // 将用户密码重置为 "123456" + userService.update(user, null); // 更新用户信息 + return R.ok("密码已重置为:123456"); // 返回成功信息 + } + + /** + * 列表 + */ + @RequestMapping("/page") // 处理请求,路径为 "users/page" + public R page(@RequestParam Map params, UsersEntity user) { + EntityWrapper ew = new EntityWrapper(); // 创建查询条件 + // 调用服务层方法查询分页数据 + PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params)); + return R.ok().put("data", page); // 返回查询结果 + } + + /** + * 列表 + */ + @RequestMapping("/list") // 处理请求,路径为 "users/list" + public R list(UsersEntity user) { + EntityWrapper ew = new EntityWrapper(); // 创建查询条件 + ew.allEq(MPUtil.allEQMapPre(user, "user")); // 添加所有相等条件 + return R.ok().put("data", userService.selectListView(ew)); // 返回查询结果 + } + + /** + * 信息 + */ + @RequestMapping("/info/{id}") // 处理请求,路径为 "users/info/{id}" + public R info(@PathVariable("id") String id) { + UsersEntity user = userService.selectById(id); // 根据 ID 查找用户 + return R.ok().put("data", user); // 返回用户信息 + } + + /** + * 获取用户的 session 用户信息 + */ + @RequestMapping("/session") // 处理请求,路径为 "users/session" + public R getCurrUser(HttpServletRequest request) { + Long id = (Long) request.getSession().getAttribute("userId"); // 从 session 中获取用户 ID + UsersEntity user = userService.selectById(id); // 根据 ID 查找用户 + return R.ok().put("data", user); // 返回用户信息 + } + + /** + * 保存 + */ + @PostMapping("/save") // 处理 POST 请求,路径为 "users/save" + public R save(@RequestBody UsersEntity user) { + // 校验用户是否已存在 + if(userService.selectOne(new EntityWrapper().eq("username", user.getUsername())) != null) { + return R.error("用户已存在"); // 返回用户已存在的错误信息 + } + userService.insert(user); // 插入新用户 + return R.ok(); // 返回成功信息 + } + + /** + * 修改 + */ + @RequestMapping("/update") // 处理请求,路径为 "users/update" + public R update(@RequestBody UsersEntity user) { + // 校验用户是否已存在 + UsersEntity u = userService.selectOne(new EntityWrapper().eq("username", user.getUsername())); + if(u != null && u.getId() != user.getId() && u.getUsername().equals(user.getUsername())) { + return R.error("用户名已存在。"); // 返回用户名已存在的错误信息 + } + userService.updateById(user); // 更新用户信息 + return R.ok(); // 返回成功信息 + } + + /** + * 删除 + */ + @RequestMapping("/delete") // 处理请求,路径为 "users/delete" + public R delete(@RequestBody Long[] ids) { + userService.deleteBatchIds(Arrays.asList(ids)); // 批量删除用户 + return R.ok(); // 返回成功信息 + } +} \ No newline at end of file diff --git a/z/src/main/java/com/dao/NewsDao.java b/z/src/main/java/com/dao/NewsDao.java new file mode 100644 index 0000000..eb37ec0 --- /dev/null +++ b/z/src/main/java/com/dao/NewsDao.java @@ -0,0 +1,38 @@ +package com.dao; + +import com.entity.NewsEntity; +import com.baomidou.mybatisplus.mapper.BaseMapper; +import java.util.List; +import java.util.Map; +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.plugins.pagination.Pagination; + +import org.apache.ibatis.annotations.Param; +import com.entity.vo.NewsVO; +import com.entity.view.NewsView; + +/** + * 公告信息 + * 该接口用于定义与公告信息相关的数据访问操作 + * + * @author + * @email + * @date 2023-02-21 09:46:06 + */ +public interface NewsDao extends BaseMapper { + + // 根据查询条件(Wrapper)选择公告的信息列表,并返回一个 NewsVO 对象的列表 + List selectListVO(@Param("ew") Wrapper wrapper); + + // 根据查询条件(Wrapper)选择单个公告的信息,并返回一个 NewsVO 对象 + NewsVO selectVO(@Param("ew") Wrapper wrapper); + + // 根据查询条件(Wrapper)选择公告的信息视图列表,并返回一个 NewsView 对象的列表 + List selectListView(@Param("ew") Wrapper wrapper); + + // 根据查询条件(Wrapper)与分页信息选择公告的信息视图列表,并返回一个 NewsView 对象的列表 + List selectListView(Pagination page, @Param("ew") Wrapper wrapper); + + // 根据查询条件(Wrapper)选择单个公告的信息视图,并返回一个 NewsView 对象 + NewsView selectView(@Param("ew") Wrapper wrapper); +} diff --git a/z/src/main/java/com/dao/StoreupDao.java b/z/src/main/java/com/dao/StoreupDao.java new file mode 100644 index 0000000..3df9b75 --- /dev/null +++ b/z/src/main/java/com/dao/StoreupDao.java @@ -0,0 +1,35 @@ +package com.dao; + +import com.entity.StoreupEntity; +import com.baomidou.mybatisplus.mapper.BaseMapper; +import java.util.List; +import java.util.Map; +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.plugins.pagination.Pagination; + +import org.apache.ibatis.annotations.Param; +import com.entity.vo.StoreupVO; +import com.entity.view.StoreupView; + + +/** + * 收藏表 + * + * @author + * @email + * @date 2023-02-21 09:46:06 + */ +public interface StoreupDao extends BaseMapper { + + List selectListVO(@Param("ew") Wrapper wrapper); + + StoreupVO selectVO(@Param("ew") Wrapper wrapper); + + List selectListView(@Param("ew") Wrapper wrapper); + + List selectListView(Pagination page,@Param("ew") Wrapper wrapper); + + StoreupView selectView(@Param("ew") Wrapper wrapper); + + +} diff --git a/z/src/main/java/com/dao/SystemintroDao.java b/z/src/main/java/com/dao/SystemintroDao.java new file mode 100644 index 0000000..0df7fc7 --- /dev/null +++ b/z/src/main/java/com/dao/SystemintroDao.java @@ -0,0 +1,38 @@ +package com.dao; + +import com.entity.SystemintroEntity; +import com.baomidou.mybatisplus.mapper.BaseMapper; +import java.util.List; +import java.util.Map; +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.plugins.pagination.Pagination; + +import org.apache.ibatis.annotations.Param; +import com.entity.vo.SystemintroVO; +import com.entity.view.SystemintroView; + +/** + * 关于我们 + * 该接口用于定义与"关于我们"页面相关的数据访问操作 + * + * @author + * @email + * @date 2023-02-21 09:46:06 + */ +public interface SystemintroDao extends BaseMapper { + + // 根据查询条件(Wrapper)选择系统介绍的信息列表,并返回一个 SystemintroVO 对象的列表 + List selectListVO(@Param("ew") Wrapper wrapper); + + // 根据查询条件(Wrapper)选择单个系统介绍的信息,并返回一个 SystemintroVO 对象 + SystemintroVO selectVO(@Param("ew") Wrapper wrapper); + + // 根据查询条件(Wrapper)选择系统介绍信息视图的列表,并返回一个 SystemintroView 对象的列表 + List selectListView(@Param("ew") Wrapper wrapper); + + // 根据查询条件(Wrapper)和分页信息选择系统介绍信息视图的列表,并返回一个 SystemintroView 对象的列表 + List selectListView(Pagination page, @Param("ew") Wrapper wrapper); + + // 根据查询条件(Wrapper)选择单个平台介绍的信息视图,并返回一个 SystemintroView 对象 + SystemintroView selectView(@Param("ew") Wrapper wrapper); +} diff --git a/z/src/main/java/com/dao/TokenDao.java b/z/src/main/java/com/dao/TokenDao.java new file mode 100644 index 0000000..0634193 --- /dev/null +++ b/z/src/main/java/com/dao/TokenDao.java @@ -0,0 +1,22 @@ + +package com.dao; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.plugins.pagination.Pagination; +import com.entity.TokenEntity; + +/** + * token + */ +public interface TokenDao extends BaseMapper { + + List selectListView(@Param("ew") Wrapper wrapper); + + List selectListView(Pagination page,@Param("ew") Wrapper wrapper); + +} diff --git a/z/src/main/java/com/dao/UsersDao.java b/z/src/main/java/com/dao/UsersDao.java new file mode 100644 index 0000000..0fa884f --- /dev/null +++ b/z/src/main/java/com/dao/UsersDao.java @@ -0,0 +1,25 @@ + +package com.dao; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.plugins.pagination.Pagination; +import com.entity.UsersEntity; +/** + * 用户 + * 该接口用于定义与用户相关的数据访问操作 + */ +public interface UsersDao extends BaseMapper { + + // 根据查询条件(Wrapper)选择用户列表,并返回一个 UsersEntity 对象的列表 + List selectListView(@Param("ew") Wrapper wrapper); + + // 根据查询条件(Wrapper)和分页信息选择用户列表,并返回一个 UsersEntity 对象的列表 + List selectListView(Pagination page, @Param("ew") Wrapper wrapper); + +} + diff --git a/z/src/main/java/com/entity/NewsEntity.java b/z/src/main/java/com/entity/NewsEntity.java new file mode 100644 index 0000000..7dea2e6 --- /dev/null +++ b/z/src/main/java/com/entity/NewsEntity.java @@ -0,0 +1,146 @@ +package com.entity; + +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import java.lang.reflect.InvocationTargetException; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import org.springframework.format.annotation.DateTimeFormat; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.beanutils.BeanUtils; +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.enums.FieldFill; +import com.baomidou.mybatisplus.enums.IdType; + + +/** + * 公告信息 + * 数据库通用操作实体类(普通增删改查) + * @author + * @email + * @date 2023-02-21 09:46:06 + */ +@TableName("news") +public class NewsEntity implements Serializable { + private static final long serialVersionUID = 1L; + + + public NewsEntity() { + + } + + public NewsEntity(T t) { + try { + BeanUtils.copyProperties(this, t); + } catch (IllegalAccessException | InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * 主键id + */ + @TableId + private Long id; + /** + * 标题 + */ + + private String title; + + /** + * 简介 + */ + + private String introduction; + + /** + * 图片 + */ + + private String picture; + + /** + * 内容 + */ + + private String content; + + + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") + @DateTimeFormat + private Date addtime; + + public Date getAddtime() { + return addtime; + } + public void setAddtime(Date addtime) { + this.addtime = addtime; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + /** + * 设置:标题 + */ + public void setTitle(String title) { + this.title = title; + } + /** + * 获取:标题 + */ + public String getTitle() { + return title; + } + /** + * 设置:简介 + */ + 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; + } + +} diff --git a/z/src/main/java/com/entity/StoreupEntity.java b/z/src/main/java/com/entity/StoreupEntity.java new file mode 100644 index 0000000..5e2932f --- /dev/null +++ b/z/src/main/java/com/entity/StoreupEntity.java @@ -0,0 +1,218 @@ +package com.entity; + +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import java.lang.reflect.InvocationTargetException; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import org.springframework.format.annotation.DateTimeFormat; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.beanutils.BeanUtils; +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.enums.FieldFill; +import com.baomidou.mybatisplus.enums.IdType; + + +/** + * 收藏表 + * 数据库通用操作实体类(普通增删改查) + * @author + * @email + * @date 2023-02-21 09:46:06 + */ +@TableName("storeup") +public class StoreupEntity implements Serializable { + private static final long serialVersionUID = 1L; + + + public StoreupEntity() { + + } + + public StoreupEntity(T t) { + try { + BeanUtils.copyProperties(this, t); + } catch (IllegalAccessException | InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * 主键id + */ + @TableId + private Long id; + /** + * 用户id + */ + + private Long userid; + + /** + * 商品id + */ + + private Long refid; + + /** + * 表名 + */ + + private String tablename; + + /** + * 名称 + */ + + private String name; + + /** + * 图片 + */ + + private String picture; + + /** + * 类型(1:收藏,21:赞,22:踩,31:竞拍参与,41:关注) + */ + + private String type; + + /** + * 推荐类型 + */ + + private String inteltype; + + /** + * 备注 + */ + + private String remark; + + + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") + @DateTimeFormat + private Date addtime; + + public Date getAddtime() { + return addtime; + } + public void setAddtime(Date addtime) { + this.addtime = addtime; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + /** + * 设置:用户id + */ + public void setUserid(Long userid) { + this.userid = userid; + } + /** + * 获取:用户id + */ + public Long getUserid() { + return userid; + } + /** + * 设置:商品id + */ + public void setRefid(Long refid) { + this.refid = refid; + } + /** + * 获取:商品id + */ + public Long getRefid() { + return refid; + } + /** + * 设置:表名 + */ + public void setTablename(String tablename) { + this.tablename = tablename; + } + /** + * 获取:表名 + */ + public String getTablename() { + return tablename; + } + /** + * 设置:名称 + */ + public void setName(String name) { + this.name = name; + } + /** + * 获取:名称 + */ + public String getName() { + return name; + } + /** + * 设置:图片 + */ + public void setPicture(String picture) { + this.picture = picture; + } + /** + * 获取:图片 + */ + public String getPicture() { + return picture; + } + /** + * 设置:类型(1:收藏,21:赞,22:踩,31:竞拍参与,41:关注) + */ + public void setType(String type) { + this.type = type; + } + /** + * 获取:类型(1:收藏,21:赞,22:踩,31:竞拍参与,41:关注) + */ + public String getType() { + return type; + } + /** + * 设置:推荐类型 + */ + public void setInteltype(String inteltype) { + this.inteltype = inteltype; + } + /** + * 获取:推荐类型 + */ + public String getInteltype() { + return inteltype; + } + /** + * 设置:备注 + */ + public void setRemark(String remark) { + this.remark = remark; + } + /** + * 获取:备注 + */ + public String getRemark() { + return remark; + } + +} diff --git a/z/src/main/java/com/entity/SystemintroEntity.java b/z/src/main/java/com/entity/SystemintroEntity.java new file mode 100644 index 0000000..5ae769d --- /dev/null +++ b/z/src/main/java/com/entity/SystemintroEntity.java @@ -0,0 +1,182 @@ +package com.entity; + +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import java.lang.reflect.InvocationTargetException; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import org.springframework.format.annotation.DateTimeFormat; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.beanutils.BeanUtils; +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.enums.FieldFill; +import com.baomidou.mybatisplus.enums.IdType; + + +/** + * 关于我们 + * 数据库通用操作实体类(普通增删改查) + * @author + * @email + * @date 2023-02-21 09:46:06 + */ +@TableName("systemintro") +public class SystemintroEntity implements Serializable { + private static final long serialVersionUID = 1L; + + + public SystemintroEntity() { + + } + + public SystemintroEntity(T t) { + try { + BeanUtils.copyProperties(this, t); + } catch (IllegalAccessException | InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * 主键id + */ + @TableId + private Long id; + /** + * 标题 + */ + + private String title; + + /** + * 副标题 + */ + + private String subtitle; + + /** + * 内容 + */ + + private String content; + + /** + * 图片1 + */ + + private String picture1; + + /** + * 图片2 + */ + + private String picture2; + + /** + * 图片3 + */ + + private String picture3; + + + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") + @DateTimeFormat + private Date addtime; + + public Date getAddtime() { + return addtime; + } + public void setAddtime(Date addtime) { + this.addtime = addtime; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + /** + * 设置:标题 + */ + public void setTitle(String title) { + this.title = title; + } + /** + * 获取:标题 + */ + public String getTitle() { + return title; + } + /** + * 设置:副标题 + */ + public void setSubtitle(String subtitle) { + this.subtitle = subtitle; + } + /** + * 获取:副标题 + */ + public String getSubtitle() { + return subtitle; + } + /** + * 设置:内容 + */ + public void setContent(String content) { + this.content = content; + } + /** + * 获取:内容 + */ + public String getContent() { + return content; + } + /** + * 设置:图片1 + */ + public void setPicture1(String picture1) { + this.picture1 = picture1; + } + /** + * 获取:图片1 + */ + public String getPicture1() { + return picture1; + } + /** + * 设置:图片2 + */ + public void setPicture2(String picture2) { + this.picture2 = picture2; + } + /** + * 获取:图片2 + */ + public String getPicture2() { + return picture2; + } + /** + * 设置:图片3 + */ + public void setPicture3(String picture3) { + this.picture3 = picture3; + } + /** + * 获取:图片3 + */ + public String getPicture3() { + return picture3; + } + +} diff --git a/z/src/main/java/com/entity/TokenEntity.java b/z/src/main/java/com/entity/TokenEntity.java new file mode 100644 index 0000000..a0f6489 --- /dev/null +++ b/z/src/main/java/com/entity/TokenEntity.java @@ -0,0 +1,132 @@ +package com.entity; + +import java.io.Serializable; +import java.util.Date; + +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; + +/** + * token表 + */ +@TableName("token") +public class TokenEntity implements Serializable { + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + private Long id; + + /** + * 用户id + */ + private Long userid; + + /** + * 用户名 + */ + private String username; + + /** + * 表名 + */ + private String tablename; + + /** + * 角色 + */ + private String role; + + /** + * token + */ + private String token; + + /** + * 过期时间 + */ + private Date expiratedtime; + + /** + * 新增时间 + */ + private Date addtime; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getUserid() { + return userid; + } + + public void setUserid(Long userid) { + this.userid = userid; + } + + public String getRole() { + return role; + } + + public void setRole(String role) { + this.role = role; + } + + public String getToken() { + return token; + } + + public String getTablename() { + return tablename; + } + + public void setTablename(String tablename) { + this.tablename = tablename; + } + + public void setToken(String token) { + this.token = token; + } + + public Date getExpiratedtime() { + return expiratedtime; + } + + public void setExpiratedtime(Date expiratedtime) { + this.expiratedtime = expiratedtime; + } + + public Date getAddtime() { + return addtime; + } + + public void setAddtime(Date addtime) { + this.addtime = addtime; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public TokenEntity(Long userid, String username, String tablename,String role, String token, Date expiratedtime) { + super(); + this.userid = userid; + this.username = username; + this.tablename = tablename; + this.role = role; + this.token = token; + this.expiratedtime = expiratedtime; + } + + public TokenEntity() { + } + +} diff --git a/z/src/main/java/com/entity/UsersEntity.java b/z/src/main/java/com/entity/UsersEntity.java new file mode 100644 index 0000000..959ac00 --- /dev/null +++ b/z/src/main/java/com/entity/UsersEntity.java @@ -0,0 +1,77 @@ +package com.entity; + +import java.io.Serializable; +import java.util.Date; + +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; + +/** + * 用户 + */ +@TableName("users") +public class UsersEntity implements Serializable { + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + private Long id; + + /** + * 用户账号 + */ + private String username; + + /** + * 密码 + */ + private String password; + + /** + * 用户类型 + */ + private String role; + + private Date addtime; + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getRole() { + return role; + } + + public void setRole(String role) { + this.role = role; + } + + public Date getAddtime() { + return addtime; + } + + public void setAddtime(Date addtime) { + this.addtime = addtime; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + +} diff --git a/z/src/main/java/com/entity/model/NewsModel.java b/z/src/main/java/com/entity/model/NewsModel.java new file mode 100644 index 0000000..7bad100 --- /dev/null +++ b/z/src/main/java/com/entity/model/NewsModel.java @@ -0,0 +1,80 @@ +package com.entity.model; + +import com.entity.NewsEntity; + +import com.baomidou.mybatisplus.annotations.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.util.Date; +import org.springframework.format.annotation.DateTimeFormat; +import java.io.Serializable; + + +/** + * 公告信息 + * 接收传参的实体类 + * (实际开发中配合移动端接口开发手动去掉些没用的字段,后端一般用 entity 就够用了) + * 取自 ModelAndView 的 model 名称 + * @author + * @email + * @date 2023-02-21 09:46:06 + */ +public class NewsModel implements Serializable { + 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; // 返回内容字段的值 + } +} diff --git a/z/src/main/java/com/entity/model/StoreupModel.java b/z/src/main/java/com/entity/model/StoreupModel.java new file mode 100644 index 0000000..1597cf0 --- /dev/null +++ b/z/src/main/java/com/entity/model/StoreupModel.java @@ -0,0 +1,179 @@ +package com.entity.model; + +import com.entity.StoreupEntity; + +import com.baomidou.mybatisplus.annotations.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.util.Date; +import org.springframework.format.annotation.DateTimeFormat; +import java.io.Serializable; + + +/** + * 收藏表 + * 接收传参的实体类 + *(实际开发中配合移动端接口开发手动去掉些没用的字段, 后端一般用entity就够用了) + * 取自ModelAndView 的model名称 + * @author + * @email + * @date 2023-02-21 09:46:06 + */ +public class StoreupModel implements Serializable { + private static final long serialVersionUID = 1L; + + + /** + * 商品id + */ + + private Long refid; + + /** + * 表名 + */ + + private String tablename; + + /** + * 名称 + */ + + private String name; + + /** + * 图片 + */ + + private String picture; + + /** + * 类型(1:收藏,21:赞,22:踩,31:竞拍参与,41:关注) + */ + + private String type; + + /** + * 推荐类型 + */ + + private String inteltype; + + /** + * 备注 + */ + + private String remark; + + + /** + * 设置:商品id + */ + + public void setRefid(Long refid) { + this.refid = refid; + } + + /** + * 获取:商品id + */ + public Long getRefid() { + return refid; + } + + + /** + * 设置:表名 + */ + + public void setTablename(String tablename) { + this.tablename = tablename; + } + + /** + * 获取:表名 + */ + public String getTablename() { + return tablename; + } + + + /** + * 设置:名称 + */ + + public void setName(String name) { + this.name = name; + } + + /** + * 获取:名称 + */ + public String getName() { + return name; + } + + + /** + * 设置:图片 + */ + + public void setPicture(String picture) { + this.picture = picture; + } + + /** + * 获取:图片 + */ + public String getPicture() { + return picture; + } + + + /** + * 设置:类型(1:收藏,21:赞,22:踩,31:竞拍参与,41:关注) + */ + + public void setType(String type) { + this.type = type; + } + + /** + * 获取:类型(1:收藏,21:赞,22:踩,31:竞拍参与,41:关注) + */ + public String getType() { + return type; + } + + + /** + * 设置:推荐类型 + */ + + public void setInteltype(String inteltype) { + this.inteltype = inteltype; + } + + /** + * 获取:推荐类型 + */ + public String getInteltype() { + return inteltype; + } + + + /** + * 设置:备注 + */ + + public void setRemark(String remark) { + this.remark = remark; + } + + /** + * 获取:备注 + */ + public String getRemark() { + return remark; + } + +} diff --git a/z/src/main/java/com/entity/model/SystemintroModel.java b/z/src/main/java/com/entity/model/SystemintroModel.java new file mode 100644 index 0000000..c42b499 --- /dev/null +++ b/z/src/main/java/com/entity/model/SystemintroModel.java @@ -0,0 +1,135 @@ +package com.entity.model; + +import com.entity.SystemintroEntity; + +import com.baomidou.mybatisplus.annotations.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.util.Date; +import org.springframework.format.annotation.DateTimeFormat; +import java.io.Serializable; + + +/** + * 关于我们 + * 接收传参的实体类 + *(实际开发中配合移动端接口开发手动去掉些没用的字段, 后端一般用entity就够用了) + * 取自ModelAndView 的model名称 + * @author + * @email + * @date 2023-02-21 09:46:06 + */ +public class SystemintroModel implements Serializable { + private static final long serialVersionUID = 1L; + + + /** + * 副标题 + */ + + private String subtitle; + + /** + * 内容 + */ + + private String content; + + /** + * 图片1 + */ + + private String picture1; + + /** + * 图片2 + */ + + private String picture2; + + /** + * 图片3 + */ + + private String picture3; + + + /** + * 设置:副标题 + */ + + public void setSubtitle(String subtitle) { + this.subtitle = subtitle; + } + + /** + * 获取:副标题 + */ + public String getSubtitle() { + return subtitle; + } + + + /** + * 设置:内容 + */ + + public void setContent(String content) { + this.content = content; + } + + /** + * 获取:内容 + */ + public String getContent() { + return content; + } + + + /** + * 设置:图片1 + */ + + public void setPicture1(String picture1) { + this.picture1 = picture1; + } + + /** + * 获取:图片1 + */ + public String getPicture1() { + return picture1; + } + + + /** + * 设置:图片2 + */ + + public void setPicture2(String picture2) { + this.picture2 = picture2; + } + + /** + * 获取:图片2 + */ + public String getPicture2() { + return picture2; + } + + + /** + * 设置:图片3 + */ + + public void setPicture3(String picture3) { + this.picture3 = picture3; + } + + /** + * 获取:图片3 + */ + public String getPicture3() { + return picture3; + } + +} diff --git a/z/src/main/java/com/entity/view/NewsView.java b/z/src/main/java/com/entity/view/NewsView.java new file mode 100644 index 0000000..e4aa33e --- /dev/null +++ b/z/src/main/java/com/entity/view/NewsView.java @@ -0,0 +1,42 @@ +package com.entity.view; + +import com.entity.NewsEntity; + +import com.baomidou.mybatisplus.annotations.TableName; +import org.apache.commons.beanutils.BeanUtils; +import java.lang.reflect.InvocationTargetException; + +import java.io.Serializable; + + +/** + * 公告信息 + * 后端返回视图实体辅助类 + * (通常后端关联的表或者自定义的字段需要返回使用) +/** + * 公告信息 + * 后端返回视图实体辅助类 + * (通常后端关联的表或者自定义的字段需要返回使用) + * @author + * @email + * @date 2023-02-21 09:46:06 + */ +@TableName("news") // 指定该类对应的数据库表名为 "news" +public class NewsView extends NewsEntity implements Serializable { + private static final long serialVersionUID = 1L; // 序列化版本号 + + // 默认构造函数 + public NewsView() { + } + + // 构造函数,接受一个 NewsEntity 对象并复制其属性 + public NewsView(NewsEntity newsEntity) { + try { + BeanUtils.copyProperties(this, newsEntity); // 使用 BeanUtils 复制属性 + } catch (IllegalAccessException | InvocationTargetException e) { + // 捕获并处理属性复制过程中的异常 + e.printStackTrace(); // 打印异常堆栈跟踪 + } + } +} + diff --git a/z/src/main/java/com/entity/view/StoreupView.java b/z/src/main/java/com/entity/view/StoreupView.java new file mode 100644 index 0000000..a8d7150 --- /dev/null +++ b/z/src/main/java/com/entity/view/StoreupView.java @@ -0,0 +1,37 @@ +package com.entity.view; + +import com.entity.StoreupEntity; + +import com.baomidou.mybatisplus.annotations.TableName; +import org.apache.commons.beanutils.BeanUtils; +import java.lang.reflect.InvocationTargetException; + +import java.io.Serializable; + + +/** + * 收藏表 + * 后端返回视图实体辅助类 + * (通常后端关联的表或者自定义的字段需要返回使用) + * @author + * @email + * @date 2023-02-21 09:46:06 + */ +@TableName("storeup") // 指定该类对应的数据库表名为 "storeup" +public class StoreupView extends StoreupEntity implements Serializable { + private static final long serialVersionUID = 1L; // 序列化版本号 + + // 默认构造函数 + public StoreupView() { + } + + // 构造函数,接受一个 StoreupEntity 对象并复制其属性 + public StoreupView(StoreupEntity storeupEntity) { + try { + BeanUtils.copyProperties(this, storeupEntity); // 使用 BeanUtils 复制属性 + } catch (IllegalAccessException | InvocationTargetException e) { + // 捕获并处理属性复制过程中的异常 + e.printStackTrace(); // 打印异常堆栈跟踪 + } + } +} diff --git a/z/src/main/java/com/entity/view/SystemintroView.java b/z/src/main/java/com/entity/view/SystemintroView.java new file mode 100644 index 0000000..c9c5582 --- /dev/null +++ b/z/src/main/java/com/entity/view/SystemintroView.java @@ -0,0 +1,36 @@ +package com.entity.view; + +import com.entity.SystemintroEntity; + +import com.baomidou.mybatisplus.annotations.TableName; +import org.apache.commons.beanutils.BeanUtils; +import java.lang.reflect.InvocationTargetException; + +import java.io.Serializable; + + +/** + * 关于我们 + * 后端返回视图实体辅助类 + * (通常后端关联的表或者自定义的字段需要返回使用) + * @author + * @email + * @date 2023-02-21 09:46:06 + */ +@TableName("systemintro") +public class SystemintroView extends SystemintroEntity implements Serializable { + private static final long serialVersionUID = 1L; + + public SystemintroView(){ + } + + public SystemintroView(SystemintroEntity systemintroEntity){ + try { + BeanUtils.copyProperties(this, systemintroEntity); + } catch (IllegalAccessException | InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } +} diff --git a/z/src/main/java/com/entity/vo/NewsVO.java b/z/src/main/java/com/entity/vo/NewsVO.java new file mode 100644 index 0000000..7a0d951 --- /dev/null +++ b/z/src/main/java/com/entity/vo/NewsVO.java @@ -0,0 +1,91 @@ +package com.entity.vo; + +import com.entity.NewsEntity; + +import com.baomidou.mybatisplus.annotations.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.util.Date; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; + + +/** + * 公告信息 + * 手机端接口返回实体辅助类 + * (主要作用去除一些不必要的字段) + * @author + * @email + * @date 2023-02-21 09:46:06 + */ +public class NewsVO implements Serializable { + 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; + } + +} diff --git a/z/src/main/java/com/entity/vo/StoreupVO.java b/z/src/main/java/com/entity/vo/StoreupVO.java new file mode 100644 index 0000000..8d4e987 --- /dev/null +++ b/z/src/main/java/com/entity/vo/StoreupVO.java @@ -0,0 +1,179 @@ +package com.entity.vo; + +import com.entity.StoreupEntity; + +import com.baomidou.mybatisplus.annotations.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.util.Date; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; + + +/** + * 收藏表 + * 手机端接口返回实体辅助类 + * (主要作用去除一些不必要的字段) + * @author + * @email + * @date 2023-02-21 09:46:06 + */ +public class StoreupVO implements Serializable { + private static final long serialVersionUID = 1L; + + + /** + * 商品id + */ + + private Long refid; + + /** + * 表名 + */ + + private String tablename; + + /** + * 名称 + */ + + private String name; + + /** + * 图片 + */ + + private String picture; + + /** + * 类型(1:收藏,21:赞,22:踩,31:竞拍参与,41:关注) + */ + + private String type; + + /** + * 推荐类型 + */ + + private String inteltype; + + /** + * 备注 + */ + + private String remark; + + + /** + * 设置:商品id + */ + + public void setRefid(Long refid) { + this.refid = refid; + } + + /** + * 获取:商品id + */ + public Long getRefid() { + return refid; + } + + + /** + * 设置:表名 + */ + + public void setTablename(String tablename) { + this.tablename = tablename; + } + + /** + * 获取:表名 + */ + public String getTablename() { + return tablename; + } + + + /** + * 设置:名称 + */ + + public void setName(String name) { + this.name = name; + } + + /** + * 获取:名称 + */ + public String getName() { + return name; + } + + + /** + * 设置:图片 + */ + + public void setPicture(String picture) { + this.picture = picture; + } + + /** + * 获取:图片 + */ + public String getPicture() { + return picture; + } + + + /** + * 设置:类型(1:收藏,21:赞,22:踩,31:竞拍参与,41:关注) + */ + + public void setType(String type) { + this.type = type; + } + + /** + * 获取:类型(1:收藏,21:赞,22:踩,31:竞拍参与,41:关注) + */ + public String getType() { + return type; + } + + + /** + * 设置:推荐类型 + */ + + public void setInteltype(String inteltype) { + this.inteltype = inteltype; + } + + /** + * 获取:推荐类型 + */ + public String getInteltype() { + return inteltype; + } + + + /** + * 设置:备注 + */ + + public void setRemark(String remark) { + this.remark = remark; + } + + /** + * 获取:备注 + */ + public String getRemark() { + return remark; + } + +} diff --git a/z/src/main/java/com/entity/vo/SystemintroVO.java b/z/src/main/java/com/entity/vo/SystemintroVO.java new file mode 100644 index 0000000..7a331ae --- /dev/null +++ b/z/src/main/java/com/entity/vo/SystemintroVO.java @@ -0,0 +1,135 @@ +package com.entity.vo; + +import com.entity.SystemintroEntity; + +import com.baomidou.mybatisplus.annotations.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.util.Date; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; + + +/** + * 关于我们 + * 手机端接口返回实体辅助类 + * (主要作用去除一些不必要的字段) + * @author + * @email + * @date 2023-02-21 09:46:06 + */ +public class SystemintroVO implements Serializable { + private static final long serialVersionUID = 1L; + + + /** + * 副标题 + */ + + private String subtitle; + + /** + * 内容 + */ + + private String content; + + /** + * 图片1 + */ + + private String picture1; + + /** + * 图片2 + */ + + private String picture2; + + /** + * 图片3 + */ + + private String picture3; + + + /** + * 设置:副标题 + */ + + public void setSubtitle(String subtitle) { + this.subtitle = subtitle; + } + + /** + * 获取:副标题 + */ + public String getSubtitle() { + return subtitle; + } + + + /** + * 设置:内容 + */ + + public void setContent(String content) { + this.content = content; + } + + /** + * 获取:内容 + */ + public String getContent() { + return content; + } + + + /** + * 设置:图片1 + */ + + public void setPicture1(String picture1) { + this.picture1 = picture1; + } + + /** + * 获取:图片1 + */ + public String getPicture1() { + return picture1; + } + + + /** + * 设置:图片2 + */ + + public void setPicture2(String picture2) { + this.picture2 = picture2; + } + + /** + * 获取:图片2 + */ + public String getPicture2() { + return picture2; + } + + + /** + * 设置:图片3 + */ + + public void setPicture3(String picture3) { + this.picture3 = picture3; + } + + /** + * 获取:图片3 + */ + public String getPicture3() { + return picture3; + } + +} diff --git a/z/src/main/java/com/service/NewsService.java b/z/src/main/java/com/service/NewsService.java new file mode 100644 index 0000000..bf6f403 --- /dev/null +++ b/z/src/main/java/com/service/NewsService.java @@ -0,0 +1,37 @@ +package com.service; + +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.service.IService; +import com.utils.PageUtils; +import com.entity.NewsEntity; +import java.util.List; +import java.util.Map; +import com.entity.vo.NewsVO; +import org.apache.ibatis.annotations.Param; +import com.entity.view.NewsView; + + +/** + * 公告信息 + * + * @author // 作者信息 + * @email // 邮箱信息 + * @date 2023-02-21 09:46:06 // 创建日期 + */ +public interface NewsService extends IService { // 声明一个接口,扩展 IService 用于基本的 CRUD 操作 + + PageUtils queryPage(Map params); // 根据传入的参数进行分页查询,并返回分页结果 + + List selectListVO(Wrapper wrapper); // 根据条件包装器查询并返回 NewsVO 列表 + + NewsVO selectVO(@Param("ew") Wrapper wrapper); // 根据条件包装器查询并返回单个 NewsVO 对象 + + List selectListView(Wrapper wrapper); // 根据条件包装器查询并返回 NewsView 列表 + + NewsView selectView(@Param("ew") Wrapper wrapper); // 根据条件包装器查询并返回单个 NewsView 对象 + + PageUtils queryPage(Map params, Wrapper wrapper); // 根据参数和条件包装器进行分页查询,并返回分页结果 + +} + + diff --git a/z/src/main/java/com/service/StoreupService.java b/z/src/main/java/com/service/StoreupService.java new file mode 100644 index 0000000..c4e64fb --- /dev/null +++ b/z/src/main/java/com/service/StoreupService.java @@ -0,0 +1,36 @@ +package com.service; + +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.service.IService; +import com.utils.PageUtils; +import com.entity.StoreupEntity; +import java.util.List; +import java.util.Map; +import com.entity.vo.StoreupVO; +import org.apache.ibatis.annotations.Param; +import com.entity.view.StoreupView; + +/** + * 收藏表 + * + * @author // 作者信息 + * @email // 邮箱信息 + * @date 2023-02-21 09:46:06 // 创建日期 + */ +public interface StoreupService extends IService { // 声明一个接口,扩展 IService 用于基本的 CRUD 操作 + + PageUtils queryPage(Map params); // 根据传入的参数进行分页查询,并返回分页结果 + + List selectListVO(Wrapper wrapper); // 根据条件包装器查询并返回 StoreupVO 列表 + + StoreupVO selectVO(@Param("ew") Wrapper wrapper); // 根据条件包装器查询并返回单个 StoreupVO 对象 + + List selectListView(Wrapper wrapper); // 根据条件包装器查询并返回 StoreupView 列表 + + StoreupView selectView(@Param("ew") Wrapper wrapper); // 根据条件包装器查询并返回单个 StoreupView 对象 + + PageUtils queryPage(Map params, Wrapper wrapper); // 根据参数和条件包装器进行分页查询,并返回分页结果 + +} + + diff --git a/z/src/main/java/com/service/SystemintroService.java b/z/src/main/java/com/service/SystemintroService.java new file mode 100644 index 0000000..5cd122c --- /dev/null +++ b/z/src/main/java/com/service/SystemintroService.java @@ -0,0 +1,35 @@ +package com.service; + +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.service.IService; +import com.utils.PageUtils; +import com.entity.SystemintroEntity; +import java.util.List; +import java.util.Map; +import com.entity.vo.SystemintroVO; +import org.apache.ibatis.annotations.Param; +import com.entity.view.SystemintroView; +/** + * 关于我们 + * + * @author // 作者信息 + * @email // 邮箱信息 + * @date 2023-02-21 09:46:06 // 创建日期 + */ +public interface SystemintroService extends IService { // 声明一个接口,扩展 IService 用于基本的 CRUD 操作 + + PageUtils queryPage(Map params); // 根据传入的参数进行分页查询,并返回分页结果 + + List selectListVO(Wrapper wrapper); // 根据条件包装器查询并返回 SystemintroVO 列表 + + SystemintroVO selectVO(@Param("ew") Wrapper wrapper); // 根据条件包装器查询并返回单个 SystemintroVO 对象 + + List selectListView(Wrapper wrapper); // 根据条件包装器查询并返回 SystemintroView 列表 + + SystemintroView selectView(@Param("ew") Wrapper wrapper); // 根据条件包装器查询并返回单个 SystemintroView 对象 + + PageUtils queryPage(Map params, Wrapper wrapper); // 根据参数和条件包装器进行分页查询,并返回分页结果 + +} + + diff --git a/z/src/main/java/com/service/UsersService.java b/z/src/main/java/com/service/UsersService.java new file mode 100644 index 0000000..3a55a5c --- /dev/null +++ b/z/src/main/java/com/service/UsersService.java @@ -0,0 +1,25 @@ + +package com.service; + +import java.util.List; +import java.util.Map; + +import org.apache.ibatis.annotations.Param; + +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.service.IService; +import com.entity.UsersEntity; +import com.utils.PageUtils; + +/** + * 系统用户 + */ +public interface UsersService extends IService { // 声明一个接口,扩展 IService,用于基本的 CRUD 操作 + + PageUtils queryPage(Map params); // 根据传入的参数进行分页查询,并返回分页结果 + + List selectListView(Wrapper wrapper); // 根据条件包装器查询并返回 UsersEntity 列表 + + PageUtils queryPage(Map params, Wrapper wrapper); // 根据参数和条件包装器进行分页查询,并返回分页结果 +} + diff --git a/z/src/main/java/com/service/impl/NewsServiceImpl.java b/z/src/main/java/com/service/impl/NewsServiceImpl.java new file mode 100644 index 0000000..c2f7e1d --- /dev/null +++ b/z/src/main/java/com/service/impl/NewsServiceImpl.java @@ -0,0 +1,69 @@ +package com.service.impl; + +import org.springframework.stereotype.Service; +import java.util.Map; +import java.util.List; + +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.plugins.Page; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.utils.PageUtils; +import com.utils.Query; + + +import com.dao.NewsDao; +import com.entity.NewsEntity; +import com.service.NewsService; +import com.entity.vo.NewsVO; +import com.entity.view.NewsView; + +@Service("newsService") // 声明该类为服务层组件,并指定服务名称为 "newsService" +public class NewsServiceImpl extends ServiceImpl implements NewsService { + + // 实现分页查询 + @Override + public PageUtils queryPage(Map params) { + // 创建一个分页对象,使用传入的参数获取页面信息 + Page page = this.selectPage( + new Query(params).getPage(), // 获取分页对象 + new EntityWrapper() // 构建查询条件的包装器 + ); + return new PageUtils(page); // 返回分页结果包装 + } + + // 实现带条件的分页查询 + @Override + public PageUtils queryPage(Map params, Wrapper wrapper) { + // 创建分页对象 + Page page = new Query(params).getPage(); + // 设置页面记录 + page.setRecords(baseMapper.selectListView(page, wrapper)); + PageUtils pageUtil = new PageUtils(page); // 包装分页结果 + return pageUtil; // 返回分页结果 + } + + // 查询符合条件的所有 NewsVO 对象 + @Override + public List selectListVO(Wrapper wrapper) { + return baseMapper.selectListVO(wrapper); // 调用 DAO 层方法执行查询 + } + + // 查询单个 NewsVO 对象 + @Override + public NewsVO selectVO(Wrapper wrapper) { + return baseMapper.selectVO(wrapper); // 调用 DAO 层方法执行查询 + } + + // 查询符合条件的所有 NewsView 对象 + @Override + public List selectListView(Wrapper wrapper) { + return baseMapper.selectListView(wrapper); // 调用 DAO 层方法执行查询 + } + + // 查询单个 NewsView 对象 + @Override + public NewsView selectView(Wrapper wrapper) { + return baseMapper.selectView(wrapper); // 调用 DAO 层方法执行查询 + } +} diff --git a/z/src/main/java/com/service/impl/StoreupServiceImpl.java b/z/src/main/java/com/service/impl/StoreupServiceImpl.java new file mode 100644 index 0000000..6ae9767 --- /dev/null +++ b/z/src/main/java/com/service/impl/StoreupServiceImpl.java @@ -0,0 +1,68 @@ +package com.service.impl; + +import org.springframework.stereotype.Service; +import java.util.Map; +import java.util.List; + +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.plugins.Page; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.utils.PageUtils; +import com.utils.Query; + + +import com.dao.StoreupDao; +import com.entity.StoreupEntity; +import com.service.StoreupService; +import com.entity.vo.StoreupVO; +import com.entity.view.StoreupView; + +@Service("storeupService") // 将该类标记为服务,并指定 bean 的名称为 "storeupService" +public class StoreupServiceImpl extends ServiceImpl implements StoreupService { + @Override + public PageUtils queryPage(Map params) { + // 根据传入的参数创建分页对象,并调用 selectPage 方法获取数据 + Page page = this.selectPage( + new Query(params).getPage(), // 构造分页信息 + new EntityWrapper() // 创建 EntityWrapper 用于封装查询条件 + ); + // 返回封装好的分页结果 + return new PageUtils(page); + } + + @Override + public PageUtils queryPage(Map params, Wrapper wrapper) { + // 创建分页对象 + Page page = new Query(params).getPage(); + // 设置分页记录 + page.setRecords(baseMapper.selectListView(page, wrapper)); // 根据分页信息和条件查询数据 + // 返回封装好的分页结果 + PageUtils pageUtil = new PageUtils(page); + return pageUtil; + } + + @Override + public List selectListVO(Wrapper wrapper) { + // 根据 Wrapper 条件查询并返回 StoreupVO 列表 + return baseMapper.selectListVO(wrapper); + } + + @Override + public StoreupVO selectVO(Wrapper wrapper) { + // 根据 Wrapper 条件查询并返回单个 StoreupVO 对象 + return baseMapper.selectVO(wrapper); + } + + @Override + public List selectListView(Wrapper wrapper) { + // 根据 Wrapper 条件查询并返回 StoreupView 列表 + return baseMapper.selectListView(wrapper); + } + + @Override + public StoreupView selectView(Wrapper wrapper) { + // 根据 Wrapper 条件查询并返回单个 StoreupView 对象 + return baseMapper.selectView(wrapper); + } +} diff --git a/z/src/main/java/com/service/impl/SystemintroServiceImpl.java b/z/src/main/java/com/service/impl/SystemintroServiceImpl.java new file mode 100644 index 0000000..1c0c32d --- /dev/null +++ b/z/src/main/java/com/service/impl/SystemintroServiceImpl.java @@ -0,0 +1,68 @@ +package com.service.impl; + +import org.springframework.stereotype.Service; +import java.util.Map; +import java.util.List; + +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.plugins.Page; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.utils.PageUtils; +import com.utils.Query; + + +import com.dao.SystemintroDao; +import com.entity.SystemintroEntity; +import com.service.SystemintroService; +import com.entity.vo.SystemintroVO; +import com.entity.view.SystemintroView; + +@Service("systemintroService") // 将该类标记为服务,并指定 bean 的名称为 "systemintroService" +public class SystemintroServiceImpl extends ServiceImpl implements SystemintroService { + @Override + public PageUtils queryPage(Map params) { + // 根据传入的参数创建分页对象,并调用 selectPage 方法获取数据 + Page page = this.selectPage( + new Query(params).getPage(), // 构造分页信息 + new EntityWrapper() // 创建 EntityWrapper 用于封装查询条件 + ); + // 返回封装好的分页结果 + return new PageUtils(page); + } + + @Override + public PageUtils queryPage(Map params, Wrapper wrapper) { + // 创建分页对象 + Page page = new Query(params).getPage(); + // 设置分页记录 + page.setRecords(baseMapper.selectListView(page, wrapper)); // 根据分页信息和条件查询数据 + // 返回封装好的分页结果 + PageUtils pageUtil = new PageUtils(page); + return pageUtil; + } + + @Override + public List selectListVO(Wrapper wrapper) { + // 根据 Wrapper 条件查询并返回 SystemintroVO 列表 + return baseMapper.selectListVO(wrapper); + } + + @Override + public SystemintroVO selectVO(Wrapper wrapper) { + // 根据 Wrapper 条件查询并返回单个 SystemintroVO 对象 + return baseMapper.selectVO(wrapper); + } + + @Override + public List selectListView(Wrapper wrapper) { + // 根据 Wrapper 条件查询并返回 SystemintroView 列表 + return baseMapper.selectListView(wrapper); + } + + @Override + public SystemintroView selectView(Wrapper wrapper) { + // 根据 Wrapper 条件查询并返回单个 SystemintroView 对象 + return baseMapper.selectView(wrapper); + } +} diff --git a/z/src/main/java/com/service/impl/UsersServiceImpl.java b/z/src/main/java/com/service/impl/UsersServiceImpl.java new file mode 100644 index 0000000..66fcb3d --- /dev/null +++ b/z/src/main/java/com/service/impl/UsersServiceImpl.java @@ -0,0 +1,54 @@ + +package com.service.impl; + + +import java.util.List; +import java.util.Map; + +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.plugins.Page; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.dao.UsersDao; +import com.entity.UsersEntity; +import com.service.UsersService; +import com.utils.PageUtils; +import com.utils.Query; + + +/** + * 系统用户 + */ +@Service("usersService") // 将该类标记为服务,并指定 bean 的名称为 "usersService" +public class UsersServiceImpl extends ServiceImpl implements UsersService { + + @Override + public PageUtils queryPage(Map params) { + // 根据传入的参数创建分页对象,并调用 selectPage 方法获取用户数据 + Page page = this.selectPage( + new Query(params).getPage(), // 构造分页信息 + new EntityWrapper() // 创建 EntityWrapper 用于封装查询条件 + ); + // 返回封装好的分页结果 + return new PageUtils(page); + } + + @Override + public List selectListView(Wrapper wrapper) { + // 根据 Wrapper 条件查询并返回 UsersEntity 列表 + return baseMapper.selectListView(wrapper); + } + + @Override + public PageUtils queryPage(Map params, Wrapper wrapper) { + // 创建分页对象 + Page page = new Query(params).getPage(); + // 设置分页记录 + page.setRecords(baseMapper.selectListView(page, wrapper)); // 根据分页信息和条件查询数据 + // 返回封装好的分页结果 + PageUtils pageUtil = new PageUtils(page); + return pageUtil; + } +} diff --git a/z/test b/z/test new file mode 160000 index 0000000..cc7b302 --- /dev/null +++ b/z/test @@ -0,0 +1 @@ +Subproject commit cc7b302c004f658cc1d4cc64d5b66b62471ab275