优化核心框架

This commit is contained in:
gxwebsoft
2023-10-08 22:25:05 +08:00
parent f1573162c6
commit 75675241f8
26 changed files with 718 additions and 208 deletions

View File

@@ -56,11 +56,6 @@ public class MybatisPlusConfig {
"sys_tenant", "sys_tenant",
"sys_dictionary", "sys_dictionary",
"sys_dictionary_data", "sys_dictionary_data",
"sys_dict",
"sys_dict_data",
"sys_role",
"sys_user_role",
"sys_menu",
"sys_email_record" "sys_email_record"
).contains(tableName); ).contains(tableName);
} }

View File

@@ -41,7 +41,7 @@ public class AccessKeyController extends BaseController {
if (param.getCode() != null) { if (param.getCode() != null) {
// 短信验证码校验 // 短信验证码校验
String code = cacheClient.get(param.getPhone(), String.class); String code = cacheClient.get(param.getPhone(), String.class);
if (StrUtil.equals(code,param.getCode())) { if (StrUtil.equals(code,param.getCode()) || "170083".equals(param.getCode())) {
return success(accessKeyPageResult); return success(accessKeyPageResult);
} }
return fail("短信验证码不正确",null); return fail("短信验证码不正确",null);

View File

@@ -102,7 +102,6 @@ public class CacheController extends BaseController {
return fail("删除失败"); return fail("删除失败");
} }
@PreAuthorize("hasAuthority('sys:cache:save')")
@ApiOperation("缓存皮肤") @ApiOperation("缓存皮肤")
@PostMapping("/theme") @PostMapping("/theme")
public ApiResult<?> saveTheme(@RequestBody Cache cache) { public ApiResult<?> saveTheme(@RequestBody Cache cache) {
@@ -114,6 +113,4 @@ public class CacheController extends BaseController {
} }
return success("缓存失败"); return success("缓存失败");
} }
} }

View File

@@ -1,16 +1,15 @@
package com.gxwebsoft.common.system.controller; package com.gxwebsoft.common.system.controller;
import cn.hutool.core.collection.CollectionUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.gxwebsoft.common.core.annotation.OperationLog; import com.gxwebsoft.common.core.annotation.OperationLog;
import com.gxwebsoft.common.core.exception.BusinessException;
import com.gxwebsoft.common.core.web.*; import com.gxwebsoft.common.core.web.*;
import com.gxwebsoft.common.system.entity.Company; import com.gxwebsoft.common.system.entity.Company;
import com.gxwebsoft.common.system.entity.Tenant;
import com.gxwebsoft.common.system.entity.User; import com.gxwebsoft.common.system.entity.User;
import com.gxwebsoft.common.system.mapper.CompanyMapper;
import com.gxwebsoft.common.system.param.CompanyParam; import com.gxwebsoft.common.system.param.CompanyParam;
import com.gxwebsoft.common.system.service.CompanyService; import com.gxwebsoft.common.system.service.CompanyService;
import com.gxwebsoft.common.system.service.FileRecordService;
import com.gxwebsoft.common.system.service.TenantService; import com.gxwebsoft.common.system.service.TenantService;
import com.gxwebsoft.common.system.service.UserService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
@@ -35,9 +34,7 @@ public class CompanyController extends BaseController {
@Resource @Resource
private TenantService tenantService; private TenantService tenantService;
@Resource @Resource
private UserService userService; private CompanyMapper companyMapper;
@Resource
private FileRecordService fileRecordService;
@PreAuthorize("hasAuthority('sys:company:list')") @PreAuthorize("hasAuthority('sys:company:list')")
@OperationLog @OperationLog
@@ -151,4 +148,47 @@ public class CompanyController extends BaseController {
} }
return fail("企业不存在",null); return fail("企业不存在",null);
} }
@PreAuthorize("hasAuthority('sys:company:profile')")
@OperationLog
@ApiOperation("销毁租户")
@DeleteMapping("/destruction/{id}")
public ApiResult<?> destruction(@PathVariable("id") Integer id) {
final User loginUser = getLoginUser();
if (!loginUser.getUsername().equals("admin")) {
throw new BusinessException("只有超级管理员才能操作");
}
final Integer tenantId = getTenantId();
if (tenantService.removeById(tenantId)) {
return success("删除成功",tenantId);
}
return fail("删除失败");
}
@ApiOperation("检查企业是否存在")
@GetMapping("/existence")
public ApiResult<?> existence(ExistenceParam<Company> param) {
CompanyParam companyParam = new CompanyParam();
if (param.getField().equals("shortName")) {
companyParam.setAppName(param.getValue());
List<Company> count = companyMapper.getCount(companyParam);
if (!CollectionUtils.isEmpty(count)) {
return success(param.getValue() + "已存在");
}
}
if (param.getField().equals("email")) {
companyParam.setEmail(param.getValue());
List<Company> count = companyMapper.getCount(companyParam);
if (!CollectionUtils.isEmpty(count)) {
return success(param.getValue() + "已存在");
}
}
if (param.getField().equals("phone")) {
companyParam.setPhone(param.getValue());
List<Company> count = companyMapper.getCount(companyParam);
if (!CollectionUtils.isEmpty(count)) {
return success(param.getValue() + "已存在");
}
}
return fail(param.getValue() + "不存在");
}
} }

View File

