Browse Source

代码修复提交

master
主管理员 6 months ago
parent
commit
895bea2730
66 changed files with 4391 additions and 29 deletions
  1. +2
    -0
      module-base/base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java
  2. +2
    -2
      module-common/src/main/java/org/jeecg/api/controller/AppletCommentController.java
  3. +5
    -4
      module-common/src/main/java/org/jeecg/api/controller/AppletIndexController.java
  4. +2
    -0
      module-common/src/main/java/org/jeecg/api/controller/AppletOrderController.java
  5. +1
    -1
      module-common/src/main/java/org/jeecg/api/service/AppletCommentService.java
  6. +2
    -2
      module-common/src/main/java/org/jeecg/api/service/AppletIndexService.java
  7. +12
    -12
      module-common/src/main/java/org/jeecg/api/service/impl/AppletAchievementServiceImpl.java
  8. +2
    -2
      module-common/src/main/java/org/jeecg/api/service/impl/AppletCommentServiceImpl.java
  9. +16
    -5
      module-common/src/main/java/org/jeecg/api/service/impl/AppletIndexServiceImpl.java
  10. +0
    -1
      module-common/src/main/java/org/jeecg/api/service/impl/AppletLoginServiceImpl.java
  11. +171
    -0
      module-common/src/main/java/org/jeecg/modules/commonBanner/controller/CommonBannerController.java
  12. +62
    -0
      module-common/src/main/java/org/jeecg/modules/commonBanner/entity/CommonBanner.java
  13. +17
    -0
      module-common/src/main/java/org/jeecg/modules/commonBanner/mapper/CommonBannerMapper.java
  14. +5
    -0
      module-common/src/main/java/org/jeecg/modules/commonBanner/mapper/xml/CommonBannerMapper.xml
  15. +14
    -0
      module-common/src/main/java/org/jeecg/modules/commonBanner/service/ICommonBannerService.java
  16. +19
    -0
      module-common/src/main/java/org/jeecg/modules/commonBanner/service/impl/CommonBannerServiceImpl.java
  17. +184
    -0
      module-common/src/main/java/org/jeecg/modules/commonBanner/vue/CommonBannerList.vue
  18. +114
    -0
      module-common/src/main/java/org/jeecg/modules/commonBanner/vue/modules/CommonBannerForm.vue
  19. +84
    -0
      module-common/src/main/java/org/jeecg/modules/commonBanner/vue/modules/CommonBannerModal.Style#Drawer.vue
  20. +60
    -0
      module-common/src/main/java/org/jeecg/modules/commonBanner/vue/modules/CommonBannerModal.vue
  21. +61
    -0
      module-common/src/main/java/org/jeecg/modules/commonBanner/vue3/CommonBanner.api.ts
  22. +46
    -0
      module-common/src/main/java/org/jeecg/modules/commonBanner/vue3/CommonBanner.data.ts
  23. +162
    -0
      module-common/src/main/java/org/jeecg/modules/commonBanner/vue3/CommonBannerList.vue
  24. +58
    -0
      module-common/src/main/java/org/jeecg/modules/commonBanner/vue3/components/CommonBannerModal.vue
  25. +171
    -0
      module-common/src/main/java/org/jeecg/modules/commonBook/controller/CommonBookController.java
  26. +71
    -0
      module-common/src/main/java/org/jeecg/modules/commonBook/entity/CommonBook.java
  27. +17
    -0
      module-common/src/main/java/org/jeecg/modules/commonBook/mapper/CommonBookMapper.java
  28. +5
    -0
      module-common/src/main/java/org/jeecg/modules/commonBook/mapper/xml/CommonBookMapper.xml
  29. +14
    -0
      module-common/src/main/java/org/jeecg/modules/commonBook/service/ICommonBookService.java
  30. +19
    -0
      module-common/src/main/java/org/jeecg/modules/commonBook/service/impl/CommonBookServiceImpl.java
  31. +197
    -0
      module-common/src/main/java/org/jeecg/modules/commonBook/vue/CommonBookList.vue
  32. +124
    -0
      module-common/src/main/java/org/jeecg/modules/commonBook/vue/modules/CommonBookForm.vue
  33. +84
    -0
      module-common/src/main/java/org/jeecg/modules/commonBook/vue/modules/CommonBookModal.Style#Drawer.vue
  34. +60
    -0
      module-common/src/main/java/org/jeecg/modules/commonBook/vue/modules/CommonBookModal.vue
  35. +61
    -0
      module-common/src/main/java/org/jeecg/modules/commonBook/vue3/CommonBook.api.ts
  36. +69
    -0
      module-common/src/main/java/org/jeecg/modules/commonBook/vue3/CommonBook.data.ts
  37. +162
    -0
      module-common/src/main/java/org/jeecg/modules/commonBook/vue3/CommonBookList.vue
  38. +58
    -0
      module-common/src/main/java/org/jeecg/modules/commonBook/vue3/components/CommonBookModal.vue
  39. +171
    -0
      module-common/src/main/java/org/jeecg/modules/commonConfig/controller/CommonConfigController.java
  40. +67
    -0
      module-common/src/main/java/org/jeecg/modules/commonConfig/entity/CommonConfig.java
  41. +17
    -0
      module-common/src/main/java/org/jeecg/modules/commonConfig/mapper/CommonConfigMapper.java
  42. +5
    -0
      module-common/src/main/java/org/jeecg/modules/commonConfig/mapper/xml/CommonConfigMapper.xml
  43. +14
    -0
      module-common/src/main/java/org/jeecg/modules/commonConfig/service/ICommonConfigService.java
  44. +19
    -0
      module-common/src/main/java/org/jeecg/modules/commonConfig/service/impl/CommonConfigServiceImpl.java
  45. +190
    -0
      module-common/src/main/java/org/jeecg/modules/commonConfig/vue/CommonConfigList.vue
  46. +119
    -0
      module-common/src/main/java/org/jeecg/modules/commonConfig/vue/modules/CommonConfigForm.vue
  47. +84
    -0
      module-common/src/main/java/org/jeecg/modules/commonConfig/vue/modules/CommonConfigModal.Style#Drawer.vue
  48. +60
    -0
      module-common/src/main/java/org/jeecg/modules/commonConfig/vue/modules/CommonConfigModal.vue
  49. +61
    -0
      module-common/src/main/java/org/jeecg/modules/commonConfig/vue3/CommonConfig.api.ts
  50. +56
    -0
      module-common/src/main/java/org/jeecg/modules/commonConfig/vue3/CommonConfig.data.ts
  51. +162
    -0
      module-common/src/main/java/org/jeecg/modules/commonConfig/vue3/CommonConfigList.vue
  52. +58
    -0
      module-common/src/main/java/org/jeecg/modules/commonConfig/vue3/components/CommonConfigModal.vue
  53. +171
    -0
      module-common/src/main/java/org/jeecg/modules/commonNotice/controller/CommonNoticeController.java
  54. +66
    -0
      module-common/src/main/java/org/jeecg/modules/commonNotice/entity/CommonNotice.java
  55. +17
    -0
      module-common/src/main/java/org/jeecg/modules/commonNotice/mapper/CommonNoticeMapper.java
  56. +5
    -0
      module-common/src/main/java/org/jeecg/modules/commonNotice/mapper/xml/CommonNoticeMapper.xml
  57. +14
    -0
      module-common/src/main/java/org/jeecg/modules/commonNotice/service/ICommonNoticeService.java
  58. +19
    -0
      module-common/src/main/java/org/jeecg/modules/commonNotice/service/impl/CommonNoticeServiceImpl.java
  59. +197
    -0
      module-common/src/main/java/org/jeecg/modules/commonNotice/vue/CommonNoticeList.vue
  60. +119
    -0
      module-common/src/main/java/org/jeecg/modules/commonNotice/vue/modules/CommonNoticeForm.vue
  61. +84
    -0
      module-common/src/main/java/org/jeecg/modules/commonNotice/vue/modules/CommonNoticeModal.Style#Drawer.vue
  62. +60
    -0
      module-common/src/main/java/org/jeecg/modules/commonNotice/vue/modules/CommonNoticeModal.vue
  63. +61
    -0
      module-common/src/main/java/org/jeecg/modules/commonNotice/vue3/CommonNotice.api.ts
  64. +62
    -0
      module-common/src/main/java/org/jeecg/modules/commonNotice/vue3/CommonNotice.data.ts
  65. +162
    -0
      module-common/src/main/java/org/jeecg/modules/commonNotice/vue3/CommonNoticeList.vue
  66. +58
    -0
      module-common/src/main/java/org/jeecg/modules/commonNotice/vue3/components/CommonNoticeModal.vue

+ 2
- 0
module-base/base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java View File

