parent
a920a3899b
commit
807e24ff96
@ -0,0 +1,93 @@
|
||||
package com.cyl.ums.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.cyl.ums.convert.MemberWechatConvert;
|
||||
import com.cyl.ums.domain.MemberWechat;
|
||||
import com.cyl.ums.pojo.query.MemberWechatQuery;
|
||||
import com.cyl.ums.service.MemberWechatService;
|
||||
import com.cyl.ums.pojo.vo.MemberWechatVO;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
/**
|
||||
* 用户微信信息Controller
|
||||
*
|
||||
* @author zcc
|
||||
* @date 2022-11-28
|
||||
*/
|
||||
@Api(description ="用户微信信息接口列表")
|
||||
@RestController
|
||||
@RequestMapping("/ums/memberWechat")
|
||||
public class MemberWechatController extends BaseController {
|
||||
@Autowired
|
||||
private MemberWechatService service;
|
||||
@Autowired
|
||||
private MemberWechatConvert convert;
|
||||
|
||||
@ApiOperation("查询用户微信信息列表")
|
||||
@PreAuthorize("@ss.hasPermi('ums:memberWechat:list')")
|
||||
@PostMapping("/list")
|
||||
public ResponseEntity<Page<MemberWechat>> list(@RequestBody MemberWechatQuery query, Pageable page) {
|
||||
List<MemberWechat> list = service.selectList(query, page);
|
||||
return ResponseEntity.ok(new PageImpl<>(list, page, ((com.github.pagehelper.Page)list).getTotal()));
|
||||
}
|
||||
|
||||
@ApiOperation("导出用户微信信息列表")
|
||||
@PreAuthorize("@ss.hasPermi('ums:memberWechat:export')")
|
||||
@Log(title = "用户微信信息", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public ResponseEntity<String> export(MemberWechatQuery query) {
|
||||
List<MemberWechat> list = service.selectList(query, null);
|
||||
ExcelUtil<MemberWechatVO> util = new ExcelUtil<>(MemberWechatVO.class);
|
||||
return ResponseEntity.ok(util.writeExcel(convert.dos2vos(list), "用户微信信息数据"));
|
||||
}
|
||||
|
||||
@ApiOperation("获取用户微信信息详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('ums:memberWechat:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public ResponseEntity<MemberWechat> getInfo(@PathVariable("id") Long id) {
|
||||
return ResponseEntity.ok(service.selectById(id));
|
||||
}
|
||||
|
||||
@ApiOperation("新增用户微信信息")
|
||||
@PreAuthorize("@ss.hasPermi('ums:memberWechat:add')")
|
||||
@Log(title = "用户微信信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public ResponseEntity<Integer> add(@RequestBody MemberWechat memberWechat) {
|
||||
return ResponseEntity.ok(service.insert(memberWechat));
|
||||
}
|
||||
|
||||
@ApiOperation("修改用户微信信息")
|
||||
@PreAuthorize("@ss.hasPermi('ums:memberWechat:edit')")
|
||||
@Log(title = "用户微信信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public ResponseEntity<Integer> edit(@RequestBody MemberWechat memberWechat) {
|
||||
return ResponseEntity.ok(service.update(memberWechat));
|
||||
}
|
||||
|
||||
@ApiOperation("删除用户微信信息")
|
||||
@PreAuthorize("@ss.hasPermi('ums:memberWechat:remove')")
|
||||
@Log(title = "用户微信信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public ResponseEntity<Integer> remove(@PathVariable Long[] ids) {
|
||||
return ResponseEntity.ok(service.deleteByIds(ids));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.cyl.ums.convert;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import com.cyl.ums.domain.MemberWechat;
|
||||
import com.cyl.ums.pojo.vo.MemberWechatVO;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 用户微信信息 DO <=> DTO <=> VO / BO / Query
|
||||
*
|
||||
* @author zcc
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface MemberWechatConvert {
|
||||
|
||||
List<MemberWechatVO> dos2vos(List<MemberWechat> list);
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.cyl.ums.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.cyl.ums.domain.MemberWechat;
|
||||
|
||||
/**
|
||||
* 用户微信信息Mapper接口
|
||||
*
|
||||
* @author zcc
|
||||
*/
|
||||
public interface MemberWechatMapper extends BaseMapper<MemberWechat> {
|
||||
/**
|
||||
* 查询用户微信信息列表
|
||||
*
|
||||
* @param memberWechat 用户微信信息
|
||||
* @return 用户微信信息集合
|
||||
*/
|
||||
List<MemberWechat> selectByEntity(MemberWechat memberWechat);
|
||||
|
||||
/**
|
||||
* 批量软删除
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
int updateDelFlagByIds(@Param("ids") Long[] ids);
|
||||
}
|
||||
@ -0,0 +1,148 @@
|
||||
package com.cyl.ums.service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.cyl.ums.mapper.MemberWechatMapper;
|
||||
import com.cyl.ums.domain.MemberWechat;
|
||||
import com.cyl.ums.pojo.query.MemberWechatQuery;
|
||||
|
||||
/**
|
||||
* 用户微信信息Service业务层处理
|
||||
*
|
||||
*
|
||||
* @author zcc
|
||||
*/
|
||||
@Service
|
||||
public class MemberWechatService {
|
||||
@Autowired
|
||||
private MemberWechatMapper memberWechatMapper;
|
||||
|
||||
/**
|
||||
* 查询用户微信信息
|
||||
*
|
||||
* @param id 用户微信信息主键
|
||||
* @return 用户微信信息
|
||||
*/
|
||||
public MemberWechat selectById(Long id) {
|
||||
return memberWechatMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户微信信息列表
|
||||
*
|
||||
* @param query 查询条件
|
||||
* @param page 分页条件
|
||||
* @return 用户微信信息
|
||||
*/
|
||||
public List<MemberWechat> selectList(MemberWechatQuery query, Pageable page) {
|
||||
if (page != null) {
|
||||
PageHelper.startPage(page.getPageNumber() + 1, page.getPageSize());
|
||||
}
|
||||
QueryWrapper<MemberWechat> qw = new QueryWrapper<>();
|
||||
qw.eq("del_flag",0);
|
||||
Long memberId = query.getMemberId();
|
||||
if (memberId != null) {
|
||||
qw.eq("member_id", memberId);
|
||||
}
|
||||
String unionid = query.getUnionid();
|
||||
if (!StringUtils.isEmpty(unionid)) {
|
||||
qw.eq("unionid", unionid);
|
||||
}
|
||||
String openid = query.getOpenid();
|
||||
if (!StringUtils.isEmpty(openid)) {
|
||||
qw.eq("openid", openid);
|
||||
}
|
||||
String routineOpenid = query.getRoutineOpenid();
|
||||
if (!StringUtils.isEmpty(routineOpenid)) {
|
||||
qw.eq("routine_openid", routineOpenid);
|
||||
}
|
||||
Integer groupid = query.getGroupid();
|
||||
if (groupid != null) {
|
||||
qw.eq("groupid", groupid);
|
||||
}
|
||||
String tagidList = query.getTagidList();
|
||||
if (!StringUtils.isEmpty(tagidList)) {
|
||||
qw.eq("tagid_list", tagidList);
|
||||
}
|
||||
Integer subscribe = query.getSubscribe();
|
||||
if (subscribe != null) {
|
||||
qw.eq("subscribe", subscribe);
|
||||
}
|
||||
Integer subscribeTime = query.getSubscribeTime();
|
||||
if (subscribeTime != null) {
|
||||
qw.eq("subscribe_time", subscribeTime);
|
||||
}
|
||||
String sessionKey = query.getSessionKey();
|
||||
if (!StringUtils.isEmpty(sessionKey)) {
|
||||
qw.eq("session_key", sessionKey);
|
||||
}
|
||||
String accessToken = query.getAccessToken();
|
||||
if (!StringUtils.isEmpty(accessToken)) {
|
||||
qw.eq("access_token", accessToken);
|
||||
}
|
||||
Integer expiresIn = query.getExpiresIn();
|
||||
if (expiresIn != null) {
|
||||
qw.eq("expires_in", expiresIn);
|
||||
}
|
||||
String refreshToken = query.getRefreshToken();
|
||||
if (!StringUtils.isEmpty(refreshToken)) {
|
||||
qw.eq("refresh_token", refreshToken);
|
||||
}
|
||||
LocalDateTime expireTime = query.getExpireTime();
|
||||
if (expireTime != null) {
|
||||
qw.eq("expire_time", expireTime);
|
||||
}
|
||||
return memberWechatMapper.selectList(qw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户微信信息
|
||||
*
|
||||
* @param memberWechat 用户微信信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insert(MemberWechat memberWechat) {
|
||||
memberWechat.setDelFlag(0);
|
||||
memberWechat.setCreateTime(LocalDateTime.now());
|
||||
return memberWechatMapper.insert(memberWechat);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户微信信息
|
||||
*
|
||||
* @param memberWechat 用户微信信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int update(MemberWechat memberWechat) {
|
||||
return memberWechatMapper.updateById(memberWechat);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除用户微信信息
|
||||
*
|
||||
* @param ids 需要删除的用户微信信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteByIds(Long[] ids) {
|
||||
return memberWechatMapper.updateDelFlagByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户微信信息信息
|
||||
*
|
||||
* @param id 用户微信信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteById(Long id) {
|
||||
Long[] ids = {id};
|
||||
return memberWechatMapper.updateDelFlagByIds(ids);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
<?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.cyl.ums.mapper.MemberWechatMapper">
|
||||
|
||||
<resultMap type="MemberWechat" id="MemberWechatResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="memberId" column="member_id"/>
|
||||
<result property="unionid" column="unionid"/>
|
||||
<result property="openid" column="openid"/>
|
||||
<result property="routineOpenid" column="routine_openid"/>
|
||||
<result property="groupid" column="groupid"/>
|
||||
<result property="tagidList" column="tagid_list"/>
|
||||
<result property="subscribe" column="subscribe"/>
|
||||
<result property="subscribeTime" column="subscribe_time"/>
|
||||
<result property="sessionKey" column="session_key"/>
|
||||
<result property="accessToken" column="access_token"/>
|
||||
<result property="expiresIn" column="expires_in"/>
|
||||
<result property="refreshToken" column="refresh_token"/>
|
||||
<result property="expireTime" column="expire_time"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectMemberWechatVo">
|
||||
select id, member_id, unionid, openid, routine_openid, groupid, tagid_list, subscribe, subscribe_time, session_key, access_token, expires_in, refresh_token, expire_time, create_time, update_time from ums_member_wechat
|
||||
</sql>
|
||||
|
||||
<select id="selectByEntity" parameterType="MemberWechat" resultMap="MemberWechatResult">
|
||||
<include refid="selectMemberWechatVo"/>
|
||||
<where>
|
||||
<if test="memberId != null "> and member_id = #{memberId}</if>
|
||||
<if test="unionid != null and unionid != ''"> and unionid = #{unionid}</if>
|
||||
<if test="openid != null and openid != ''"> and openid = #{openid}</if>
|
||||
<if test="routineOpenid != null and routineOpenid != ''"> and routine_openid = #{routineOpenid}</if>
|
||||
<if test="groupid != null "> and groupid = #{groupid}</if>
|
||||
<if test="tagidList != null and tagidList != ''"> and tagid_list = #{tagidList}</if>
|
||||
<if test="subscribe != null "> and subscribe = #{subscribe}</if>
|
||||
<if test="subscribeTime != null "> and subscribe_time = #{subscribeTime}</if>
|
||||
<if test="sessionKey != null and sessionKey != ''"> and session_key = #{sessionKey}</if>
|
||||
<if test="accessToken != null and accessToken != ''"> and access_token = #{accessToken}</if>
|
||||
<if test="expiresIn != null "> and expires_in = #{expiresIn}</if>
|
||||
<if test="refreshToken != null and refreshToken != ''"> and refresh_token = #{refreshToken}</if>
|
||||
<if test="expireTime != null "> and expire_time = #{expireTime}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<update id="updateDelFlagByIds">
|
||||
update ums_member_wechat set del_flag=1
|
||||
<where>
|
||||
id in <foreach collection="ids" open="(" item="it" close=")" separator=",">#{it}</foreach>
|
||||
</where>
|
||||
</update>
|
||||
</mapper>
|
||||
@ -0,0 +1,22 @@
|
||||
-- 菜单 SQL
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('用户微信信息', '3', '1', 'memberWechat', 'ums/memberWechat/index', 1, 0, 'C', '0', '0', 'ums:memberWechat:list', '#', 1, sysdate(), '', null, '用户微信信息菜单');
|
||||
|
||||
-- 按钮父菜单ID
|
||||
SELECT @parentId := LAST_INSERT_ID();
|
||||
|
||||
-- 按钮 SQL
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('用户微信信息查询', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', 'ums:memberWechat:query', '#', 1, sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('用户微信信息新增', @parentId, '2', '#', '', 1, 0, 'F', '0', '0', 'ums:memberWechat:add', '#', 1, sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('用户微信信息修改', @parentId, '3', '#', '', 1, 0, 'F', '0', '0', 'ums:memberWechat:edit', '#', 1, sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('用户微信信息删除', @parentId, '4', '#', '', 1, 0, 'F', '0', '0', 'ums:memberWechat:remove', '#', 1, sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('用户微信信息导出', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', 'ums:memberWechat:export', '#', 1, sysdate(), '', null, '');
|
||||
Loading…
Reference in new issue