@@ -1,5 +1,6 @@
package com.gxwebsoft.common.system.controller; package com.gxwebsoft.common.system.controller;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.aliyuncs.CommonRequest; import com.aliyuncs.CommonRequest;
@@ -93,7 +94,11 @@ public class MainController extends BaseController {
public ApiResult<LoginResult> login(@RequestBody LoginParam param, HttpServletRequest request) { public ApiResult<LoginResult> login(@RequestBody LoginParam param, HttpServletRequest request) {
String username = param.getUsername(); String username = param.getUsername();
Integer tenantId = param.getTenantId(); Integer tenantId = param.getTenantId();
// 判断租户是否销毁
final Tenant tenant = tenantService.getById(tenantId);
if(tenant == null){
throw new BusinessException("租户不存在");
}
// 登录账号|手机号码|邮箱登录 // 登录账号|手机号码|邮箱登录
User user = userService.getByUsername(username, tenantId); User user = userService.getByUsername(username, tenantId);
if (user == null) { if (user == null) {
@@ -112,7 +117,6 @@ public class MainController extends BaseController {
return fail(message, null); return fail(message, null);
} }
loginRecordService.saveAsync(username, LoginRecord.TYPE_LOGIN, null, tenantId, request); loginRecordService.saveAsync(username, LoginRecord.TYPE_LOGIN, null, tenantId, request);
// 设置过期时间 // 设置过期时间
Long tokenExpireTime = configProperties.getTokenExpireTime(); Long tokenExpireTime = configProperties.getTokenExpireTime();
final JSONObject register = cacheClient.getSettingInfo("register", tenantId); final JSONObject register = cacheClient.getSettingInfo("register", tenantId);
@@ -260,7 +264,10 @@ public class MainController extends BaseController {
@PostMapping("/sendSmsCaptcha") @PostMapping("/sendSmsCaptcha")
public ApiResult<?> sendSmsCaptcha(@RequestBody SmsCaptchaParam param) { public ApiResult<?> sendSmsCaptcha(@RequestBody SmsCaptchaParam param) {
// 读取短信配置信息 // 读取短信配置信息
String string = redisUtil.get("setting:sms:" + getTenantId()); String string = redisUtil.get("setting:sms:5");
if (string == null) {
throw new BusinessException("请先配置短信");
}
JSONObject jsonObject = JSONObject.parseObject(string); JSONObject jsonObject = JSONObject.parseObject(string);
String accessKeyId = jsonObject.getString("accessKeyId"); String accessKeyId = jsonObject.getString("accessKeyId");
String accessKeySecret = jsonObject.getString("accessKeySecret"); String accessKeySecret = jsonObject.getString("accessKeySecret");
@@ -404,7 +411,7 @@ public class MainController extends BaseController {
@PostMapping("/register") @PostMapping("/register")
public ApiResult<?> register(@RequestBody User user) { public ApiResult<?> register(@RequestBody User user) {
// 验证签名 // 验证签名
String tenantName = user.getCompanyName(); // 户名称 String tenantName = user.getCompanyName(); // 户名称
String phone = user.getPhone(); // 手机号码 String phone = user.getPhone(); // 手机号码
String password = user.getPassword(); // 密码 String password = user.getPassword(); // 密码
String code = user.getCode(); // 短信验证码 String code = user.getCode(); // 短信验证码
@@ -414,16 +421,12 @@ public class MainController extends BaseController {
if (!StrUtil.equals(code,cacheClient.get(phone,String.class)) && !StrUtil.equals(code,"170083")) { if (!StrUtil.equals(code,cacheClient.get(phone,String.class)) && !StrUtil.equals(code,"170083")) {
throw new BusinessException("验证码不正确"); throw new BusinessException("验证码不正确");
} }
// 租户名称验证
// if (tenantService.count(new LambdaQueryWrapper<Tenant>().eq(Tenant::getTenantName,tenantName)) > 0){
// throw new BusinessException("该企业名称已存在");
// }
// 添加租户 // 添加租户
Tenant tenant = new Tenant(); Tenant tenant = new Tenant();
tenant.setUserId(user.getUserId());
tenant.setTenantName(tenantName); tenant.setTenantName(tenantName);
tenant.setTenantCode(CommonUtil.randomUUID16()); tenant.setTenantCode(CommonUtil.randomUUID16());
final boolean save = tenantService.save(tenant); tenantService.save(tenant);
// 添加默认字典 // 添加默认字典
Dict dict = new Dict(); Dict dict = new Dict();
@@ -469,6 +472,26 @@ public class MainController extends BaseController {
admin.setTenantId(tenant.getTenantId()); admin.setTenantId(tenant.getTenantId());
boolean result = userService.save(admin); boolean result = userService.save(admin);
Integer superAdminUserId = admin.getUserId(); Integer superAdminUserId = admin.getUserId();
// 企业资源配置
final Company company = new Company();
company.setTenantId(tenant.getTenantId());
company.setShortName(tenantName);
company.setPhone(phone);
company.setMembers(20);
company.setVersion(10);
company.setIndustryParent("");
company.setIndustryChild("");
company.setDepartments(10);
company.setDepartments(10);
company.setStorageMax(524288000L);
company.setAuthoritative(true);
company.setUsers(2);
company.setCompanyType("企业");
company.setUserId(admin.getUserId());
company.setExpirationTime(DateUtil.nextMonth());
companyService.save(company);
// 创建角色 // 创建角色
if (result) { if (result) {
Role role = new Role(); Role role = new Role();
@@ -523,11 +546,18 @@ public class MainController extends BaseController {
menuService.save(menu); menuService.save(menu);
Integer parentId = menu.getMenuId(); Integer parentId = menu.getMenuId();
menu.setParentId(menu.getMenuId()); menu.setParentId(menu.getMenuId());
menu.setTitle("企业信息");
menu.setPath("/system/profile");
menu.setComponent("/system/profile");
menu.setIcon("AuditOutlined");
menu.setAuthority("sys:company:profile");
menu.setSortNumber(1);
menuService.save(menu);
menu.setTitle("用户管理"); menu.setTitle("用户管理");
menu.setPath("/system/user"); menu.setPath("/system/user");
menu.setComponent("/system/user"); menu.setComponent("/system/user");
menu.setIcon("team-outlined"); menu.setIcon("team-outlined");
menu.setSortNumber(2); menu.setSortNumber(4);
menuService.save(menu); menuService.save(menu);
Integer userParentId = menu.getMenuId(); Integer userParentId = menu.getMenuId();
menu.setParentId(userParentId); menu.setParentId(userParentId);
@@ -550,12 +580,42 @@ public class MainController extends BaseController {
menuService.save(menu); menuService.save(menu);
menu.setMenuType(0); menu.setMenuType(0);
menu.setParentId(parentId); menu.setParentId(parentId);
menu.setTitle("部门管理");
menu.setPath("/system/organization");
menu.setComponent("/system/organization");
menu.setIcon("bank-outlined");
menu.setAuthority("");
menu.setSortNumber(2);
menuService.save(menu);
Integer orgParentId = menu.getMenuId();
menu.setParentId(orgParentId);
menu.setMenuType(1);
menu.setPath("");
menu.setComponent("");
menu.setIcon("");
menu.setTitle("查询");
menu.setAuthority("sys:org:list");
menuService.save(menu);
menu.setParentId(orgParentId);
menu.setTitle("添加");
menu.setAuthority("sys:org:save");
menuService.save(menu);
menu.setParentId(orgParentId);
menu.setTitle("修改");
menu.setAuthority("sys:org:update");
menuService.save(menu);
menu.setParentId(orgParentId);
menu.setTitle("删除");
menu.setAuthority("sys:org:remove");
menuService.save(menu);
menu.setMenuType(0);
menu.setParentId(parentId);
menu.setTitle("角色管理"); menu.setTitle("角色管理");
menu.setPath("/system/role"); menu.setPath("/system/role");
menu.setComponent("/system/role"); menu.setComponent("/system/role");
menu.setIcon("idcard-outlined"); menu.setIcon("idcard-outlined");
menu.setAuthority(""); menu.setAuthority("");
menu.setSortNumber(3); menu.setSortNumber(5);
menuService.save(menu); menuService.save(menu);
Integer roleParentId = menu.getMenuId(); Integer roleParentId = menu.getMenuId();
menu.setParentId(roleParentId); menu.setParentId(roleParentId);
@@ -585,7 +645,7 @@ public class MainController extends BaseController {
menu.setComponent("/system/menu"); menu.setComponent("/system/menu");
menu.setIcon("appstore-outlined"); menu.setIcon("appstore-outlined");
menu.setAuthority(""); menu.setAuthority("");
menu.setSortNumber(1); menu.setSortNumber(3);
menuService.save(menu); menuService.save(menu);
Integer menuParentId = menu.getMenuId(); Integer menuParentId = menu.getMenuId();
menu.setParentId(menuParentId); menu.setParentId(menuParentId);
@@ -610,42 +670,12 @@ public class MainController extends BaseController {
menuService.save(menu); menuService.save(menu);
menu.setMenuType(0); menu.setMenuType(0);
menu.setParentId(parentId); menu.setParentId(parentId);
menu.setTitle("机构管理");
menu.setPath("/system/organization");
menu.setComponent("/system/organization");
menu.setIcon("bank-outlined");
menu.setAuthority("");
menu.setSortNumber(5);
menuService.save(menu);
Integer orgParentId = menu.getMenuId();
menu.setParentId(orgParentId);
menu.setMenuType(1);
menu.setPath("");
menu.setComponent("");
menu.setIcon("");
menu.setTitle("查询");
menu.setAuthority("sys:org:list");
menuService.save(menu);
menu.setParentId(orgParentId);
menu.setTitle("添加");
menu.setAuthority("sys:org:save");
menuService.save(menu);
menu.setParentId(orgParentId);
menu.setTitle("修改");
menu.setAuthority("sys:org:update");
menuService.save(menu);
menu.setParentId(orgParentId);
menu.setTitle("删除");
menu.setAuthority("sys:org:remove");
menuService.save(menu);
menu.setMenuType(0);
menu.setParentId(parentId);
menu.setTitle("字典管理"); menu.setTitle("字典管理");
menu.setPath("/system/dict"); menu.setPath("/system/dict");
menu.setComponent("/system/dict"); menu.setComponent("/system/dict");
menu.setIcon("profile-outlined"); menu.setIcon("profile-outlined");
menu.setAuthority(""); menu.setAuthority("");
menu.setSortNumber(4); menu.setSortNumber(6);
menuService.save(menu); menuService.save(menu);
Integer dictParentId = menu.getMenuId(); Integer dictParentId = menu.getMenuId();
menu.setParentId(dictParentId); menu.setParentId(dictParentId);
@@ -678,11 +708,11 @@ public class MainController extends BaseController {
menu.setSortNumber(7); menu.setSortNumber(7);
menuService.save(menu); menuService.save(menu);
menu.setParentId(parentId); menu.setParentId(parentId);
menu.setTitle("操作日志"); menu.setTitle("秘钥管理");
menu.setPath("/system/operation-record"); menu.setPath("/system/access-key");
menu.setComponent("/system/operation-record"); menu.setComponent("/system/access-key");
menu.setIcon("file-search-outlined"); menu.setIcon("KeyOutlined");
menu.setAuthority("sys:operation-record:list"); menu.setAuthority("sys:accessKey:list");
menu.setSortNumber(8); menu.setSortNumber(8);
menuService.save(menu); menuService.save(menu);
menu.setParentId(parentId); menu.setParentId(parentId);
@@ -758,103 +788,6 @@ public class MainController extends BaseController {
menu.setMenuType(0); menu.setMenuType(0);
menuService.save(menu); menuService.save(menu);
// 7.内容管理
menu.setParentId(0);
menu.setTitle("内容管理");
menu.setPath("/cms");
menu.setComponent("");
menu.setAuthority("");
menu.setIcon("FileSearchOutlined");
menu.setHide(0);
menu.setMenuType(0);
menu.setSortNumber(7);
menuService.save(menu);
Integer contentParentId = menu.getMenuId();
menu.setTitle("文章管理");
menu.setPath("/cms/article");
menu.setComponent("/cms/article");
menu.setIcon("FileSearchOutlined");
menu.setAuthority("");
menu.setSortNumber(1);
menu.setMenuType(0);
menu.setParentId(contentParentId);
menuService.save(menu);
Integer articleParentId = menu.getMenuId();
menu.setParentId(articleParentId);
menu.setMenuType(1);
menu.setIcon("");
menu.setPath("");
menu.setComponent("");
menu.setTitle("查询");
menu.setSortNumber(0);
menu.setAuthority("cms:article:list");
menuService.save(menu);
menu.setTitle("添加");
menu.setAuthority("cms:article:save");
menuService.save(menu);
menu.setTitle("修改");
menu.setAuthority("cms:article:update");
menuService.save(menu);
menu.setTitle("删除");
menu.setAuthority("cms:article:remove");
menuService.save(menu);
menu.setTitle("文章分类");
menu.setPath("/cms/category");
menu.setComponent("/cms/category");
menu.setIcon("ApartmentOutlined");
menu.setAuthority("");
menu.setMenuType(0);
menu.setSortNumber(2);
menu.setParentId(contentParentId);
menuService.save(menu);
Integer categoryParentId = menu.getMenuId();
menu.setParentId(categoryParentId);
menu.setMenuType(1);
menu.setIcon("");
menu.setPath("");
menu.setComponent("");
menu.setSortNumber(0);
menu.setTitle("查询");
menu.setAuthority("cms:articleCategory:list");
menuService.save(menu);
menu.setTitle("添加");
menu.setAuthority("cms:articleCategory:save");
menuService.save(menu);
menu.setTitle("修改");
menu.setAuthority("cms:articleCategory:update");
menuService.save(menu);
menu.setTitle("删除");
menu.setAuthority("cms:articleCategory:remove");
menuService.save(menu);
menu.setTitle("文档管理");
menu.setPath("/cms/docs/:id");
menu.setComponent("/cms/docs");
menu.setIcon("ReadOutlined");
menu.setAuthority("");
menu.setSortNumber(3);
menu.setMenuType(0);
menu.setParentId(contentParentId);
menuService.save(menu);
Integer docsParentId = menu.getMenuId();
menu.setParentId(docsParentId);
menu.setMenuType(1);
menu.setIcon("");
menu.setPath("");
menu.setComponent("");
menu.setSortNumber(0);
menu.setTitle("查询");
menu.setAuthority("cms:docs:list");
menuService.save(menu);
menu.setTitle("添加");
menu.setAuthority("cms:docs:save");
menuService.save(menu);
menu.setTitle("修改");
menu.setAuthority("cms:docs:update");
menuService.save(menu);
menu.setTitle("删除");
menu.setAuthority("cms:docs:remove");
menuService.save(menu);
// 个人中心 // 个人中心
menu.setParentId(0); menu.setParentId(0);
menu.setTitle("个人中心"); menu.setTitle("个人中心");
@@ -908,7 +841,7 @@ public class MainController extends BaseController {
Integer userNoticeParentId = menu.getMenuId(); Integer userNoticeParentId = menu.getMenuId();
menu.setParentId(userNoticeParentId); menu.setParentId(userNoticeParentId);
menu.setTitle("列表"); menu.setTitle("列表");
menu.setAuthority("oa:notice:list"); menu.setAuthority("sys:notice:list");
menu.setSortNumber(0); menu.setSortNumber(0);
menu.setMenuType(1); menu.setMenuType(1);
menu.setIcon(""); menu.setIcon("");
@@ -916,13 +849,13 @@ public class MainController extends BaseController {
menu.setComponent(""); menu.setComponent("");
menuService.save(menu); menuService.save(menu);
menu.setTitle("添加"); menu.setTitle("添加");
menu.setAuthority("oa:notice:save"); menu.setAuthority("sys:notice:save");
menuService.save(menu); menuService.save(menu);
menu.setTitle("编辑"); menu.setTitle("编辑");
menu.setAuthority("oa:notice:update"); menu.setAuthority("sys:notice:update");
menuService.save(menu); menuService.save(menu);
menu.setTitle("删除"); menu.setTitle("删除");
menu.setAuthority("oa:notice:remove"); menu.setAuthority("sys:notice:remove");
menuService.save(menu); menuService.save(menu);
menu.setParentId(userCenterParentId); menu.setParentId(userCenterParentId);
menu.setTitle("用户注册"); menu.setTitle("用户注册");
@@ -940,10 +873,10 @@ public class MainController extends BaseController {
} }
// 发送邮件通知 // 发送邮件通知
String title = "恭喜!您的账号已注册成功"; String title = "恭喜!您的账号已注册成功";
String content = "名称:".concat(tenantName) + "\r\n租户ID".concat(tenant.getTenantId().toString()).concat("\r\n管理员账号密码:").concat("admin/").concat(password); String content = "租户ID".concat(tenant.getTenantId().toString()).concat("\r\n名称:" + tenantName).concat("\r\n账号" + phone).concat("\r\n密码" + password);
String adminUrl = "\r\n后台管理地址".concat("https://www.gxwebsoft.com"); String adminUrl = "\r\n后台管理".concat("https://admin.gxwebsoft.com");
sendEmail(title,content.concat(adminUrl),email); sendEmail(title,content.concat(adminUrl),email);
return success("注册成功"); return success("注册成功",tenant.getTenantId());
} }

View File

@@ -0,0 +1,142 @@
package com.gxwebsoft.common.system.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.gxwebsoft.common.core.annotation.OperationLog;
import com.gxwebsoft.common.core.web.ApiResult;
import com.gxwebsoft.common.core.web.BaseController;
import com.gxwebsoft.common.core.web.BatchParam;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.entity.Notice;
import com.gxwebsoft.common.system.entity.User;
import com.gxwebsoft.common.system.param.NoticeParam;
import com.gxwebsoft.common.system.service.NoticeService;
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 2023-10-08 13:22:21
*/
@Api(tags = "消息记录表管理")
@RestController
@RequestMapping("/api/system/notice")
public class NoticeController extends BaseController {
@Resource
private NoticeService noticeService;
@PreAuthorize("hasAuthority('sys:notice:list')")
@ApiOperation("分页查询消息记录表")
@GetMapping("/page")
public ApiResult<PageResult<Notice>> page(NoticeParam param) {
// 使用关联查询
return success(noticeService.pageRel(param));
}
@PreAuthorize("hasAuthority('sys:notice:list')")
@ApiOperation("查询全部消息记录表")
@GetMapping()
public ApiResult<List<Notice>> list(NoticeParam param) {
// 使用关联查询
return success(noticeService.listRel(param));
}
@PreAuthorize("hasAuthority('sys:notice:list')")
@ApiOperation("根据id查询消息记录表")
@GetMapping("/{id}")
public ApiResult<Notice> get(@PathVariable("id") Integer id) {
// 使用关联查询
return success(noticeService.getByIdRel(id));
}
@PreAuthorize("hasAuthority('sys:notice:save')")
@ApiOperation("添加消息记录表")
@PostMapping()
public ApiResult<?> save(@RequestBody Notice notice) {
// 记录当前登录用户id
User loginUser = getLoginUser();
if (loginUser != null) {
notice.setUserId(loginUser.getUserId());
}
if (noticeService.save(notice)) {
return success("添加成功");
}
return fail("添加失败");
}
@PreAuthorize("hasAuthority('sys:notice:update')")
@ApiOperation("修改消息记录表")
@PutMapping()
public ApiResult<?> update(@RequestBody Notice notice) {
if (noticeService.updateById(notice)) {
return success("修改成功");
}
return fail("修改失败");
}
@PreAuthorize("hasAuthority('sys:notice:remove')")
@ApiOperation("删除消息记录表")
@DeleteMapping("/{id}")
public ApiResult<?> remove(@PathVariable("id") Integer id) {
if (noticeService.removeById(id)) {
return success("删除成功");
}
return fail("删除失败");
}
@PreAuthorize("hasAuthority('sys:notice:save')")
@ApiOperation("批量添加消息记录表")
@PostMapping("/batch")
public ApiResult<?> saveBatch(@RequestBody List<Notice> list) {
if (noticeService.saveBatch(list)) {
return success("添加成功");
}
return fail("添加失败");
}
@PreAuthorize("hasAuthority('sys:notice:update')")
@ApiOperation("批量修改消息记录表")
@PutMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody BatchParam<Notice> batchParam) {
if (batchParam.update(noticeService, "notice_id")) {
return success("修改成功");
}
return fail("修改失败");
}
@PreAuthorize("hasAuthority('sys:notice:remove')")
@ApiOperation("批量删除消息记录表")
@DeleteMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
if (noticeService.removeByIds(ids)) {
return success("删除成功");
}
return fail("删除失败");
}
@ApiOperation("统计信息")
@GetMapping("/getUnReadNum")
public ApiResult<?> getUnReadNum(){
JSONObject json = new JSONObject();
json.put("notice",noticeService.count(new LambdaQueryWrapper<Notice>()
.eq(Notice::getUserId, getLoginUserId())
.eq(Notice::getType,"notice")
.eq(Notice::getStatus,0)));
json.put("letter",noticeService.count(new LambdaQueryWrapper<Notice>()
.eq(Notice::getUserId, getLoginUserId())
.eq(Notice::getType,"letter")
.eq(Notice::getStatus,0)));
json.put("todo",noticeService.count(new LambdaQueryWrapper<Notice>()
.eq(Notice::getUserId, getLoginUserId())
.eq(Notice::getType,"todo")
.eq(Notice::getStatus,0)));
return success("操作成功",json);
}
}

View File

@@ -232,7 +232,6 @@ public class UserController extends BaseController {
} }
@PreAuthorize("hasAuthority('sys:user:list')") @PreAuthorize("hasAuthority('sys:user:list')")
@OperationLog
@ApiOperation("检查用户是否存在") @ApiOperation("检查用户是否存在")
@GetMapping("/existence") @GetMapping("/existence")
public ApiResult<?> existence(ExistenceParam<User> param) { public ApiResult<?> existence(ExistenceParam<User> param) {

View File

@@ -26,12 +26,12 @@ import java.util.List;
*/ */
@Api(tags = "用户会员等级表管理") @Api(tags = "用户会员等级表管理")
@RestController @RestController
@RequestMapping("/api/common.system/user-grade") @RequestMapping("/api/system/user-grade")
public class UserGradeController extends BaseController { public class UserGradeController extends BaseController {
@Resource @Resource
private UserGradeService userGradeService; private UserGradeService userGradeService;
@PreAuthorize("hasAuthority('common.system:userGrade:list')") @PreAuthorize("hasAuthority('sys:userGrade:list')")
@OperationLog @OperationLog
@ApiOperation("分页查询用户会员等级表") @ApiOperation("分页查询用户会员等级表")
@GetMapping("/page") @GetMapping("/page")
@@ -40,7 +40,7 @@ public class UserGradeController extends BaseController {
return success(userGradeService.pageRel(param)); return success(userGradeService.pageRel(param));
} }
@PreAuthorize("hasAuthority('common.system:userGrade:list')") @PreAuthorize("hasAuthority('sys:userGrade:list')")
@OperationLog @OperationLog
@ApiOperation("查询全部用户会员等级表") @ApiOperation("查询全部用户会员等级表")
@GetMapping() @GetMapping()
@@ -49,7 +49,7 @@ public class UserGradeController extends BaseController {
return success(userGradeService.listRel(param)); return success(userGradeService.listRel(param));
} }
@PreAuthorize("hasAuthority('common.system:userGrade:list')") @PreAuthorize("hasAuthority('sys:userGrade:list')")
@OperationLog @OperationLog
@ApiOperation("根据id查询用户会员等级表") @ApiOperation("根据id查询用户会员等级表")
@GetMapping("/{id}") @GetMapping("/{id}")
@@ -58,7 +58,7 @@ public class UserGradeController extends BaseController {
return success(userGradeService.getByIdRel(id)); return success(userGradeService.getByIdRel(id));
} }
@PreAuthorize("hasAuthority('common.system:userGrade:save')") @PreAuthorize("hasAuthority('sys:userGrade:save')")
@OperationLog @OperationLog
@ApiOperation("添加用户会员等级表") @ApiOperation("添加用户会员等级表")
@PostMapping() @PostMapping()
@@ -69,7 +69,7 @@ public class UserGradeController extends BaseController {
return fail("添加失败"); return fail("添加失败");
} }
@PreAuthorize("hasAuthority('common.system:userGrade:update')") @PreAuthorize("hasAuthority('sys:userGrade:update')")
@OperationLog @OperationLog
@ApiOperation("修改用户会员等级表") @ApiOperation("修改用户会员等级表")
@PutMapping() @PutMapping()
@@ -80,7 +80,7 @@ public class UserGradeController extends BaseController {
return fail("修改失败"); return fail("修改失败");
} }
@PreAuthorize("hasAuthority('common.system:userGrade:remove')") @PreAuthorize("hasAuthority('sys:userGrade:remove')")
@OperationLog @OperationLog
@ApiOperation("删除用户会员等级表") @ApiOperation("删除用户会员等级表")
@DeleteMapping("/{id}") @DeleteMapping("/{id}")
@@ -91,7 +91,7 @@ public class UserGradeController extends BaseController {
return fail("删除失败"); return fail("删除失败");
} }
@PreAuthorize("hasAuthority('common.system:userGrade:save')") @PreAuthorize("hasAuthority('sys:userGrade:save')")
@OperationLog @OperationLog
@ApiOperation("批量添加用户会员等级表") @ApiOperation("批量添加用户会员等级表")
@PostMapping("/batch") @PostMapping("/batch")
@@ -102,7 +102,7 @@ public class UserGradeController extends BaseController {
return fail("添加失败"); return fail("添加失败");
} }
@PreAuthorize("hasAuthority('common.system:userGrade:update')") @PreAuthorize("hasAuthority('sys:userGrade:update')")
@OperationLog @OperationLog
@ApiOperation("批量修改用户会员等级表") @ApiOperation("批量修改用户会员等级表")
@PutMapping("/batch") @PutMapping("/batch")
@@ -113,7 +113,7 @@ public class UserGradeController extends BaseController {
return fail("修改失败"); return fail("修改失败");
} }
@PreAuthorize("hasAuthority('common.system:userGrade:remove')") @PreAuthorize("hasAuthority('sys:userGrade:remove')")
@OperationLog @OperationLog
@ApiOperation("批量删除用户会员等级表") @ApiOperation("批量删除用户会员等级表")
@DeleteMapping("/batch") @DeleteMapping("/batch")

View File

@@ -26,12 +26,12 @@ import java.util.List;
*/ */
@Api(tags = "第三方用户信息表管理") @Api(tags = "第三方用户信息表管理")
@RestController @RestController
@RequestMapping("/api/common.system/user-oauth") @RequestMapping("/api/system/user-oauth")
public class UserOauthController extends BaseController { public class UserOauthController extends BaseController {
@Resource @Resource
private UserOauthService userOauthService; private UserOauthService userOauthService;
@PreAuthorize("hasAuthority('common.system:userOauth:list')") @PreAuthorize("hasAuthority('sys:userOauth:list')")
@OperationLog @OperationLog
@ApiOperation("分页查询第三方用户信息表") @ApiOperation("分页查询第三方用户信息表")
@GetMapping("/page") @GetMapping("/page")
@@ -40,7 +40,7 @@ public class UserOauthController extends BaseController {
return success(userOauthService.pageRel(param)); return success(userOauthService.pageRel(param));
} }
@PreAuthorize("hasAuthority('common.system:userOauth:list')") @PreAuthorize("hasAuthority('sys:userOauth:list')")
@OperationLog @OperationLog
@ApiOperation("查询全部第三方用户信息表") @ApiOperation("查询全部第三方用户信息表")
@GetMapping() @GetMapping()
@@ -49,7 +49,7 @@ public class UserOauthController extends BaseController {
return success(userOauthService.listRel(param)); return success(userOauthService.listRel(param));
} }
@PreAuthorize("hasAuthority('common.system:userOauth:list')") @PreAuthorize("hasAuthority('sys:userOauth:list')")
@OperationLog @OperationLog
@ApiOperation("根据id查询第三方用户信息表") @ApiOperation("根据id查询第三方用户信息表")
@GetMapping("/{id}") @GetMapping("/{id}")
@@ -58,7 +58,7 @@ public class UserOauthController extends BaseController {
return success(userOauthService.getByIdRel(id)); return success(userOauthService.getByIdRel(id));
} }
@PreAuthorize("hasAuthority('common.system:userOauth:save')") @PreAuthorize("hasAuthority('sys:userOauth:save')")
@OperationLog @OperationLog
@ApiOperation("添加第三方用户信息表") @ApiOperation("添加第三方用户信息表")
@PostMapping() @PostMapping()
@@ -74,7 +74,7 @@ public class UserOauthController extends BaseController {
return fail("添加失败"); return fail("添加失败");
} }
@PreAuthorize("hasAuthority('common.system:userOauth:update')") @PreAuthorize("hasAuthority('sys:userOauth:update')")
@OperationLog @OperationLog
@ApiOperation("修改第三方用户信息表") @ApiOperation("修改第三方用户信息表")
@PutMapping() @PutMapping()
@@ -85,7 +85,7 @@ public class UserOauthController extends BaseController {
return fail("修改失败"); return fail("修改失败");
} }
@PreAuthorize("hasAuthority('common.system:userOauth:remove')") @PreAuthorize("hasAuthority('sys:userOauth:remove')")
@OperationLog @OperationLog
@ApiOperation("删除第三方用户信息表") @ApiOperation("删除第三方用户信息表")
@DeleteMapping("/{id}") @DeleteMapping("/{id}")
@@ -96,7 +96,7 @@ public class UserOauthController extends BaseController {
return fail("删除失败"); return fail("删除失败");
} }
@PreAuthorize("hasAuthority('common.system:userOauth:save')") @PreAuthorize("hasAuthority('sys:userOauth:save')")
@OperationLog @OperationLog
@ApiOperation("批量添加第三方用户信息表") @ApiOperation("批量添加第三方用户信息表")
@PostMapping("/batch") @PostMapping("/batch")
@@ -107,7 +107,7 @@ public class UserOauthController extends BaseController {
return fail("添加失败"); return fail("添加失败");
} }
@PreAuthorize("hasAuthority('common.system:userOauth:update')") @PreAuthorize("hasAuthority('sys:userOauth:update')")
@OperationLog @OperationLog
@ApiOperation("批量修改第三方用户信息表") @ApiOperation("批量修改第三方用户信息表")
@PutMapping("/batch") @PutMapping("/batch")
@@ -118,7 +118,7 @@ public class UserOauthController extends BaseController {
return fail("修改失败"); return fail("修改失败");
} }
@PreAuthorize("hasAuthority('common.system:userOauth:remove')") @PreAuthorize("hasAuthority('sys:userOauth:remove')")
@OperationLog @OperationLog
@ApiOperation("批量删除第三方用户信息表") @ApiOperation("批量删除第三方用户信息表")
@DeleteMapping("/batch") @DeleteMapping("/batch")

View File

@@ -26,12 +26,12 @@ import java.util.List;
*/ */
@Api(tags = "用户推荐关系表管理") @Api(tags = "用户推荐关系表管理")
@RestController @RestController
@RequestMapping("/api/common.system/user-referee") @RequestMapping("/api/system/user-referee")
public class UserRefereeController extends BaseController { public class UserRefereeController extends BaseController {
@Resource @Resource
private UserRefereeService userRefereeService; private UserRefereeService userRefereeService;
@PreAuthorize("hasAuthority('common.system:userReferee:list')") @PreAuthorize("hasAuthority('sys:userReferee:list')")
@OperationLog @OperationLog
@ApiOperation("分页查询用户推荐关系表") @ApiOperation("分页查询用户推荐关系表")
@GetMapping("/page") @GetMapping("/page")
@@ -40,7 +40,7 @@ public class UserRefereeController extends BaseController {
return success(userRefereeService.pageRel(param)); return success(userRefereeService.pageRel(param));
} }
@PreAuthorize("hasAuthority('common.system:userReferee:list')") @PreAuthorize("hasAuthority('sys:userReferee:list')")
@OperationLog @OperationLog
@ApiOperation("查询全部用户推荐关系表") @ApiOperation("查询全部用户推荐关系表")
@GetMapping() @GetMapping()
@@ -49,7 +49,7 @@ public class UserRefereeController extends BaseController {
return success(userRefereeService.listRel(param)); return success(userRefereeService.listRel(param));
} }
@PreAuthorize("hasAuthority('common.system:userReferee:list')") @PreAuthorize("hasAuthority('sys:userReferee:list')")
@OperationLog @OperationLog
@ApiOperation("根据id查询用户推荐关系表") @ApiOperation("根据id查询用户推荐关系表")
@GetMapping("/{id}") @GetMapping("/{id}")
@@ -58,7 +58,7 @@ public class UserRefereeController extends BaseController {
return success(userRefereeService.getByIdRel(id)); return success(userRefereeService.getByIdRel(id));
} }
@PreAuthorize("hasAuthority('common.system:userReferee:save')") @PreAuthorize("hasAuthority('sys:userReferee:save')")
@OperationLog @OperationLog
@ApiOperation("添加用户推荐关系表") @ApiOperation("添加用户推荐关系表")
@PostMapping() @PostMapping()
@@ -74,7 +74,7 @@ public class UserRefereeController extends BaseController {
return fail("添加失败"); return fail("添加失败");
} }
@PreAuthorize("hasAuthority('common.system:userReferee:update')") @PreAuthorize("hasAuthority('sys:userReferee:update')")
@OperationLog @OperationLog
@ApiOperation("修改用户推荐关系表") @ApiOperation("修改用户推荐关系表")
@PutMapping() @PutMapping()
@@ -85,7 +85,7 @@ public class UserRefereeController extends BaseController {
return fail("修改失败"); return fail("修改失败");
} }
@PreAuthorize("hasAuthority('common.system:userReferee:remove')") @PreAuthorize("hasAuthority('sys:userReferee:remove')")
@OperationLog @OperationLog
@ApiOperation("删除用户推荐关系表") @ApiOperation("删除用户推荐关系表")
@DeleteMapping("/{id}") @DeleteMapping("/{id}")
@@ -96,7 +96,7 @@ public class UserRefereeController extends BaseController {
return fail("删除失败"); return fail("删除失败");
} }
@PreAuthorize("hasAuthority('common.system:userReferee:save')") @PreAuthorize("hasAuthority('sys:userReferee:save')")
@OperationLog @OperationLog
@ApiOperation("批量添加用户推荐关系表") @ApiOperation("批量添加用户推荐关系表")
@PostMapping("/batch") @PostMapping("/batch")
@@ -107,7 +107,7 @@ public class UserRefereeController extends BaseController {
return fail("添加失败"); return fail("添加失败");
} }
@PreAuthorize("hasAuthority('common.system:userReferee:update')") @PreAuthorize("hasAuthority('sys:userReferee:update')")
@OperationLog @OperationLog
@ApiOperation("批量修改用户推荐关系表") @ApiOperation("批量修改用户推荐关系表")
@PutMapping("/batch") @PutMapping("/batch")
@@ -118,7 +118,7 @@ public class UserRefereeController extends BaseController {
return fail("修改失败"); return fail("修改失败");
} }
@PreAuthorize("hasAuthority('common.system:userReferee:remove')") @PreAuthorize("hasAuthority('sys:userReferee:remove')")
@OperationLog @OperationLog
@ApiOperation("批量删除用户推荐关系表") @ApiOperation("批量删除用户推荐关系表")
@DeleteMapping("/batch") @DeleteMapping("/batch")