@ -82,6 +82,8 @@ public class ShiroConfig {
filterChainDefinitionMap.put("/my_comment/**", "anon");
filterChainDefinitionMap.put("/all_money/**", "anon");
filterChainDefinitionMap.put("/all_achievement/**", "anon");
filterChainDefinitionMap.put("/my_order/**", "anon");


+ 2
- 2
module-common/src/main/java/org/jeecg/api/controller/AppletCommentController.java View File

@ -29,8 +29,8 @@ public class AppletCommentController {
//查询我未读的评论列表
@ApiOperation(value="获取我的评论列表", notes="获取我的评论列表")
@GetMapping(value = "/getMyCommentList")
public Result<?> getMyCommentList(@RequestHeader("X-Access-Token") String token, PageBean pageBean) {
return appletCommentService.getMyCommentList(token, pageBean);
public Result<?> getMyCommentList(@RequestHeader("X-Access-Token") String token,String type, PageBean pageBean) {
return appletCommentService.getMyCommentList(token,type, pageBean);
}


+ 5
- 4
module-common/src/main/java/org/jeecg/api/controller/AppletIndexController.java View File

@ -1,6 +1,7 @@
package org.jeecg.api.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@ -62,8 +63,8 @@ public class AppletIndexController {
//获取首页精品推荐小说列表带分页
@ApiOperation(value="获取首页精品推荐小说列表带分页", notes="获取首页精品推荐小说列表带分页")
@GetMapping(value = "/getRecommendList")
public Result<?> getRecommendList(){
return appletIndexService.getRecommendList();
public Result<?> getRecommendList(String name,String shopCion,String shopClass, PageBean pageBean){
return appletIndexService.getRecommendList(name,shopCion,shopClass, pageBean);
}
@ -71,8 +72,8 @@ public class AppletIndexController {
//获取首页最新小说列表带分页
@ApiOperation(value="获取首页最新小说列表带分页", notes="获取首页最新小说列表带分页")
@GetMapping(value = "/getNewList")
public Result<?> getNewList(PageBean pageBean){
return appletIndexService.getNewList(pageBean);
public Result<?> getNewList(String name,String shopCion,String shopClass, PageBean pageBean){
return appletIndexService.getNewList(name,shopCion,shopClass, pageBean);
}
//获取书城区域列表


+ 2
- 0
module-common/src/main/java/org/jeecg/api/controller/AppletOrderController.java View File

@ -29,6 +29,8 @@ public class AppletOrderController {
return appletOrderService.getInteractionGiftList(pageBean);
}
//查询我的礼物包订单列表
@ApiOperation( value="查询我的礼物包订单列表", notes="查询我的礼物包订单列表")
@GetMapping("/getMyGiftList")


+ 1
- 1
module-common/src/main/java/org/jeecg/api/service/AppletCommentService.java View File

@ -10,7 +10,7 @@ public interface AppletCommentService {
Result<?> getMyCommentNum(String token);
//查询我未读的评论列表
Result<?> getMyCommentList(String token, PageBean pageBean);
Result<?> getMyCommentList(String token,String type, PageBean pageBean);
//根据书籍标识查询评论信息列表带分页
Result<?> getCommentList(String bookId, PageBean pageBean);


+ 2
- 2
module-common/src/main/java/org/jeecg/api/service/AppletIndexService.java View File

@ -19,10 +19,10 @@ public interface AppletIndexService {
Result<?> getNoticeById(String id);
// 获取首页精品推荐小说列表带分页
Result<?> getRecommendList();
Result<?> getRecommendList(String name,String shopCion,String shopClass, PageBean pageBean);
// 获取首页最新小说列表带分页
Result<?> getNewList(PageBean pageBean);
Result<?> getNewList(String name,String shopCion,String shopClass,PageBean pageBean);
// 获取书城区域列表
Result<?> getBookAreaList();


+ 12
- 12
module-common/src/main/java/org/jeecg/api/service/impl/AppletAchievementServiceImpl.java View File

@ -41,17 +41,17 @@ public class AppletAchievementServiceImpl implements AppletAchievementService {
@Override
public Result<?> setAchievementName(String token, CommonBookAchievementLog bookAchievementLog){
HanHaiMember member = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token);
//书籍标识不能为空
if(StringUtils.isEmpty(bookAchievementLog.getBookId())){
return Result.error("书籍标识不能为空");
}
//根据书籍标识查询书籍信息
CommonShop commonShop = commonShopService.getById(bookAchievementLog.getBookId());
if(commonShop==null){
return Result.error("书籍不存在");
}
// //书籍标识不能为空
// if(StringUtils.isEmpty(bookAchievementLog.getBookId())){
// return Result.error("书籍标识不能为空");
// }
// //根据书籍标识查询书籍信息
// CommonShop commonShop = commonShopService.getById(bookAchievementLog.getBookId());
// if(commonShop==null){
// return Result.error("书籍不存在");
// }
CommonBookAchievementLog one = commonBookAchievementLogService.lambdaQuery()
.eq(CommonBookAchievementLog::getBookId, bookAchievementLog.getBookId())
// .eq(CommonBookAchievementLog::getBookId, bookAchievementLog.getBookId())
.eq(CommonBookAchievementLog::getUserId, member.getId())
.one();
if(one!=null){
@ -59,7 +59,7 @@ public class AppletAchievementServiceImpl implements AppletAchievementService {
commonBookAchievementLogService.save(bookAchievementLog);
return Result.OK("修改成功");
}else{
bookAchievementLog.setBookId(commonShop.getId());
// bookAchievementLog.setBookId(commonShop.getId());
bookAchievementLog.setUserId(member.getId());
commonBookAchievementLogService.save(bookAchievementLog);
return Result.OK("设置成功");
@ -72,7 +72,7 @@ public class AppletAchievementServiceImpl implements AppletAchievementService {
public Result<?> getAchievement(String token, String bookId){
HanHaiMember member = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token);
CommonBookAchievementLog one = commonBookAchievementLogService.lambdaQuery()
.eq(CommonBookAchievementLog::getBookId, bookId)
// .eq(CommonBookAchievementLog::getBookId, bookId)
.eq(CommonBookAchievementLog::getUserId, member.getId())
.one();
return Result.OK("查询成功",one);


+ 2
- 2
module-common/src/main/java/org/jeecg/api/service/impl/AppletCommentServiceImpl.java View File

@ -45,13 +45,13 @@ public class AppletCommentServiceImpl implements AppletCommentService {
//查询我未读的评论列表
@Override
public Result<?> getMyCommentList(String token, PageBean pageBean){
public Result<?> getMyCommentList(String token,String type, PageBean pageBean){
HanHaiMember member = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token);
Page<CommonBookComment> page = new Page<>(pageBean.getPageNo(), pageBean.getPageSize());
IPage<CommonBookComment> pageList = commonBookCommentService
.lambdaQuery()
.eq(CommonBookComment::getToUserId, member.getId())
.eq(CommonBookComment::getIsLook, "N")
.eq(StringUtils.isNotBlank(type),CommonBookComment::getIsLook, type)
.page(page);
//创建一个新的集合
List<CommonBookComment> commonBookComments = new ArrayList<>();


+ 16
- 5
module-common/src/main/java/org/jeecg/api/service/impl/AppletIndexServiceImpl.java View File

@ -120,19 +120,30 @@ public class AppletIndexServiceImpl implements AppletIndexService {
// 获取首页精品推荐小说列表带分页
@Override
public Result<?> getRecommendList(){
List<CommonShop> commonBooks = commonShopService.lambdaQuery()
public Result<?> getRecommendList(String name,String shopCion,String shopClass, PageBean pageBean){
Page<CommonShop> page = new Page<>(pageBean.getPageNo(),pageBean.getPageSize());
IPage<CommonShop> commonBooks = commonShopService
.lambdaQuery()
.like(StringUtils.isNotBlank(name),CommonShop::getName,name)
.eq(StringUtils.isNotBlank(shopCion),CommonShop::getShopCion,shopCion)
.eq(StringUtils.isNotBlank(shopClass),CommonShop::getShopClass,shopClass)
.orderByDesc(CommonShop::getCreateTime)
.list();
.page(page);
return Result.OK("首页精品推荐小说列表",commonBooks);
}
// 获取首页最新小说列表带分页
@Override
public Result<?> getNewList(PageBean pageBean){
public Result<?> getNewList(String name,String shopCion,String shopClass, PageBean pageBean){
Page<CommonShop> page = new Page<>(pageBean.getPageNo(),pageBean.getPageSize());
IPage<CommonShop> commonBooks = commonShopService.page(page);
IPage<CommonShop> commonBooks = commonShopService
.lambdaQuery()
.like(StringUtils.isNotBlank(name),CommonShop::getName,name)
.eq(StringUtils.isNotBlank(shopCion),CommonShop::getShopCion,shopCion)
.eq(StringUtils.isNotBlank(shopClass),CommonShop::getShopClass,shopClass)
.orderByDesc(CommonShop::getCreateTime)
.page(page);
return Result.OK("首页最新小说列表",commonBooks);
}


+ 0
- 1
module-common/src/main/java/org/jeecg/api/service/impl/AppletLoginServiceImpl.java View File

@ -92,7 +92,6 @@ public class AppletLoginServiceImpl implements AppletLoginService {
loginReq.setSession_key(sessionKey);
member = new HanHaiMember();
member.setAppletOpenid(wxOpenid);
member.setNickName("裂变星"+System.currentTimeMillis());
member.setHeadImage(loginReq.getHeadimgurl());
// 生成token返回给小程序端


+ 171
- 0
module-common/src/main/java/org/jeecg/modules/commonBanner/controller/CommonBannerController.java View File

@ -0,0 +1,171 @@
package org.jeecg.modules.commonBanner.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.commonBanner.entity.CommonBanner;
import org.jeecg.modules.commonBanner.service.ICommonBannerService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
/**
* @Description: 公共轮播图
* @Author: jeecg-boot
* @Date: 2025-05-14
* @Version: V1.0
*/
@Api(tags="公共轮播图")
@RestController
@RequestMapping("/commonBanner/commonBanner")
@Slf4j
public class CommonBannerController extends JeecgController<CommonBanner, ICommonBannerService> {
@Autowired
private ICommonBannerService commonBannerService;
/**
* 分页列表查询
*
* @param commonBanner
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "公共轮播图-分页列表查询")
@ApiOperation(value="公共轮播图-分页列表查询", notes="公共轮播图-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<CommonBanner>> queryPageList(CommonBanner commonBanner,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<CommonBanner> queryWrapper = QueryGenerator.initQueryWrapper(commonBanner, req.getParameterMap());
Page<CommonBanner> page = new Page<CommonBanner>(pageNo, pageSize);
IPage<CommonBanner> pageList = commonBannerService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param commonBanner
* @return
*/
@AutoLog(value = "公共轮播图-添加")
@ApiOperation(value="公共轮播图-添加", notes="公共轮播图-添加")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody CommonBanner commonBanner) {
commonBannerService.save(commonBanner);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param commonBanner
* @return
*/
@AutoLog(value = "公共轮播图-编辑")
@ApiOperation(value="公共轮播图-编辑", notes="公共轮播图-编辑")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody CommonBanner commonBanner) {
commonBannerService.updateById(commonBanner);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "公共轮播图-通过id删除")
@ApiOperation(value="公共轮播图-通过id删除", notes="公共轮播图-通过id删除")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
commonBannerService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "公共轮播图-批量删除")
@ApiOperation(value="公共轮播图-批量删除", notes="公共轮播图-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.commonBannerService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "公共轮播图-通过id查询")
@ApiOperation(value="公共轮播图-通过id查询", notes="公共轮播图-通过id查询")
@GetMapping(value = "/queryById")
public Result<CommonBanner> queryById(@RequestParam(name="id",required=true) String id) {
CommonBanner commonBanner = commonBannerService.getById(id);
if(commonBanner==null) {
return Result.error("未找到对应数据");
}
return Result.OK(commonBanner);
}
/**
* 导出excel
*
* @param request
* @param commonBanner
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, CommonBanner commonBanner) {
return super.exportXls(request, commonBanner, CommonBanner.class, "公共轮播图");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, CommonBanner.class);
}
}

+ 62
- 0
module-common/src/main/java/org/jeecg/modules/commonBanner/entity/CommonBanner.java View File

@ -0,0 +1,62 @@
package org.jeecg.modules.commonBanner.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Description: 公共轮播图
* @Author: jeecg-boot
* @Date: 2025-05-14
* @Version: V1.0
*/
@Data
@TableName("common_banner")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="common_banner对象", description="公共轮播图")
public class CommonBanner implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private java.lang.String id;
/**创建人*/
@ApiModelProperty(value = "创建人")
private java.lang.String createBy;
/**创建日期*/
@ApiModelProperty(value = "创建日期")
private java.util.Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private java.lang.String updateBy;
/**更新日期*/
@ApiModelProperty(value = "更新日期")
private java.util.Date updateTime;
/**图片*/
@Excel(name = "图片", width = 15)
@ApiModelProperty(value = "图片")
private java.lang.String image;
/**标题*/
@Excel(name = "标题", width = 15)
@ApiModelProperty(value = "标题")
private java.lang.String title;
/**说明*/
@Excel(name = "说明", width = 15)
@ApiModelProperty(value = "说明")
private java.lang.String details;
}

+ 17
- 0
module-common/src/main/java/org/jeecg/modules/commonBanner/mapper/CommonBannerMapper.java View File

@ -0,0 +1,17 @@
package org.jeecg.modules.commonBanner.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.commonBanner.entity.CommonBanner;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 公共轮播图
* @Author: jeecg-boot
* @Date: 2025-05-14
* @Version: V1.0
*/
public interface CommonBannerMapper extends BaseMapper<CommonBanner> {
}

+ 5
- 0
module-common/src/main/java/org/jeecg/modules/commonBanner/mapper/xml/CommonBannerMapper.xml View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.commonBanner.mapper.CommonBannerMapper">
</mapper>

+ 14
- 0
module-common/src/main/java/org/jeecg/modules/commonBanner/service/ICommonBannerService.java View File

@ -0,0 +1,14 @@
package org.jeecg.modules.commonBanner.service;
import org.jeecg.modules.commonBanner.entity.CommonBanner;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: 公共轮播图
* @Author: jeecg-boot
* @Date: 2025-05-14
* @Version: V1.0
*/
public interface ICommonBannerService extends IService<CommonBanner> {
}

+ 19
- 0
module-common/src/main/java/org/jeecg/modules/commonBanner/service/impl/CommonBannerServiceImpl.java View File

@ -0,0 +1,19 @@
package org.jeecg.modules.commonBanner.service.impl;
import org.jeecg.modules.commonBanner.entity.CommonBanner;
import org.jeecg.modules.commonBanner.mapper.CommonBannerMapper;
import org.jeecg.modules.commonBanner.service.ICommonBannerService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: 公共轮播图
* @Author: jeecg-boot
* @Date: 2025-05-14
* @Version: V1.0
*/
@Service
public class CommonBannerServiceImpl extends ServiceImpl<CommonBannerMapper, CommonBanner> implements ICommonBannerService {
}

+ 184
- 0
module-common/src/main/java/org/jeecg/modules/commonBanner/vue/CommonBannerList.vue View File

@ -0,0 +1,184 @@
<template>
<a-card :bordered="false">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
</a-row>
</a-form>
</div>
<!-- 查询区域-END -->
<!-- 操作按钮区域 -->
<div class="table-operator">
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
<a-button type="primary" icon="download" @click="handleExportXls('公共轮播图')">导出</a-button>
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
<a-button type="primary" icon="import">导入</a-button>
</a-upload>
<!-- 高级查询区域 -->
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
<a-dropdown v-if="selectedRowKeys.length > 0">
<a-menu slot="overlay">
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
</a-menu>
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
</a-dropdown>
</div>
<!-- table区域-begin -->
<div>
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
</div>
<a-table
ref="table"
size="middle"
:scroll="{x:true}"
bordered
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
class="j-table-force-nowrap"
@change="handleTableChange">
<template slot="htmlSlot" slot-scope="text">
<div v-html="text"></div>
</template>
<template slot="imgSlot" slot-scope="text,record">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
<img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
</template>
<template slot="fileSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button
v-else
:ghost="true"
type="primary"
icon="download"
size="small"
@click="downloadFile(text)">
下载
</a-button>
</template>
<span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">编辑</a>
<a-divider type="vertical" />
<a-dropdown>
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
<a-menu slot="overlay">
<a-menu-item>
<a @click="handleDetail(record)">详情</a>
</a-menu-item>
<a-menu-item>
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a>删除</a>
</a-popconfirm>
</a-menu-item>
</a-menu>
</a-dropdown>
</span>
</a-table>
</div>
<common-banner-modal ref="modalForm" @ok="modalFormOk"></common-banner-modal>
</a-card>
</template>
<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import CommonBannerModal from './modules/CommonBannerModal'
export default {
name: 'CommonBannerList',
mixins:[JeecgListMixin, mixinDevice],
components: {
CommonBannerModal
},
data () {
return {
description: '公共轮播图管理页面',
//
columns: [
{
title: '#',
dataIndex: '',
key:'rowIndex',
width:60,
align:"center",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
{
title:'图片',
align:"center",
dataIndex: 'image',
scopedSlots: {customRender: 'imgSlot'}
},
{
title:'标题',
align:"center",
dataIndex: 'title'
},
{
title:'说明',
align:"center",
dataIndex: 'details'
},
{
title: '操作',
dataIndex: 'action',
align:"center",
fixed:"right",
width:147,
scopedSlots: { customRender: 'action' }
}
],
url: {
list: "/commonBanner/commonBanner/list",
delete: "/commonBanner/commonBanner/delete",
deleteBatch: "/commonBanner/commonBanner/deleteBatch",
exportXlsUrl: "/commonBanner/commonBanner/exportXls",
importExcelUrl: "commonBanner/commonBanner/importExcel",
},
dictOptions:{},
superFieldList:[],
}
},
created() {
this.getSuperFieldList();
},
computed: {
importExcelUrl: function(){
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
},
},
methods: {
initDictConfig(){
},
getSuperFieldList(){
let fieldList=[];
fieldList.push({type:'Text',value:'image',text:'图片',dictCode:''})
fieldList.push({type:'string',value:'title',text:'标题',dictCode:''})
fieldList.push({type:'Text',value:'details',text:'说明',dictCode:''})
this.superFieldList = fieldList
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>

+ 114
- 0
module-common/src/main/java/org/jeecg/modules/commonBanner/vue/modules/CommonBannerForm.vue View File

@ -0,0 +1,114 @@
<template>
<a-spin :spinning="confirmLoading">
<j-form-container :disabled="formDisabled">
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
<a-row>
<a-col :span="24">
<a-form-model-item label="图片" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="image">
<j-image-upload isMultiple v-model="model.image" ></j-image-upload>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="标题" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="title">
<a-input v-model="model.title" placeholder="请输入标题" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="说明" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="details">
<a-textarea v-model="model.details" rows="4" placeholder="请输入说明" />
</a-form-model-item>
</a-col>
</a-row>
</a-form-model>
</j-form-container>
</a-spin>
</template>
<script>
import { httpAction, getAction } from '@/api/manage'
import { validateDuplicateValue } from '@/utils/util'
export default {
name: 'CommonBannerForm',
components: {
},
props: {
//
disabled: {
type: Boolean,
default: false,
required: false
}
},
data () {
return {
model:{
},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
confirmLoading: false,
validatorRules: {
},
url: {
add: "/commonBanner/commonBanner/add",
edit: "/commonBanner/commonBanner/edit",
queryById: "/commonBanner/commonBanner/queryById"
}
}
},
computed: {
formDisabled(){
return this.disabled
},
},
created () {
//model
this.modelDefault = JSON.parse(JSON.stringify(this.model));
},
methods: {
add () {
this.edit(this.modelDefault);
},
edit (record) {
this.model = Object.assign({}, record);
this.visible = true;
},
submitForm () {
const that = this;
//
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
if(!this.model.id){
httpurl+=this.url.add;
method = 'post';
}else{
httpurl+=this.url.edit;
method = 'put';
}
httpAction(httpurl,this.model,method).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.$emit('ok');
}else{
that.$message.warning(res.message);
}
}).finally(() => {
that.confirmLoading = false;
})
}
})
},
}
}
</script>

+ 84
- 0
module-common/src/main/java/org/jeecg/modules/commonBanner/vue/modules/CommonBannerModal.Style#Drawer.vue View File

@ -0,0 +1,84 @@
<template>
<a-drawer
:title="title"
:width="width"
placement="right"
:closable="false"
@close="close"
destroyOnClose
:visible="visible">
<common-banner-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></common-banner-form>
<div class="drawer-footer">
<a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button>
<a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button>
</div>
</a-drawer>
</template>
<script>
import CommonBannerForm from './CommonBannerForm'
export default {
name: 'CommonBannerModal',
components: {
CommonBannerForm
},
data () {
return {
title:"操作",
width:800,
visible: false,
disableSubmit: false
}
},
methods: {
add () {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.add();
})
},
edit (record) {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.edit(record);
});
},
close () {
this.$emit('close');
this.visible = false;
},
submitCallback(){
this.$emit('ok');
this.visible = false;
},
handleOk () {
this.$refs.realForm.submitForm();
},
handleCancel () {
this.close()
}
}
}
</script>
<style lang="less" scoped>
/** Button按钮间距 */
.ant-btn {
margin-left: 30px;
margin-bottom: 30px;
float: right;
}
.drawer-footer{
position: absolute;
bottom: -8px;
width: 100%;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
left: 0;
background: #fff;
border-radius: 0 0 2px 2px;
}
</style>

+ 60
- 0
module-common/src/main/java/org/jeecg/modules/commonBanner/vue/modules/CommonBannerModal.vue View File

@ -0,0 +1,60 @@
<template>
<j-modal
:title="title"
:width="width"
:visible="visible"
switchFullscreen
@ok="handleOk"
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
@cancel="handleCancel"
cancelText="关闭">
<common-banner-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></common-banner-form>
</j-modal>
</template>
<script>
import CommonBannerForm from './CommonBannerForm'
export default {
name: 'CommonBannerModal',
components: {
CommonBannerForm
},
data () {
return {
title:'',
width:800,
visible: false,
disableSubmit: false
}
},
methods: {
add () {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.add();
})
},
edit (record) {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.edit(record);
})
},
close () {
this.$emit('close');
this.visible = false;
},
handleOk () {
this.$refs.realForm.submitForm();
},
submitCallback(){
this.$emit('ok');
this.visible = false;
},
handleCancel () {
this.close()
}
}
}
</script>

+ 61
- 0
module-common/src/main/java/org/jeecg/modules/commonBanner/vue3/CommonBanner.api.ts View File

@ -0,0 +1,61 @@
import {defHttp} from '/@/utils/http/axios';
import {Modal} from 'ant-design-vue';
enum Api {
list = '/commonBanner/commonBanner/list',
save='/commonBanner/commonBanner/add',
edit='/commonBanner/commonBanner/edit',
deleteOne = '/commonBanner/commonBanner/delete',
deleteBatch = '/commonBanner/commonBanner/deleteBatch',
importExcel = '/commonBanner/commonBanner/importExcel',
exportXls = '/commonBanner/commonBanner/exportXls',
}
/**
* api
* @param params
*/
export const getExportUrl = Api.exportXls;
/**
* api
*/
export const getImportUrl = Api.importExcel;
/**
*
* @param params
*/
export const list = (params) =>
defHttp.get({url: Api.list, params});
/**
*
*/
export const deleteOne = (params,handleSuccess) => {
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
/**
*
* @param params
*/
export const batchDelete = (params, handleSuccess) => {
Modal.confirm({
title: '确认删除',
content: '是否删除选中数据',
okText: '确认',
cancelText: '取消',
onOk: () => {
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
});
}
/**
*
* @param params
*/
export const saveOrUpdate = (params, isUpdate) => {
let url = isUpdate ? Api.edit : Api.save;
return defHttp.post({url: url, params});
}

+ 46
- 0
module-common/src/main/java/org/jeecg/modules/commonBanner/vue3/CommonBanner.data.ts View File

@ -0,0 +1,46 @@
import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
{
title: '图片',
align:"center",
dataIndex: 'image',
customRender:render.renderAvatar,
},
{
title: '标题',
align:"center",
dataIndex: 'title'
},
{
title: '说明',
align:"center",
dataIndex: 'details'
},
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
{
label: '图片',
field: 'image',
component: 'JImageUpload',
componentProps:{
},
},
{
label: '标题',
field: 'title',
component: 'Input',
},
{
label: '说明',
field: 'details',
component: 'InputTextArea',//TODO 注意string转换问题
},
];

+ 162
- 0
module-common/src/main/java/org/jeecg/modules/commonBanner/vue3/CommonBannerList.vue View File

@ -0,0 +1,162 @@
<template>
<div>
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-dropdown v-if="checkedKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete">
<Icon icon="ant-design:delete-outlined"></Icon>
删除
</a-menu-item>
</a-menu>
</template>
<a-button>批量操作
<Icon icon="mdi:chevron-down"></Icon>
</a-button>
</a-dropdown>
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>
</template>
<!--字段回显插槽-->
<template #htmlSlot="{text}">
<div v-html="text"></div>
</template>
<template #fileSlot="{text}">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button>
</template>
</BasicTable>
<!-- 表单区域 -->
<CommonBannerModal @register="registerModal" @success="handleSuccess"></CommonBannerModal>
</div>
</template>
<script lang="ts" name="commonBanner-commonBanner" setup>
import {ref, computed, unref} from 'vue';
import {BasicTable, useTable, TableAction} from '/@/components/Table';
import {useModal} from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage'
import CommonBannerModal from './components/CommonBannerModal.vue'
import {columns, searchFormSchema} from './commonBanner.data';
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './commonBanner.api';
const checkedKeys = ref<Array<string | number>>([]);
//model
const [registerModal, {openModal}] = useModal();
//table
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
tableProps:{
title: '公共轮播图',
api: list,
columns,
canResize:false,
formConfig: {
labelWidth: 120,
schemas: searchFormSchema,
autoSubmitOnEnter:true,
showAdvancedButton:true,
fieldMapToTime: [
],
},
actionColumn: {
width: 120,
},
},
exportConfig: {
name:"公共轮播图",
url: getExportUrl,
},
importConfig: {
url: getImportUrl
},
})
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext
/**
* 新增事件
*/
function handleAdd() {
openModal(true, {
isUpdate: false,
showFooter: true,
});
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: true,
});
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: false,
});
}
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({id: record.id}, reload);
}
/**
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ids: checkedKeys.value}, reload);
}
/**
* 成功回调
*/
function handleSuccess() {
reload();
}
/**
* 操作栏
*/
function getTableAction(record){
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
}
]
}
/**
* 下拉操作栏
*/
function getDropDownAction(record){
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
}, {
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
}
}
]
}
</script>
<style scoped>
</style>

