From a849b740b99b5193379a1c476685348aec131d73 Mon Sep 17 00:00:00 2001 From: gxwebsoft Date: Thu, 2 May 2024 18:45:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=B0=8F=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E7=AB=AF=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../booking/controller/UsersController.java | 161 ++++++++++-------- .../cms/controller/MpMenuController.java | 129 ++++++++++++++ .../java/com/gxwebsoft/cms/entity/MpMenu.java | 113 ++++++++++++ .../com/gxwebsoft/cms/entity/Navigation.java | 3 + .../gxwebsoft/cms/mapper/MpMenuMapper.java | 37 ++++ .../gxwebsoft/cms/mapper/xml/MpMenuMapper.xml | 111 ++++++++++++ .../cms/mapper/xml/NavigationMapper.xml | 3 + .../com/gxwebsoft/cms/param/MpMenuParam.java | 120 +++++++++++++ .../gxwebsoft/cms/param/NavigationParam.java | 4 + .../gxwebsoft/cms/service/MpMenuService.java | 42 +++++ .../cms/service/impl/MpMenuServiceImpl.java | 47 +++++ .../com/gxwebsoft/generator/CmsGenerator.java | 1 + .../gxwebsoft/generator/ShopGenerator.java | 3 +- 13 files changed, 701 insertions(+), 73 deletions(-) create mode 100644 src/main/java/com/gxwebsoft/cms/controller/MpMenuController.java create mode 100644 src/main/java/com/gxwebsoft/cms/entity/MpMenu.java create mode 100644 src/main/java/com/gxwebsoft/cms/mapper/MpMenuMapper.java create mode 100644 src/main/java/com/gxwebsoft/cms/mapper/xml/MpMenuMapper.xml create mode 100644 src/main/java/com/gxwebsoft/cms/param/MpMenuParam.java create mode 100644 src/main/java/com/gxwebsoft/cms/service/MpMenuService.java create mode 100644 src/main/java/com/gxwebsoft/cms/service/impl/MpMenuServiceImpl.java diff --git a/src/main/java/com/gxwebsoft/booking/controller/UsersController.java b/src/main/java/com/gxwebsoft/booking/controller/UsersController.java index 84c1805..6d20388 100644 --- a/src/main/java/com/gxwebsoft/booking/controller/UsersController.java +++ b/src/main/java/com/gxwebsoft/booking/controller/UsersController.java @@ -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> page(UsersParam param) { - // 使用关联查询 - return success(usersService.pageRel(param)); + @ApiOperation("分页查询用户") + @GetMapping("/page") + public ApiResult> page(UsersParam param) { + // 使用关联查询 + return success(usersService.pageRel(param)); + } + + @ApiOperation("查询全部用户") + @GetMapping() + public ApiResult> list(UsersParam param) { + // 使用关联查询 + return success(usersService.listRel(param)); + } + + @PreAuthorize("hasAuthority('booking:users:list')") + @ApiOperation("根据id查询用户") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(usersService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('booking:users:list')") + @ApiOperation("根据手机查询用户") + @GetMapping("/getByPhone") + public ApiResult getByPhone(UsersParam param) { + final List 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(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 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 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 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 ids) { + if (usersService.removeByIds(ids)) { + return success("删除成功"); } - - @ApiOperation("批量添加用户") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (usersService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @ApiOperation("批量修改用户") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(usersService, "user_id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @ApiOperation("批量删除用户") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (usersService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - + return fail("删除失败"); + } } diff --git a/src/main/java/com/gxwebsoft/cms/controller/MpMenuController.java b/src/main/java/com/gxwebsoft/cms/controller/MpMenuController.java new file mode 100644 index 0000000..d7966f0 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/controller/MpMenuController.java @@ -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> page(MpMenuParam param) { + // 使用关联查询 + return success(mpMenuService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('cms:mpMenu:list')") + @ApiOperation("查询全部小程序端菜单") + @GetMapping() + public ApiResult> list(MpMenuParam param) { + // 使用关联查询 + return success(mpMenuService.listRel(param)); + } + + @PreAuthorize("hasAuthority('cms:mpMenu:list')") + @ApiOperation("根据id查询小程序端菜单") + @GetMapping("/{id}") + public ApiResult 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 list) { + if (mpMenuService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('cms:mpMenu:update')") + @OperationLog + @ApiOperation("批量修改小程序端菜单") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam 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 ids) { + if (mpMenuService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/entity/MpMenu.java b/src/main/java/com/gxwebsoft/cms/entity/MpMenu.java new file mode 100644 index 0000000..3f01d8e --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/entity/MpMenu.java @@ -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; + +} diff --git a/src/main/java/com/gxwebsoft/cms/entity/Navigation.java b/src/main/java/com/gxwebsoft/cms/entity/Navigation.java index 5cddb0f..7738c5b 100644 --- a/src/main/java/com/gxwebsoft/cms/entity/Navigation.java +++ b/src/main/java/com/gxwebsoft/cms/entity/Navigation.java @@ -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; diff --git a/src/main/java/com/gxwebsoft/cms/mapper/MpMenuMapper.java b/src/main/java/com/gxwebsoft/cms/mapper/MpMenuMapper.java new file mode 100644 index 0000000..7c7768f --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/MpMenuMapper.java @@ -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 { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") MpMenuParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") MpMenuParam param); + +} diff --git a/src/main/java/com/gxwebsoft/cms/mapper/xml/MpMenuMapper.xml b/src/main/java/com/gxwebsoft/cms/mapper/xml/MpMenuMapper.xml new file mode 100644 index 0000000..9530ccd --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/xml/MpMenuMapper.xml @@ -0,0 +1,111 @@ + + + + + + + SELECT a.* + FROM cms_mp_menu a + + + AND a.menu_id = #{param.menuId} + + + AND a.parent_id = #{param.parentId} + + + AND a.title LIKE CONCAT('%', #{param.title}, '%') + + + AND a.type = #{param.type} + + + AND a.is_mp_weixin = #{param.isMpWeixin} + + + AND a.path LIKE CONCAT('%', #{param.path}, '%') + + + AND a.component LIKE CONCAT('%', #{param.component}, '%') + + + AND a.target LIKE CONCAT('%', #{param.target}, '%') + + + AND a.icon LIKE CONCAT('%', #{param.icon}, '%') + + + AND a.color LIKE CONCAT('%', #{param.color}, '%') + + + AND a.hide = #{param.hide} + + + AND a.position = #{param.position} + + + AND a.active LIKE CONCAT('%', #{param.active}, '%') + + + AND a.meta LIKE CONCAT('%', #{param.meta}, '%') + + + AND a.page_id = #{param.pageId} + + + AND a.article_category_id = #{param.articleCategoryId} + + + AND a.article_id = #{param.articleId} + + + AND a.form_id = #{param.formId} + + + AND a.book_code LIKE CONCAT('%', #{param.bookCode}, '%') + + + AND a.goods_category_id = #{param.goodsCategoryId} + + + AND a.goods_id = #{param.goodsId} + + + AND a.user_id = #{param.userId} + + + AND a.home = #{param.home} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/cms/mapper/xml/NavigationMapper.xml b/src/main/java/com/gxwebsoft/cms/mapper/xml/NavigationMapper.xml index 6adaf8f..7d36da0 100644 --- a/src/main/java/com/gxwebsoft/cms/mapper/xml/NavigationMapper.xml +++ b/src/main/java/com/gxwebsoft/cms/mapper/xml/NavigationMapper.xml @@ -71,6 +71,9 @@ AND a.status = #{param.status} + + AND a.is_mp_weixin = #{param.isMpWeixin} + AND a.create_time >= #{param.createTimeStart} diff --git a/src/main/java/com/gxwebsoft/cms/param/MpMenuParam.java b/src/main/java/com/gxwebsoft/cms/param/MpMenuParam.java new file mode 100644 index 0000000..8f30584 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/param/MpMenuParam.java @@ -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; + +} diff --git a/src/main/java/com/gxwebsoft/cms/param/NavigationParam.java b/src/main/java/com/gxwebsoft/cms/param/NavigationParam.java index 4145ccb..e4f1c9b 100644 --- a/src/main/java/com/gxwebsoft/cms/param/NavigationParam.java +++ b/src/main/java/com/gxwebsoft/cms/param/NavigationParam.java @@ -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; + } diff --git a/src/main/java/com/gxwebsoft/cms/service/MpMenuService.java b/src/main/java/com/gxwebsoft/cms/service/MpMenuService.java new file mode 100644 index 0000000..4eb3802 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/MpMenuService.java @@ -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 { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(MpMenuParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(MpMenuParam param); + + /** + * 根据id查询 + * + * @param menuId ID + * @return MpMenu + */ + MpMenu getByIdRel(Integer menuId); + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/impl/MpMenuServiceImpl.java b/src/main/java/com/gxwebsoft/cms/service/impl/MpMenuServiceImpl.java new file mode 100644 index 0000000..914360f --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/impl/MpMenuServiceImpl.java @@ -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 implements MpMenuService { + + @Override + public PageResult pageRel(MpMenuParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, menu_id asc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(MpMenuParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam 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)); + } + +} diff --git a/src/test/java/com/gxwebsoft/generator/CmsGenerator.java b/src/test/java/com/gxwebsoft/generator/CmsGenerator.java index 96707a5..e24d965 100644 --- a/src/test/java/com/gxwebsoft/generator/CmsGenerator.java +++ b/src/test/java/com/gxwebsoft/generator/CmsGenerator.java @@ -59,6 +59,7 @@ public class CmsGenerator { // "cms_form", // "cms_form_record", // "cms_domain", +// "cms_mp_menu" }; // 需要去除的表前缀 diff --git a/src/test/java/com/gxwebsoft/generator/ShopGenerator.java b/src/test/java/com/gxwebsoft/generator/ShopGenerator.java index 8456dea..bdcf160 100644 --- a/src/test/java/com/gxwebsoft/generator/ShopGenerator.java +++ b/src/test/java/com/gxwebsoft/generator/ShopGenerator.java @@ -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[]{