微信网页登录
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
package com.starry.admin.modules.play.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.starry.admin.modules.play.module.entity.PlayNoticeInfoEntity;
|
||||
import com.starry.admin.modules.play.module.vo.PlayNoticeInfoAddVo;
|
||||
import com.starry.admin.modules.play.service.IPlayNoticeInfoService;
|
||||
import com.starry.common.annotation.Log;
|
||||
import com.starry.common.enums.BusinessType;
|
||||
import com.starry.common.result.R;
|
||||
import com.starry.common.utils.ConvertUtil;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 公告Controller
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-04-06
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/play/notice")
|
||||
public class PlayNoticeInfoController {
|
||||
@Resource
|
||||
private IPlayNoticeInfoService playNoticeInfoService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询公告列表
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:list')")
|
||||
@GetMapping("/listAll")
|
||||
public R listAll(PlayNoticeInfoEntity playNoticeInfo) {
|
||||
IPage<PlayNoticeInfoEntity> list = playNoticeInfoService.selectPlayNoticeInfoByPage(playNoticeInfo);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询公告列表
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:list')")
|
||||
@GetMapping("/list")
|
||||
public R list(PlayNoticeInfoEntity playNoticeInfo) {
|
||||
IPage<PlayNoticeInfoEntity> list = playNoticeInfoService.selectPlayNoticeInfoByPage(playNoticeInfo);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取公告详细信息
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public R getInfo(@PathVariable("id") String id) {
|
||||
return R.ok(playNoticeInfoService.selectPlayNoticeInfoById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增公告
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:create')")
|
||||
@Log(title = "公告", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/create")
|
||||
public R create(@Valid @RequestBody PlayNoticeInfoAddVo vo) {
|
||||
PlayNoticeInfoEntity entity = ConvertUtil.entityToVo(vo, PlayNoticeInfoEntity.class);
|
||||
boolean success = playNoticeInfoService.create(entity);
|
||||
if (success) {
|
||||
return R.ok();
|
||||
}
|
||||
return R.error("添加失败");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除公告
|
||||
*/
|
||||
@PreAuthorize("@customSs.hasPermission('play:info:remove')")
|
||||
@Log(title = "公告", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R remove(@PathVariable String[] ids) {
|
||||
return R.ok(playNoticeInfoService.deletePlayNoticeInfoByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.starry.admin.modules.play.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.starry.admin.modules.play.module.entity.PlayNoticeInfoEntity;
|
||||
|
||||
/**
|
||||
* 公告Mapper接口
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-04-06
|
||||
*/
|
||||
public interface PlayNoticeInfoMapper extends BaseMapper<PlayNoticeInfoEntity> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.starry.admin.modules.play.module.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.starry.common.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 公告对象 play_notice_info
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-04-06
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("play_notice_info")
|
||||
public class PlayNoticeInfoEntity extends BaseEntity<PlayNoticeInfoEntity> {
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
private String tenantId;
|
||||
|
||||
/**
|
||||
* 公告类型【0:公告,1:消息】
|
||||
*/
|
||||
private String noticeType;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
|
||||
}
|
||||
@@ -37,4 +37,9 @@ public class PlayUserInfoEntity extends BaseEntity<PlayUserInfoEntity> {
|
||||
*/
|
||||
private String areaCode;
|
||||
|
||||
/**
|
||||
* 账户状态(1:审批通过,0:注册未审批)
|
||||
*/
|
||||
private String accountState;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.starry.admin.modules.play.module.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* 公告对象 play_notice_info
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-04-06
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class PlayNoticeInfoAddVo {
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
@NotBlank(message = "标题不能为空")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
@NotBlank(message = "内容不能为空")
|
||||
private String content;
|
||||
|
||||
|
||||
}
|
||||
@@ -4,6 +4,9 @@ import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
*/
|
||||
@Data
|
||||
public class PlayUserInfoUpdateVo {
|
||||
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.starry.admin.modules.play.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.starry.admin.modules.play.module.entity.PlayNoticeInfoEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 公告Service接口
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-04-06
|
||||
*/
|
||||
public interface IPlayNoticeInfoService extends IService<PlayNoticeInfoEntity> {
|
||||
/**
|
||||
* 查询公告
|
||||
*
|
||||
* @param id 公告主键
|
||||
* @return 公告
|
||||
*/
|
||||
PlayNoticeInfoEntity selectPlayNoticeInfoById(String id);
|
||||
|
||||
/**
|
||||
* 查询公告列表
|
||||
*
|
||||
* @return 公告集合
|
||||
*/
|
||||
List<PlayNoticeInfoEntity> selectPlayNoticeInfo();
|
||||
|
||||
/**
|
||||
* 查询公告列表
|
||||
*
|
||||
* @param playNoticeInfo 公告
|
||||
* @return 公告集合
|
||||
*/
|
||||
IPage<PlayNoticeInfoEntity> selectPlayNoticeInfoByPage(PlayNoticeInfoEntity playNoticeInfo);
|
||||
|
||||
/**
|
||||
* 新增公告
|
||||
*
|
||||
* @param playNoticeInfo 公告
|
||||
* @return 结果
|
||||
*/
|
||||
boolean create(PlayNoticeInfoEntity playNoticeInfo);
|
||||
|
||||
/**
|
||||
* 修改公告
|
||||
*
|
||||
* @param playNoticeInfo 公告
|
||||
* @return 结果
|
||||
*/
|
||||
boolean update(PlayNoticeInfoEntity playNoticeInfo);
|
||||
|
||||
/**
|
||||
* 批量删除公告
|
||||
*
|
||||
* @param ids 需要删除的公告主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
int deletePlayNoticeInfoByIds(String[] ids);
|
||||
|
||||
/**
|
||||
* 删除公告信息
|
||||
*
|
||||
* @param id 公告主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deletePlayNoticeInfoById(String id);
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.starry.admin.modules.play.service.impl;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.starry.admin.modules.play.mapper.PlayNoticeInfoMapper;
|
||||
import com.starry.admin.modules.play.module.entity.PlayNoticeInfoEntity;
|
||||
import com.starry.admin.modules.play.service.IPlayNoticeInfoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 公告Service业务层处理
|
||||
*
|
||||
* @author admin
|
||||
* @since 2024-04-06
|
||||
*/
|
||||
@Service
|
||||
public class PlayNoticeInfoServiceImpl extends ServiceImpl<PlayNoticeInfoMapper, PlayNoticeInfoEntity> implements IPlayNoticeInfoService {
|
||||
@Resource
|
||||
private PlayNoticeInfoMapper playNoticeInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询公告
|
||||
*
|
||||
* @param id 公告主键
|
||||
* @return 公告
|
||||
*/
|
||||
@Override
|
||||
public PlayNoticeInfoEntity selectPlayNoticeInfoById(String id) {
|
||||
return this.baseMapper.selectById(id);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<PlayNoticeInfoEntity> selectPlayNoticeInfo() {
|
||||
return this.baseMapper.selectList(new LambdaQueryWrapper<>());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询公告列表
|
||||
*
|
||||
* @param playNoticeInfo 公告
|
||||
* @return 公告
|
||||
*/
|
||||
@Override
|
||||
public IPage<PlayNoticeInfoEntity> selectPlayNoticeInfoByPage(PlayNoticeInfoEntity playNoticeInfo) {
|
||||
Page<PlayNoticeInfoEntity> page = new Page<>(1, 10);
|
||||
return this.baseMapper.selectPage(page, new LambdaQueryWrapper<>());
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增公告
|
||||
*
|
||||
* @param playNoticeInfo 公告
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean create(PlayNoticeInfoEntity playNoticeInfo) {
|
||||
if (StrUtil.isBlankIfStr(playNoticeInfo.getId())) {
|
||||
playNoticeInfo.setId(IdUtil.fastSimpleUUID());
|
||||
}
|
||||
return save(playNoticeInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改公告
|
||||
*
|
||||
* @param playNoticeInfo 公告
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean update(PlayNoticeInfoEntity playNoticeInfo) {
|
||||
return updateById(playNoticeInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除公告
|
||||
*
|
||||
* @param ids 需要删除的公告主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePlayNoticeInfoByIds(String[] ids) {
|
||||
return playNoticeInfoMapper.deleteBatchIds(Arrays.asList(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除公告信息
|
||||
*
|
||||
* @param id 公告主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deletePlayNoticeInfoById(String id) {
|
||||
return playNoticeInfoMapper.deleteById(id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user