优化核心框架

This commit is contained in:
gxwebsoft
2023-10-12 15:32:24 +08:00
parent a5f930dc33
commit 2280c4211d
23 changed files with 121 additions and 368 deletions

View File

@@ -56,7 +56,8 @@ public class MybatisPlusConfig {
"sys_tenant", "sys_tenant",
"sys_dictionary", "sys_dictionary",
"sys_dictionary_data", "sys_dictionary_data",
"sys_email_record" "sys_email_record",
"sys_plug"
).contains(tableName); ).contains(tableName);
} }
}; };

View File

@@ -33,7 +33,6 @@ public class CacheClient {
* 写入redis缓存 * 写入redis缓存
* @param key [表名]:id * @param key [表名]:id
* @param entity 实体类对象 * @param entity 实体类对象
* 示例 cacheClient.set("merchant:"+id,merchant)
*/ */
public <T> void set(String key, T entity){ public <T> void set(String key, T entity){
stringRedisTemplate.opsForValue().set(prefix(key), JSONUtil.toJSONString(entity)); stringRedisTemplate.opsForValue().set(prefix(key), JSONUtil.toJSONString(entity));

View File

@@ -20,7 +20,6 @@ import com.gxwebsoft.common.core.security.JwtSubject;
import com.gxwebsoft.common.core.security.JwtUtil; import com.gxwebsoft.common.core.security.JwtUtil;
import com.gxwebsoft.common.core.utils.CacheClient; import com.gxwebsoft.common.core.utils.CacheClient;
import com.gxwebsoft.common.core.utils.CommonUtil; import com.gxwebsoft.common.core.utils.CommonUtil;
import com.gxwebsoft.common.core.utils.JSONUtil;
import com.gxwebsoft.common.core.utils.RedisUtil; import com.gxwebsoft.common.core.utils.RedisUtil;
import com.gxwebsoft.common.core.web.ApiResult; import com.gxwebsoft.common.core.web.ApiResult;
import com.gxwebsoft.common.core.web.BaseController; import com.gxwebsoft.common.core.web.BaseController;
@@ -33,7 +32,6 @@ import com.gxwebsoft.common.system.result.CaptchaResult;
import com.gxwebsoft.common.system.result.LoginResult; import com.gxwebsoft.common.system.result.LoginResult;
import com.gxwebsoft.common.system.service.*; import com.gxwebsoft.common.system.service.*;
import com.wf.captcha.SpecCaptcha; import com.wf.captcha.SpecCaptcha;
import io.jsonwebtoken.Claims;
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;

View File

@@ -146,9 +146,9 @@ public class MenuController extends BaseController {
public ApiResult<?> install(@PathVariable("id") Integer id){ public ApiResult<?> install(@PathVariable("id") Integer id){
if(menuService.install(id)){ if(menuService.install(id)){
// 更新安装次数 // 更新安装次数
final Plug plug = plugService.getOne(new LambdaQueryWrapper<Plug>().eq(Plug::getMenuId, id)); // final Plug plug = plugService.getOne(new LambdaQueryWrapper<Plug>().eq(Plug::getMenuId, id));
plug.setInstalls(plug.getInstalls() + 1); // plug.setInstalls(plug.getInstalls() + 1);
plugService.updateById(plug); // plugService.updateById(plug);
return success("安装成功"); return success("安装成功");
} }
return fail("安装失败",id); return fail("安装失败",id);

View File

@@ -1,17 +1,15 @@
package com.gxwebsoft.common.system.controller; package com.gxwebsoft.common.system.controller;
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.BaseController;
import com.gxwebsoft.common.core.web.BatchParam;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.entity.Menu;
import com.gxwebsoft.common.system.entity.Plug;
import com.gxwebsoft.common.system.entity.User; import com.gxwebsoft.common.system.entity.User;
import com.gxwebsoft.common.system.param.PlugParam;
import com.gxwebsoft.common.system.service.MenuService;
import com.gxwebsoft.common.system.service.PlugService; import com.gxwebsoft.common.system.service.PlugService;
import com.gxwebsoft.common.system.entity.Plug;
import com.gxwebsoft.common.system.param.PlugParam;
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 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;
@@ -24,7 +22,7 @@ import java.util.List;
* 插件扩展控制器 * 插件扩展控制器
* *
* @author 科技小王子 * @author 科技小王子
* @since 2023-05-18 11:57:37 * @since 2023-10-12 09:53:07
*/ */
@Api(tags = "插件扩展管理") @Api(tags = "插件扩展管理")
@RestController @RestController
@@ -32,20 +30,17 @@ import java.util.List;
public class PlugController extends BaseController { public class PlugController extends BaseController {
@Resource @Resource
private PlugService plugService; private PlugService plugService;
@Resource
private MenuService menuService;
@PreAuthorize("hasAuthority('sys:plug:list')") @PreAuthorize("hasAuthority('sys:plug:list')")
@OperationLog @OperationLog
@ApiOperation("分页查询插件扩展") @ApiOperation("分页查询插件扩展")
@GetMapping("/page") @GetMapping("/page")
public ApiResult<PageResult<Plug>> page(PlugParam param) { public ApiResult<PageResult<Plug>> page(PlugParam param) {
// 如果不传userId只显示审核通过的插件 PageParam<Plug, PlugParam> page = new PageParam<>(param);
if (param.getUserId() == null) { page.setDefaultOrder("create_time desc");
param.setStatus(20); return success(plugService.page(page, page.getWrapper()));
}
// 使用关联查询 // 使用关联查询
return success(plugService.pageRel(param)); //return success(plugService.pageRel(param));
} }
@PreAuthorize("hasAuthority('sys:plug:list')") @PreAuthorize("hasAuthority('sys:plug:list')")
@@ -53,8 +48,11 @@ public class PlugController extends BaseController {
@ApiOperation("查询全部插件扩展") @ApiOperation("查询全部插件扩展")
@GetMapping() @GetMapping()
public ApiResult<List<Plug>> list(PlugParam param) { public ApiResult<List<Plug>> list(PlugParam param) {
PageParam<Plug, PlugParam> page = new PageParam<>(param);
page.setDefaultOrder("create_time desc");
return success(plugService.list(page.getOrderWrapper()));
// 使用关联查询 // 使用关联查询
return success(plugService.listRel(param)); //return success(plugService.listRel(param));
} }
@PreAuthorize("hasAuthority('sys:plug:list')") @PreAuthorize("hasAuthority('sys:plug:list')")
@@ -62,8 +60,9 @@ public class PlugController extends BaseController {
@ApiOperation("根据id查询插件扩展") @ApiOperation("根据id查询插件扩展")
@GetMapping("/{id}") @GetMapping("/{id}")
public ApiResult<Plug> get(@PathVariable("id") Integer id) { public ApiResult<Plug> get(@PathVariable("id") Integer id) {
return success(plugService.getById(id));
// 使用关联查询 // 使用关联查询
return success(plugService.getByIdRel(id)); //return success(plugService.getByIdRel(id));
} }
@PreAuthorize("hasAuthority('sys:plug:save')") @PreAuthorize("hasAuthority('sys:plug:save')")
@@ -120,7 +119,7 @@ public class PlugController extends BaseController {
@ApiOperation("批量修改插件扩展") @ApiOperation("批量修改插件扩展")
@PutMapping("/batch") @PutMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody BatchParam<Plug> batchParam) { public ApiResult<?> removeBatch(@RequestBody BatchParam<Plug> batchParam) {
if (batchParam.update(plugService, "menu_id")) { if (batchParam.update(plugService, "plug_id")) {
return success("修改成功"); return success("修改成功");
} }
return fail("修改失败"); return fail("修改失败");
@@ -137,35 +136,4 @@ public class PlugController extends BaseController {
return fail("删除失败"); return fail("删除失败");
} }
@PreAuthorize("hasAuthority('sys:plug:save')")
@OperationLog
@ApiOperation("发布插件")
@PostMapping("/plug")
public ApiResult<?> plug(@RequestBody Plug plug){
final Integer menuId = plug.getParentId();
// 查重
final int count = plugService.count(new LambdaQueryWrapper<Plug>().eq(Plug::getMenuId, menuId));
if(count > 0){
return fail("请勿重复发布");
}
// 准备数据
final Menu menu = menuService.getById(menuId);
plug.setUserId(getLoginUserId());
plug.setMenuId(menuId);
plug.setTenantId(getTenantId());
plug.setIcon(menu.getIcon());
plug.setPath(menu.getPath());
plug.setComponent(menu.getComponent());
plug.setAuthority(menu.getAuthority());
plug.setTitle(menu.getTitle());
plug.setMenuType(menu.getMenuType());
plug.setMeta(menu.getMeta());
plug.setParentId(menu.getParentId());
plug.setHide(menu.getHide());
plug.setSortNumber(menu.getSortNumber());
if(plugService.save(plug)){
return success("发布成功");
}
return fail("发布失败");
}
} }

View File

@@ -49,9 +49,6 @@ public class FileRecord implements Serializable {
@TableLogic @TableLogic
private Integer deleted; private Integer deleted;
@ApiModelProperty("商户编号")
private String merchantCode;
@ApiModelProperty(value = "租户id") @ApiModelProperty(value = "租户id")
private Integer tenantId; private Integer tenantId;

View File

@@ -1,21 +1,24 @@
package com.gxwebsoft.common.system.entity; package com.gxwebsoft.common.system.entity;
import com.baomidou.mybatisplus.annotation.*; import java.math.BigDecimal;
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 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;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/** /**
* 插件扩展 * 插件扩展
* *
* @author 科技小王子 * @author 科技小王子
* @since 2023-05-18 11:57:37 * @since 2023-10-12 09:53:07
*/ */
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@@ -23,89 +26,51 @@ import java.util.List;
@TableName("sys_plug") @TableName("sys_plug")
public class Plug implements Serializable { public class Plug implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public static final int TYPE_MENU = 0; // 菜单类型
public static final int TYPE_BTN = 1; // 按钮类型
@ApiModelProperty(value = "插件id") @ApiModelProperty(value = "插件id")
@TableId(value = "plug_id", type = IdType.AUTO) @TableId(value = "plug_id", type = IdType.AUTO)
private Integer plugId; private Integer plugId;
@ApiModelProperty(value = "菜单ID")
private Integer menuId;
@ApiModelProperty(value = "上级id, 0是顶级")
private Integer parentId;
@ApiModelProperty(value = "菜单名称") @ApiModelProperty(value = "菜单名称")
private String title; private String plugName;
@ApiModelProperty(value = "菜单路由地址") @ApiModelProperty(value = "插件ID")
private String path; private String plugCode;
@ApiModelProperty(value = "菜单组件地址, 目录可为空") @ApiModelProperty(value = "插件类型 10后台模块")
private String component; private Integer plugType;
@ApiModelProperty(value = "类型, 0菜单, 1按钮")
private Integer menuType;
@ApiModelProperty(value = "排序号") @ApiModelProperty(value = "排序号")
private Integer sortNumber; private Integer sortNumber;
@ApiModelProperty(value = "权限标识") @ApiModelProperty(value = "插件价格")
private String authority; private BigDecimal price;
@ApiModelProperty(value = "打开位置") @ApiModelProperty(value = "评分")
private String target; private BigDecimal score;
@ApiModelProperty(value = "菜单图标") @ApiModelProperty(value = "下载次数")
private String icon; private Integer clicks;
@ApiModelProperty(value = "图标颜色") @ApiModelProperty(value = "安装次数")
private String color; private Integer installs;
@ApiModelProperty(value = "是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)") @ApiModelProperty(value = "备注")
private Integer hide;
@ApiModelProperty(value = "菜单侧栏选中的path")
private String active;
@ApiModelProperty(value = "其它路由元信息")
private String meta;
@ApiModelProperty(value = "插件描述")
private String comments; private String comments;
@ApiModelProperty(value = "插件详情") @ApiModelProperty(value = "插件详情")
private String content; private String content;
@ApiModelProperty("评分") @ApiModelProperty(value = "状态, 10待审核 20已通过 30已驳回")
private BigDecimal score; private Integer status;
@ApiModelProperty("插件价格")
private BigDecimal price;
@ApiModelProperty("浏览次数")
private Integer clicks;
@ApiModelProperty("安装次数")
private Integer installs;
@ApiModelProperty(value = "关联应用ID")
private Integer appId;
@ApiModelProperty(value = "用户ID") @ApiModelProperty(value = "用户ID")
private Integer userId; private Integer userId;
@ApiModelProperty(value = "状态")
private Integer status;
@ApiModelProperty(value = "是否删除, 0否, 1是") @ApiModelProperty(value = "是否删除, 0否, 1是")
@TableLogic @TableLogic
private Integer deleted; private Integer deleted;
@ApiModelProperty(value = "商户编码")
private String merchantCode;
@ApiModelProperty(value = "租户id") @ApiModelProperty(value = "租户id")
private Integer tenantId; private Integer tenantId;
@@ -115,27 +80,4 @@ public class Plug implements Serializable {
@ApiModelProperty(value = "修改时间") @ApiModelProperty(value = "修改时间")
private Date updateTime; private Date updateTime;
@ApiModelProperty("子菜单")
@TableField(exist = false)
private List<Menu> children;
@ApiModelProperty("角色权限树选中状态")
@TableField(exist = false)
private Boolean checked;
@ApiModelProperty("租户名称")
@TableField(exist = false)
private String tenantName;
@ApiModelProperty("企业名称")
@TableField(exist = false)
private String companyName;
@ApiModelProperty("企业简称")
@TableField(exist = false)
private String shortName;
@ApiModelProperty("企业域名")
@TableField(exist = false)
private String domain;
} }

View File

@@ -236,14 +236,6 @@ public class User implements UserDetails {
@TableField(exist = false) @TableField(exist = false)
private String unionid; private String unionid;
@ApiModelProperty("所属商户的编号")
@TableField(exist = false)
private String merchantCode;
@ApiModelProperty("所属商户名称")
@TableField(exist = false)
private String merchantName;
@ApiModelProperty("ico文件") @ApiModelProperty("ico文件")
@TableField(exist = false) @TableField(exist = false)
private String logo; private String logo;

View File

@@ -58,9 +58,6 @@ public class UserGrade implements Serializable {
@TableLogic @TableLogic
private Integer deleted; private Integer deleted;
@ApiModelProperty(value = "商户编码")
private String merchantCode;
@ApiModelProperty(value = "租户id") @ApiModelProperty(value = "租户id")
private Integer tenantId; private Integer tenantId;

View File

@@ -55,9 +55,6 @@ public class UserOauth implements Serializable {
@TableLogic @TableLogic
private Integer deleted; private Integer deleted;
@ApiModelProperty(value = "商户编码")
private String merchantCode;
@ApiModelProperty(value = "租户id") @ApiModelProperty(value = "租户id")
private Integer tenantId; private Integer tenantId;

View File

@@ -1,6 +1,5 @@
package com.gxwebsoft.common.system.mapper; package com.gxwebsoft.common.system.mapper;
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.system.entity.Plug; import com.gxwebsoft.common.system.entity.Plug;
@@ -13,7 +12,7 @@ import java.util.List;
* 插件扩展Mapper * 插件扩展Mapper
* *
* @author 科技小王子 * @author 科技小王子
* @since 2023-05-18 11:57:37 * @since 2023-10-12 09:53:07
*/ */
public interface PlugMapper extends BaseMapper<Plug> { public interface PlugMapper extends BaseMapper<Plug> {
@@ -24,7 +23,6 @@ public interface PlugMapper extends BaseMapper<Plug> {
* @param param 查询参数 * @param param 查询参数
* @return List<Plug> * @return List<Plug>
*/ */
@InterceptorIgnore(tenantLine = "true")
List<Plug> selectPageRel(@Param("page") IPage<Plug> page, List<Plug> selectPageRel(@Param("page") IPage<Plug> page,
@Param("param") PlugParam param); @Param("param") PlugParam param);
@@ -36,7 +34,4 @@ public interface PlugMapper extends BaseMapper<Plug> {
*/ */
List<Plug> selectListRel(@Param("param") PlugParam param); List<Plug> selectListRel(@Param("param") PlugParam param);
@InterceptorIgnore(tenantLine = "true")
List<Plug> getMenuByClone(@Param("param") PlugParam param);
} }

View File

@@ -7,11 +7,9 @@
SELECT a.*, SELECT a.*,
b.username create_username, b.username create_username,
b.nickname create_nickname, b.nickname create_nickname,
b.avatar, b.avatar
c.merchant_code
FROM sys_file_record a FROM sys_file_record a
LEFT JOIN sys_user b ON a.create_user_id = b.user_id LEFT JOIN sys_user b ON a.create_user_id = b.user_id
LEFT JOIN shop_merchant c ON a.merchant_code = c.merchant_code
<where> <where>
<if test="param.id != null"> <if test="param.id != null">
AND a.id = #{param.id} AND a.id = #{param.id}
@@ -52,9 +50,6 @@
<if test="param.contentType != null"> <if test="param.contentType != null">
AND a.content_type LIKE CONCAT('%', #{param.contentType}, '%') AND a.content_type LIKE CONCAT('%', #{param.contentType}, '%')
</if> </if>
<if test="param.merchantCode != null">
AND a.merchant_code LIKE CONCAT('%', #{param.merchantCode}, '%')
</if>
</where> </where>
</sql> </sql>

View File

@@ -4,64 +4,47 @@
<!-- 关联查询sql --> <!-- 关联查询sql -->
<sql id="selectSql"> <sql id="selectSql">
SELECT a.*,b.tenant_name,c.company_name,c.short_name,c.domain SELECT a.*
FROM sys_plug a FROM sys_plug a
LEFT JOIN sys_tenant b ON a.tenant_id = b.tenant_id
LEFT JOIN sys_company c ON a.tenant_id = c.tenant_id
<where> <where>
<if test="param.plugId != null"> <if test="param.plugId != null">
AND a.plug_id = #{param.plugId} AND a.plug_id = #{param.plugId}
</if> </if>
<if test="param.menuId != null"> <if test="param.plugName != null">
AND a.menu_id = #{param.menuId} AND a.plug_name LIKE CONCAT('%', #{param.plugName}, '%')
</if> </if>
<if test="param.parentId != null"> <if test="param.plugCode != null">
AND a.parent_id = #{param.parentId} AND a.plug_code LIKE CONCAT('%', #{param.plugCode}, '%')
</if> </if>
<if test="param.title != null"> <if test="param.plugType != null">
AND a.title LIKE CONCAT('%', #{param.title}, '%') AND a.plug_type = #{param.plugType}
</if>
<if test="param.path != null">
AND a.path LIKE CONCAT('%', #{param.path}, '%')
</if>
<if test="param.component != null">
AND a.component LIKE CONCAT('%', #{param.component}, '%')
</if>
<if test="param.menuType != null">
AND a.menu_type = #{param.menuType}
</if> </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>
<if test="param.authority != null"> <if test="param.price != null">
AND a.authority LIKE CONCAT('%', #{param.authority}, '%') AND a.price = #{param.price}
</if> </if>
<if test="param.target != null"> <if test="param.score != null">
AND a.target LIKE CONCAT('%', #{param.target}, '%') AND a.score = #{param.score}
</if> </if>
<if test="param.icon != null"> <if test="param.clicks != null">
AND a.icon LIKE CONCAT('%', #{param.icon}, '%') AND a.clicks = #{param.clicks}
</if> </if>
<if test="param.color != null"> <if test="param.installs != null">
AND a.color LIKE CONCAT('%', #{param.color}, '%') AND a.installs = #{param.installs}
</if> </if>
<if test="param.hide != null"> <if test="param.comments != null">
AND a.hide = #{param.hide} AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
</if> </if>
<if test="param.active != null"> <if test="param.content != null">
AND a.active LIKE CONCAT('%', #{param.active}, '%') AND a.content LIKE CONCAT('%', #{param.content}, '%')
</if>
<if test="param.meta != null">
AND a.meta LIKE CONCAT('%', #{param.meta}, '%')
</if>
<if test="param.appId != null">
AND a.app_id = #{param.appId}
</if>
<if test="param.userId != null">
AND a.user_id = #{param.userId}
</if> </if>
<if test="param.status != null"> <if test="param.status != null">
AND a.status = #{param.status} AND a.status = #{param.status}
</if>
<if test="param.userId != null">
AND a.user_id = #{param.userId}
</if> </if>
<if test="param.deleted != null"> <if test="param.deleted != null">
AND a.deleted = #{param.deleted} AND a.deleted = #{param.deleted}
@@ -69,22 +52,12 @@
<if test="param.deleted == null"> <if test="param.deleted == null">
AND a.deleted = 0 AND a.deleted = 0
</if> </if>
<if test="param.merchantCode != null">
AND a.merchant_code LIKE CONCAT('%', #{param.merchantCode}, '%')
</if>
<if test="param.createTimeStart != null"> <if test="param.createTimeStart != null">
AND a.create_time &gt;= #{param.createTimeStart} AND a.create_time &gt;= #{param.createTimeStart}
</if> </if>
<if test="param.createTimeEnd != null"> <if test="param.createTimeEnd != null">
AND a.create_time &lt;= #{param.createTimeEnd} AND a.create_time &lt;= #{param.createTimeEnd}
</if> </if>
<if test="param.keywords != null">
AND (a.title LIKE CONCAT('%', #{param.keywords}, '%')
OR a.menu_id = #{param.keywords}
OR c.company_name LIKE CONCAT('%', #{param.keywords}, '%')
OR c.short_name LIKE CONCAT('%', #{param.keywords}, '%')
)
</if>
</where> </where>
</sql> </sql>
@@ -98,8 +71,4 @@
<include refid="selectSql"></include> <include refid="selectSql"></include>
</select> </select>
<select id="getMenuByClone" resultType="com.gxwebsoft.common.system.entity.Plug">
<include refid="selectSql"></include>
</select>
</mapper> </mapper>

View File

@@ -40,9 +40,6 @@
<if test="param.deleted == null"> <if test="param.deleted == null">
AND a.deleted = 0 AND a.deleted = 0
</if> </if>
<if test="param.merchantCode != null">
AND a.merchant_code LIKE CONCAT('%', #{param.merchantCode}, '%')
</if>
<if test="param.createTimeStart != null"> <if test="param.createTimeStart != null">
AND a.create_time &gt;= #{param.createTimeStart} AND a.create_time &gt;= #{param.createTimeStart}
</if> </if>

View File

@@ -37,9 +37,6 @@
<if test="param.deleted == null"> <if test="param.deleted == null">
AND a.deleted = 0 AND a.deleted = 0
</if> </if>
<if test="param.merchantCode != null">
AND a.merchant_code LIKE CONCAT('%', #{param.merchantCode}, '%')
</if>
<if test="param.createTimeStart != null"> <if test="param.createTimeStart != null">
AND a.create_time &gt;= #{param.createTimeStart} AND a.create_time &gt;= #{param.createTimeStart}
</if> </if>

View File

@@ -64,7 +64,4 @@ public class FileRecordParam extends BaseParam {
@TableField(exist = false) @TableField(exist = false)
private String avatar; private String avatar;
@ApiModelProperty("商户编号")
private String merchantCode;
} }

View File

@@ -9,11 +9,13 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
/** /**
* 插件扩展查询参数 * 插件扩展查询参数
* *
* @author 科技小王子 * @author 科技小王子
* @since 2023-05-18 11:57:37 * @since 2023-10-12 09:53:07
*/ */
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@@ -26,58 +28,43 @@ public class PlugParam extends BaseParam {
@QueryField(type = QueryType.EQ) @QueryField(type = QueryType.EQ)
private Integer plugId; private Integer plugId;
@ApiModelProperty(value = "菜单id")
@QueryField(type = QueryType.EQ)
private Integer menuId;
@ApiModelProperty(value = "上级id, 0是顶级")
@QueryField(type = QueryType.EQ)
private Integer parentId;
@ApiModelProperty(value = "菜单名称") @ApiModelProperty(value = "菜单名称")
private String title; private String plugName;
@ApiModelProperty(value = "菜单路由地址") @ApiModelProperty(value = "插件ID")
private String path; private String plugCode;
@ApiModelProperty(value = "菜单组件地址, 目录可为空") @ApiModelProperty(value = "插件类型 10后台模块")
private String component;
@ApiModelProperty(value = "类型, 0菜单, 1按钮")
@QueryField(type = QueryType.EQ) @QueryField(type = QueryType.EQ)
private Integer menuType; private Integer plugType;
@ApiModelProperty(value = "排序号") @ApiModelProperty(value = "排序号")
@QueryField(type = QueryType.EQ) @QueryField(type = QueryType.EQ)
private Integer sortNumber; private Integer sortNumber;
@ApiModelProperty(value = "权限标识") @ApiModelProperty(value = "插件价格")
private String authority;
@ApiModelProperty(value = "打开位置")
private String target;
@ApiModelProperty(value = "菜单图标")
private String icon;
@ApiModelProperty(value = "图标颜色")
private String color;
@ApiModelProperty(value = "是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)")
@QueryField(type = QueryType.EQ) @QueryField(type = QueryType.EQ)
private Integer hide; private BigDecimal price;
@ApiModelProperty(value = "菜单侧栏选中的path") @ApiModelProperty(value = "评分")
private String active;
@ApiModelProperty(value = "其它路由元信息")
private String meta;
@ApiModelProperty(value = "关联应用ID")
@QueryField(type = QueryType.EQ) @QueryField(type = QueryType.EQ)
private Integer appId; private BigDecimal score;
@ApiModelProperty(value = "状态") @ApiModelProperty(value = "下载次数")
@QueryField(type = QueryType.EQ)
private Integer clicks;
@ApiModelProperty(value = "安装次数")
@QueryField(type = QueryType.EQ)
private Integer installs;
@ApiModelProperty(value = "备注")
private String comments;
@ApiModelProperty(value = "插件详情")
private String content;
@ApiModelProperty(value = "状态, 10待审核 20已通过 30已驳回")
@QueryField(type = QueryType.EQ) @QueryField(type = QueryType.EQ)
private Integer status; private Integer status;
@@ -89,7 +76,4 @@ public class PlugParam extends BaseParam {
@QueryField(type = QueryType.EQ) @QueryField(type = QueryType.EQ)
private Integer deleted; private Integer deleted;
@ApiModelProperty(value = "商户编码")
private String merchantCode;
} }

View File

@@ -57,7 +57,4 @@ public class UserGradeParam extends BaseParam {
@QueryField(type = QueryType.EQ) @QueryField(type = QueryType.EQ)
private Integer deleted; private Integer deleted;
@ApiModelProperty(value = "商户编码")
private String merchantCode;
} }

View File

@@ -54,7 +54,4 @@ public class UserOauthParam extends BaseParam {
@QueryField(type = QueryType.EQ) @QueryField(type = QueryType.EQ)
private Integer deleted; private Integer deleted;
@ApiModelProperty(value = "商户编码")
private String merchantCode;
} }

View File

@@ -11,7 +11,7 @@ import java.util.List;
* 插件扩展Service * 插件扩展Service
* *
* @author 科技小王子 * @author 科技小王子
* @since 2023-05-18 11:57:37 * @since 2023-10-12 09:53:07
*/ */
public interface PlugService extends IService<Plug> { public interface PlugService extends IService<Plug> {
@@ -34,11 +34,9 @@ public interface PlugService extends IService<Plug> {
/** /**
* 根据id查询 * 根据id查询
* *
* @param menuId 菜单id * @param plugId 插件id
* @return Plug * @return Plug
*/ */
Plug getByIdRel(Integer menuId); Plug getByIdRel(Integer plugId);
Boolean cloneMenu(PlugParam param);
} }

View File

@@ -1,16 +1,13 @@
package com.gxwebsoft.common.system.service.impl; package com.gxwebsoft.common.system.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.common.system.mapper.PlugMapper;
import com.gxwebsoft.common.system.service.PlugService;
import com.gxwebsoft.common.system.entity.Plug;
import com.gxwebsoft.common.system.param.PlugParam;
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.Plug;
import com.gxwebsoft.common.system.mapper.PlugMapper;
import com.gxwebsoft.common.system.param.PlugParam;
import com.gxwebsoft.common.system.service.PlugService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.List;
@@ -18,7 +15,7 @@ import java.util.List;
* 插件扩展Service实现 * 插件扩展Service实现
* *
* @author 科技小王子 * @author 科技小王子
* @since 2023-05-18 11:57:37 * @since 2023-10-12 09:53:07
*/ */
@Service @Service
public class PlugServiceImpl extends ServiceImpl<PlugMapper, Plug> implements PlugService { public class PlugServiceImpl extends ServiceImpl<PlugMapper, Plug> implements PlugService {
@@ -26,7 +23,7 @@ public class PlugServiceImpl extends ServiceImpl<PlugMapper, Plug> implements Pl
@Override @Override
public PageResult<Plug> pageRel(PlugParam param) { public PageResult<Plug> pageRel(PlugParam param) {
PageParam<Plug, PlugParam> page = new PageParam<>(param); PageParam<Plug, PlugParam> page = new PageParam<>(param);
page.setDefaultOrder("create_time desc"); //page.setDefaultOrder("create_time desc");
List<Plug> list = baseMapper.selectPageRel(page, param); List<Plug> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal()); return new PageResult<>(list, page.getTotal());
} }
@@ -36,77 +33,15 @@ public class PlugServiceImpl extends ServiceImpl<PlugMapper, Plug> implements Pl
List<Plug> list = baseMapper.selectListRel(param); List<Plug> list = baseMapper.selectListRel(param);
// 排序 // 排序
PageParam<Plug, PlugParam> page = new PageParam<>(); PageParam<Plug, PlugParam> page = new PageParam<>();
page.setDefaultOrder("create_time desc"); //page.setDefaultOrder("create_time desc");
return page.sortRecords(list); return page.sortRecords(list);
} }
@Override @Override
public Plug getByIdRel(Integer menuId) { public Plug getByIdRel(Integer plugId) {
PlugParam param = new PlugParam(); PlugParam param = new PlugParam();
param.setMenuId(menuId); param.setPlugId(plugId);
return param.getOne(baseMapper.selectListRel(param)); return param.getOne(baseMapper.selectListRel(param));
} }
@Override
@Transactional(rollbackFor = {Exception.class}, isolation = Isolation.SERIALIZABLE)
public Boolean cloneMenu(PlugParam param) {
System.out.println("准备待克隆的菜单数据 = " + param);
// 删除本项目菜单
baseMapper.delete(new LambdaQueryWrapper<Plug>().eq(Plug::getDeleted,0));
// 顶级栏目
param.setParentId(0);
final List<Plug> list = baseMapper.getMenuByClone(param);
// final List<Integer> menuIds = list.stream().map(Menu::getMenuId).collect(Collectors.toList());
list.forEach(d -> {
Plug plug = new Plug();
plug.setParentId(0);
plug.setTitle(d.getTitle());
plug.setPath(d.getPath());
plug.setComponent(d.getComponent());
plug.setMenuType(d.getMenuType());
plug.setSortNumber(d.getSortNumber());
plug.setAuthority(d.getAuthority());
plug.setIcon(d.getIcon());
plug.setHide(d.getHide());
plug.setMeta(d.getMeta());
save(plug);
// 二级菜单
param.setParentId(d.getMenuId());
final List<Plug> list1 = baseMapper.getMenuByClone(param);
list1.forEach(d1 -> {
final Plug menu1 = new Plug();
menu1.setParentId(plug.getMenuId());
menu1.setTitle(d1.getTitle());
menu1.setPath(d1.getPath());
menu1.setComponent(d1.getComponent());
menu1.setMenuType(d1.getMenuType());
menu1.setSortNumber(d1.getSortNumber());
menu1.setAuthority(d1.getAuthority());
menu1.setIcon(d1.getIcon());
menu1.setHide(d1.getHide());
menu1.setMeta(d1.getMeta());
save(menu1);
// 三级菜单
param.setParentId(d1.getMenuId());
final List<Plug> list2 = baseMapper.getMenuByClone(param);
list2.forEach(d2 -> {
final Plug menu2 = new Plug();
menu2.setParentId(menu1.getMenuId());
menu2.setTitle(d2.getTitle());
menu2.setPath(d2.getPath());
menu2.setComponent(d2.getComponent());
menu2.setMenuType(d2.getMenuType());
menu2.setSortNumber(d2.getSortNumber());
menu2.setAuthority(d2.getAuthority());
menu2.setIcon(d2.getIcon());
menu2.setHide(d2.getHide());
menu2.setMeta(d2.getMeta());
save(menu2);
});
});
});
return true;
}
} }

View File

@@ -3,16 +3,16 @@
# 数据源配置 # 数据源配置
spring: spring:
datasource: datasource:
url: jdbc:mysql://127.0.0.1:3308/com_gxwebsoft_oa?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8 url: jdbc:mysql://127.0.0.1:3308/gxwebsoft_core?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8
username: com_gxwebsoft_oa username: gxwebsoft_core
password: EZfW2R4YiWfbLHLw password: jdj7HYEdYHnYEFBy
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
# 日志配置 # 日志配置
logging: logging:
file: file:
name: websoft-api.log name: websoft-core.log
level: level:
root: WARN root: WARN
com.gxwebsoft: ERROR com.gxwebsoft: ERROR

View File

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