+ 58
- 0
module-common/src/main/java/org/jeecg/modules/commonBanner/vue3/components/CommonBannerModal.vue View File

@ -0,0 +1,58 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" @ok="handleSubmit">
<BasicForm @register="registerForm"/>
</BasicModal>
</template>
<script lang="ts" setup>
import {ref, computed, unref} from 'vue';
import {BasicModal, useModalInner} from '/@/components/Modal';
import {BasicForm, useForm} from '/@/components/Form/index';
import {formSchema} from '../commonBanner.data';
import {saveOrUpdate} from '../commonBanner.api';
// Emits
const emit = defineEmits(['register','success']);
const isUpdate = ref(true);
//
const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({
labelWidth: 150,
schemas: formSchema,
showActionButtonGroup: false,
});
//
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
//
await resetFields();
setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter});
isUpdate.value = !!data?.isUpdate;
if (unref(isUpdate)) {
//
await setFieldsValue({
...data.record,
});
}
//
setProps({ disabled: !data?.showFooter })
});
//
const title = computed(() => (!unref(isUpdate) ? '新增' : '编辑'));
//
async function handleSubmit(v) {
try {
let values = await validate();
setModalProps({confirmLoading: true});
//
await saveOrUpdate(values, isUpdate.value);
//
closeModal();
//
emit('success');
} finally {
setModalProps({confirmLoading: false});
}
}
</script>
<style lang="less" scoped>
</style>