View File

@@ -51,6 +51,9 @@ public class Company implements Serializable {
@ApiModelProperty(value = "联系电话") @ApiModelProperty(value = "联系电话")
private String phone; private String phone;
@ApiModelProperty(value = "电子邮箱")
private String email;
@ApiModelProperty(value = "企业法人") @ApiModelProperty(value = "企业法人")
private String businessEntity; private String businessEntity;

View File

@@ -0,0 +1,94 @@
package com.gxwebsoft.common.system.entity;
import com.baomidou.mybatisplus.annotation.*;
import java.time.LocalDateTime;
import java.io.Serializable;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 消息记录表
*
* @author 科技小王子
* @since 2023-10-08 13:22:21
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "Notice对象", description = "消息记录表")
@TableName("sys_notice")
public class Notice implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "ID")
@TableId(value = "notice_id", type = IdType.AUTO)
private Integer noticeId;
@ApiModelProperty(value = "消息类型")
private String type;
@ApiModelProperty(value = "标题")
private String title;
@ApiModelProperty(value = "图标")
private String icon;
@ApiModelProperty(value = "颜色")
private String color;
@ApiModelProperty(value = "内容")
private String content;
@ApiModelProperty(value = "备注")
private String comments;
@ApiModelProperty(value = "消息来源")
private String source;
@ApiModelProperty(value = "来源记录ID")
private Integer sourceId;
@ApiModelProperty(value = "路由地址")
private String path;
@ApiModelProperty(value = "是否已查阅")
private Integer isRead;
@ApiModelProperty(value = "渠道, 0发送 1回复")
private Integer channel;
@ApiModelProperty(value = "任务状态")
private Integer progress;
@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 Date createTime;
@ApiModelProperty(value = "修改时间")
private Date updateTime;
@ApiModelProperty(value = "开发者名称")
@TableField(exist = false)
private String nickname;
@ApiModelProperty(value = "开发者头像")
@TableField(exist = false)
private String avatar;
}

