新增小程序cms_mp表及模块
This commit is contained in:
@@ -1,121 +1,311 @@
|
|||||||
package com.gxwebsoft.cms.controller;
|
package com.gxwebsoft.cms.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateField;
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.http.HttpRequest;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
import com.gxwebsoft.cms.entity.*;
|
||||||
|
import com.gxwebsoft.cms.param.MpMenuParam;
|
||||||
|
import com.gxwebsoft.cms.param.NavigationParam;
|
||||||
|
import com.gxwebsoft.cms.param.WebsiteParam;
|
||||||
|
import com.gxwebsoft.cms.service.*;
|
||||||
|
import com.gxwebsoft.common.core.exception.BusinessException;
|
||||||
|
import com.gxwebsoft.common.core.security.JwtUtil;
|
||||||
|
import com.gxwebsoft.common.core.utils.RedisUtil;
|
||||||
import com.gxwebsoft.common.core.web.BaseController;
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
import com.gxwebsoft.cms.service.MpService;
|
|
||||||
import com.gxwebsoft.cms.entity.Mp;
|
|
||||||
import com.gxwebsoft.cms.param.MpParam;
|
import com.gxwebsoft.cms.param.MpParam;
|
||||||
import com.gxwebsoft.common.core.web.ApiResult;
|
import com.gxwebsoft.common.core.web.ApiResult;
|
||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
import com.gxwebsoft.common.core.web.PageParam;
|
import com.gxwebsoft.common.core.web.PageParam;
|
||||||
import com.gxwebsoft.common.core.web.BatchParam;
|
import com.gxwebsoft.common.core.web.BatchParam;
|
||||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||||
|
import com.gxwebsoft.common.system.entity.Dict;
|
||||||
|
import com.gxwebsoft.common.system.entity.DictData;
|
||||||
import com.gxwebsoft.common.system.entity.User;
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
|
import com.gxwebsoft.oa.entity.Company;
|
||||||
|
import com.gxwebsoft.oa.param.LinkParam;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.apache.ibatis.jdbc.Null;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static com.gxwebsoft.common.core.utils.CommonUtil.toTreeData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 小程序信息控制器
|
* 小程序信息控制器
|
||||||
*
|
*
|
||||||
* @author 科技小王子
|
* @author 科技小王子
|
||||||
* @since 2024-07-21 22:18:08
|
* @since 2024-07-21 23:03:05
|
||||||
*/
|
*/
|
||||||
@Api(tags = "小程序信息管理")
|
@Api(tags = "小程序信息管理")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/cms/mp")
|
@RequestMapping("/api/cms/mp")
|
||||||
public class MpController extends BaseController {
|
public class MpController extends BaseController {
|
||||||
@Resource
|
@Resource
|
||||||
private MpService mpService;
|
private MpService mpService;
|
||||||
|
@Resource
|
||||||
|
private MpPagesService mpPagesService;
|
||||||
|
@Resource
|
||||||
|
private AdService adService;
|
||||||
|
@Resource
|
||||||
|
private MpMenuService mpMenuService;
|
||||||
|
@Resource
|
||||||
|
private MpFieldService mpFieldService;
|
||||||
|
@Resource
|
||||||
|
private RedisUtil redisUtil;
|
||||||
|
|
||||||
@ApiOperation("分页查询小程序信息")
|
@ApiOperation("获取小程序信息")
|
||||||
@GetMapping("/page")
|
@GetMapping("/getMpInfo")
|
||||||
public ApiResult<PageResult<Mp>> page(MpParam param) {
|
public ApiResult<?> getMpInfo() {
|
||||||
// 使用关联查询
|
final Integer tenantId = getTenantId();
|
||||||
return success(mpService.pageRel(param));
|
String key = "MpInfo:" + tenantId;
|
||||||
|
final String mpInfo = redisUtil.get(key);
|
||||||
|
|
||||||
|
if (tenantId.equals(0)) {
|
||||||
|
return fail("租户ID不存在", null);
|
||||||
|
}
|
||||||
|
// 从缓存读取信息
|
||||||
|
if (StrUtil.isNotBlank(mpInfo)) {
|
||||||
|
// return success(JSONObject.parseObject(siteInfo,Website.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("查询全部小程序信息")
|
// 获取小程序信息
|
||||||
@GetMapping()
|
if (mpService.count(new LambdaUpdateWrapper<Mp>().eq(Mp::getDeleted,0)) == 0) {
|
||||||
public ApiResult<List<Mp>> list(MpParam param) {
|
// 创建小程序
|
||||||
// 使用关联查询
|
createMp();
|
||||||
return success(mpService.listRel(param));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('cms:mp:list')")
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
@ApiOperation("根据id查询小程序信息")
|
|
||||||
@GetMapping("/{id}")
|
// 获取小程序信息
|
||||||
public ApiResult<Mp> get(@PathVariable("id") Integer id) {
|
final Mp mp = mpService.getOne(new LambdaQueryWrapper<Mp>().eq(Mp::getTenantId, tenantId).last("limit 1"));
|
||||||
// 使用关联查询
|
map.put("mp", mp);
|
||||||
return success(mpService.getByIdRel(id));
|
|
||||||
|
// 原生导航条
|
||||||
|
final List<MpPages> tabBar = mpPagesService.list(new LambdaQueryWrapper<MpPages>().eq(MpPages::getSubpackage, "MainPackage").last("limit 5"));
|
||||||
|
map.put("tabBar", tabBar);
|
||||||
|
|
||||||
|
// 读取幻灯片广告
|
||||||
|
final List<Ad> list = adService.list(new LambdaQueryWrapper<Ad>().eq(Ad::getAdType, "幻灯片"));
|
||||||
|
if (!CollectionUtils.isEmpty(list)) {
|
||||||
|
map.put("slide", list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('cms:mp:save')")
|
// 小程序端导航图标
|
||||||
@ApiOperation("添加小程序信息")
|
final List<MpMenu> mpMenus = mpMenuService.list(new LambdaQueryWrapper<MpMenu>().isNotNull(MpMenu::getGroupName));
|
||||||
@PostMapping()
|
if (!CollectionUtils.isEmpty(mpMenus)) {
|
||||||
public ApiResult<?> save(@RequestBody Mp mp) {
|
final Map<String, List<MpMenu>> mpMenuMap = mpMenus.stream().collect(Collectors.groupingBy(MpMenu::getGroupName));
|
||||||
// 记录当前登录用户id
|
map.put("mpMenus", mpMenuMap);
|
||||||
User loginUser = getLoginUser();
|
|
||||||
if (loginUser != null) {
|
|
||||||
mp.setUserId(loginUser.getUserId());
|
|
||||||
}
|
|
||||||
if (mpService.save(mp)) {
|
|
||||||
return success("添加成功");
|
|
||||||
}
|
|
||||||
return fail("添加失败");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('cms:mp:update')")
|
// 配置信息
|
||||||
@ApiOperation("修改小程序信息")
|
HashMap<String, Object> config = new HashMap<>();
|
||||||
@PutMapping()
|
config.put("LICENSE_CODE", "");
|
||||||
public ApiResult<?> update(@RequestBody Mp mp) {
|
config.put("MAP_KEY", "");
|
||||||
if (mpService.updateById(mp)) {
|
final List<MpField> fields = mpFieldService.list();
|
||||||
return success("修改成功");
|
fields.forEach(d -> {
|
||||||
}
|
config.put(d.getName(), d.getValue());
|
||||||
return fail("修改失败");
|
});
|
||||||
}
|
map.put("config", config);
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('cms:mp:remove')")
|
// 服务器时间
|
||||||
@ApiOperation("删除小程序信息")
|
HashMap<String, Object> serverTime = new HashMap<>();
|
||||||
@DeleteMapping("/{id}")
|
// 今天日期
|
||||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
DateTime date = DateUtil.date();
|
||||||
if (mpService.removeById(id)) {
|
String today = DateUtil.today();
|
||||||
return success("删除成功");
|
// 明天日期
|
||||||
}
|
final DateTime dateTime = DateUtil.tomorrow();
|
||||||
return fail("删除失败");
|
String tomorrow = DateUtil.format(dateTime, "yyyy-MM-dd");
|
||||||
}
|
// 后天日期
|
||||||
|
final DateTime dateTime2 = DateUtil.offsetDay(date, 2);
|
||||||
|
final String afterDay = DateUtil.format(dateTime2, "yyyy-MM-dd");
|
||||||
|
// 今天星期几
|
||||||
|
final int week = DateUtil.thisDayOfWeek();
|
||||||
|
final DateTime nextWeek = DateUtil.nextWeek();
|
||||||
|
serverTime.put("now", DateUtil.now()); // 2024-07-18 22:06:36
|
||||||
|
serverTime.put("today", today); // 2024-07-18
|
||||||
|
serverTime.put("tomorrow", tomorrow); // 2024-07-19
|
||||||
|
serverTime.put("afterDay", afterDay); // 2024-07-20
|
||||||
|
serverTime.put("nextWeek", nextWeek); // 2024-07-25 22:06:36
|
||||||
|
serverTime.put("week", week); // 5
|
||||||
|
map.put("serverTime",serverTime);
|
||||||
|
redisUtil.set(key, map, 1L, TimeUnit.DAYS);
|
||||||
|
return success(map);
|
||||||
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('cms:mp:save')")
|
private void createMp() {
|
||||||
@ApiOperation("批量添加小程序信息")
|
System.out.println("创建小程序 = ");
|
||||||
@PostMapping("/batch")
|
final User loginUser = getLoginUser();
|
||||||
public ApiResult<?> saveBatch(@RequestBody List<Mp> list) {
|
final Integer tenantId = getTenantId();
|
||||||
if (mpService.saveBatch(list)) {
|
// 创建网站记录
|
||||||
return success("添加成功");
|
final Mp mp = new Mp();
|
||||||
}
|
mp.setTenantId(tenantId);
|
||||||
return fail("添加失败");
|
mp.setAppId("小程序ID");
|
||||||
|
mp.setMpName("小程序名称");
|
||||||
|
mp.setMainPath("/pages/index");
|
||||||
|
if (loginUser != null) {
|
||||||
|
mp.setUserId(getLoginUserId());
|
||||||
}
|
}
|
||||||
|
mp.setExpirationTime(DateUtil.offset(DateUtil.date(), DateField.YEAR, 1));
|
||||||
|
mpService.save(mp);
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('cms:mp:update')")
|
// 创建底部导航栏
|
||||||
@ApiOperation("批量修改小程序信息")
|
final MpPages mpPages = new MpPages();
|
||||||
@PutMapping("/batch")
|
mpPages.setHome(1);
|
||||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<Mp> batchParam) {
|
mpPages.setTitle("首页");
|
||||||
if (batchParam.update(mpService, "mp_id")) {
|
mpPages.setPath("/pages/index");
|
||||||
return success("修改成功");
|
mpPages.setSubpackage("MainPackage");
|
||||||
}
|
mpPages.setIcon("HomeOutlined");
|
||||||
return fail("修改失败");
|
mpPages.setSortNumber(0);
|
||||||
}
|
mpPages.setTenantId(tenantId);
|
||||||
|
mpPagesService.save(mpPages);
|
||||||
|
mpPages.setHome(0);
|
||||||
|
mpPages.setTitle("分类");
|
||||||
|
mpPages.setPath("/pages/category");
|
||||||
|
mpPages.setSubpackage("MainPackage");
|
||||||
|
mpPages.setIcon("AppstoreOutlined");
|
||||||
|
mpPages.setSortNumber(0);
|
||||||
|
mpPagesService.save(mpPages);
|
||||||
|
mpPages.setTitle("购物车");
|
||||||
|
mpPages.setPath("/pages/category");
|
||||||
|
mpPages.setSubpackage("MainPackage");
|
||||||
|
mpPages.setIcon("ShoppingCartOutlined");
|
||||||
|
mpPages.setSortNumber(0);
|
||||||
|
mpPagesService.save(mpPages);
|
||||||
|
mpPages.setTitle("我的");
|
||||||
|
mpPages.setPath("/pages/user");
|
||||||
|
mpPages.setSubpackage("MainPackage");
|
||||||
|
mpPages.setIcon("UserOutlined");
|
||||||
|
mpPages.setSortNumber(0);
|
||||||
|
mpPagesService.save(mpPages);
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('cms:mp:remove')")
|
// 创建导航图标
|
||||||
@ApiOperation("批量删除小程序信息")
|
final MpMenu mpMenu = new MpMenu();
|
||||||
@DeleteMapping("/batch")
|
mpMenu.setTenantId(tenantId);
|
||||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
mpMenu.setTitle("分类1");
|
||||||
if (mpService.removeByIds(ids)) {
|
mpMenu.setIcon("PictureOutlined");
|
||||||
return success("删除成功");
|
mpMenu.setPath("/package/order");
|
||||||
}
|
mpMenu.setTarget("uni.navigateTo");
|
||||||
return fail("删除失败");
|
mpMenuService.save(mpMenu);
|
||||||
|
mpMenu.setTitle("分类2");
|
||||||
|
mpMenu.setIcon("PictureOutlined");
|
||||||
|
mpMenu.setPath("/package/order");
|
||||||
|
mpMenuService.save(mpMenu);
|
||||||
|
mpMenu.setTitle("分类3");
|
||||||
|
mpMenu.setIcon("PictureOutlined");
|
||||||
|
mpMenu.setPath("/package/order");
|
||||||
|
mpMenuService.save(mpMenu);
|
||||||
|
mpMenu.setTitle("分类4");
|
||||||
|
mpMenu.setIcon("PictureOutlined");
|
||||||
|
mpMenu.setPath("/package/order");
|
||||||
|
mpMenuService.save(mpMenu);
|
||||||
|
|
||||||
|
// 小程序配置信息
|
||||||
|
MpField field = new MpField();
|
||||||
|
field.setName("mpLogo");
|
||||||
|
mpFieldService.save(field);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("分页查询小程序信息")
|
||||||
|
@GetMapping("/page")
|
||||||
|
public ApiResult<PageResult<Mp>> page(MpParam param) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(mpService.pageRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("查询全部小程序信息")
|
||||||
|
@GetMapping()
|
||||||
|
public ApiResult<List<Mp>> list(MpParam param) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(mpService.listRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('cms:mp:list')")
|
||||||
|
@ApiOperation("根据id查询小程序信息")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public ApiResult<Mp> get(@PathVariable("id") Integer id) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(mpService.getByIdRel(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('cms:mp:save')")
|
||||||
|
@ApiOperation("添加小程序信息")
|
||||||
|
@PostMapping()
|
||||||
|
public ApiResult<?> save(@RequestBody Mp mp) {
|
||||||
|
// 记录当前登录用户id
|
||||||
|
User loginUser = getLoginUser();
|
||||||
|
if (loginUser != null) {
|
||||||
|
mp.setUserId(loginUser.getUserId());
|
||||||
}
|
}
|
||||||
|
if (mpService.save(mp)) {
|
||||||
|
return success("添加成功");
|
||||||
|
}
|
||||||
|
return fail("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('cms:mp:update')")
|
||||||
|
@ApiOperation("修改小程序信息")
|
||||||
|
@PutMapping()
|
||||||
|
public ApiResult<?> update(@RequestBody Mp mp) {
|
||||||
|
if (mpService.updateById(mp)) {
|
||||||
|
return success("修改成功");
|
||||||
|
}
|
||||||
|
return fail("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('cms:mp:remove')")
|
||||||
|
@ApiOperation("删除小程序信息")
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||||
|
if (mpService.removeById(id)) {
|
||||||
|
return success("删除成功");
|
||||||
|
}
|
||||||
|
return fail("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('cms:mp:save')")
|
||||||
|
@ApiOperation("批量添加小程序信息")
|
||||||
|
@PostMapping("/batch")
|
||||||
|
public ApiResult<?> saveBatch(@RequestBody List<Mp> list) {
|
||||||
|
if (mpService.saveBatch(list)) {
|
||||||
|
return success("添加成功");
|
||||||
|
}
|
||||||
|
return fail("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('cms:mp:update')")
|
||||||
|
@ApiOperation("批量修改小程序信息")
|
||||||
|
@PutMapping("/batch")
|
||||||
|
public ApiResult<?> removeBatch(@RequestBody BatchParam<Mp> batchParam) {
|
||||||
|
if (batchParam.update(mpService, "mp_id")) {
|
||||||
|
return success("修改成功");
|
||||||
|
}
|
||||||
|
return fail("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('cms:mp:remove')")
|
||||||
|
@ApiOperation("批量删除小程序信息")
|
||||||
|
@DeleteMapping("/batch")
|
||||||
|
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||||
|
if (mpService.removeByIds(ids)) {
|
||||||
|
return success("删除成功");
|
||||||
|
}
|
||||||
|
return fail("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,110 @@
|
|||||||
|
package com.gxwebsoft.cms.controller;
|
||||||
|
|
||||||
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
|
import com.gxwebsoft.cms.service.MpFieldService;
|
||||||
|
import com.gxwebsoft.cms.entity.MpField;
|
||||||
|
import com.gxwebsoft.cms.param.MpFieldParam;
|
||||||
|
import com.gxwebsoft.common.core.web.ApiResult;
|
||||||
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import com.gxwebsoft.common.core.web.PageParam;
|
||||||
|
import com.gxwebsoft.common.core.web.BatchParam;
|
||||||
|
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||||
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序配置控制器
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-07-22 12:54:13
|
||||||
|
*/
|
||||||
|
@Api(tags = "小程序配置管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/cms/mp-field")
|
||||||
|
public class MpFieldController extends BaseController {
|
||||||
|
@Resource
|
||||||
|
private MpFieldService mpFieldService;
|
||||||
|
|
||||||
|
@ApiOperation("分页查询小程序配置")
|
||||||
|
@GetMapping("/page")
|
||||||
|
public ApiResult<PageResult<MpField>> page(MpFieldParam param) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(mpFieldService.pageRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("查询全部小程序配置")
|
||||||
|
@GetMapping()
|
||||||
|
public ApiResult<List<MpField>> list(MpFieldParam param) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(mpFieldService.listRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('cms:mpField:list')")
|
||||||
|
@ApiOperation("根据id查询小程序配置")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public ApiResult<MpField> get(@PathVariable("id") Integer id) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(mpFieldService.getByIdRel(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("添加小程序配置")
|
||||||
|
@PostMapping()
|
||||||
|
public ApiResult<?> save(@RequestBody MpField mpField) {
|
||||||
|
if (mpFieldService.save(mpField)) {
|
||||||
|
return success("添加成功");
|
||||||
|
}
|
||||||
|
return fail("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("修改小程序配置")
|
||||||
|
@PutMapping()
|
||||||
|
public ApiResult<?> update(@RequestBody MpField mpField) {
|
||||||
|
if (mpFieldService.updateById(mpField)) {
|
||||||
|
return success("修改成功");
|
||||||
|
}
|
||||||
|
return fail("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("删除小程序配置")
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||||
|
if (mpFieldService.removeById(id)) {
|
||||||
|
return success("删除成功");
|
||||||
|
}
|
||||||
|
return fail("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量添加小程序配置")
|
||||||
|
@PostMapping("/batch")
|
||||||
|
public ApiResult<?> saveBatch(@RequestBody List<MpField> list) {
|
||||||
|
if (mpFieldService.saveBatch(list)) {
|
||||||
|
return success("添加成功");
|
||||||
|
}
|
||||||
|
return fail("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量修改小程序配置")
|
||||||
|
@PutMapping("/batch")
|
||||||
|
public ApiResult<?> removeBatch(@RequestBody BatchParam<MpField> batchParam) {
|
||||||
|
if (batchParam.update(mpFieldService, "id")) {
|
||||||
|
return success("修改成功");
|
||||||
|
}
|
||||||
|
return fail("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量删除小程序配置")
|
||||||
|
@DeleteMapping("/batch")
|
||||||
|
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||||
|
if (mpFieldService.removeByIds(ids)) {
|
||||||
|
return success("删除成功");
|
||||||
|
}
|
||||||
|
return fail("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -106,7 +106,6 @@ public class WebsiteController extends BaseController {
|
|||||||
createWebsite(access_token);
|
createWebsite(access_token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
|
|
||||||
// 获取站点信息
|
// 获取站点信息
|
||||||
@@ -117,13 +116,18 @@ public class WebsiteController extends BaseController {
|
|||||||
// 原生导航条
|
// 原生导航条
|
||||||
final List<MpPages> tabBar = mpPagesService.list(new LambdaQueryWrapper<MpPages>().eq(MpPages::getSubpackage, "MainPackage").last("limit 5"));
|
final List<MpPages> tabBar = mpPagesService.list(new LambdaQueryWrapper<MpPages>().eq(MpPages::getSubpackage, "MainPackage").last("limit 5"));
|
||||||
map.put("tabBar",tabBar);
|
map.put("tabBar",tabBar);
|
||||||
// tabBar.stream().map(MpPages::getHome).collect()
|
|
||||||
|
// 读取幻灯片广告
|
||||||
|
final List<Ad> list = adService.list(new LambdaQueryWrapper<Ad>().eq(Ad::getAdType,"幻灯片"));
|
||||||
|
if (!CollectionUtils.isEmpty(list)) {
|
||||||
|
map.put("slide",list);
|
||||||
|
}
|
||||||
|
|
||||||
// 小程序端导航图标
|
// 小程序端导航图标
|
||||||
final MpMenuParam mpMenuParam = new MpMenuParam();
|
final MpMenuParam mpMenuParam = new MpMenuParam();
|
||||||
final List<MpMenu> mpMenus = mpMenuService.listRel(mpMenuParam);
|
final List<MpMenu> mpMenus = mpMenuService.listRel(mpMenuParam);
|
||||||
final Map<String, List<MpMenu>> mpMenuMap = mpMenus.stream().collect(Collectors.groupingBy(MpMenu::getGroupName));
|
final Map<String, List<MpMenu>> mpMenuMap = mpMenus.stream().collect(Collectors.groupingBy(MpMenu::getGroupName));
|
||||||
website.setMpMenus(mpMenuMap);
|
map.put("mpMenus",mpMenuMap);
|
||||||
|
|
||||||
// 附加自定义导航
|
// 附加自定义导航
|
||||||
final NavigationParam navigationParam = new NavigationParam();
|
final NavigationParam navigationParam = new NavigationParam();
|
||||||
@@ -142,12 +146,7 @@ public class WebsiteController extends BaseController {
|
|||||||
website.setBottomNavs(bottomNavs);
|
website.setBottomNavs(bottomNavs);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 读取幻灯片广告
|
|
||||||
final List<Ad> list = adService.list(new LambdaQueryWrapper<Ad>().eq(Ad::getAdType,"幻灯片"));
|
|
||||||
if (!CollectionUtils.isEmpty(list)) {
|
|
||||||
final Ad ad = list.get(0);
|
|
||||||
website.setSlide(ad);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 首页布局
|
// 首页布局
|
||||||
final Design design = designService.getOne(new LambdaQueryWrapper<Design>().eq(Design::getHome, 1).last("limit 1"));
|
final Design design = designService.getOne(new LambdaQueryWrapper<Design>().eq(Design::getHome, 1).last("limit 1"));
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -15,7 +17,7 @@ import lombok.EqualsAndHashCode;
|
|||||||
* 小程序信息
|
* 小程序信息
|
||||||
*
|
*
|
||||||
* @author 科技小王子
|
* @author 科技小王子
|
||||||
* @since 2024-07-21 22:18:08
|
* @since 2024-07-21 23:03:05
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@@ -31,6 +33,9 @@ public class Mp implements Serializable {
|
|||||||
@ApiModelProperty(value = "小程序ID")
|
@ApiModelProperty(value = "小程序ID")
|
||||||
private String appId;
|
private String appId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "小程序密钥")
|
||||||
|
private String appSecret;
|
||||||
|
|
||||||
@ApiModelProperty(value = "小程序名称")
|
@ApiModelProperty(value = "小程序名称")
|
||||||
private String mpName;
|
private String mpName;
|
||||||
|
|
||||||
@@ -64,6 +69,9 @@ public class Mp implements Serializable {
|
|||||||
@ApiModelProperty(value = "入口页面")
|
@ApiModelProperty(value = "入口页面")
|
||||||
private String mainPath;
|
private String mainPath;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "过期时间")
|
||||||
|
private Date expirationTime;
|
||||||
|
|
||||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||||
private Integer sortNumber;
|
private Integer sortNumber;
|
||||||
|
|
||||||
@@ -84,6 +92,6 @@ public class Mp implements Serializable {
|
|||||||
private Integer tenantId;
|
private Integer tenantId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "注册时间")
|
@ApiModelProperty(value = "注册时间")
|
||||||
private LocalDateTime createTime;
|
private Date createTime;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package com.gxwebsoft.cms.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序配置
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-07-22 12:54:13
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value = "MpField对象", description = "小程序配置")
|
||||||
|
@TableName("cms_mp_field")
|
||||||
|
public class MpField implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "自增ID")
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "类型,0文本 1图片 2其他")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "备注")
|
||||||
|
private String comments;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "名称")
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||||
|
private Integer sortNumber;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||||
|
@TableLogic
|
||||||
|
private Integer deleted;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "租户id")
|
||||||
|
private Integer tenantId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "注册时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -66,6 +68,6 @@ public class MpPages implements Serializable {
|
|||||||
private Integer tenantId;
|
private Integer tenantId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "注册时间")
|
@ApiModelProperty(value = "注册时间")
|
||||||
private LocalDateTime createTime;
|
private Date createTime;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.gxwebsoft.cms.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.gxwebsoft.cms.entity.MpField;
|
||||||
|
import com.gxwebsoft.cms.param.MpFieldParam;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序配置Mapper
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-07-22 12:54:13
|
||||||
|
*/
|
||||||
|
public interface MpFieldMapper extends BaseMapper<MpField> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*
|
||||||
|
* @param page 分页对象
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<MpField>
|
||||||
|
*/
|
||||||
|
List<MpField> selectPageRel(@Param("page") IPage<MpField> page,
|
||||||
|
@Param("param") MpFieldParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询全部
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<User>
|
||||||
|
*/
|
||||||
|
List<MpField> selectListRel(@Param("param") MpFieldParam param);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -12,7 +12,7 @@ import java.util.List;
|
|||||||
* 小程序信息Mapper
|
* 小程序信息Mapper
|
||||||
*
|
*
|
||||||
* @author 科技小王子
|
* @author 科技小王子
|
||||||
* @since 2024-07-21 22:18:08
|
* @since 2024-07-21 23:03:05
|
||||||
*/
|
*/
|
||||||
public interface MpMapper extends BaseMapper<Mp> {
|
public interface MpMapper extends BaseMapper<Mp> {
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
<?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="com.gxwebsoft.cms.mapper.MpFieldMapper">
|
||||||
|
|
||||||
|
<!-- 关联查询sql -->
|
||||||
|
<sql id="selectSql">
|
||||||
|
SELECT a.*
|
||||||
|
FROM cms_mp_field a
|
||||||
|
<where>
|
||||||
|
<if test="param.id != null">
|
||||||
|
AND a.id = #{param.id}
|
||||||
|
</if>
|
||||||
|
<if test="param.type != null">
|
||||||
|
AND a.type = #{param.type}
|
||||||
|
</if>
|
||||||
|
<if test="param.name != null">
|
||||||
|
AND a.name LIKE CONCAT('%', #{param.name}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.comments != null">
|
||||||
|
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.value != null">
|
||||||
|
AND a.value LIKE CONCAT('%', #{param.value}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.sortNumber != null">
|
||||||
|
AND a.sort_number = #{param.sortNumber}
|
||||||
|
</if>
|
||||||
|
<if test="param.deleted != null">
|
||||||
|
AND a.deleted = #{param.deleted}
|
||||||
|
</if>
|
||||||
|
<if test="param.deleted == null">
|
||||||
|
AND a.deleted = 0
|
||||||
|
</if>
|
||||||
|
<if test="param.createTimeStart != null">
|
||||||
|
AND a.create_time >= #{param.createTimeStart}
|
||||||
|
</if>
|
||||||
|
<if test="param.createTimeEnd != null">
|
||||||
|
AND a.create_time <= #{param.createTimeEnd}
|
||||||
|
</if>
|
||||||
|
<if test="param.keywords != null">
|
||||||
|
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!-- 分页查询 -->
|
||||||
|
<select id="selectPageRel" resultType="com.gxwebsoft.cms.entity.MpField">
|
||||||
|
<include refid="selectSql"></include>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 查询全部 -->
|
||||||
|
<select id="selectListRel" resultType="com.gxwebsoft.cms.entity.MpField">
|
||||||
|
<include refid="selectSql"></include>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -13,6 +13,9 @@
|
|||||||
<if test="param.appId != null">
|
<if test="param.appId != null">
|
||||||
AND a.app_id LIKE CONCAT('%', #{param.appId}, '%')
|
AND a.app_id LIKE CONCAT('%', #{param.appId}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
<if test="param.appSecret != null">
|
||||||
|
AND a.app_secret LIKE CONCAT('%', #{param.appSecret}, '%')
|
||||||
|
</if>
|
||||||
<if test="param.mpName != null">
|
<if test="param.mpName != null">
|
||||||
AND a.mp_name LIKE CONCAT('%', #{param.mpName}, '%')
|
AND a.mp_name LIKE CONCAT('%', #{param.mpName}, '%')
|
||||||
</if>
|
</if>
|
||||||
@@ -46,6 +49,9 @@
|
|||||||
<if test="param.mainPath != null">
|
<if test="param.mainPath != null">
|
||||||
AND a.main_path LIKE CONCAT('%', #{param.mainPath}, '%')
|
AND a.main_path LIKE CONCAT('%', #{param.mainPath}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
<if test="param.expirationTime != null">
|
||||||
|
AND a.expiration_time LIKE CONCAT('%', #{param.expirationTime}, '%')
|
||||||
|
</if>
|
||||||
<if test="param.sortNumber != null">
|
<if test="param.sortNumber != null">
|
||||||
AND a.sort_number = #{param.sortNumber}
|
AND a.sort_number = #{param.sortNumber}
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package com.gxwebsoft.cms.param;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||||
|
import com.gxwebsoft.common.core.annotation.QueryType;
|
||||||
|
import com.gxwebsoft.common.core.web.BaseParam;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序配置查询参数
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-07-22 12:54:13
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
@ApiModel(value = "MpFieldParam对象", description = "小程序配置查询参数")
|
||||||
|
public class MpFieldParam extends BaseParam {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "自增ID")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "类型,0文本 1图片 2其他")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "备注")
|
||||||
|
private String comments;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "名称")
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer sortNumber;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer deleted;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -14,7 +14,7 @@ import lombok.EqualsAndHashCode;
|
|||||||
* 小程序信息查询参数
|
* 小程序信息查询参数
|
||||||
*
|
*
|
||||||
* @author 科技小王子
|
* @author 科技小王子
|
||||||
* @since 2024-07-21 22:18:08
|
* @since 2024-07-21 23:03:05
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@@ -30,6 +30,9 @@ public class MpParam extends BaseParam {
|
|||||||
@ApiModelProperty(value = "小程序ID")
|
@ApiModelProperty(value = "小程序ID")
|
||||||
private String appId;
|
private String appId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "小程序密钥")
|
||||||
|
private String appSecret;
|
||||||
|
|
||||||
@ApiModelProperty(value = "小程序名称")
|
@ApiModelProperty(value = "小程序名称")
|
||||||
private String mpName;
|
private String mpName;
|
||||||
|
|
||||||
@@ -64,6 +67,9 @@ public class MpParam extends BaseParam {
|
|||||||
@ApiModelProperty(value = "入口页面")
|
@ApiModelProperty(value = "入口页面")
|
||||||
private String mainPath;
|
private String mainPath;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "过期时间")
|
||||||
|
private String expirationTime;
|
||||||
|
|
||||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer sortNumber;
|
private Integer sortNumber;
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.gxwebsoft.cms.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import com.gxwebsoft.cms.entity.MpField;
|
||||||
|
import com.gxwebsoft.cms.param.MpFieldParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序配置Service
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-07-22 12:54:13
|
||||||
|
*/
|
||||||
|
public interface MpFieldService extends IService<MpField> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页关联查询
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return PageResult<MpField>
|
||||||
|
*/
|
||||||
|
PageResult<MpField> pageRel(MpFieldParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联查询全部
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<MpField>
|
||||||
|
*/
|
||||||
|
List<MpField> listRel(MpFieldParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询
|
||||||
|
*
|
||||||
|
* @param id 自增ID
|
||||||
|
* @return MpField
|
||||||
|
*/
|
||||||
|
MpField getByIdRel(Integer id);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -11,7 +11,7 @@ import java.util.List;
|
|||||||
* 小程序信息Service
|
* 小程序信息Service
|
||||||
*
|
*
|
||||||
* @author 科技小王子
|
* @author 科技小王子
|
||||||
* @since 2024-07-21 22:18:08
|
* @since 2024-07-21 23:03:05
|
||||||
*/
|
*/
|
||||||
public interface MpService extends IService<Mp> {
|
public interface MpService extends IService<Mp> {
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.gxwebsoft.cms.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.gxwebsoft.cms.mapper.MpFieldMapper;
|
||||||
|
import com.gxwebsoft.cms.service.MpFieldService;
|
||||||
|
import com.gxwebsoft.cms.entity.MpField;
|
||||||
|
import com.gxwebsoft.cms.param.MpFieldParam;
|
||||||
|
import com.gxwebsoft.common.core.web.PageParam;
|
||||||
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序配置Service实现
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-07-22 12:54:13
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class MpFieldServiceImpl extends ServiceImpl<MpFieldMapper, MpField> implements MpFieldService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<MpField> pageRel(MpFieldParam param) {
|
||||||
|
PageParam<MpField, MpFieldParam> page = new PageParam<>(param);
|
||||||
|
page.setDefaultOrder("sort_number asc, create_time asc");
|
||||||
|
List<MpField> list = baseMapper.selectPageRel(page, param);
|
||||||
|
return new PageResult<>(list, page.getTotal());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MpField> listRel(MpFieldParam param) {
|
||||||
|
List<MpField> list = baseMapper.selectListRel(param);
|
||||||
|
// 排序
|
||||||
|
PageParam<MpField, MpFieldParam> page = new PageParam<>();
|
||||||
|
page.setDefaultOrder("sort_number asc, create_time asc");
|
||||||
|
return page.sortRecords(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MpField getByIdRel(Integer id) {
|
||||||
|
MpFieldParam param = new MpFieldParam();
|
||||||
|
param.setId(id);
|
||||||
|
return param.getOne(baseMapper.selectListRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@ import java.util.List;
|
|||||||
* 小程序信息Service实现
|
* 小程序信息Service实现
|
||||||
*
|
*
|
||||||
* @author 科技小王子
|
* @author 科技小王子
|
||||||
* @since 2024-07-21 22:18:08
|
* @since 2024-07-21 23:03:05
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class MpServiceImpl extends ServiceImpl<MpMapper, Mp> implements MpService {
|
public class MpServiceImpl extends ServiceImpl<MpMapper, Mp> implements MpService {
|
||||||
|
|||||||
@@ -68,7 +68,8 @@ public class CmsGenerator {
|
|||||||
// "cms_domain",
|
// "cms_domain",
|
||||||
// "cms_mp_menu"
|
// "cms_mp_menu"
|
||||||
// "cms_mp_pages"
|
// "cms_mp_pages"
|
||||||
"cms_mp"
|
// "cms_mp"
|
||||||
|
// "cms_mp_field"
|
||||||
|
|
||||||
};
|
};
|
||||||
// 需要去除的表前缀
|
// 需要去除的表前缀
|
||||||
|
|||||||
Reference in New Issue
Block a user