增加小程序端配置
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
package com.gxwebsoft.booking.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.exception.BusinessException;
|
||||
import com.gxwebsoft.common.core.security.JwtSubject;
|
||||
import com.gxwebsoft.common.core.security.JwtUtil;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.booking.service.UsersService;
|
||||
import com.gxwebsoft.booking.entity.Users;
|
||||
@@ -9,15 +12,22 @@ 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.LoginRecord;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.common.system.param.UserParam;
|
||||
import com.gxwebsoft.common.system.result.LoginResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
import static com.gxwebsoft.common.core.constants.RedisConstants.ACCESS_TOKEN_KEY;
|
||||
|
||||
/**
|
||||
* 用户控制器
|
||||
*
|
||||
@@ -28,88 +38,95 @@ import java.util.List;
|
||||
@RestController
|
||||
@RequestMapping("/api/booking/users")
|
||||
public class UsersController extends BaseController {
|
||||
@Resource
|
||||
private UsersService usersService;
|
||||
@Resource
|
||||
private UsersService usersService;
|
||||
|
||||
@ApiOperation("分页查询用户")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<Users>> page(UsersParam param) {
|
||||
// 使用关联查询
|
||||
return success(usersService.pageRel(param));
|
||||
@ApiOperation("分页查询用户")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<Users>> page(UsersParam param) {
|
||||
// 使用关联查询
|
||||
return success(usersService.pageRel(param));
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部用户")
|
||||
@GetMapping()
|
||||
public ApiResult<List<Users>> list(UsersParam param) {
|
||||
// 使用关联查询
|
||||
return success(usersService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('booking:users:list')")
|
||||
@ApiOperation("根据id查询用户")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<Users> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(usersService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('booking:users:list')")
|
||||
@ApiOperation("根据手机查询用户")
|
||||
@GetMapping("/getByPhone")
|
||||
public ApiResult<Users> getByPhone(UsersParam param) {
|
||||
final List<Users> users = usersService.listRel(param);
|
||||
return success(param.getOne(users));
|
||||
}
|
||||
|
||||
@ApiOperation("添加用户")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody Users users) {
|
||||
// 记录当前登录用户id
|
||||
// User loginUser = getLoginUser();
|
||||
// if (loginUser != null) {
|
||||
// users.setUserId(loginUser.getUserId());
|
||||
// }
|
||||
if (usersService.save(users)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("查询全部用户")
|
||||
@GetMapping()
|
||||
public ApiResult<List<Users>> list(UsersParam param) {
|
||||
// 使用关联查询
|
||||
return success(usersService.listRel(param));
|
||||
@ApiOperation("修改用户")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody Users users) {
|
||||
if (usersService.updateById(users)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('booking:users:list')")
|
||||
@ApiOperation("根据id查询用户")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<Users> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(usersService.getByIdRel(id));
|
||||
@ApiOperation("删除用户")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (usersService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@ApiOperation("添加用户")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody Users users) {
|
||||
// 记录当前登录用户id
|
||||
// User loginUser = getLoginUser();
|
||||
// if (loginUser != null) {
|
||||
// users.setUserId(loginUser.getUserId());
|
||||
// }
|
||||
if (usersService.save(users)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
@ApiOperation("批量添加用户")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<Users> list) {
|
||||
if (usersService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("修改用户")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody Users users) {
|
||||
if (usersService.updateById(users)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
@ApiOperation("批量修改用户")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<Users> batchParam) {
|
||||
if (batchParam.update(usersService, "user_id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("删除用户")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (usersService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
@ApiOperation("批量删除用户")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (usersService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
|
||||
@ApiOperation("批量添加用户")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<Users> list) {
|
||||
if (usersService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改用户")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<Users> batchParam) {
|
||||
if (batchParam.update(usersService, "user_id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("批量删除用户")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (usersService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
return fail("删除失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
package com.gxwebsoft.cms.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.cms.service.MpMenuService;
|
||||
import com.gxwebsoft.cms.entity.MpMenu;
|
||||
import com.gxwebsoft.cms.param.MpMenuParam;
|
||||
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-05-02 12:22:25
|
||||
*/
|
||||
@Api(tags = "小程序端菜单管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/cms/mp-menu")
|
||||
public class MpMenuController extends BaseController {
|
||||
@Resource
|
||||
private MpMenuService mpMenuService;
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:mpMenu:list')")
|
||||
@ApiOperation("分页查询小程序端菜单")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<MpMenu>> page(MpMenuParam param) {
|
||||
// 使用关联查询
|
||||
return success(mpMenuService.pageRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:mpMenu:list')")
|
||||
@ApiOperation("查询全部小程序端菜单")
|
||||
@GetMapping()
|
||||
public ApiResult<List<MpMenu>> list(MpMenuParam param) {
|
||||
// 使用关联查询
|
||||
return success(mpMenuService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:mpMenu:list')")
|
||||
@ApiOperation("根据id查询小程序端菜单")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<MpMenu> get(@PathVariable("id") Integer id) {
|
||||
// 使用关联查询
|
||||
return success(mpMenuService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:mpMenu:save')")
|
||||
@OperationLog
|
||||
@ApiOperation("添加小程序端菜单")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody MpMenu mpMenu) {
|
||||
// 记录当前登录用户id
|
||||
// User loginUser = getLoginUser();
|
||||
// if (loginUser != null) {
|
||||
// mpMenu.setUserId(loginUser.getUserId());
|
||||
// }
|
||||
if (mpMenuService.save(mpMenu)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:mpMenu:update')")
|
||||
@OperationLog
|
||||
@ApiOperation("修改小程序端菜单")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody MpMenu mpMenu) {
|
||||
if (mpMenuService.updateById(mpMenu)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:mpMenu:remove')")
|
||||
@OperationLog
|
||||
@ApiOperation("删除小程序端菜单")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (mpMenuService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:mpMenu:save')")
|
||||
@OperationLog
|
||||
@ApiOperation("批量添加小程序端菜单")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<MpMenu> list) {
|
||||
if (mpMenuService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:mpMenu:update')")
|
||||
@OperationLog
|
||||
@ApiOperation("批量修改小程序端菜单")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<MpMenu> batchParam) {
|
||||
if (batchParam.update(mpMenuService, "menu_id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('cms:mpMenu:remove')")
|
||||
@OperationLog
|
||||
@ApiOperation("批量删除小程序端菜单")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (mpMenuService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
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 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 2024-05-02 12:22:25
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "MpMenu对象", description = "小程序端菜单")
|
||||
@TableName("cms_mp_menu")
|
||||
public class MpMenu implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "ID")
|
||||
@TableId(value = "menu_id", type = IdType.AUTO)
|
||||
private Integer menuId;
|
||||
|
||||
@ApiModelProperty(value = "上级id, 0是顶级")
|
||||
private Integer parentId;
|
||||
|
||||
@ApiModelProperty(value = "菜单名称")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "类型 0自定义 1单页内容2外部链接")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "是否微信小程序菜单")
|
||||
private Boolean isMpWeixin;
|
||||
|
||||
@ApiModelProperty(value = "菜单路由地址")
|
||||
private String path;
|
||||
|
||||
@ApiModelProperty(value = "菜单组件地址, 目录可为空")
|
||||
private String component;
|
||||
|
||||
@ApiModelProperty(value = "打开位置")
|
||||
private String target;
|
||||
|
||||
@ApiModelProperty(value = "菜单图标")
|
||||
private String icon;
|
||||
|
||||
@ApiModelProperty(value = "图标颜色")
|
||||
private String color;
|
||||
|
||||
@ApiModelProperty(value = "是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)")
|
||||
private Integer hide;
|
||||
|
||||
@ApiModelProperty(value = "位置 0不限 1顶部 2底部")
|
||||
private Integer position;
|
||||
|
||||
@ApiModelProperty(value = "菜单侧栏选中的path")
|
||||
private String active;
|
||||
|
||||
@ApiModelProperty(value = "其它路由元信息")
|
||||
private String meta;
|
||||
|
||||
@ApiModelProperty(value = "绑定的页面")
|
||||
private Integer pageId;
|
||||
|
||||
@ApiModelProperty(value = "绑定的文章分类ID")
|
||||
private Integer articleCategoryId;
|
||||
|
||||
@ApiModelProperty(value = "绑定的文章ID")
|
||||
private Integer articleId;
|
||||
|
||||
@ApiModelProperty(value = "绑定的表单ID")
|
||||
private Integer formId;
|
||||
|
||||
@ApiModelProperty(value = "绑定的书籍标识")
|
||||
private String bookCode;
|
||||
|
||||
@ApiModelProperty(value = "绑定的商品分类ID")
|
||||
private Integer goodsCategoryId;
|
||||
|
||||
@ApiModelProperty(value = "绑定的商品ID")
|
||||
private Integer goodsId;
|
||||
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "设为首页")
|
||||
private Integer home;
|
||||
|
||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String comments;
|
||||
|
||||
@ApiModelProperty(value = "状态, 0正常, 1冻结")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Integer tenantId;
|
||||
|
||||
@ApiModelProperty(value = "注册时间")
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@@ -101,6 +101,9 @@ public class Navigation implements Serializable {
|
||||
@ApiModelProperty(value = "状态, 0正常, 1冻结")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "是否微信小程序菜单")
|
||||
private Boolean isMpWeixin;
|
||||
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Integer tenantId;
|
||||
|
||||
|
||||
@@ -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.MpMenu;
|
||||
import com.gxwebsoft.cms.param.MpMenuParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 小程序端菜单Mapper
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-05-02 12:22:25
|
||||
*/
|
||||
public interface MpMenuMapper extends BaseMapper<MpMenu> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param param 查询参数
|
||||
* @return List<MpMenu>
|
||||
*/
|
||||
List<MpMenu> selectPageRel(@Param("page") IPage<MpMenu> page,
|
||||
@Param("param") MpMenuParam param);
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<User>
|
||||
*/
|
||||
List<MpMenu> selectListRel(@Param("param") MpMenuParam param);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
<?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.MpMenuMapper">
|
||||
|
||||
<!-- 关联查询sql -->
|
||||
<sql id="selectSql">
|
||||
SELECT a.*
|
||||
FROM cms_mp_menu a
|
||||
<where>
|
||||
<if test="param.menuId != null">
|
||||
AND a.menu_id = #{param.menuId}
|
||||
</if>
|
||||
<if test="param.parentId != null">
|
||||
AND a.parent_id = #{param.parentId}
|
||||
</if>
|
||||
<if test="param.title != null">
|
||||
AND a.title LIKE CONCAT('%', #{param.title}, '%')
|
||||
</if>
|
||||
<if test="param.type != null">
|
||||
AND a.type = #{param.type}
|
||||
</if>
|
||||
<if test="param.isMpWeixin != null">
|
||||
AND a.is_mp_weixin = #{param.isMpWeixin}
|
||||
</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.target != null">
|
||||
AND a.target LIKE CONCAT('%', #{param.target}, '%')
|
||||
</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.hide != null">
|
||||
AND a.hide = #{param.hide}
|
||||
</if>
|
||||
<if test="param.position != null">
|
||||
AND a.position = #{param.position}
|
||||
</if>
|
||||
<if test="param.active != null">
|
||||
AND a.active LIKE CONCAT('%', #{param.active}, '%')
|
||||
</if>
|
||||
<if test="param.meta != null">
|
||||
AND a.meta LIKE CONCAT('%', #{param.meta}, '%')
|
||||
</if>
|
||||
<if test="param.pageId != null">
|
||||
AND a.page_id = #{param.pageId}
|
||||
</if>
|
||||
<if test="param.articleCategoryId != null">
|
||||
AND a.article_category_id = #{param.articleCategoryId}
|
||||
</if>
|
||||
<if test="param.articleId != null">
|
||||
AND a.article_id = #{param.articleId}
|
||||
</if>
|
||||
<if test="param.formId != null">
|
||||
AND a.form_id = #{param.formId}
|
||||
</if>
|
||||
<if test="param.bookCode != null">
|
||||
AND a.book_code LIKE CONCAT('%', #{param.bookCode}, '%')
|
||||
</if>
|
||||
<if test="param.goodsCategoryId != null">
|
||||
AND a.goods_category_id = #{param.goodsCategoryId}
|
||||
</if>
|
||||
<if test="param.goodsId != null">
|
||||
AND a.goods_id = #{param.goodsId}
|
||||
</if>
|
||||
<if test="param.userId != null">
|
||||
AND a.user_id = #{param.userId}
|
||||
</if>
|
||||
<if test="param.home != null">
|
||||
AND a.home = #{param.home}
|
||||
</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.status != null">
|
||||
AND a.status = #{param.status}
|
||||
</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.MpMenu">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
<select id="selectListRel" resultType="com.gxwebsoft.cms.entity.MpMenu">
|
||||
<include refid="selectSql"></include>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -71,6 +71,9 @@
|
||||
<if test="param.status != null">
|
||||
AND a.status = #{param.status}
|
||||
</if>
|
||||
<if test="param.isMpWeixin != null">
|
||||
AND a.is_mp_weixin = #{param.isMpWeixin}
|
||||
</if>
|
||||
<if test="param.createTimeStart != null">
|
||||
AND a.create_time >= #{param.createTimeStart}
|
||||
</if>
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
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-05-02 12:22:25
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@ApiModel(value = "MpMenuParam对象", description = "小程序端菜单查询参数")
|
||||
public class MpMenuParam extends BaseParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer menuId;
|
||||
|
||||
@ApiModelProperty(value = "上级id, 0是顶级")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer parentId;
|
||||
|
||||
@ApiModelProperty(value = "菜单名称")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "类型 0自定义 1单页内容2外部链接")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "是否微信小程序菜单")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Boolean isMpWeixin;
|
||||
|
||||
@ApiModelProperty(value = "菜单路由地址")
|
||||
private String path;
|
||||
|
||||
@ApiModelProperty(value = "菜单组件地址, 目录可为空")
|
||||
private String component;
|
||||
|
||||
@ApiModelProperty(value = "打开位置")
|
||||
private String target;
|
||||
|
||||
@ApiModelProperty(value = "菜单图标")
|
||||
private String icon;
|
||||
|
||||
@ApiModelProperty(value = "图标颜色")
|
||||
private String color;
|
||||
|
||||
@ApiModelProperty(value = "是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer hide;
|
||||
|
||||
@ApiModelProperty(value = "位置 0不限 1顶部 2底部")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer position;
|
||||
|
||||
@ApiModelProperty(value = "菜单侧栏选中的path")
|
||||
private String active;
|
||||
|
||||
@ApiModelProperty(value = "其它路由元信息")
|
||||
private String meta;
|
||||
|
||||
@ApiModelProperty(value = "绑定的页面")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer pageId;
|
||||
|
||||
@ApiModelProperty(value = "绑定的文章分类ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer articleCategoryId;
|
||||
|
||||
@ApiModelProperty(value = "绑定的文章ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer articleId;
|
||||
|
||||
@ApiModelProperty(value = "绑定的表单ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer formId;
|
||||
|
||||
@ApiModelProperty(value = "绑定的书籍标识")
|
||||
private String bookCode;
|
||||
|
||||
@ApiModelProperty(value = "绑定的商品分类ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer goodsCategoryId;
|
||||
|
||||
@ApiModelProperty(value = "绑定的商品ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer goodsId;
|
||||
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "设为首页")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer home;
|
||||
|
||||
@ApiModelProperty(value = "排序(数字越小越靠前)")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer sortNumber;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String comments;
|
||||
|
||||
@ApiModelProperty(value = "状态, 0正常, 1冻结")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
@@ -98,4 +98,8 @@ public class NavigationParam extends BaseParam {
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer goodsId;
|
||||
|
||||
@ApiModelProperty(value = "是否微信小程序菜单")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Boolean isMpWeixin;
|
||||
|
||||
}
|
||||
|
||||
@@ -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.MpMenu;
|
||||
import com.gxwebsoft.cms.param.MpMenuParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 小程序端菜单Service
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2024-05-02 12:22:25
|
||||
*/
|
||||
public interface MpMenuService extends IService<MpMenu> {
|
||||
|
||||
/**
|
||||
* 分页关联查询
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return PageResult<MpMenu>
|
||||
*/
|
||||
PageResult<MpMenu> pageRel(MpMenuParam param);
|
||||
|
||||
/**
|
||||
* 关联查询全部
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return List<MpMenu>
|
||||
*/
|
||||
List<MpMenu> listRel(MpMenuParam param);
|
||||
|
||||
/**
|
||||
* 根据id查询
|
||||
*
|
||||
* @param menuId ID
|
||||
* @return MpMenu
|
||||
*/
|
||||
MpMenu getByIdRel(Integer menuId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.gxwebsoft.cms.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gxwebsoft.cms.mapper.MpMenuMapper;
|
||||
import com.gxwebsoft.cms.service.MpMenuService;
|
||||
import com.gxwebsoft.cms.entity.MpMenu;
|
||||
import com.gxwebsoft.cms.param.MpMenuParam;
|
||||
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-05-02 12:22:25
|
||||
*/
|
||||
@Service
|
||||
public class MpMenuServiceImpl extends ServiceImpl<MpMenuMapper, MpMenu> implements MpMenuService {
|
||||
|
||||
@Override
|
||||
public PageResult<MpMenu> pageRel(MpMenuParam param) {
|
||||
PageParam<MpMenu, MpMenuParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("sort_number asc, menu_id asc");
|
||||
List<MpMenu> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MpMenu> listRel(MpMenuParam param) {
|
||||
List<MpMenu> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<MpMenu, MpMenuParam> page = new PageParam<>();
|
||||
page.setDefaultOrder("sort_number asc, menu_id asc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MpMenu getByIdRel(Integer menuId) {
|
||||
MpMenuParam param = new MpMenuParam();
|
||||
param.setMenuId(menuId);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -59,6 +59,7 @@ public class CmsGenerator {
|
||||
// "cms_form",
|
||||
// "cms_form_record",
|
||||
// "cms_domain",
|
||||
// "cms_mp_menu"
|
||||
|
||||
};
|
||||
// 需要去除的表前缀
|
||||
|
||||
@@ -66,7 +66,8 @@ public class ShopGenerator {
|
||||
// "shop_merchant_account",
|
||||
// "shop_chat_message",
|
||||
// "shop_chat_conversation"
|
||||
// "shop_user_collection"
|
||||
// "shop_user_collection",
|
||||
"shop_mp_menu"
|
||||
};
|
||||
// 需要去除的表前缀
|
||||
private static final String[] TABLE_PREFIX = new String[]{
|
||||
|
||||
Reference in New Issue
Block a user