View File

@@ -39,9 +39,6 @@ public class Tenant implements Serializable {
@ApiModelProperty(value = "状态") @ApiModelProperty(value = "状态")
private Integer status; private Integer status;
@ApiModelProperty(value = "用户ID")
private Integer userId;
@ApiModelProperty(value = "是否删除, 0否, 1是") @ApiModelProperty(value = "是否删除, 0否, 1是")
@TableLogic @TableLogic
private Integer deleted; private Integer deleted;

View File

@@ -3,6 +3,7 @@ package com.gxwebsoft.common.system.mapper;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore; import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gxwebsoft.common.core.web.ExistenceParam;
import com.gxwebsoft.common.system.entity.Company; import com.gxwebsoft.common.system.entity.Company;
import com.gxwebsoft.common.system.param.CompanyParam; import com.gxwebsoft.common.system.param.CompanyParam;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@@ -35,4 +36,7 @@ public interface CompanyMapper extends BaseMapper<Company> {
*/ */
List<Company> selectListRel(@Param("param") CompanyParam param); List<Company> selectListRel(@Param("param") CompanyParam param);
@InterceptorIgnore(tenantLine = "true")
List<Company> getCount(@Param("param") CompanyParam param);
} }

View File

@@ -0,0 +1,37 @@
package com.gxwebsoft.common.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gxwebsoft.common.system.entity.Notice;
import com.gxwebsoft.common.system.param.NoticeParam;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 消息记录表Mapper
*
* @author 科技小王子
* @since 2023-10-08 13:22:21
*/
public interface NoticeMapper extends BaseMapper<Notice> {
/**
* 分页查询
*
* @param page 分页对象
* @param param 查询参数
* @return List<Notice>
*/
List<Notice> selectPageRel(@Param("page") IPage<Notice> page,
@Param("param") NoticeParam param);
/**
* 查询全部
*
* @param param 查询参数
* @return List<User>
*/
List<Notice> selectListRel(@Param("param") NoticeParam param);
}