+ 171
- 0
module-common/src/main/java/org/jeecg/modules/commonBook/controller/CommonBookController.java View File

@ -0,0 +1,171 @@
package org.jeecg.modules.commonBook.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.commonBook.entity.CommonBook;
import org.jeecg.modules.commonBook.service.ICommonBookService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
/**
* @Description: 书架信息
* @Author: jeecg-boot
* @Date: 2025-05-14
* @Version: V1.0
*/
@Api(tags="书架信息")
@RestController
@RequestMapping("/commonBook/commonBook")
@Slf4j
public class CommonBookController extends JeecgController<CommonBook, ICommonBookService> {
@Autowired
private ICommonBookService commonBookService;
/**
* 分页列表查询
*
* @param commonBook
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "书架信息-分页列表查询")
@ApiOperation(value="书架信息-分页列表查询", notes="书架信息-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<CommonBook>> queryPageList(CommonBook commonBook,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<CommonBook> queryWrapper = QueryGenerator.initQueryWrapper(commonBook, req.getParameterMap());
Page<CommonBook> page = new Page<CommonBook>(pageNo, pageSize);
IPage<CommonBook> pageList = commonBookService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param commonBook
* @return
*/
@AutoLog(value = "书架信息-添加")
@ApiOperation(value="书架信息-添加", notes="书架信息-添加")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody CommonBook commonBook) {
commonBookService.save(commonBook);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param commonBook
* @return
*/
@AutoLog(value = "书架信息-编辑")
@ApiOperation(value="书架信息-编辑", notes="书架信息-编辑")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody CommonBook commonBook) {
commonBookService.updateById(commonBook);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "书架信息-通过id删除")
@ApiOperation(value="书架信息-通过id删除", notes="书架信息-通过id删除")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
commonBookService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "书架信息-批量删除")
@ApiOperation(value="书架信息-批量删除", notes="书架信息-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.commonBookService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "书架信息-通过id查询")
@ApiOperation(value="书架信息-通过id查询", notes="书架信息-通过id查询")
@GetMapping(value = "/queryById")
public Result<CommonBook> queryById(@RequestParam(name="id",required=true) String id) {
CommonBook commonBook = commonBookService.getById(id);
if(commonBook==null) {
return Result.error("未找到对应数据");
}
return Result.OK(commonBook);
}
/**
* 导出excel
*
* @param request
* @param commonBook
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, CommonBook commonBook) {
return super.exportXls(request, commonBook, CommonBook.class, "书架信息");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, CommonBook.class);
}
}

+ 71
- 0
module-common/src/main/java/org/jeecg/modules/commonBook/entity/CommonBook.java View File

@ -0,0 +1,71 @@
package org.jeecg.modules.commonBook.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Description: 书架信息
* @Author: jeecg-boot
* @Date: 2025-05-14
* @Version: V1.0
*/
@Data
@TableName("common_book")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="common_book对象", description="书架信息")
public class CommonBook implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private java.lang.String id;
/**创建人*/
@ApiModelProperty(value = "创建人")
private java.lang.String createBy;
/**创建日期*/
@ApiModelProperty(value = "创建日期")
private java.util.Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private java.lang.String updateBy;
/**更新日期*/
@ApiModelProperty(value = "更新日期")
private java.util.Date updateTime;
/**用户*/
@Excel(name = "用户", width = 15)
@ApiModelProperty(value = "用户")
private java.lang.String userId;
/**类型*/
@Excel(name = "类型", width = 15)
@ApiModelProperty(value = "类型")
private java.lang.String type;
/**书名*/
@Excel(name = "书名", width = 15)
@ApiModelProperty(value = "书名")
private java.lang.String name;
/**主图*/
@Excel(name = "主图", width = 15)
@ApiModelProperty(value = "主图")
private java.lang.String image;
/**关联小说*/
@Excel(name = "关联小说", width = 15, dictTable = "common_shop", dicText = "name", dicCode = "id")
@Dict(dictTable = "common_shop", dicText = "name", dicCode = "id")
@ApiModelProperty(value = "关联小说")
private java.lang.String shopId;
}

+ 17
- 0
module-common/src/main/java/org/jeecg/modules/commonBook/mapper/CommonBookMapper.java View File

@ -0,0 +1,17 @@
package org.jeecg.modules.commonBook.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.commonBook.entity.CommonBook;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 书架信息
* @Author: jeecg-boot
* @Date: 2025-05-14
* @Version: V1.0
*/
public interface CommonBookMapper extends BaseMapper<CommonBook> {
}

+ 5
- 0
module-common/src/main/java/org/jeecg/modules/commonBook/mapper/xml/CommonBookMapper.xml View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.commonBook.mapper.CommonBookMapper">
</mapper>

+ 14
- 0
module-common/src/main/java/org/jeecg/modules/commonBook/service/ICommonBookService.java View File

@ -0,0 +1,14 @@
package org.jeecg.modules.commonBook.service;
import org.jeecg.modules.commonBook.entity.CommonBook;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: 书架信息
* @Author: jeecg-boot
* @Date: 2025-05-14
* @Version: V1.0
*/
public interface ICommonBookService extends IService<CommonBook> {
}

+ 19
- 0
module-common/src/main/java/org/jeecg/modules/commonBook/service/impl/CommonBookServiceImpl.java View File

@ -0,0 +1,19 @@
package org.jeecg.modules.commonBook.service.impl;
import org.jeecg.modules.commonBook.entity.CommonBook;
import org.jeecg.modules.commonBook.mapper.CommonBookMapper;
import org.jeecg.modules.commonBook.service.ICommonBookService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: 书架信息
* @Author: jeecg-boot
* @Date: 2025-05-14
* @Version: V1.0
*/
@Service
public class CommonBookServiceImpl extends ServiceImpl<CommonBookMapper, CommonBook> implements ICommonBookService {
}

+ 197
- 0
module-common/src/main/java/org/jeecg/modules/commonBook/vue/CommonBookList.vue View File

@ -0,0 +1,197 @@
<template>
<a-card :bordered="false">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
</a-row>
</a-form>
</div>
<!-- 查询区域-END -->
<!-- 操作按钮区域 -->
<div class="table-operator">
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
<a-button type="primary" icon="download" @click="handleExportXls('书架信息')">导出</a-button>
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
<a-button type="primary" icon="import">导入</a-button>
</a-upload>
<!-- 高级查询区域 -->
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
<a-dropdown v-if="selectedRowKeys.length > 0">
<a-menu slot="overlay">
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
</a-menu>
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
</a-dropdown>
</div>
<!-- table区域-begin -->
<div>
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
</div>
<a-table
ref="table"
size="middle"
:scroll="{x:true}"
bordered
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
class="j-table-force-nowrap"
@change="handleTableChange">
<template slot="htmlSlot" slot-scope="text">
<div v-html="text"></div>
</template>
<template slot="imgSlot" slot-scope="text,record">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
<img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
</template>
<template slot="fileSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button
v-else
:ghost="true"
type="primary"
icon="download"
size="small"
@click="downloadFile(text)">
下载
</a-button>
</template>
<span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">编辑</a>
<a-divider type="vertical" />
<a-dropdown>
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
<a-menu slot="overlay">
<a-menu-item>
<a @click="handleDetail(record)">详情</a>
</a-menu-item>
<a-menu-item>
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a>删除</a>
</a-popconfirm>
</a-menu-item>
</a-menu>
</a-dropdown>
</span>
</a-table>
</div>
<common-book-modal ref="modalForm" @ok="modalFormOk"></common-book-modal>
</a-card>
</template>
<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import CommonBookModal from './modules/CommonBookModal'
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
export default {
name: 'CommonBookList',
mixins:[JeecgListMixin, mixinDevice],
components: {
CommonBookModal
},
data () {
return {
description: '书架信息管理页面',
//
columns: [
{
title: '#',
dataIndex: '',
key:'rowIndex',
width:60,
align:"center",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
{
title:'用户',
align:"center",
dataIndex: 'userId'
},
{
title:'类型',
align:"center",
dataIndex: 'type'
},
{
title:'书名',
align:"center",
dataIndex: 'name'
},
{
title:'主图',
align:"center",
dataIndex: 'image',
scopedSlots: {customRender: 'imgSlot'}
},
{
title:'关联小说',
align:"center",
dataIndex: 'shopId_dictText'
},
{
title: '操作',
dataIndex: 'action',
align:"center",
fixed:"right",
width:147,
scopedSlots: { customRender: 'action' }
}
],
url: {
list: "/commonBook/commonBook/list",
delete: "/commonBook/commonBook/delete",
deleteBatch: "/commonBook/commonBook/deleteBatch",
exportXlsUrl: "/commonBook/commonBook/exportXls",
importExcelUrl: "commonBook/commonBook/importExcel",
},
dictOptions:{},
superFieldList:[],
}
},
created() {
this.getSuperFieldList();
},
computed: {
importExcelUrl: function(){
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
},
},
methods: {
initDictConfig(){
},
getSuperFieldList(){
let fieldList=[];
fieldList.push({type:'string',value:'userId',text:'用户',dictCode:"han_hai_member,nick_name,id"})
fieldList.push({type:'string',value:'type',text:'类型',dictCode:''})
fieldList.push({type:'string',value:'name',text:'书名',dictCode:''})
fieldList.push({type:'Text',value:'image',text:'主图',dictCode:''})
fieldList.push({type:'sel_search',value:'shopId',text:'关联小说',dictTable:"common_shop", dictText:'name', dictCode:'id'})
this.superFieldList = fieldList
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>

+ 124
- 0
module-common/src/main/java/org/jeecg/modules/commonBook/vue/modules/CommonBookForm.vue View File

@ -0,0 +1,124 @@
<template>
<a-spin :spinning="confirmLoading">
<j-form-container :disabled="formDisabled">
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
<a-row>
<a-col :span="24">
<a-form-model-item label="用户" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="userId">
<a-input v-model="model.userId" placeholder="请输入用户" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="type">
<a-input v-model="model.type" placeholder="请输入类型" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="书名" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="name">
<a-input v-model="model.name" placeholder="请输入书名" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="主图" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="image">
<j-image-upload isMultiple v-model="model.image" ></j-image-upload>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="关联小说" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="shopId">
<j-search-select-tag v-model="model.shopId" dict="common_shop,name,id" />
</a-form-model-item>
</a-col>
</a-row>
</a-form-model>
</j-form-container>
</a-spin>
</template>
<script>
import { httpAction, getAction } from '@/api/manage'
import { validateDuplicateValue } from '@/utils/util'
export default {
name: 'CommonBookForm',
components: {
},
props: {
//
disabled: {
type: Boolean,
default: false,
required: false
}
},
data () {
return {
model:{
},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
confirmLoading: false,
validatorRules: {
},
url: {
add: "/commonBook/commonBook/add",
edit: "/commonBook/commonBook/edit",
queryById: "/commonBook/commonBook/queryById"
}
}
},
computed: {
formDisabled(){
return this.disabled
},
},
created () {
//model
this.modelDefault = JSON.parse(JSON.stringify(this.model));
},
methods: {
add () {
this.edit(this.modelDefault);
},
edit (record) {
this.model = Object.assign({}, record);
this.visible = true;
},
submitForm () {
const that = this;
//
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
if(!this.model.id){
httpurl+=this.url.add;
method = 'post';
}else{
httpurl+=this.url.edit;
method = 'put';
}
httpAction(httpurl,this.model,method).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.$emit('ok');
}else{
that.$message.warning(res.message);
}
}).finally(() => {
that.confirmLoading = false;
})
}
})
},
}
}
</script>

