| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.comment.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.modules.comment.entity.Comment; |
| | | import org.springblade.modules.comment.service.ICommentService; |
| | | import org.springblade.modules.comment.vo.CommentVO; |
| | | import org.springblade.modules.comment.wrapper.CommentWrapper; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | |
| | | /** |
| | | * 控制器 |
| | | * |
| | | * @author BladeX |
| | | * @since 2020-08-11 |
| | | */ |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @RequestMapping("comment/comment") |
| | | @Api(value = "", tags = "接口") |
| | | public class CommentController extends BladeController { |
| | | |
| | | private final ICommentService commentService; |
| | | |
| | | /** |
| | | * 详情 |
| | | */ |
| | | @GetMapping("/detail") |
| | | @ApiOperationSupport(order = 1) |
| | | @ApiOperation(value = "详情", notes = "传入survey") |
| | | public R<CommentVO> detail(Comment comment) { |
| | | Comment detail = commentService.getOne(Condition.getQueryWrapper(comment)); |
| | | return R.data(CommentWrapper.build().entityVO(detail)); |
| | | } |
| | | |
| | | /** |
| | | * 分页 |
| | | */ |
| | | @GetMapping("/list") |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "分页", notes = "传入survey") |
| | | public R<IPage<CommentVO>> list(Comment comment, Query query) { |
| | | IPage<Comment> pages = commentService.page(Condition.getPage(query), Condition.getQueryWrapper(comment)); |
| | | return R.data(CommentWrapper.build().pageVO(pages)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 自定义分页 |
| | | */ |
| | | @GetMapping("/page") |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "分页", notes = "传入survey") |
| | | public R<IPage<CommentVO>> page(CommentVO comment, Query query) { |
| | | IPage<CommentVO> pages = commentService.selectSurveyPage(Condition.getPage(query), comment); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | /** |
| | | * 新增 |
| | | */ |
| | | @PostMapping("/save") |
| | | @ApiOperationSupport(order = 4) |
| | | @ApiOperation(value = "新增", notes = "传入survey") |
| | | public R save(@Valid @RequestBody Comment comment) { |
| | | return R.status(commentService.save(comment)); |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | */ |
| | | @PostMapping("/update") |
| | | @ApiOperationSupport(order = 5) |
| | | @ApiOperation(value = "修改", notes = "传入survey") |
| | | public R update(@Valid @RequestBody Comment comment) { |
| | | return R.status(commentService.updateById(comment)); |
| | | } |
| | | |
| | | /** |
| | | * 新增或修改 |
| | | */ |
| | | @PostMapping("/submit") |
| | | @ApiOperationSupport(order = 6) |
| | | @ApiOperation(value = "新增或修改", notes = "传入survey") |
| | | public R submit(@Valid Comment comment) { |
| | | return R.status(commentService.saveOrUpdate(comment)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | @PostMapping("/remove") |
| | | @ApiOperationSupport(order = 8) |
| | | @ApiOperation(value = "删除", notes = "传入ids") |
| | | public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { |
| | | return R.status(commentService.removeByIds(Func.toLongList(ids))); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.comment.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * 实体类 |
| | | * |
| | | * @author BladeX |
| | | * @since 2020-08-11 |
| | | */ |
| | | @Data |
| | | @TableName("sys_comment") |
| | | @ApiModel(value = "Survey对象", description = "Survey对象") |
| | | public class Comment implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "人员名称") |
| | | private String name; |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.comment.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springblade.modules.comment.entity.Comment; |
| | | import org.springblade.modules.comment.vo.CommentVO; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * Mapper 接口 |
| | | * |
| | | * @author BladeX |
| | | * @since 2020-08-11 |
| | | */ |
| | | public interface CommentMapper extends BaseMapper<Comment> { |
| | | |
| | | /** |
| | | * 自定义分页 |
| | | * |
| | | * @param page |
| | | * @param ulikes |
| | | * @return |
| | | */ |
| | | List<CommentVO> selectSurveyPage(IPage page, CommentVO ulikes); |
| | | } |
| New file |
| | |
| | | <?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="org.springblade.modules.comment.mapper.CommentMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="ulikesResultMap" type="org.springblade.modules.comment.entity.Comment"> |
| | | <id column="id" property="id"/> |
| | | <result column="name" property="name"/> |
| | | <result column="identityCard" property="identityCard"/> |
| | | <result column="ticketCode" property="ticketCode"/> |
| | | </resultMap> |
| | | |
| | | |
| | | <select id="selectSurveyPage" resultMap="ulikesResultMap"> |
| | | select * from sys_ulikes |
| | | </select> |
| | | |
| | | |
| | | </mapper> |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.comment.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.springblade.modules.comment.entity.Comment; |
| | | import org.springblade.modules.comment.vo.CommentVO; |
| | | |
| | | /** |
| | | * 服务类 |
| | | * |
| | | * @author BladeX |
| | | * @since 2020-08-11 |
| | | */ |
| | | public interface ICommentService extends IService<Comment> { |
| | | |
| | | /** |
| | | * 自定义分页 |
| | | * |
| | | * @param page |
| | | * @param comment |
| | | * @return |
| | | */ |
| | | IPage<CommentVO> selectSurveyPage(IPage<CommentVO> page, CommentVO comment); |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.comment.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.modules.comment.entity.Comment; |
| | | import org.springblade.modules.comment.mapper.CommentMapper; |
| | | import org.springblade.modules.comment.service.ICommentService; |
| | | import org.springblade.modules.comment.vo.CommentVO; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * 服务实现类 |
| | | * |
| | | * @author BladeX |
| | | * @since 2020-08-11 |
| | | */ |
| | | @Service |
| | | public class CommentServiceImpl extends ServiceImpl<CommentMapper, Comment> implements ICommentService { |
| | | |
| | | @Override |
| | | public IPage<CommentVO> selectSurveyPage(IPage<CommentVO> page, CommentVO comment) { |
| | | return page.setRecords(baseMapper.selectSurveyPage(page, comment)); |
| | | } |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.comment.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.springblade.modules.comment.entity.Comment; |
| | | |
| | | /** |
| | | * 视图实体类 |
| | | * |
| | | * @author BladeX |
| | | * @since 2020-08-11 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ApiModel(value = "SurveyVO对象", description = "SurveyVO对象") |
| | | public class CommentVO extends Comment { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.comment.wrapper; |
| | | |
| | | import org.springblade.core.mp.support.BaseEntityWrapper; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | | import org.springblade.modules.comment.entity.Comment; |
| | | import org.springblade.modules.comment.vo.CommentVO; |
| | | |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 包装类,返回视图层所需的字段 |
| | | * |
| | | * @author BladeX |
| | | * @since 2020-08-11 |
| | | */ |
| | | public class CommentWrapper extends BaseEntityWrapper<Comment, CommentVO> { |
| | | |
| | | public static CommentWrapper build() { |
| | | return new CommentWrapper(); |
| | | } |
| | | |
| | | @Override |
| | | public CommentVO entityVO(Comment comment) { |
| | | CommentVO commentVO = Objects.requireNonNull(BeanUtil.copy(comment, CommentVO.class)); |
| | | |
| | | //User createUser = UserCache.getUser(comment.getCreateUser()); |
| | | //User updateUser = UserCache.getUser(comment.getUpdateUser()); |
| | | //commentVO.setCreateUserName(createUser.getName()); |
| | | //commentVO.setUpdateUserName(updateUser.getName()); |
| | | |
| | | return commentVO; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright likes, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * likes, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.likes.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiSort; |
| | | import io.swagger.annotations.*; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import org.springblade.core.launch.constant.AppConstant; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tenant.annotation.TenantDS; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.modules.likes.entity.Likes; |
| | | import org.springblade.modules.likes.service.ILikesService; |
| | | import org.springblade.modules.likes.vo.LikesVO; |
| | | import org.springblade.modules.likes.wrapper.LikesWrapper; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 控制器 |
| | | * |
| | | * @author Chill |
| | | */ |
| | | @TenantDS |
| | | @RestController |
| | | @RequestMapping("likes/likes") |
| | | @AllArgsConstructor |
| | | @ApiSort(2) |
| | | public class LikesController extends BladeController { |
| | | |
| | | private final ILikesService likesService; |
| | | |
| | | /** |
| | | * 详情 |
| | | */ |
| | | @GetMapping("/detail") |
| | | @ApiOperationSupport(order = 1) |
| | | @ApiOperation(value = "详情", notes = "传入likes") |
| | | public R<LikesVO> detail(Likes likes) { |
| | | Likes detail = likesService.getOne(Condition.getQueryWrapper(likes)); |
| | | return R.data(LikesWrapper.build().entityVO(detail)); |
| | | } |
| | | |
| | | /** |
| | | * 分页 |
| | | */ |
| | | @GetMapping("/list") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "category", value = "公告类型", paramType = "query", dataType = "integer"), |
| | | @ApiImplicitParam(name = "title", value = "公告标题", paramType = "query", dataType = "string") |
| | | }) |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "分页", notes = "传入likes") |
| | | public R<IPage<LikesVO>> list(@ApiIgnore @RequestParam Map<String, Object> likes, Query query) { |
| | | IPage<Likes> pages = likesService.page(Condition.getPage(query), Condition.getQueryWrapper(likes, Likes.class)); |
| | | return R.data(LikesWrapper.build().pageVO(pages)); |
| | | } |
| | | |
| | | /** |
| | | * 多表联合查询自定义分页 |
| | | */ |
| | | @GetMapping("/page") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "category", value = "公告类型", paramType = "query", dataType = "integer"), |
| | | @ApiImplicitParam(name = "title", value = "公告标题", paramType = "query", dataType = "string") |
| | | }) |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "分页", notes = "传入likes") |
| | | public R<IPage<LikesVO>> page(@ApiIgnore LikesVO likes, Query query) { |
| | | IPage<LikesVO> pages = likesService.selectLikesPage(Condition.getPage(query), likes); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | /** |
| | | * 新增 |
| | | */ |
| | | @PostMapping("/save") |
| | | @ApiOperationSupport(order = 4) |
| | | @ApiOperation(value = "新增", notes = "传入likes") |
| | | public R save(@RequestBody Likes likes) { |
| | | return R.status(likesService.save(likes)); |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | */ |
| | | @PostMapping("/update") |
| | | @ApiOperationSupport(order = 5) |
| | | @ApiOperation(value = "修改", notes = "传入likes") |
| | | public R update(@RequestBody Likes likes) { |
| | | return R.status(likesService.updateById(likes)); |
| | | } |
| | | |
| | | /** |
| | | * 新增或修改 |
| | | */ |
| | | @PostMapping("/submit") |
| | | @ApiOperationSupport(order = 6) |
| | | @ApiOperation(value = "新增或修改", notes = "传入likes") |
| | | public R submit(@RequestBody Likes likes) { |
| | | return R.status(likesService.saveOrUpdate(likes)); |
| | | } |
| | | |
| | | /** |
| | | * 删除 |
| | | */ |
| | | @PostMapping("/remove") |
| | | @ApiOperationSupport(order = 7) |
| | | @ApiOperation(value = "逻辑删除", notes = "传入likes") |
| | | public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) { |
| | | boolean temp = likesService.removeByIds(Func.toLongList(ids)); |
| | | return R.status(temp); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.likes.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * 实体类 |
| | | * |
| | | * @author Chill |
| | | */ |
| | | @Data |
| | | @TableName("sys_likes") |
| | | public class Likes implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 内容 |
| | | */ |
| | | @ApiModelProperty(value = "内容") |
| | | private String content; |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright likes, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * likes, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.likes.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springblade.modules.likes.entity.Likes; |
| | | import org.springblade.modules.likes.vo.LikesVO; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * Mapper 接口 |
| | | * |
| | | * @author Chill |
| | | */ |
| | | public interface LikesMapper extends BaseMapper<Likes> { |
| | | |
| | | /** |
| | | * 自定义分页 |
| | | * |
| | | * @param page 分页 |
| | | * @param likes 实体 |
| | | * @return List<LikesVO> |
| | | */ |
| | | List<LikesVO> selectLikesPage(IPage page, LikesVO likes); |
| | | |
| | | } |
| New file |
| | |
| | | <?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="org.springblade.modules.likes.mapper.LikesMapper"> |
| | | |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="likesVOResultMap" type="org.springblade.modules.likes.vo.LikesVO"> |
| | | |
| | | </resultMap> |
| | | |
| | | <select id="selectLikesPage" resultMap="likesVOResultMap"> |
| | | select * from sys_likes |
| | | </select> |
| | | </mapper> |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright likes, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * likes, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.likes.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.springblade.modules.likes.entity.Likes; |
| | | import org.springblade.modules.likes.vo.LikesVO; |
| | | |
| | | /** |
| | | * 服务类 |
| | | * |
| | | * @author Chill |
| | | */ |
| | | public interface ILikesService extends IService<Likes> { |
| | | |
| | | /** |
| | | * 自定义分页 |
| | | * @param page |
| | | * @param likes |
| | | * @return |
| | | */ |
| | | IPage<LikesVO> selectLikesPage(IPage<LikesVO> page, LikesVO likes); |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright likes, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * likes, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.likes.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.modules.likes.entity.Likes; |
| | | import org.springblade.modules.likes.mapper.LikesMapper; |
| | | import org.springblade.modules.likes.service.ILikesService; |
| | | import org.springblade.modules.likes.vo.LikesVO; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * 服务实现类 |
| | | * |
| | | * @author Chill |
| | | */ |
| | | @Service |
| | | public class LikesServiceImpl extends ServiceImpl<LikesMapper, Likes> implements ILikesService { |
| | | |
| | | @Override |
| | | public IPage<LikesVO> selectLikesPage(IPage<LikesVO> page, LikesVO likes) { |
| | | return page.setRecords(baseMapper.selectLikesPage(page, likes)); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package org.springblade.modules.likes.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.springblade.modules.likes.entity.Likes; |
| | | |
| | | /** |
| | | * 通知公告视图类 |
| | | * |
| | | * @author Chill |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | public class LikesVO extends Likes { |
| | | |
| | | @ApiModelProperty(value = "通知类型名") |
| | | private String categoryName; |
| | | |
| | | @ApiModelProperty(value = "租户编号") |
| | | private String tenantId; |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright likes, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * likes, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.likes.wrapper; |
| | | |
| | | import org.springblade.common.cache.DictCache; |
| | | import org.springblade.common.enums.DictEnum; |
| | | import org.springblade.core.mp.support.BaseEntityWrapper; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | | import org.springblade.modules.likes.entity.Likes; |
| | | import org.springblade.modules.likes.vo.LikesVO; |
| | | |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * Likes包装类,返回视图层所需的字段 |
| | | * |
| | | * @author Chill |
| | | */ |
| | | public class LikesWrapper extends BaseEntityWrapper<Likes, LikesVO> { |
| | | |
| | | public static LikesWrapper build() { |
| | | return new LikesWrapper(); |
| | | } |
| | | |
| | | @Override |
| | | public LikesVO entityVO(Likes likes) { |
| | | LikesVO likesVO = Objects.requireNonNull(BeanUtil.copy(likes, LikesVO.class)); |
| | | // String dictValue = DictCache.getValue(DictEnum.NOTICE, likesVO.getCategory()); |
| | | // likesVO.setCategoryName(dictValue); |
| | | return likesVO; |
| | | } |
| | | |
| | | } |