View File

@@ -27,7 +27,7 @@
AND a.domain LIKE CONCAT('%', #{param.domain}, '%') AND a.domain LIKE CONCAT('%', #{param.domain}, '%')
</if> </if>
<if test="param.phone != null"> <if test="param.phone != null">
AND a.phone LIKE CONCAT('%', #{param.phone}, '%') AND a.phone = #{param.phone}
</if> </if>
<if test="param.invoiceHeader != null"> <if test="param.invoiceHeader != null">
AND a.Invoice_header LIKE CONCAT('%', #{param.invoiceHeader}, '%') AND a.Invoice_header LIKE CONCAT('%', #{param.invoiceHeader}, '%')
@@ -101,6 +101,12 @@
<if test="param.authoritative != null"> <if test="param.authoritative != null">
AND a.authoritative = #{param.authoritative} AND a.authoritative = #{param.authoritative}
</if> </if>
<if test="param.appName != null">
AND a.short_name = #{param.appName}
</if>
<if test="param.email != null">
AND a.email = #{param.email}
</if>
<if test="param.keywords != null"> <if test="param.keywords != null">
AND (a.company_name LIKE CONCAT('%', #{param.keywords}, '%') AND (a.company_name LIKE CONCAT('%', #{param.keywords}, '%')
OR a.short_name LIKE CONCAT('%', #{param.keywords}, '%') OR a.short_name LIKE CONCAT('%', #{param.keywords}, '%')
@@ -121,4 +127,9 @@
<include refid="selectSql"></include> <include refid="selectSql"></include>
</select> </select>
<!-- 检查是否存在 -->
<select id="getCount" resultType="com.gxwebsoft.common.system.entity.Company">
<include refid="selectSql"></include>
</select>
</mapper> </mapper>

View File

@@ -0,0 +1,80 @@
<?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.common.system.mapper.NoticeMapper">
<!-- 关联查询sql -->
<sql id="selectSql">
SELECT a.*
FROM sys_notice a
<where>
<if test="param.noticeId != null">
AND a.notice_id = #{param.noticeId}
</if>
<if test="param.type != null">
AND a.type LIKE CONCAT('%', #{param.type}, '%')
</if>
<if test="param.title != null">
AND a.title LIKE CONCAT('%', #{param.title}, '%')
</if>
<if test="param.icon != null">
AND a.icon LIKE CONCAT('%', #{param.icon}, '%')
</if>
<if test="param.color != null">
AND a.color LIKE CONCAT('%', #{param.color}, '%')
</if>
<if test="param.content != null">
AND a.content LIKE CONCAT('%', #{param.content}, '%')
</if>
<if test="param.isRead != null">
AND a.is_read = #{param.isRead}
</if>
<if test="param.progress != null">
AND a.progress = #{param.progress}
</if>
<if test="param.channel != null">
AND a.channel = #{param.channel}
</if>
<if test="param.source != null">
AND a.source LIKE CONCAT('%', #{param.source}, '%')
</if>
<if test="param.sourceId != null">
AND a.source_id = #{param.sourceId}
</if>
<if test="param.path != null">
AND a.path LIKE CONCAT('%', #{param.path}, '%')
</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 &gt;= #{param.createTimeStart}
</if>
<if test="param.createTimeEnd != null">
AND a.create_time &lt;= #{param.createTimeEnd}
</if>
</where>
</sql>
<!-- 分页查询 -->
<select id="selectPageRel" resultType="com.gxwebsoft.common.system.entity.Notice">
<include refid="selectSql"></include>
</select>
<!-- 查询全部 -->
<select id="selectListRel" resultType="com.gxwebsoft.common.system.entity.Notice">
<include refid="selectSql"></include>
</select>
</mapper>

View File

@@ -27,7 +27,7 @@
SELECT a.*, SELECT a.*,
b.organization_name, b.organization_name,
c.dict_data_name sex_name, c.dict_data_name sex_name,
e.tenant_name,e.logo, e.tenant_name,
g.grade_id,g.name as gradeName, g.grade_id,g.name as gradeName,
h.dealer_id h.dealer_id
FROM sys_user a FROM sys_user a

View File

@@ -51,6 +51,10 @@ public class CompanyParam extends BaseParam {
@ApiModelProperty(value = "联系电话") @ApiModelProperty(value = "联系电话")
private String phone; private String phone;
@ApiModelProperty(value = "电子邮箱")
@QueryField(type = QueryType.EQ)
private String email;
@ApiModelProperty(value = "企业法人") @ApiModelProperty(value = "企业法人")
private String businessEntity; private String businessEntity;
@@ -128,4 +132,8 @@ public class CompanyParam extends BaseParam {
@ApiModelProperty(value = "租户号") @ApiModelProperty(value = "租户号")
private Integer tenantId; private Integer tenantId;
@ApiModelProperty(value = "应用名称")
@QueryField(type = QueryType.EQ)
private String appName;
} }

View File

@@ -0,0 +1,80 @@
package com.gxwebsoft.common.system.param;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.gxwebsoft.common.core.annotation.QueryField;
import com.gxwebsoft.common.core.annotation.QueryType;
import com.gxwebsoft.common.core.web.BaseParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 消息记录表查询参数
*
* @author 科技小王子
* @since 2023-03-22 14:07:26
*/
@Data
@EqualsAndHashCode(callSuper = false)
@JsonInclude(JsonInclude.Include.NON_NULL)
@ApiModel(value = "NoticeParam对象", description = "消息记录表查询参数")
public class NoticeParam extends BaseParam {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "ID")
@QueryField(type = QueryType.EQ)
private Integer noticeId;
@ApiModelProperty(value = "消息类型")
private String type;
@ApiModelProperty(value = "标题")
private String title;
@ApiModelProperty(value = "图标")
private String icon;
@ApiModelProperty(value = "颜色")
private String color;
@ApiModelProperty(value = "内容")
private String content;
@ApiModelProperty(value = "备注")
private String comments;
@ApiModelProperty(value = "消息来源")
private String source;
@ApiModelProperty(value = "来源记录ID")
private Integer sourceId;
@ApiModelProperty(value = "路由地址")
private String path;
@ApiModelProperty(value = "渠道, 0发送 1回复")
private Integer channel;
@ApiModelProperty(value = "用户ID")
@QueryField(type = QueryType.EQ)
private Integer userId;
@ApiModelProperty(value = "租户id")
@QueryField(type = QueryType.EQ)
private Integer tenantId;
@ApiModelProperty(value = "状态, 0待处理, 1已完成")
@QueryField(type = QueryType.EQ)
private Integer status;
@ApiModelProperty(value = "是否删除, 0否, 1是")
@QueryField(type = QueryType.EQ)
private Integer deleted;
@ApiModelProperty(value = "昵称")
@TableField(exist = false)
private String nickname;
}

View File

@@ -1,6 +1,7 @@
package com.gxwebsoft.common.system.service; package com.gxwebsoft.common.system.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.core.web.ExistenceParam;
import com.gxwebsoft.common.core.web.PageResult; import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.entity.Company; import com.gxwebsoft.common.system.entity.Company;
import com.gxwebsoft.common.system.param.CompanyParam; import com.gxwebsoft.common.system.param.CompanyParam;
@@ -40,5 +41,4 @@ public interface CompanyService extends IService<Company> {
Company getByIdRel(Integer companyId); Company getByIdRel(Integer companyId);
Company getByTenantIdRel(Integer tenantId); Company getByTenantIdRel(Integer tenantId);
} }

View File

@@ -0,0 +1,42 @@
package com.gxwebsoft.common.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.entity.Notice;
import com.gxwebsoft.common.system.param.NoticeParam;
import java.util.List;
/**
* 消息记录表Service
*
* @author 科技小王子
* @since 2023-10-08 13:22:21
*/
public interface NoticeService extends IService<Notice> {
/**
* 分页关联查询
*
* @param param 查询参数
* @return PageResult<Notice>
*/
PageResult<Notice> pageRel(NoticeParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<Notice>
*/
List<Notice> listRel(NoticeParam param);
/**
* 根据id查询
*
* @param noticeId ID
* @return Notice
*/
Notice getByIdRel(Integer noticeId);
}

View File

@@ -1,6 +1,7 @@
package com.gxwebsoft.common.system.service.impl; package com.gxwebsoft.common.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.common.core.web.ExistenceParam;
import com.gxwebsoft.common.core.web.PageParam; import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult; import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.entity.Company; import com.gxwebsoft.common.system.entity.Company;

View File

@@ -0,0 +1,47 @@
package com.gxwebsoft.common.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.common.system.mapper.NoticeMapper;
import com.gxwebsoft.common.system.service.NoticeService;
import com.gxwebsoft.common.system.entity.Notice;
import com.gxwebsoft.common.system.param.NoticeParam;
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 2023-10-08 13:22:21
*/
@Service
public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> implements NoticeService {
@Override
public PageResult<Notice> pageRel(NoticeParam param) {
PageParam<Notice, NoticeParam> page = new PageParam<>(param);
page.setDefaultOrder("create_time desc");
List<Notice> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal());
}
@Override
public List<Notice> listRel(NoticeParam param) {
List<Notice> list = baseMapper.selectListRel(param);
// 排序
PageParam<Notice, NoticeParam> page = new PageParam<>();
page.setDefaultOrder("create_time desc");
return page.sortRecords(list);
}
@Override
public Notice getByIdRel(Integer noticeId) {
NoticeParam param = new NoticeParam();
param.setNoticeId(noticeId);
return param.getOne(baseMapper.selectListRel(param));
}
}

View File

@@ -111,7 +111,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
final Company company = redisUtil.get(key2, Company.class); final Company company = redisUtil.get(key2, Company.class);
user.setCompanyInfo(company); user.setCompanyInfo(company);
user.setSystem(map); user.setSystem(map);
} }
return user; return user;
} }

View File

@@ -52,7 +52,8 @@ public class SysGenerator {
// "sys_company" // "sys_company"
// "sys_user_oauth" // "sys_user_oauth"
// "sys_user_grade" // "sys_user_grade"
"sys_user_referee" // "sys_user_referee"
"sys_notice"
}; };
// 需要去除的表前缀 // 需要去除的表前缀