+ 84
- 0
module-common/src/main/java/org/jeecg/modules/commonBook/vue/modules/CommonBookModal.Style#Drawer.vue View File

@ -0,0 +1,84 @@
<template>
<a-drawer
:title="title"
:width="width"
placement="right"
:closable="false"
@close="close"
destroyOnClose
:visible="visible">
<common-book-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></common-book-form>
<div class="drawer-footer">
<a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button>
<a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button>
</div>
</a-drawer>
</template>
<script>
import CommonBookForm from './CommonBookForm'
export default {
name: 'CommonBookModal',
components: {
CommonBookForm
},
data () {
return {
title:"操作",
width:800,
visible: false,
disableSubmit: false
}
},
methods: {
add () {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.add();
})
},
edit (record) {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.edit(record);
});
},
close () {
this.$emit('close');
this.visible = false;
},
submitCallback(){
this.$emit('ok');
this.visible = false;
},
handleOk () {
this.$refs.realForm.submitForm();
},
handleCancel () {
this.close()
}
}
}
</script>
<style lang="less" scoped>
/** Button按钮间距 */
.ant-btn {
margin-left: 30px;
margin-bottom: 30px;
float: right;
}
.drawer-footer{
position: absolute;
bottom: -8px;
width: 100%;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
left: 0;
background: #fff;
border-radius: 0 0 2px 2px;
}
</style>

+ 60
- 0
module-common/src/main/java/org/jeecg/modules/commonBook/vue/modules/CommonBookModal.vue View File

@ -0,0 +1,60 @@
<template>
<j-modal
:title="title"
:width="width"
:visible="visible"
switchFullscreen
@ok="handleOk"
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
@cancel="handleCancel"
cancelText="关闭">
<common-book-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></common-book-form>
</j-modal>
</template>
<script>
import CommonBookForm from './CommonBookForm'
export default {
name: 'CommonBookModal',
components: {
CommonBookForm
},
data () {
return {
title:'',
width:800,
visible: false,
disableSubmit: false
}
},
methods: {
add () {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.add();
})
},
edit (record) {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.edit(record);
})
},
close () {
this.$emit('close');
this.visible = false;
},
handleOk () {
this.$refs.realForm.submitForm();
},
submitCallback(){
this.$emit('ok');
this.visible = false;
},
handleCancel () {
this.close()
}
}
}
</script>

+ 61
- 0
module-common/src/main/java/org/jeecg/modules/commonBook/vue3/CommonBook.api.ts View File

@ -0,0 +1,61 @@
import {defHttp} from '/@/utils/http/axios';
import {Modal} from 'ant-design-vue';
enum Api {
list = '/commonBook/commonBook/list',
save='/commonBook/commonBook/add',
edit='/commonBook/commonBook/edit',
deleteOne = '/commonBook/commonBook/delete',
deleteBatch = '/commonBook/commonBook/deleteBatch',
importExcel = '/commonBook/commonBook/importExcel',
exportXls = '/commonBook/commonBook/exportXls',
}
/**
* api
* @param params
*/
export const getExportUrl = Api.exportXls;
/**
* api
*/
export const getImportUrl = Api.importExcel;
/**
*
* @param params
*/
export const list = (params) =>
defHttp.get({url: Api.list, params});
/**
*
*/
export const deleteOne = (params,handleSuccess) => {
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
/**
*
* @param params
*/
export const batchDelete = (params, handleSuccess) => {
Modal.confirm({
title: '确认删除',
content: '是否删除选中数据',
okText: '确认',
cancelText: '取消',
onOk: () => {
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
});
}
/**
*
* @param params
*/
export const saveOrUpdate = (params, isUpdate) => {
let url = isUpdate ? Api.edit : Api.save;
return defHttp.post({url: url, params});
}

+ 69
- 0
module-common/src/main/java/org/jeecg/modules/commonBook/vue3/CommonBook.data.ts View File

@ -0,0 +1,69 @@
import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
{
title: '用户',
align:"center",
dataIndex: 'userId'
},
{
title: '类型',
align:"center",
dataIndex: 'type'
},
{
title: '书名',
align:"center",
dataIndex: 'name'
},
{
title: '主图',
align:"center",
dataIndex: 'image',
customRender:render.renderAvatar,
},
{
title: '关联小说',
align:"center",
dataIndex: 'shopId_dictText'
},
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
{
label: '用户',
field: 'userId',
component: 'Input',
},
{
label: '类型',
field: 'type',
component: 'Input',
},
{
label: '书名',
field: 'name',
component: 'Input',
},
{
label: '主图',
field: 'image',
component: 'JImageUpload',
componentProps:{
},
},
{
label: '关联小说',
field: 'shopId',
component: 'JSearchSelect',
componentProps:{
dict:"common_shop,name,id"
},
},
];

+ 162
- 0
module-common/src/main/java/org/jeecg/modules/commonBook/vue3/CommonBookList.vue View File

@ -0,0 +1,162 @@
<template>
<div>
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-dropdown v-if="checkedKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete">
<Icon icon="ant-design:delete-outlined"></Icon>
删除
</a-menu-item>
</a-menu>
</template>
<a-button>批量操作
<Icon icon="mdi:chevron-down"></Icon>
</a-button>
</a-dropdown>
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>
</template>
<!--字段回显插槽-->
<template #htmlSlot="{text}">
<div v-html="text"></div>
</template>
<template #fileSlot="{text}">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button>
</template>
</BasicTable>
<!-- 表单区域 -->
<CommonBookModal @register="registerModal" @success="handleSuccess"></CommonBookModal>
</div>
</template>
<script lang="ts" name="commonBook-commonBook" setup>
import {ref, computed, unref} from 'vue';
import {BasicTable, useTable, TableAction} from '/@/components/Table';
import {useModal} from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage'
import CommonBookModal from './components/CommonBookModal.vue'
import {columns, searchFormSchema} from './commonBook.data';
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './commonBook.api';
const checkedKeys = ref<Array<string | number>>([]);
//model
const [registerModal, {openModal}] = useModal();
//table
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
tableProps:{
title: '书架信息',
api: list,
columns,
canResize:false,
formConfig: {
labelWidth: 120,
schemas: searchFormSchema,
autoSubmitOnEnter:true,
showAdvancedButton:true,
fieldMapToTime: [
],
},
actionColumn: {
width: 120,
},
},
exportConfig: {
name:"书架信息",
url: getExportUrl,
},
importConfig: {
url: getImportUrl
},
})
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext
/**
* 新增事件
*/
function handleAdd() {
openModal(true, {
isUpdate: false,
showFooter: true,
});
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: true,
});
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: false,
});
}
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({id: record.id}, reload);
}
/**
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ids: checkedKeys.value}, reload);
}
/**
* 成功回调
*/
function handleSuccess() {
reload();
}
/**
* 操作栏
*/
function getTableAction(record){
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
}
]
}
/**
* 下拉操作栏
*/
function getDropDownAction(record){
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
}, {
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
}
}
]
}
</script>
<style scoped>
</style>

+ 58
- 0
module-common/src/main/java/org/jeecg/modules/commonBook/vue3/components/CommonBookModal.vue View File

@ -0,0 +1,58 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" @ok="handleSubmit">
<BasicForm @register="registerForm"/>
</BasicModal>
</template>
<script lang="ts" setup>
import {ref, computed, unref} from 'vue';
import {BasicModal, useModalInner} from '/@/components/Modal';
import {BasicForm, useForm} from '/@/components/Form/index';
import {formSchema} from '../commonBook.data';
import {saveOrUpdate} from '../commonBook.api';
// Emits
const emit = defineEmits(['register','success']);
const isUpdate = ref(true);
//
const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({
labelWidth: 150,
schemas: formSchema,
showActionButtonGroup: false,
});
//
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
//
await resetFields();
setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter});
isUpdate.value = !!data?.isUpdate;
if (unref(isUpdate)) {
//
await setFieldsValue({
...data.record,
});
}
//
setProps({ disabled: !data?.showFooter })
});
//
const title = computed(() => (!unref(isUpdate) ? '新增' : '编辑'));
//
async function handleSubmit(v) {
try {
let values = await validate();
setModalProps({confirmLoading: true});
//
await saveOrUpdate(values, isUpdate.value);
//
closeModal();
//
emit('success');
} finally {
setModalProps({confirmLoading: false});
}
}
</script>
<style lang="less" scoped>
</style>

+ 171
- 0
module-common/src/main/java/org/jeecg/modules/commonConfig/controller/CommonConfigController.java View File

@ -0,0 +1,171 @@
package org.jeecg.modules.commonConfig.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.commonConfig.entity.CommonConfig;
import org.jeecg.modules.commonConfig.service.ICommonConfigService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
/**
* @Description: 公共配置表
* @Author: jeecg-boot
* @Date: 2025-05-14
* @Version: V1.0
*/
@Api(tags="公共配置表")
@RestController
@RequestMapping("/commonConfig/commonConfig")
@Slf4j
public class CommonConfigController extends JeecgController<CommonConfig, ICommonConfigService> {
@Autowired
private ICommonConfigService commonConfigService;
/**
* 分页列表查询
*
* @param commonConfig
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "公共配置表-分页列表查询")
@ApiOperation(value="公共配置表-分页列表查询", notes="公共配置表-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<CommonConfig>> queryPageList(CommonConfig commonConfig,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<CommonConfig> queryWrapper = QueryGenerator.initQueryWrapper(commonConfig, req.getParameterMap());
Page<CommonConfig> page = new Page<CommonConfig>(pageNo, pageSize);
IPage<CommonConfig> pageList = commonConfigService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param commonConfig
* @return
*/
@AutoLog(value = "公共配置表-添加")
@ApiOperation(value="公共配置表-添加", notes="公共配置表-添加")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody CommonConfig commonConfig) {
commonConfigService.save(commonConfig);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param commonConfig
* @return
*/
@AutoLog(value = "公共配置表-编辑")
@ApiOperation(value="公共配置表-编辑", notes="公共配置表-编辑")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody CommonConfig commonConfig) {
commonConfigService.updateById(commonConfig);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "公共配置表-通过id删除")
@ApiOperation(value="公共配置表-通过id删除", notes="公共配置表-通过id删除")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
commonConfigService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "公共配置表-批量删除")
@ApiOperation(value="公共配置表-批量删除", notes="公共配置表-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.commonConfigService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "公共配置表-通过id查询")
@ApiOperation(value="公共配置表-通过id查询", notes="公共配置表-通过id查询")
@GetMapping(value = "/queryById")
public Result<CommonConfig> queryById(@RequestParam(name="id",required=true) String id) {
CommonConfig commonConfig = commonConfigService.getById(id);
if(commonConfig==null) {
return Result.error("未找到对应数据");
}
return Result.OK(commonConfig);
}
/**
* 导出excel
*
* @param request
* @param commonConfig
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, CommonConfig commonConfig) {
return super.exportXls(request, commonConfig, CommonConfig.class, "公共配置表");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, CommonConfig.class);
}
}

+ 67
- 0
module-common/src/main/java/org/jeecg/modules/commonConfig/entity/CommonConfig.java View File

@ -0,0 +1,67 @@
package org.jeecg.modules.commonConfig.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Description: 公共配置表
* @Author: jeecg-boot
* @Date: 2025-05-14
* @Version: V1.0
*/
@Data
@TableName("common_config")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="common_config对象", description="公共配置表")
public class CommonConfig implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private java.lang.String id;
/**创建人*/
@ApiModelProperty(value = "创建人")
private java.lang.String createBy;
/**创建日期*/
@ApiModelProperty(value = "创建日期")
private java.util.Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private java.lang.String updateBy;
/**更新日期*/
@ApiModelProperty(value = "更新日期")
private java.util.Date updateTime;
/**标识*/
@Excel(name = "标识", width = 15)
@ApiModelProperty(value = "标识")
private java.lang.String keyName;
/**说明*/
@Excel(name = "说明", width = 15)
@ApiModelProperty(value = "说明")
private java.lang.String keyValue;
/**内容*/
@Excel(name = "内容", width = 15)
@ApiModelProperty(value = "内容")
private java.lang.String keyContent;
/**类型*/
@Excel(name = "类型", width = 15, dicCode = "common_config_type")
@Dict(dicCode = "common_config_type")
@ApiModelProperty(value = "类型")
private java.lang.Integer type;
}

