新增小程序cms_mp表及模块
This commit is contained in:
@@ -0,0 +1,121 @@
|
||||
package com.gxwebsoft.cms.controller;
|
||||
|
||||
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.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-21 22:18:08
|
||||
*/
|
||||
@Api(tags = "小程序信息管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/cms/mp")
|
||||
public class MpController extends BaseController {
|
||||
@Resource
|
||||
private MpService mpService;
|
||||
|
||||
@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("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,6 +11,7 @@ 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.ApiResult;
|
||||
@@ -72,6 +73,8 @@ public class WebsiteController extends BaseController {
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
@Resource
|
||||
private MpPagesService mpPagesService;
|
||||
@Resource
|
||||
private MpMenuService mpMenuService;
|
||||
@Resource
|
||||
private OrderService orderService;
|
||||
@@ -82,7 +85,7 @@ public class WebsiteController extends BaseController {
|
||||
|
||||
@ApiOperation("获取网站信息")
|
||||
@GetMapping("/getSiteInfo")
|
||||
public ApiResult<Website> getSiteInfo(HttpServletRequest request) {
|
||||
public ApiResult<?> getSiteInfo(HttpServletRequest request) {
|
||||
final Integer tenantId = getTenantId();
|
||||
String key = "SiteInfo:" + tenantId;
|
||||
final String siteInfo = redisUtil.get(key);
|
||||
@@ -99,194 +102,28 @@ public class WebsiteController extends BaseController {
|
||||
// 获取站点信息
|
||||
final WebsiteParam websiteParam = new WebsiteParam();
|
||||
if (websiteService.count() == 0) {
|
||||
// 请求主服务器获取租户信息
|
||||
String result = HttpRequest.get("https://server.gxwebsoft.com/api/auth/tenant")
|
||||
.header("Authorization", access_token)
|
||||
.header("Tenantid", tenantId.toString())
|
||||
.timeout(20000)//超时,毫秒
|
||||
.execute().body();
|
||||
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
final String data = jsonObject.getString("data");
|
||||
final Company company = JSONObject.parseObject(data, Company.class);
|
||||
if(company == null){
|
||||
return success("站点不存在",null);
|
||||
}
|
||||
// 创建网站记录
|
||||
final Website website = new Website();
|
||||
website.setTenantId(company.getTenantId());
|
||||
website.setWebsiteName(company.getShortName());
|
||||
website.setWebsiteLogo(company.getCompanyLogo());
|
||||
website.setWebsiteIcon("/favicon.ico");
|
||||
website.setWebsiteType("企业官网");
|
||||
website.setDomain(company.getDomain());
|
||||
website.setExpirationTime(company.getExpirationTime());
|
||||
website.setIndustryParent(company.getIndustryParent());
|
||||
website.setIndustryChild(company.getIndustryChild());
|
||||
website.setCompanyId(company.getCompanyId());
|
||||
website.setAddress(company.getAddress());
|
||||
website.setComments(company.getComments());
|
||||
website.setKeywords(company.getCompanyName());
|
||||
website.setUserId(company.getUserId());
|
||||
websiteService.save(website);
|
||||
|
||||
// 创建默认页面及导航
|
||||
final Navigation navigation = new Navigation();
|
||||
final Design design = new Design();
|
||||
// 1.首页
|
||||
design.setName("首页");
|
||||
design.setHome(1);
|
||||
design.setPath("/");
|
||||
design.setComponent("/index");
|
||||
design.setSortNumber(0);
|
||||
designService.save(design);
|
||||
navigation.setTitle(design.getName());
|
||||
navigation.setPath(design.getPath());
|
||||
navigation.setComponent(design.getComponent());
|
||||
navigation.setHome(design.getHome());
|
||||
navigation.setPageId(design.getPageId());
|
||||
navigation.setSortNumber(0);
|
||||
navigation.setType(1);
|
||||
navigation.setPosition(1);
|
||||
navigationService.save(navigation);
|
||||
// 2.关于我们
|
||||
design.setName("关于我们");
|
||||
design.setPath("/about");
|
||||
design.setComponent("/about/index");
|
||||
design.setSortNumber(1);
|
||||
designService.save(design);
|
||||
navigation.setTitle(design.getName());
|
||||
navigation.setPath(design.getPath());
|
||||
navigation.setComponent(design.getComponent());
|
||||
navigation.setPageId(design.getPageId());
|
||||
navigation.setSortNumber(1);
|
||||
navigation.setType(1);
|
||||
navigationService.save(navigation);
|
||||
// 3.产品展示
|
||||
final ArticleCategory articleCategory = new ArticleCategory();
|
||||
articleCategory.setTitle("产品展示");
|
||||
articleCategory.setPath("/product/" + articleCategory.getCategoryId());
|
||||
articleCategory.setComponent("/article/photo");
|
||||
articleCategory.setSortNumber(2);
|
||||
articleCategoryService.save(articleCategory);
|
||||
navigation.setTitle(articleCategory.getTitle());
|
||||
navigation.setPath(articleCategory.getPath());
|
||||
navigation.setComponent(articleCategory.getComponent());
|
||||
navigation.setArticleCategoryId(articleCategory.getCategoryId());
|
||||
navigation.setSortNumber(2);
|
||||
navigation.setType(2);
|
||||
navigationService.save(navigation);
|
||||
// 4.新闻资讯
|
||||
articleCategory.setTitle("新闻资讯");
|
||||
articleCategoryService.save(articleCategory);
|
||||
navigation.setTitle(articleCategory.getTitle());
|
||||
navigation.setPath("/article/" + articleCategory.getCategoryId());
|
||||
navigation.setComponent("/article/index");
|
||||
navigation.setArticleCategoryId(articleCategory.getCategoryId());
|
||||
navigation.setSortNumber(3);
|
||||
navigation.setType(2);
|
||||
navigation.setPosition(1);
|
||||
navigationService.save(navigation);
|
||||
// 5.表单页面
|
||||
final Form form = new Form();
|
||||
form.setName("业务咨询");
|
||||
form.setLayout("[{\"id\":\"vhEB\",\"type\":\"text\",\"name\":\"姓名\",\"checked\":true},{\"id\":\"Hg7v\",\"type\":\"phone\",\"name\":\"手机号码\",\"checked\":true},{\"id\":\"byBy\",\"type\":\"textarea\",\"name\":\"需求描述\",\"checked\":false}]");
|
||||
form.setComments("简单描述您的需求,我们会尽快联系您");
|
||||
formService.save(form);
|
||||
navigation.setTitle(form.getName());
|
||||
navigation.setPath("/form/" + form.getFormId());
|
||||
navigation.setComponent("/form/index");
|
||||
navigation.setFormId(form.getFormId());
|
||||
navigation.setSortNumber(4);
|
||||
navigation.setType(4);
|
||||
navigation.setPosition(1);
|
||||
navigationService.save(navigation);
|
||||
// 6.联系我们
|
||||
design.setName("联系我们");
|
||||
design.setPath("/contact");
|
||||
design.setComponent("/about/index");
|
||||
design.setSortNumber(5);
|
||||
designService.save(design);
|
||||
navigation.setTitle(design.getName());
|
||||
navigation.setPath(design.getPath());
|
||||
navigation.setComponent(design.getComponent());
|
||||
navigation.setPageId(design.getPageId());
|
||||
navigation.setSortNumber(5);
|
||||
navigation.setType(1);
|
||||
navigation.setPosition(1);
|
||||
navigationService.save(navigation);
|
||||
// 添加字典
|
||||
final Dict dict = new Dict();
|
||||
dict.setDictName("路由方式");
|
||||
dict.setDictCode("navType");
|
||||
dict.setSortNumber(100);
|
||||
final boolean save = dictService.save(dict);
|
||||
final Integer dictId = dict.getDictId();
|
||||
final DictData dictData = new DictData();
|
||||
dictData.setDictDataName("uni.navigateTo");
|
||||
dictData.setDictDataCode("uni.navigateTo");
|
||||
dictData.setComments("保留当前页面,跳转到应用内的某个页面,使用uni.navigateBack可以返回到原页面");
|
||||
dictDataService.save(dictData);
|
||||
dictData.setDictDataName("uni.redirectTo");
|
||||
dictData.setDictDataCode("uni.redirectTo");
|
||||
dictData.setComments("关闭当前页面,跳转到应用内的某个页面");
|
||||
dictDataService.save(dictData);
|
||||
dictData.setDictDataName("uni.reLaunch");
|
||||
dictData.setDictDataCode("uni.reLaunch");
|
||||
dictData.setComments("关闭所有页面,打开到应用内的某个页面");
|
||||
dictDataService.save(dictData);
|
||||
dictData.setDictDataName("uni.switchTab");
|
||||
dictData.setDictDataCode("uni.switchTab");
|
||||
dictData.setComments("跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面");
|
||||
dictDataService.save(dictData);
|
||||
// 网站配置参数
|
||||
List<WebsiteField> fields = new ArrayList<>();
|
||||
WebsiteField field = new WebsiteField();
|
||||
field.setType(0);
|
||||
field.setName("siteLogo");
|
||||
field.setValue(company.getCompanyLogo());
|
||||
field.setComments("网站LOGO");
|
||||
websiteFieldService.save(field);
|
||||
field.setName("siteName");
|
||||
field.setValue(company.getShortName());
|
||||
field.setComments("网站名称");
|
||||
websiteFieldService.save(field);
|
||||
field.setName("icpNo");
|
||||
field.setValue("-");
|
||||
field.setComments("备案号");
|
||||
websiteFieldService.save(field);
|
||||
field.setName("qrcode");
|
||||
field.setValue("");
|
||||
field.setComments("公众号二维码");
|
||||
websiteFieldService.save(field);
|
||||
field.setName("bottomBg");
|
||||
field.setValue("https://oss.wsdns.cn/20240717/13165035c35e4f25a6c9fbd3636c6292.png");
|
||||
field.setComments("网站底部背景图");
|
||||
websiteFieldService.save(field);
|
||||
field.setName("address");
|
||||
field.setValue(company.getAddress());
|
||||
field.setComments("办公地址");
|
||||
websiteFieldService.save(field);
|
||||
field.setName("tel");
|
||||
field.setValue(company.getTel());
|
||||
field.setComments("公司电话");
|
||||
websiteFieldService.save(field);
|
||||
field.setName("domain");
|
||||
field.setValue(company.getDomain());
|
||||
field.setComments("网站域名");
|
||||
websiteFieldService.save(field);
|
||||
// 创建网站
|
||||
createWebsite(access_token);
|
||||
}
|
||||
|
||||
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
|
||||
// 获取站点信息
|
||||
final List<Website> websites = websiteService.listRel(websiteParam);
|
||||
final Website website = websites.get(0);
|
||||
map.put("website",website);
|
||||
|
||||
// 附加自定义字段
|
||||
// website.setFields(fields);
|
||||
// 原生导航条
|
||||
final List<MpPages> tabBar = mpPagesService.list(new LambdaQueryWrapper<MpPages>().eq(MpPages::getSubpackage, "MainPackage").last("limit 5"));
|
||||
map.put("tabBar",tabBar);
|
||||
// tabBar.stream().map(MpPages::getHome).collect()
|
||||
|
||||
// 小程序端导航图标
|
||||
final MpMenuParam mpMenuParam = new MpMenuParam();
|
||||
website.setMpMenus(mpMenuService.listRel(mpMenuParam));
|
||||
final List<MpMenu> mpMenus = mpMenuService.listRel(mpMenuParam);
|
||||
final Map<String, List<MpMenu>> mpMenuMap = mpMenus.stream().collect(Collectors.groupingBy(MpMenu::getGroupName));
|
||||
website.setMpMenus(mpMenuMap);
|
||||
|
||||
// 附加自定义导航
|
||||
final NavigationParam navigationParam = new NavigationParam();
|
||||
@@ -331,7 +168,8 @@ public class WebsiteController extends BaseController {
|
||||
fields.forEach(d -> {
|
||||
config.put(d.getName(),d.getValue());
|
||||
});
|
||||
website.setConfig(config);
|
||||
map.put("config",config);
|
||||
// website.setConfig(config);
|
||||
|
||||
// 服务器时间
|
||||
HashMap<String, Object> serverTime = new HashMap<>();
|
||||
@@ -355,10 +193,190 @@ public class WebsiteController extends BaseController {
|
||||
serverTime.put("week",week); // 5
|
||||
website.setServerTime(serverTime);
|
||||
redisUtil.set(key,website,1L, TimeUnit.DAYS);
|
||||
return success(website);
|
||||
return success(map);
|
||||
}
|
||||
|
||||
@ApiOperation("获取服务器时间")
|
||||
private void createWebsite(String access_token) {
|
||||
final Integer tenantId = getTenantId();
|
||||
// 请求主服务器获取租户信息
|
||||
String result = HttpRequest.get("https://server.gxwebsoft.com/api/auth/tenant")
|
||||
.header("Authorization", access_token)
|
||||
.header("Tenantid", tenantId.toString())
|
||||
.timeout(20000)//超时,毫秒
|
||||
.execute().body();
|
||||
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
final String data = jsonObject.getString("data");
|
||||
final Company company = JSONObject.parseObject(data, Company.class);
|
||||
if(company == null){
|
||||
throw new BusinessException("站点不存在");
|
||||
}
|
||||
// 创建网站记录
|
||||
final Website website = new Website();
|
||||
website.setTenantId(company.getTenantId());
|
||||
website.setWebsiteName(company.getShortName());
|
||||
website.setWebsiteLogo(company.getCompanyLogo());
|
||||
website.setWebsiteIcon("/favicon.ico");
|
||||
website.setWebsiteType("企业官网");
|
||||
website.setDomain(company.getDomain());
|
||||
website.setExpirationTime(company.getExpirationTime());
|
||||
website.setIndustryParent(company.getIndustryParent());
|
||||
website.setIndustryChild(company.getIndustryChild());
|
||||
website.setCompanyId(company.getCompanyId());
|
||||
website.setAddress(company.getAddress());
|
||||
website.setComments(company.getComments());
|
||||
website.setKeywords(company.getCompanyName());
|
||||
website.setUserId(company.getUserId());
|
||||
websiteService.save(website);
|
||||
|
||||
// 创建默认页面及导航
|
||||
final Navigation navigation = new Navigation();
|
||||
final Design design = new Design();
|
||||
// 1.首页
|
||||
design.setName("首页");
|
||||
design.setHome(1);
|
||||
design.setPath("/");
|
||||
design.setComponent("/index");
|
||||
design.setSortNumber(0);
|
||||
designService.save(design);
|
||||
navigation.setTitle(design.getName());
|
||||
navigation.setPath(design.getPath());
|
||||
navigation.setComponent(design.getComponent());
|
||||
navigation.setHome(design.getHome());
|
||||
navigation.setPageId(design.getPageId());
|
||||
navigation.setSortNumber(0);
|
||||
navigation.setType(1);
|
||||
navigation.setPosition(1);
|
||||
navigationService.save(navigation);
|
||||
// 2.关于我们
|
||||
design.setName("关于我们");
|
||||
design.setPath("/about");
|
||||
design.setComponent("/about/index");
|
||||
design.setSortNumber(1);
|
||||
designService.save(design);
|
||||
navigation.setTitle(design.getName());
|
||||
navigation.setPath(design.getPath());
|
||||
navigation.setComponent(design.getComponent());
|
||||
navigation.setPageId(design.getPageId());
|
||||
navigation.setSortNumber(1);
|
||||
navigation.setType(1);
|
||||
navigationService.save(navigation);
|
||||
// 3.产品展示
|
||||
final ArticleCategory articleCategory = new ArticleCategory();
|
||||
articleCategory.setTitle("产品展示");
|
||||
articleCategory.setPath("/product/" + articleCategory.getCategoryId());
|
||||
articleCategory.setComponent("/article/photo");
|
||||
articleCategory.setSortNumber(2);
|
||||
articleCategoryService.save(articleCategory);
|
||||
navigation.setTitle(articleCategory.getTitle());
|
||||
navigation.setPath(articleCategory.getPath());
|
||||
navigation.setComponent(articleCategory.getComponent());
|
||||
navigation.setArticleCategoryId(articleCategory.getCategoryId());
|
||||
navigation.setSortNumber(2);
|
||||
navigation.setType(2);
|
||||
navigationService.save(navigation);
|
||||
// 4.新闻资讯
|
||||
articleCategory.setTitle("新闻资讯");
|
||||
articleCategoryService.save(articleCategory);
|
||||
navigation.setTitle(articleCategory.getTitle());
|
||||
navigation.setPath("/article/" + articleCategory.getCategoryId());
|
||||
navigation.setComponent("/article/index");
|
||||
navigation.setArticleCategoryId(articleCategory.getCategoryId());
|
||||
navigation.setSortNumber(3);
|
||||
navigation.setType(2);
|
||||
navigation.setPosition(1);
|
||||
navigationService.save(navigation);
|
||||
// 5.表单页面
|
||||
final Form form = new Form();
|
||||
form.setName("业务咨询");
|
||||
form.setLayout("[{\"id\":\"vhEB\",\"type\":\"text\",\"name\":\"姓名\",\"checked\":true},{\"id\":\"Hg7v\",\"type\":\"phone\",\"name\":\"手机号码\",\"checked\":true},{\"id\":\"byBy\",\"type\":\"textarea\",\"name\":\"需求描述\",\"checked\":false}]");
|
||||
form.setComments("简单描述您的需求,我们会尽快联系您");
|
||||
formService.save(form);
|
||||
navigation.setTitle(form.getName());
|
||||
navigation.setPath("/form/" + form.getFormId());
|
||||
navigation.setComponent("/form/index");
|
||||
navigation.setFormId(form.getFormId());
|
||||
navigation.setSortNumber(4);
|
||||
navigation.setType(4);
|
||||
navigation.setPosition(1);
|
||||
navigationService.save(navigation);
|
||||
// 6.联系我们
|
||||
design.setName("联系我们");
|
||||
design.setPath("/contact");
|
||||
design.setComponent("/about/index");
|
||||
design.setSortNumber(5);
|
||||
designService.save(design);
|
||||
navigation.setTitle(design.getName());
|
||||
navigation.setPath(design.getPath());
|
||||
navigation.setComponent(design.getComponent());
|
||||
navigation.setPageId(design.getPageId());
|
||||
navigation.setSortNumber(5);
|
||||
navigation.setType(1);
|
||||
navigation.setPosition(1);
|
||||
navigationService.save(navigation);
|
||||
// 添加字典
|
||||
final Dict dict = new Dict();
|
||||
dict.setDictName("路由方式");
|
||||
dict.setDictCode("navType");
|
||||
dict.setSortNumber(100);
|
||||
final boolean save = dictService.save(dict);
|
||||
final Integer dictId = dict.getDictId();
|
||||
final DictData dictData = new DictData();
|
||||
dictData.setDictDataName("uni.navigateTo");
|
||||
dictData.setDictDataCode("uni.navigateTo");
|
||||
dictData.setComments("保留当前页面,跳转到应用内的某个页面,使用uni.navigateBack可以返回到原页面");
|
||||
dictDataService.save(dictData);
|
||||
dictData.setDictDataName("uni.redirectTo");
|
||||
dictData.setDictDataCode("uni.redirectTo");
|
||||
dictData.setComments("关闭当前页面,跳转到应用内的某个页面");
|
||||
dictDataService.save(dictData);
|
||||
dictData.setDictDataName("uni.reLaunch");
|
||||
dictData.setDictDataCode("uni.reLaunch");
|
||||
dictData.setComments("关闭所有页面,打开到应用内的某个页面");
|
||||
dictDataService.save(dictData);
|
||||
dictData.setDictDataName("uni.switchTab");
|
||||
dictData.setDictDataCode("uni.switchTab");
|
||||
dictData.setComments("跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面");
|
||||
dictDataService.save(dictData);
|
||||
// 网站配置参数
|
||||
List<WebsiteField> fields = new ArrayList<>();
|
||||
WebsiteField field = new WebsiteField();
|
||||
field.setType(0);
|
||||
field.setName("siteLogo");
|
||||
field.setValue(company.getCompanyLogo());
|
||||
field.setComments("网站LOGO");
|
||||
websiteFieldService.save(field);
|
||||
field.setName("siteName");
|
||||
field.setValue(company.getShortName());
|
||||
field.setComments("网站名称");
|
||||
websiteFieldService.save(field);
|
||||
field.setName("icpNo");
|
||||
field.setValue("-");
|
||||
field.setComments("备案号");
|
||||
websiteFieldService.save(field);
|
||||
field.setName("qrcode");
|
||||
field.setValue("");
|
||||
field.setComments("公众号二维码");
|
||||
websiteFieldService.save(field);
|
||||
field.setName("bottomBg");
|
||||
field.setValue("https://oss.wsdns.cn/20240717/13165035c35e4f25a6c9fbd3636c6292.png");
|
||||
field.setComments("网站底部背景图");
|
||||
websiteFieldService.save(field);
|
||||
field.setName("address");
|
||||
field.setValue(company.getAddress());
|
||||
field.setComments("办公地址");
|
||||
websiteFieldService.save(field);
|
||||
field.setName("tel");
|
||||
field.setValue(company.getTel());
|
||||
field.setComments("公司电话");
|
||||
websiteFieldService.save(field);
|
||||
field.setName("domain");
|
||||
field.setValue(company.getDomain());
|
||||
field.setComments("网站域名");
|
||||
websiteFieldService.save(field);
|
||||
}
|
||||
|
||||
@ApiOperation("获取服务器时间")
|
||||
@GetMapping("/getServerTime")
|
||||
public ApiResult<?> getServerTime(){
|
||||
// 服务器时间
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
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-21 22:18:08
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "Mp对象", description = "小程序信息")
|
||||
@TableName("cms_mp")
|
||||
public class Mp implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "ID")
|
||||
@TableId(value = "mp_id", type = IdType.AUTO)
|
||||
private Integer mpId;
|
||||
|
||||
@ApiModelProperty(value = "小程序ID")
|
||||
private String appId;
|
||||
|
||||
@ApiModelProperty(value = "小程序名称")
|
||||
private String mpName;
|
||||
|
||||
@ApiModelProperty(value = "小程序简称")
|
||||
private String shortName;
|
||||
|
||||
@ApiModelProperty(value = "头像")
|
||||
private String avatar;
|
||||
|
||||
@ApiModelProperty(value = "小程序码")
|
||||
private String mpQrcode;
|
||||
|
||||
@ApiModelProperty(value = "微信认证")
|
||||
private Integer authentication;
|
||||
|
||||
@ApiModelProperty(value = "主体信息")
|
||||
private String companyName;
|
||||
|
||||
@ApiModelProperty(value = "小程序备案")
|
||||
private String icpNo;
|
||||
|
||||
@ApiModelProperty(value = "登录邮箱")
|
||||
private String email;
|
||||
|
||||
@ApiModelProperty(value = "登录密码")
|
||||
private String password;
|
||||
|
||||
@ApiModelProperty(value = "原始ID")
|
||||
private String ghId;
|
||||
|
||||
@ApiModelProperty(value = "入口页面")
|
||||
private String mainPath;
|
||||
|
||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "介绍")
|
||||
private String comments;
|
||||
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "状态, 0正常, 1冻结")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Integer tenantId;
|
||||
|
||||
@ApiModelProperty(value = "注册时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.time.LocalDateTime;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@@ -120,4 +121,9 @@ public class MpMenu implements Serializable {
|
||||
@ApiModelProperty(value = "分组名称")
|
||||
private String groupName;
|
||||
|
||||
@ApiModelProperty("子菜单")
|
||||
@TableField(exist = false)
|
||||
private List<MpMenu> children;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 网站信息记录表
|
||||
@@ -135,7 +136,7 @@ public class Website implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "小程序导航图标")
|
||||
@TableField(exist = false)
|
||||
private List<MpMenu> mpMenus;
|
||||
private Map<String, List<MpMenu>> mpMenus;
|
||||
|
||||
@ApiModelProperty(value = "网站导航栏")
|
||||
@TableField(exist = false)
|
||||
|
||||
@@ -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.Mp;
|
||||
import com.gxwebsoft.cms.param.MpParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 小程序信息Mapper
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-07-21 22:18:08
|
||||
*/
|
||||
public interface MpMapper extends BaseMapper<Mp> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param param 查询参数
|
||||
* @return List<Mp>
|
||||
*/
|
||||
List<Mp> selectPageRel(@Param("page") IPage<Mp> page,
|
||||
@Param("param") MpParam param);
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<User>
|
||||
*/
|
||||
List<Mp> selectListRel(@Param("param") MpParam param);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
<?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.MpMapper">
|
||||
|
||||
<!-- 关联查询sql -->
|
||||
<sql id="selectSql">
|
||||
SELECT a.*
|
||||
FROM cms_mp a
|
||||
<where>
|
||||
<if test="param.mpId != null">
|
||||
AND a.mp_id = #{param.mpId}
|
||||
</if>
|
||||
<if test="param.appId != null">
|
||||
AND a.app_id LIKE CONCAT('%', #{param.appId}, '%')
|
||||
</if>
|
||||
<if test="param.mpName != null">
|
||||
AND a.mp_name LIKE CONCAT('%', #{param.mpName}, '%')
|
||||
</if>
|
||||
<if test="param.shortName != null">
|
||||
AND a.short_name LIKE CONCAT('%', #{param.shortName}, '%')
|
||||
</if>
|
||||
<if test="param.avatar != null">
|
||||
AND a.avatar LIKE CONCAT('%', #{param.avatar}, '%')
|
||||
</if>
|
||||
<if test="param.mpQrcode != null">
|
||||
AND a.mp_qrcode LIKE CONCAT('%', #{param.mpQrcode}, '%')
|
||||
</if>
|
||||
<if test="param.authentication != null">
|
||||
AND a.authentication = #{param.authentication}
|
||||
</if>
|
||||
<if test="param.companyName != null">
|
||||
AND a.company_name LIKE CONCAT('%', #{param.companyName}, '%')
|
||||
</if>
|
||||
<if test="param.icpNo != null">
|
||||
AND a.icp_no LIKE CONCAT('%', #{param.icpNo}, '%')
|
||||
</if>
|
||||
<if test="param.email != null">
|
||||
AND a.email LIKE CONCAT('%', #{param.email}, '%')
|
||||
</if>
|
||||
<if test="param.password != null">
|
||||
AND a.password LIKE CONCAT('%', #{param.password}, '%')
|
||||
</if>
|
||||
<if test="param.ghId != null">
|
||||
AND a.gh_id LIKE CONCAT('%', #{param.ghId}, '%')
|
||||
</if>
|
||||
<if test="param.mainPath != null">
|
||||
AND a.main_path LIKE CONCAT('%', #{param.mainPath}, '%')
|
||||
</if>
|
||||
<if test="param.sortNumber != null">
|
||||
AND a.sort_number = #{param.sortNumber}
|
||||
</if>
|
||||
<if test="param.comments != null">
|
||||
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
|
||||
</if>
|
||||
<if test="param.userId != null">
|
||||
AND a.user_id = #{param.userId}
|
||||
</if>
|
||||
<if test="param.status != null">
|
||||
AND a.status = #{param.status}
|
||||
</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.Mp">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
<select id="selectListRel" resultType="com.gxwebsoft.cms.entity.Mp">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,86 @@
|
||||
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-21 22:18:08
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@ApiModel(value = "MpParam对象", description = "小程序信息查询参数")
|
||||
public class MpParam extends BaseParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer mpId;
|
||||
|
||||
@ApiModelProperty(value = "小程序ID")
|
||||
private String appId;
|
||||
|
||||
@ApiModelProperty(value = "小程序名称")
|
||||
private String mpName;
|
||||
|
||||
@ApiModelProperty(value = "小程序简称")
|
||||
private String shortName;
|
||||
|
||||
@ApiModelProperty(value = "头像")
|
||||
private String avatar;
|
||||
|
||||
@ApiModelProperty(value = "小程序码")
|
||||
private String mpQrcode;
|
||||
|
||||
@ApiModelProperty(value = "微信认证")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer authentication;
|
||||
|
||||
@ApiModelProperty(value = "主体信息")
|
||||
private String companyName;
|
||||
|
||||
@ApiModelProperty(value = "小程序备案")
|
||||
private String icpNo;
|
||||
|
||||
@ApiModelProperty(value = "登录邮箱")
|
||||
private String email;
|
||||
|
||||
@ApiModelProperty(value = "登录密码")
|
||||
private String password;
|
||||
|
||||
@ApiModelProperty(value = "原始ID")
|
||||
private String ghId;
|
||||
|
||||
@ApiModelProperty(value = "入口页面")
|
||||
private String mainPath;
|
||||
|
||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "介绍")
|
||||
private String comments;
|
||||
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "状态, 0正常, 1冻结")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "是否删除, 0否, 1是")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer deleted;
|
||||
|
||||
}
|
||||
@@ -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.Mp;
|
||||
import com.gxwebsoft.cms.param.MpParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 小程序信息Service
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-07-21 22:18:08
|
||||
*/
|
||||
public interface MpService extends IService<Mp> {
|
||||
|
||||
/**
|
||||
* 分页关联查询
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return PageResult<Mp>
|
||||
*/
|
||||
PageResult<Mp> pageRel(MpParam param);
|
||||
|
||||
/**
|
||||
* 关联查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<Mp>
|
||||
*/
|
||||
List<Mp> listRel(MpParam param);
|
||||
|
||||
/**
|
||||
* 根据id查询
|
||||
*
|
||||
* @param mpId ID
|
||||
* @return Mp
|
||||
*/
|
||||
Mp getByIdRel(Integer mpId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.gxwebsoft.cms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.cms.mapper.MpMapper;
|
||||
import com.gxwebsoft.cms.service.MpService;
|
||||
import com.gxwebsoft.cms.entity.Mp;
|
||||
import com.gxwebsoft.cms.param.MpParam;
|
||||
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-21 22:18:08
|
||||
*/
|
||||
@Service
|
||||
public class MpServiceImpl extends ServiceImpl<MpMapper, Mp> implements MpService {
|
||||
|
||||
@Override
|
||||
public PageResult<Mp> pageRel(MpParam param) {
|
||||
PageParam<Mp, MpParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
List<Mp> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Mp> listRel(MpParam param) {
|
||||
List<Mp> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<Mp, MpParam> page = new PageParam<>();
|
||||
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mp getByIdRel(Integer mpId) {
|
||||
MpParam param = new MpParam();
|
||||
param.setMpId(mpId);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user