工作人员管理、转发人员配置
This commit is contained in:
@@ -0,0 +1,54 @@
|
|||||||
|
package com.ruoyi.cms.controller.cms;
|
||||||
|
|
||||||
|
import com.ruoyi.cms.domain.CommunityUser;
|
||||||
|
import com.ruoyi.cms.service.ICommunityUserService;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/cms/communityUser")
|
||||||
|
@Api(tags = "后台:工作人员管理")
|
||||||
|
public class CommunityUserController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ICommunityUserService communityUserService;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation("查询工作人员列表")
|
||||||
|
@PreAuthorize("@ss.hasPermi('cms:communityUser:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(CommunityUser communityUser) {
|
||||||
|
startPage();
|
||||||
|
List<CommunityUser> list = communityUserService.selectCommunityUserList(communityUser);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("新增工作人员")
|
||||||
|
@PreAuthorize("@ss.hasPermi('cms:communityUser:add')")
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody CommunityUser communityUser) {
|
||||||
|
return toAjax(communityUserService.save(communityUser));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("修改工作人员")
|
||||||
|
@PreAuthorize("@ss.hasPermi('cms:communityUser:edit')")
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult update(@RequestBody CommunityUser communityUser) {
|
||||||
|
return toAjax(communityUserService.updateById(communityUser));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("删除工作人员")
|
||||||
|
@PreAuthorize("@ss.hasPermi('cms:communityUser:remove')")
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable("ids") Long[] ids) {
|
||||||
|
return toAjax(communityUserService.delCommunityUser(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
package com.ruoyi.cms.controller.cms;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.ruoyi.cms.domain.WechatGroup;
|
||||||
|
import com.ruoyi.cms.domain.vo.WechatGroupVo;
|
||||||
|
import com.ruoyi.cms.service.IWechatGroupService;
|
||||||
|
import com.ruoyi.common.annotation.Anonymous;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/cms/wechatGroup")
|
||||||
|
@Api(tags = "后台:转发对象管理")
|
||||||
|
public class WechatGroupController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IWechatGroupService wechatGroupService;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation("查询转发对象列表")
|
||||||
|
@PreAuthorize("@ss.hasPermi('cms:wechatGroup:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(WechatGroup wechatGroup) {
|
||||||
|
startPage();
|
||||||
|
List<WechatGroupVo> list = wechatGroupService.selectWechatGroupList(wechatGroup);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("新增转发对象")
|
||||||
|
@PreAuthorize("@ss.hasPermi('cms:wechatGroup:add')")
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody WechatGroup wechatGroup) {
|
||||||
|
return toAjax(wechatGroupService.save(wechatGroup));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("修改转发对象")
|
||||||
|
@PreAuthorize("@ss.hasPermi('cms:wechatGroup:edit')")
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult update(@RequestBody WechatGroup wechatGroup) {
|
||||||
|
return toAjax(wechatGroupService.updateById(wechatGroup));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("删除转发对象")
|
||||||
|
@PreAuthorize("@ss.hasPermi('cms:wechatGroup:remove')")
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable("ids") Long[] ids) {
|
||||||
|
return toAjax(wechatGroupService.removeBatchByIds(CollUtil.newArrayList(ids)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/enableList")
|
||||||
|
@Anonymous
|
||||||
|
public List<WechatGroupVo> enableList() {
|
||||||
|
WechatGroup wechatGroup = new WechatGroup();
|
||||||
|
wechatGroup.setIsPush(1);
|
||||||
|
return wechatGroupService.selectWechatGroupList(wechatGroup);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.ruoyi.cms.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作人员配置
|
||||||
|
*/
|
||||||
|
@TableName("community_user")
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class CommunityUser extends BaseEntity {
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信名
|
||||||
|
*/
|
||||||
|
private String wechatName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手机号
|
||||||
|
*/
|
||||||
|
private String phoneNumber;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.ruoyi.cms.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转发对象配置
|
||||||
|
*/
|
||||||
|
@TableName("wechat_group")
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class WechatGroup extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 群聊名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作人员 ID
|
||||||
|
*/
|
||||||
|
private Long communityId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否启用 0=禁用 1=启用
|
||||||
|
*/
|
||||||
|
private Integer isPush;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.ruoyi.cms.domain.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class WechatGroupVo {
|
||||||
|
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date createTime;
|
||||||
|
private Long id;
|
||||||
|
private String name;
|
||||||
|
private Integer isPush;
|
||||||
|
private String wechatNumber;
|
||||||
|
private String phoneNumber;
|
||||||
|
private String wechatName;
|
||||||
|
private Long communityId;
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.ruoyi.cms.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.ruoyi.cms.domain.CommunityUser;
|
||||||
|
|
||||||
|
public interface CommunityUserMapper extends BaseMapper<CommunityUser> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.ruoyi.cms.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.ruoyi.cms.domain.WechatGroup;
|
||||||
|
import com.ruoyi.cms.domain.vo.WechatGroupVo;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface WechatGroupMapper extends BaseMapper<WechatGroup> {
|
||||||
|
List<WechatGroupVo> selectWechatGroupList(@Param("p") WechatGroup wechatGroup);
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.ruoyi.cms.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.ruoyi.cms.domain.CommunityUser;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ICommunityUserService extends IService<CommunityUser> {
|
||||||
|
List<CommunityUser> selectCommunityUserList(CommunityUser communityUser);
|
||||||
|
|
||||||
|
int delCommunityUser(Long[] ids);
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.ruoyi.cms.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.ruoyi.cms.domain.WechatGroup;
|
||||||
|
import com.ruoyi.cms.domain.vo.WechatGroupVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface IWechatGroupService extends IService<WechatGroup> {
|
||||||
|
List<WechatGroupVo> selectWechatGroupList(WechatGroup wechatGroup);
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package com.ruoyi.cms.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.ruoyi.cms.domain.CommunityUser;
|
||||||
|
import com.ruoyi.cms.domain.WechatGroup;
|
||||||
|
import com.ruoyi.cms.mapper.CommunityUserMapper;
|
||||||
|
import com.ruoyi.cms.mapper.WechatGroupMapper;
|
||||||
|
import com.ruoyi.cms.service.ICommunityUserService;
|
||||||
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class CommunityUserServiceImpl extends ServiceImpl<CommunityUserMapper, CommunityUser>
|
||||||
|
implements ICommunityUserService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private WechatGroupMapper wechatGroupMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CommunityUser> selectCommunityUserList(CommunityUser communityUser) {
|
||||||
|
|
||||||
|
return baseMapper.selectList(Wrappers.lambdaQuery(CommunityUser.class)
|
||||||
|
.like(StrUtil.isNotBlank(communityUser.getWechatName()), CommunityUser::getWechatName, communityUser.getWechatName())
|
||||||
|
.like(StrUtil.isNotBlank(communityUser.getPhoneNumber()), CommunityUser::getPhoneNumber, communityUser.getPhoneNumber())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int delCommunityUser(Long[] ids) {
|
||||||
|
if (ids == null || ids.length == 0) return 0;
|
||||||
|
Collection<Long> userIds = CollUtil.newArrayList(ids);
|
||||||
|
Long count = wechatGroupMapper.selectCount(Wrappers.lambdaQuery(WechatGroup.class)
|
||||||
|
.in(WechatGroup::getCommunityId, userIds));
|
||||||
|
if (count > 0) {
|
||||||
|
throw new ServiceException("所选工作人员已配置转发对象!");
|
||||||
|
}
|
||||||
|
return baseMapper.deleteBatchIds(userIds);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.ruoyi.cms.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.ruoyi.cms.domain.WechatGroup;
|
||||||
|
import com.ruoyi.cms.domain.vo.WechatGroupVo;
|
||||||
|
import com.ruoyi.cms.mapper.WechatGroupMapper;
|
||||||
|
import com.ruoyi.cms.service.IWechatGroupService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class WechatGroupServiceImpl extends ServiceImpl<WechatGroupMapper, WechatGroup>
|
||||||
|
implements IWechatGroupService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<WechatGroupVo> selectWechatGroupList(WechatGroup wechatGroup) {
|
||||||
|
return baseMapper.selectWechatGroupList(wechatGroup);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?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.ruoyi.cms.mapper.WechatGroupMapper">
|
||||||
|
|
||||||
|
<select id="selectWechatGroupList" resultType="com.ruoyi.cms.domain.vo.WechatGroupVo">
|
||||||
|
select g.create_time, g.id, g.name, g.is_push, u.wechat_name, u.phone_number, u.id communityId
|
||||||
|
from wechat_group g join community_user u on g.community_id = u.id
|
||||||
|
where g.del_flag = 0 and u.del_flag = 0
|
||||||
|
<if test="p.name != null and p.name != ''">
|
||||||
|
and g.name like '%' || #{p.name} || '%'
|
||||||
|
</if>
|
||||||
|
<if test="p.isPush != null">
|
||||||
|
and g.is_push = #{p.isPush}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Reference in New Issue
Block a user