+ 17
- 0
module-common/src/main/java/org/jeecg/modules/commonConfig/mapper/CommonConfigMapper.java View File

@ -0,0 +1,17 @@
package org.jeecg.modules.commonConfig.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.commonConfig.entity.CommonConfig;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 公共配置表
* @Author: jeecg-boot
* @Date: 2025-05-14
* @Version: V1.0
*/
public interface CommonConfigMapper extends BaseMapper<CommonConfig> {
}

+ 5
- 0
module-common/src/main/java/org/jeecg/modules/commonConfig/mapper/xml/CommonConfigMapper.xml View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.commonConfig.mapper.CommonConfigMapper">
</mapper>

+ 14
- 0
module-common/src/main/java/org/jeecg/modules/commonConfig/service/ICommonConfigService.java View File

@ -0,0 +1,14 @@
package org.jeecg.modules.commonConfig.service;
import org.jeecg.modules.commonConfig.entity.CommonConfig;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: 公共配置表
* @Author: jeecg-boot
* @Date: 2025-05-14
* @Version: V1.0
*/
public interface ICommonConfigService extends IService<CommonConfig> {
}

+ 19
- 0
module-common/src/main/java/org/jeecg/modules/commonConfig/service/impl/CommonConfigServiceImpl.java View File

@ -0,0 +1,19 @@
package org.jeecg.modules.commonConfig.service.impl;
import org.jeecg.modules.commonConfig.entity.CommonConfig;
import org.jeecg.modules.commonConfig.mapper.CommonConfigMapper;
import org.jeecg.modules.commonConfig.service.ICommonConfigService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: 公共配置表
* @Author: jeecg-boot
* @Date: 2025-05-14
* @Version: V1.0
*/
@Service
public class CommonConfigServiceImpl extends ServiceImpl<CommonConfigMapper, CommonConfig> implements ICommonConfigService {
}

+ 190
- 0
module-common/src/main/java/org/jeecg/modules/commonConfig/vue/CommonConfigList.vue View File

@ -0,0 +1,190 @@
<template>
<a-card :bordered="false">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
</a-row>
</a-form>
</div>
<!-- 查询区域-END -->
<!-- 操作按钮区域 -->
<div class="table-operator">
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
<a-button type="primary" icon="download" @click="handleExportXls('公共配置表')">导出</a-button>
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
<a-button type="primary" icon="import">导入</a-button>
</a-upload>
<!-- 高级查询区域 -->
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
<a-dropdown v-if="selectedRowKeys.length > 0">
<a-menu slot="overlay">
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
</a-menu>
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
</a-dropdown>
</div>
<!-- table区域-begin -->
<div>
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
</div>
<a-table
ref="table"
size="middle"
:scroll="{x:true}"
bordered
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
class="j-table-force-nowrap"
@change="handleTableChange">
<template slot="htmlSlot" slot-scope="text">
<div v-html="text"></div>
</template>
<template slot="imgSlot" slot-scope="text,record">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
<img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
</template>
<template slot="fileSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button
v-else
:ghost="true"
type="primary"
icon="download"
size="small"
@click="downloadFile(text)">
下载
</a-button>
</template>
<span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">编辑</a>
<a-divider type="vertical" />
<a-dropdown>
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
<a-menu slot="overlay">
<a-menu-item>
<a @click="handleDetail(record)">详情</a>
</a-menu-item>
<a-menu-item>
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a>删除</a>
</a-popconfirm>
</a-menu-item>
</a-menu>
</a-dropdown>
</span>
</a-table>
</div>
<common-config-modal ref="modalForm" @ok="modalFormOk"></common-config-modal>
</a-card>
</template>
<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import CommonConfigModal from './modules/CommonConfigModal'
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
export default {
name: 'CommonConfigList',
mixins:[JeecgListMixin, mixinDevice],
components: {
CommonConfigModal
},
data () {
return {
description: '公共配置表管理页面',
//
columns: [
{
title: '#',
dataIndex: '',
key:'rowIndex',
width:60,
align:"center",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
{
title:'标识',
align:"center",
dataIndex: 'keyName'
},
{
title:'说明',
align:"center",
dataIndex: 'keyValue'
},
{
title:'内容',
align:"center",
dataIndex: 'keyContent'
},
{
title:'类型',
align:"center",
dataIndex: 'type_dictText'
},
{
title: '操作',
dataIndex: 'action',
align:"center",
fixed:"right",
width:147,
scopedSlots: { customRender: 'action' }
}
],
url: {
list: "/commonConfig/commonConfig/list",
delete: "/commonConfig/commonConfig/delete",
deleteBatch: "/commonConfig/commonConfig/deleteBatch",
exportXlsUrl: "/commonConfig/commonConfig/exportXls",
importExcelUrl: "commonConfig/commonConfig/importExcel",
},
dictOptions:{},
superFieldList:[],
}
},
created() {
this.getSuperFieldList();
},
computed: {
importExcelUrl: function(){
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
},
},
methods: {
initDictConfig(){
},
getSuperFieldList(){
let fieldList=[];
fieldList.push({type:'string',value:'keyName',text:'标识',dictCode:''})
fieldList.push({type:'Text',value:'keyValue',text:'说明',dictCode:''})
fieldList.push({type:'Text',value:'keyContent',text:'内容',dictCode:''})
fieldList.push({type:'int',value:'type',text:'类型',dictCode:'common_config_type'})
this.superFieldList = fieldList
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>

+ 119
- 0
module-common/src/main/java/org/jeecg/modules/commonConfig/vue/modules/CommonConfigForm.vue View File

@ -0,0 +1,119 @@
<template>
<a-spin :spinning="confirmLoading">
<j-form-container :disabled="formDisabled">
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
<a-row>
<a-col :span="24">
<a-form-model-item label="标识" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="keyName">
<a-input v-model="model.keyName" placeholder="请输入标识" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="说明" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="keyValue">
<a-input v-model="model.keyValue" placeholder="请输入说明" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="内容" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="keyContent">
<a-input v-model="model.keyContent" placeholder="请输入内容" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="type">
<j-dict-select-tag type="list" v-model="model.type" dictCode="common_config_type" placeholder="请选择类型" />
</a-form-model-item>
</a-col>
</a-row>
</a-form-model>
</j-form-container>
</a-spin>
</template>
<script>
import { httpAction, getAction } from '@/api/manage'
import { validateDuplicateValue } from '@/utils/util'
export default {
name: 'CommonConfigForm',
components: {
},
props: {
//
disabled: {
type: Boolean,
default: false,
required: false
}
},
data () {
return {
model:{
},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
confirmLoading: false,
validatorRules: {
},
url: {
add: "/commonConfig/commonConfig/add",
edit: "/commonConfig/commonConfig/edit",
queryById: "/commonConfig/commonConfig/queryById"
}
}
},
computed: {
formDisabled(){
return this.disabled
},
},
created () {
//model
this.modelDefault = JSON.parse(JSON.stringify(this.model));
},
methods: {
add () {
this.edit(this.modelDefault);
},
edit (record) {
this.model = Object.assign({}, record);
this.visible = true;
},
submitForm () {
const that = this;
//
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
if(!this.model.id){
httpurl+=this.url.add;
method = 'post';
}else{
httpurl+=this.url.edit;
method = 'put';
}
httpAction(httpurl,this.model,method).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.$emit('ok');
}else{
that.$message.warning(res.message);
}
}).finally(() => {
that.confirmLoading = false;
})
}
})
},
}
}
</script>

+ 84
- 0
module-common/src/main/java/org/jeecg/modules/commonConfig/vue/modules/CommonConfigModal.Style#Drawer.vue View File

@ -0,0 +1,84 @@
<template>
<a-drawer
:title="title"
:width="width"
placement="right"
:closable="false"
@close="close"
destroyOnClose
:visible="visible">
<common-config-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></common-config-form>
<div class="drawer-footer">
<a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button>
<a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button>
</div>
</a-drawer>
</template>
<script>
import CommonConfigForm from './CommonConfigForm'
export default {
name: 'CommonConfigModal',
components: {
CommonConfigForm
},
data () {
return {
title:"操作",
width:800,
visible: false,
disableSubmit: false
}
},
methods: {
add () {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.add();
})
},
edit (record) {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.edit(record);
});
},
close () {
this.$emit('close');
this.visible = false;
},
submitCallback(){
this.$emit('ok');
this.visible = false;
},
handleOk () {
this.$refs.realForm.submitForm();
},
handleCancel () {
this.close()
}
}
}
</script>
<style lang="less" scoped>
/** Button按钮间距 */
.ant-btn {
margin-left: 30px;
margin-bottom: 30px;
float: right;
}
.drawer-footer{
position: absolute;
bottom: -8px;
width: 100%;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
left: 0;
background: #fff;
border-radius: 0 0 2px 2px;
}
</style>

+ 60
- 0
module-common/src/main/java/org/jeecg/modules/commonConfig/vue/modules/CommonConfigModal.vue View File

@ -0,0 +1,60 @@
<template>
<j-modal
:title="title"
:width="width"
:visible="visible"
switchFullscreen
@ok="handleOk"
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
@cancel="handleCancel"
cancelText="关闭">
<common-config-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></common-config-form>
</j-modal>
</template>
<script>
import CommonConfigForm from './CommonConfigForm'
export default {
name: 'CommonConfigModal',
components: {
CommonConfigForm
},
data () {
return {
title:'',
width:800,
visible: false,
disableSubmit: false
}
},
methods: {
add () {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.add();
})
},
edit (record) {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.edit(record);
})
},
close () {
this.$emit('close');
this.visible = false;
},
handleOk () {
this.$refs.realForm.submitForm();
},
submitCallback(){
this.$emit('ok');
this.visible = false;
},
handleCancel () {
this.close()
}
}
}
</script>

+ 61
- 0
module-common/src/main/java/org/jeecg/modules/commonConfig/vue3/CommonConfig.api.ts View File

@ -0,0 +1,61 @@
import {defHttp} from '/@/utils/http/axios';
import {Modal} from 'ant-design-vue';
enum Api {
list = '/commonConfig/commonConfig/list',
save='/commonConfig/commonConfig/add',
edit='/commonConfig/commonConfig/edit',
deleteOne = '/commonConfig/commonConfig/delete',
deleteBatch = '/commonConfig/commonConfig/deleteBatch',
importExcel = '/commonConfig/commonConfig/importExcel',
exportXls = '/commonConfig/commonConfig/exportXls',
}
/**
* api
* @param params
*/
export const getExportUrl = Api.exportXls;
/**
* api
*/
export const getImportUrl = Api.importExcel;
/**
*
* @param params
*/
export const list = (params) =>
defHttp.get({url: Api.list, params});
/**
*
*/
export const deleteOne = (params,handleSuccess) => {
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
/**
*
* @param params
*/
export const batchDelete = (params, handleSuccess) => {
Modal.confirm({
title: '确认删除',
content: '是否删除选中数据',
okText: '确认',
cancelText: '取消',
onOk: () => {
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
});
}
/**
*
* @param params
*/
export const saveOrUpdate = (params, isUpdate) => {
let url = isUpdate ? Api.edit : Api.save;
return defHttp.post({url: url, params});
}

+ 56
- 0
module-common/src/main/java/org/jeecg/modules/commonConfig/vue3/CommonConfig.data.ts View File

@ -0,0 +1,56 @@
import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
{
title: '标识',
align:"center",
dataIndex: 'keyName'
},
{
title: '说明',
align:"center",
dataIndex: 'keyValue'
},
{
title: '内容',
align:"center",
dataIndex: 'keyContent'
},
{
title: '类型',
align:"center",
dataIndex: 'type_dictText'
},
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
{
label: '标识',
field: 'keyName',
component: 'Input',
},
{
label: '说明',
field: 'keyValue',
component: 'Input',
},
{
label: '内容',
field: 'keyContent',
component: 'Input',
},
{
label: '类型',
field: 'type',
component: 'JDictSelectTag',
componentProps:{
dictCode:"common_config_type"
},
},
];

+ 162
- 0
module-common/src/main/java/org/jeecg/modules/commonConfig/vue3/CommonConfigList.vue View File

@ -0,0 +1,162 @@
<template>
<div>
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-dropdown v-if="checkedKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete">
<Icon icon="ant-design:delete-outlined"></Icon>
删除
</a-menu-item>
</a-menu>
</template>
<a-button>批量操作
<Icon icon="mdi:chevron-down"></Icon>
</a-button>
</a-dropdown>
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>
</template>
<!--字段回显插槽-->
<template #htmlSlot="{text}">
<div v-html="text"></div>
</template>
<template #fileSlot="{text}">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button>
</template>
</BasicTable>
<!-- 表单区域 -->
<CommonConfigModal @register="registerModal" @success="handleSuccess"></CommonConfigModal>
</div>
</template>
<script lang="ts" name="commonConfig-commonConfig" setup>
import {ref, computed, unref} from 'vue';
import {BasicTable, useTable, TableAction} from '/@/components/Table';
import {useModal} from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage'
import CommonConfigModal from './components/CommonConfigModal.vue'
import {columns, searchFormSchema} from './commonConfig.data';
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './commonConfig.api';
const checkedKeys = ref<Array<string | number>>([]);
//model
const [registerModal, {openModal}] = useModal();
//table
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
tableProps:{
title: '公共配置表',
api: list,
columns,
canResize:false,
formConfig: {
labelWidth: 120,
schemas: searchFormSchema,
autoSubmitOnEnter:true,
showAdvancedButton:true,
fieldMapToTime: [
],
},
actionColumn: {
width: 120,
},
},
exportConfig: {
name:"公共配置表",
url: getExportUrl,
},
importConfig: {
url: getImportUrl
},
})
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext
/**
* 新增事件
*/
function handleAdd() {
openModal(true, {
isUpdate: false,
showFooter: true,
});
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: true,
});
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: false,
});
}
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({id: record.id}, reload);
}
/**
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ids: checkedKeys.value}, reload);
}
/**
* 成功回调
*/
function handleSuccess() {
reload();
}
/**
* 操作栏
*/
function getTableAction(record){
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
}
]
}
/**
* 下拉操作栏
*/
function getDropDownAction(record){
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
}, {
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
}
}
]
}
</script>
<style scoped>
</style>

+ 58
- 0
module-common/src/main/java/org/jeecg/modules/commonConfig/vue3/components/CommonConfigModal.vue View File

@ -0,0 +1,58 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" @ok="handleSubmit">
<BasicForm @register="registerForm"/>
</BasicModal>
</template>
<script lang="ts" setup>
import {ref, computed, unref} from 'vue';
import {BasicModal, useModalInner} from '/@/components/Modal';
import {BasicForm, useForm} from '/@/components/Form/index';
import {formSchema} from '../commonConfig.data';
import {saveOrUpdate} from '../commonConfig.api';
// Emits
const emit = defineEmits(['register','success']);
const isUpdate = ref(true);
//
const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({
labelWidth: 150,
schemas: formSchema,
showActionButtonGroup: false,
});
//
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
//
await resetFields();
setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter});
isUpdate.value = !!data?.isUpdate;
if (unref(isUpdate)) {
//
await setFieldsValue({
...data.record,
});
}
//
setProps({ disabled: !data?.showFooter })
});
//
const title = computed(() => (!unref(isUpdate) ? '新增' : '编辑'));
//
async function handleSubmit(v) {
try {
let values = await validate();
setModalProps({confirmLoading: true});
//
await saveOrUpdate(values, isUpdate.value);
//
closeModal();
//
emit('success');
} finally {
setModalProps({confirmLoading: false});
}
}
</script>
<style lang="less" scoped>
</style>

+ 171
- 0
module-common/src/main/java/org/jeecg/modules/commonNotice/controller/CommonNoticeController.java View File

@ -0,0 +1,171 @@
package org.jeecg.modules.commonNotice.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.commonNotice.entity.CommonNotice;
import org.jeecg.modules.commonNotice.service.ICommonNoticeService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
/**
* @Description: 公告
* @Author: jeecg-boot
* @Date: 2025-05-14
* @Version: V1.0
*/
@Api(tags="公告")
@RestController
@RequestMapping("/commonNotice/commonNotice")
@Slf4j
public class CommonNoticeController extends JeecgController<CommonNotice, ICommonNoticeService> {
@Autowired
private ICommonNoticeService commonNoticeService;
/**
* 分页列表查询
*
* @param commonNotice
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@AutoLog(value = "公告-分页列表查询")
@ApiOperation(value="公告-分页列表查询", notes="公告-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<CommonNotice>> queryPageList(CommonNotice commonNotice,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<CommonNotice> queryWrapper = QueryGenerator.initQueryWrapper(commonNotice, req.getParameterMap());
Page<CommonNotice> page = new Page<CommonNotice>(pageNo, pageSize);
IPage<CommonNotice> pageList = commonNoticeService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
* @param commonNotice
* @return
*/
@AutoLog(value = "公告-添加")
@ApiOperation(value="公告-添加", notes="公告-添加")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody CommonNotice commonNotice) {
commonNoticeService.save(commonNotice);
return Result.OK("添加成功!");
}
/**
* 编辑
*
* @param commonNotice
* @return
*/
@AutoLog(value = "公告-编辑")
@ApiOperation(value="公告-编辑", notes="公告-编辑")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
public Result<String> edit(@RequestBody CommonNotice commonNotice) {
commonNoticeService.updateById(commonNotice);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "公告-通过id删除")
@ApiOperation(value="公告-通过id删除", notes="公告-通过id删除")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
commonNoticeService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "公告-批量删除")
@ApiOperation(value="公告-批量删除", notes="公告-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.commonNoticeService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
* @param id
* @return
*/
//@AutoLog(value = "公告-通过id查询")
@ApiOperation(value="公告-通过id查询", notes="公告-通过id查询")
@GetMapping(value = "/queryById")
public Result<CommonNotice> queryById(@RequestParam(name="id",required=true) String id) {
CommonNotice commonNotice = commonNoticeService.getById(id);
if(commonNotice==null) {
return Result.error("未找到对应数据");
}
return Result.OK(commonNotice);
}
/**
* 导出excel
*
* @param request
* @param commonNotice
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, CommonNotice commonNotice) {
return super.exportXls(request, commonNotice, CommonNotice.class, "公告");
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, CommonNotice.class);
}
}

+ 66
- 0
module-common/src/main/java/org/jeecg/modules/commonNotice/entity/CommonNotice.java View File

@ -0,0 +1,66 @@
package org.jeecg.modules.commonNotice.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Description: 公告
* @Author: jeecg-boot
* @Date: 2025-05-14
* @Version: V1.0
*/
@Data
@TableName("common_notice")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="common_notice对象", description="公告")
public class CommonNotice implements Serializable {
private static final long serialVersionUID = 1L;
/**主键*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private java.lang.String id;
/**创建人*/
@ApiModelProperty(value = "创建人")
private java.lang.String createBy;
/**创建日期*/
@ApiModelProperty(value = "创建日期")
private java.util.Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private java.lang.String updateBy;
/**更新日期*/
@ApiModelProperty(value = "更新日期")
private java.util.Date updateTime;
/**公告图标*/
@Excel(name = "公告图标", width = 15)
@ApiModelProperty(value = "公告图标")
private java.lang.String icon;
/**公告标题*/
@Excel(name = "公告标题", width = 15)
@ApiModelProperty(value = "公告标题")
private java.lang.String title;
/**公告小标题*/
@Excel(name = "公告小标题", width = 15)
@ApiModelProperty(value = "公告小标题")
private java.lang.String titleText;
/**公共内容*/
@Excel(name = "公共内容", width = 15)
@ApiModelProperty(value = "公共内容")
private java.lang.String details;
}

+ 17
- 0
module-common/src/main/java/org/jeecg/modules/commonNotice/mapper/CommonNoticeMapper.java View File

@ -0,0 +1,17 @@
package org.jeecg.modules.commonNotice.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.commonNotice.entity.CommonNotice;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 公告
* @Author: jeecg-boot
* @Date: 2025-05-14
* @Version: V1.0
*/
public interface CommonNoticeMapper extends BaseMapper<CommonNotice> {
}

+ 5
- 0
module-common/src/main/java/org/jeecg/modules/commonNotice/mapper/xml/CommonNoticeMapper.xml View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.commonNotice.mapper.CommonNoticeMapper">
</mapper>

+ 14
- 0
module-common/src/main/java/org/jeecg/modules/commonNotice/service/ICommonNoticeService.java View File

@ -0,0 +1,14 @@
package org.jeecg.modules.commonNotice.service;
import org.jeecg.modules.commonNotice.entity.CommonNotice;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: 公告
* @Author: jeecg-boot
* @Date: 2025-05-14
* @Version: V1.0
*/
public interface ICommonNoticeService extends IService<CommonNotice> {
}

+ 19
- 0
module-common/src/main/java/org/jeecg/modules/commonNotice/service/impl/CommonNoticeServiceImpl.java View File

@ -0,0 +1,19 @@
package org.jeecg.modules.commonNotice.service.impl;
import org.jeecg.modules.commonNotice.entity.CommonNotice;
import org.jeecg.modules.commonNotice.mapper.CommonNoticeMapper;
import org.jeecg.modules.commonNotice.service.ICommonNoticeService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: 公告
* @Author: jeecg-boot
* @Date: 2025-05-14
* @Version: V1.0
*/
@Service
public class CommonNoticeServiceImpl extends ServiceImpl<CommonNoticeMapper, CommonNotice> implements ICommonNoticeService {
}

+ 197
- 0
module-common/src/main/java/org/jeecg/modules/commonNotice/vue/CommonNoticeList.vue View File

@ -0,0 +1,197 @@
<template>
<a-card :bordered="false">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
</a-row>
</a-form>
</div>
<!-- 查询区域-END -->
<!-- 操作按钮区域 -->
<div class="table-operator">
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
<a-button type="primary" icon="download" @click="handleExportXls('公告')">导出</a-button>
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
<a-button type="primary" icon="import">导入</a-button>
</a-upload>
<!-- 高级查询区域 -->
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
<a-dropdown v-if="selectedRowKeys.length > 0">
<a-menu slot="overlay">
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
</a-menu>
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
</a-dropdown>
</div>
<!-- table区域-begin -->
<div>
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
</div>
<a-table
ref="table"
size="middle"
:scroll="{x:true}"
bordered
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
class="j-table-force-nowrap"
@change="handleTableChange">
<template slot="htmlSlot" slot-scope="text">
<div v-html="text"></div>
</template>
<template slot="imgSlot" slot-scope="text,record">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
<img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
</template>
<template slot="fileSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button
v-else
:ghost="true"
type="primary"
icon="download"
size="small"
@click="downloadFile(text)">
下载
</a-button>
</template>
<span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">编辑</a>
<a-divider type="vertical" />
<a-dropdown>
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
<a-menu slot="overlay">
<a-menu-item>
<a @click="handleDetail(record)">详情</a>
</a-menu-item>
<a-menu-item>
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a>删除</a>
</a-popconfirm>
</a-menu-item>
</a-menu>
</a-dropdown>
</span>
</a-table>
</div>
<common-notice-modal ref="modalForm" @ok="modalFormOk"></common-notice-modal>
</a-card>
</template>
<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import CommonNoticeModal from './modules/CommonNoticeModal'
export default {
name: 'CommonNoticeList',
mixins:[JeecgListMixin, mixinDevice],
components: {
CommonNoticeModal
},
data () {
return {
description: '公告管理页面',
//
columns: [
{
title: '#',
dataIndex: '',
key:'rowIndex',
width:60,
align:"center",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
{
title:'创建日期',
align:"center",
dataIndex: 'createTime'
},
{
title:'公告图标',
align:"center",
dataIndex: 'icon',
scopedSlots: {customRender: 'imgSlot'}
},
{
title:'公告标题',
align:"center",
dataIndex: 'title'
},
{
title:'公告小标题',
align:"center",
dataIndex: 'titleText'
},
{
title:'公共内容',
align:"center",
dataIndex: 'details',
scopedSlots: {customRender: 'htmlSlot'}
},
{
title: '操作',
dataIndex: 'action',
align:"center",
fixed:"right",
width:147,
scopedSlots: { customRender: 'action' }
}
],
url: {
list: "/commonNotice/commonNotice/list",
delete: "/commonNotice/commonNotice/delete",
deleteBatch: "/commonNotice/commonNotice/deleteBatch",
exportXlsUrl: "/commonNotice/commonNotice/exportXls",
importExcelUrl: "commonNotice/commonNotice/importExcel",
},
dictOptions:{},
superFieldList:[],
}
},
created() {
this.getSuperFieldList();
},
computed: {
importExcelUrl: function(){
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
},
},
methods: {
initDictConfig(){
},
getSuperFieldList(){
let fieldList=[];
fieldList.push({type:'datetime',value:'createTime',text:'创建日期'})
fieldList.push({type:'Text',value:'icon',text:'公告图标',dictCode:''})
fieldList.push({type:'string',value:'title',text:'公告标题',dictCode:''})
fieldList.push({type:'Text',value:'titleText',text:'公告小标题',dictCode:''})
fieldList.push({type:'Text',value:'details',text:'公共内容',dictCode:''})
this.superFieldList = fieldList
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>

+ 119
- 0
module-common/src/main/java/org/jeecg/modules/commonNotice/vue/modules/CommonNoticeForm.vue View File

@ -0,0 +1,119 @@
<template>
<a-spin :spinning="confirmLoading">
<j-form-container :disabled="formDisabled">
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
<a-row>
<a-col :span="24">
<a-form-model-item label="公告图标" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="icon">
<j-image-upload isMultiple v-model="model.icon" ></j-image-upload>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="公告标题" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="title">
<a-input v-model="model.title" placeholder="请输入公告标题" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="公告小标题" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="titleText">
<a-textarea v-model="model.titleText" rows="4" placeholder="请输入公告小标题" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="公共内容" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="details">
<j-editor v-model="model.details" />
</a-form-model-item>
</a-col>
</a-row>
</a-form-model>
</j-form-container>
</a-spin>
</template>
<script>
import { httpAction, getAction } from '@/api/manage'
import { validateDuplicateValue } from '@/utils/util'
export default {
name: 'CommonNoticeForm',
components: {
},
props: {
//
disabled: {
type: Boolean,
default: false,
required: false
}
},
data () {
return {
model:{
},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
confirmLoading: false,
validatorRules: {
},
url: {
add: "/commonNotice/commonNotice/add",
edit: "/commonNotice/commonNotice/edit",
queryById: "/commonNotice/commonNotice/queryById"
}
}
},
computed: {
formDisabled(){
return this.disabled
},
},
created () {
//model
this.modelDefault = JSON.parse(JSON.stringify(this.model));
},
methods: {
add () {
this.edit(this.modelDefault);
},
edit (record) {
this.model = Object.assign({}, record);
this.visible = true;
},
submitForm () {
const that = this;
//
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
if(!this.model.id){
httpurl+=this.url.add;
method = 'post';
}else{
httpurl+=this.url.edit;
method = 'put';
}
httpAction(httpurl,this.model,method).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.$emit('ok');
}else{
that.$message.warning(res.message);
}
}).finally(() => {
that.confirmLoading = false;
})
}
})
},
}
}
</script>

+ 84
- 0
module-common/src/main/java/org/jeecg/modules/commonNotice/vue/modules/CommonNoticeModal.Style#Drawer.vue View File

@ -0,0 +1,84 @@
<template>
<a-drawer
:title="title"
:width="width"
placement="right"
:closable="false"
@close="close"
destroyOnClose
:visible="visible">
<common-notice-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></common-notice-form>
<div class="drawer-footer">
<a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button>
<a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button>
</div>
</a-drawer>
</template>
<script>
import CommonNoticeForm from './CommonNoticeForm'
export default {
name: 'CommonNoticeModal',
components: {
CommonNoticeForm
},
data () {
return {
title:"操作",
width:800,
visible: false,
disableSubmit: false
}
},
methods: {
add () {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.add();
})
},
edit (record) {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.edit(record);
});
},
close () {
this.$emit('close');
this.visible = false;
},
submitCallback(){
this.$emit('ok');
this.visible = false;
},
handleOk () {
this.$refs.realForm.submitForm();
},
handleCancel () {
this.close()
}
}
}
</script>
<style lang="less" scoped>
/** Button按钮间距 */
.ant-btn {
margin-left: 30px;
margin-bottom: 30px;
float: right;
}
.drawer-footer{
position: absolute;
bottom: -8px;
width: 100%;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
left: 0;
background: #fff;
border-radius: 0 0 2px 2px;
}
</style>

+ 60
- 0
module-common/src/main/java/org/jeecg/modules/commonNotice/vue/modules/CommonNoticeModal.vue View File

@ -0,0 +1,60 @@
<template>
<j-modal
:title="title"
:width="width"
:visible="visible"
switchFullscreen
@ok="handleOk"
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
@cancel="handleCancel"
cancelText="关闭">
<common-notice-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></common-notice-form>
</j-modal>
</template>
<script>
import CommonNoticeForm from './CommonNoticeForm'
export default {
name: 'CommonNoticeModal',
components: {
CommonNoticeForm
},
data () {
return {
title:'',
width:800,
visible: false,
disableSubmit: false
}
},
methods: {
add () {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.add();
})
},
edit (record) {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.edit(record);
})
},
close () {
this.$emit('close');
this.visible = false;
},
handleOk () {
this.$refs.realForm.submitForm();
},
submitCallback(){
this.$emit('ok');
this.visible = false;
},
handleCancel () {
this.close()
}
}
}
</script>

+ 61
- 0
module-common/src/main/java/org/jeecg/modules/commonNotice/vue3/CommonNotice.api.ts View File

@ -0,0 +1,61 @@
import {defHttp} from '/@/utils/http/axios';
import {Modal} from 'ant-design-vue';
enum Api {
list = '/commonNotice/commonNotice/list',
save='/commonNotice/commonNotice/add',
edit='/commonNotice/commonNotice/edit',
deleteOne = '/commonNotice/commonNotice/delete',
deleteBatch = '/commonNotice/commonNotice/deleteBatch',
importExcel = '/commonNotice/commonNotice/importExcel',
exportXls = '/commonNotice/commonNotice/exportXls',
}
/**
* api
* @param params
*/
export const getExportUrl = Api.exportXls;
/**
* api
*/
export const getImportUrl = Api.importExcel;
/**
*
* @param params
*/
export const list = (params) =>
defHttp.get({url: Api.list, params});
/**
*
*/
export const deleteOne = (params,handleSuccess) => {
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
/**
*
* @param params
*/
export const batchDelete = (params, handleSuccess) => {
Modal.confirm({
title: '确认删除',
content: '是否删除选中数据',
okText: '确认',
cancelText: '取消',
onOk: () => {
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
});
}
/**
*
* @param params
*/
export const saveOrUpdate = (params, isUpdate) => {
let url = isUpdate ? Api.edit : Api.save;
return defHttp.post({url: url, params});
}

+ 62
- 0
module-common/src/main/java/org/jeecg/modules/commonNotice/vue3/CommonNotice.data.ts View File

@ -0,0 +1,62 @@
import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
{
title: '创建日期',
align:"center",
dataIndex: 'createTime'
},
{
title: '公告图标',
align:"center",
dataIndex: 'icon',
customRender:render.renderAvatar,
},
{
title: '公告标题',
align:"center",
dataIndex: 'title'
},
{
title: '公告小标题',
align:"center",
dataIndex: 'titleText'
},
{
title: '公共内容',
align:"center",
dataIndex: 'details',
slots: { customRender: 'htmlSlot' },
},
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
{
label: '公告图标',
field: 'icon',
component: 'JImageUpload',
componentProps:{
},
},
{
label: '公告标题',
field: 'title',
component: 'Input',
},
{
label: '公告小标题',
field: 'titleText',
component: 'InputTextArea',//TODO 注意string转换问题
},
{
label: '公共内容',
field: 'details',
component: 'JCodeEditor', //TODO String后缀暂未添加
},
];

+ 162
- 0
module-common/src/main/java/org/jeecg/modules/commonNotice/vue3/CommonNoticeList.vue View File

@ -0,0 +1,162 @@
<template>
<div>
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-dropdown v-if="checkedKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete">
<Icon icon="ant-design:delete-outlined"></Icon>
删除
</a-menu-item>
</a-menu>
</template>
<a-button>批量操作
<Icon icon="mdi:chevron-down"></Icon>
</a-button>
</a-dropdown>
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>
</template>
<!--字段回显插槽-->
<template #htmlSlot="{text}">
<div v-html="text"></div>
</template>
<template #fileSlot="{text}">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button>
</template>
</BasicTable>
<!-- 表单区域 -->
<CommonNoticeModal @register="registerModal" @success="handleSuccess"></CommonNoticeModal>
</div>
</template>
<script lang="ts" name="commonNotice-commonNotice" setup>
import {ref, computed, unref} from 'vue';
import {BasicTable, useTable, TableAction} from '/@/components/Table';
import {useModal} from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage'
import CommonNoticeModal from './components/CommonNoticeModal.vue'
import {columns, searchFormSchema} from './commonNotice.data';
import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './commonNotice.api';
const checkedKeys = ref<Array<string | number>>([]);
//model
const [registerModal, {openModal}] = useModal();
//table
const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
tableProps:{
title: '公告',
api: list,
columns,
canResize:false,
formConfig: {
labelWidth: 120,
schemas: searchFormSchema,
autoSubmitOnEnter:true,
showAdvancedButton:true,
fieldMapToTime: [
],
},
actionColumn: {
width: 120,
},
},
exportConfig: {
name:"公告",
url: getExportUrl,
},
importConfig: {
url: getImportUrl
},
})
const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext
/**
* 新增事件
*/
function handleAdd() {
openModal(true, {
isUpdate: false,
showFooter: true,
});
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: true,
});
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
showFooter: false,
});
}
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({id: record.id}, reload);
}
/**
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ids: checkedKeys.value}, reload);
}
/**
* 成功回调
*/
function handleSuccess() {
reload();
}
/**
* 操作栏
*/
function getTableAction(record){
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
}
]
}
/**
* 下拉操作栏
*/
function getDropDownAction(record){
return [
{
label: '详情',
onClick: handleDetail.bind(null, record),
}, {
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
}
}
]
}
</script>
<style scoped>
</style>

+ 58
- 0
module-common/src/main/java/org/jeecg/modules/commonNotice/vue3/components/CommonNoticeModal.vue View File

@ -0,0 +1,58 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" @ok="handleSubmit">
<BasicForm @register="registerForm"/>
</BasicModal>
</template>
<script lang="ts" setup>
import {ref, computed, unref} from 'vue';
import {BasicModal, useModalInner} from '/@/components/Modal';
import {BasicForm, useForm} from '/@/components/Form/index';
import {formSchema} from '../commonNotice.data';
import {saveOrUpdate} from '../commonNotice.api';
// Emits
const emit = defineEmits(['register','success']);
const isUpdate = ref(true);
//
const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({
labelWidth: 150,
schemas: formSchema,
showActionButtonGroup: false,
});
//
const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
//
await resetFields();
setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter});
isUpdate.value = !!data?.isUpdate;
if (unref(isUpdate)) {
//
await setFieldsValue({
...data.record,
});
}
//
setProps({ disabled: !data?.showFooter })
});
//
const title = computed(() => (!unref(isUpdate) ? '新增' : '编辑'));
//
async function handleSubmit(v) {
try {
let values = await validate();
setModalProps({confirmLoading: true});
//
await saveOrUpdate(values, isUpdate.value);
//
closeModal();
//
emit('success');
} finally {
setModalProps({confirmLoading: false});
}
}
</script>
<style lang="less" scoped>
</style>

Loading…
Cancel
Save