新增查询微信用户代码

pull/371/head
wuyibo 3 years ago
parent afa23c2111
commit d7ce9bbbb8

@ -238,6 +238,8 @@
<artifactId>ruoyi-api-system</artifactId> <artifactId>ruoyi-api-system</artifactId>
<version>${ruoyi.version}</version> <version>${ruoyi.version}</version>
</dependency> </dependency>
<!-- basketball微信小程序接口 -->
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>

@ -14,12 +14,14 @@ spring:
nacos: nacos:
discovery: discovery:
# 服务注册地址 # 服务注册地址
server-addr: 127.0.0.1:8848 server-addr: 192.168.1.211:30006
namespace: dev
config: config:
# 配置中心地址 # 配置中心地址
server-addr: 127.0.0.1:8848 server-addr: 192.168.1.211:30006
# 配置文件格式 # 配置文件格式
file-extension: yml file-extension: yml
namespace: dev
# 共享配置 # 共享配置
shared-configs: shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}

@ -14,10 +14,12 @@ spring:
nacos: nacos:
discovery: discovery:
# 服务注册地址 # 服务注册地址
server-addr: 127.0.0.1:8848 server-addr: 192.168.1.211:30006
namespace: dev
config: config:
# 配置中心地址 # 配置中心地址
server-addr: 127.0.0.1:8848 server-addr: 192.168.1.211:30006
namespace: dev
# 配置文件格式 # 配置文件格式
file-extension: yml file-extension: yml
# 共享配置 # 共享配置
@ -33,7 +35,8 @@ spring:
datasource: datasource:
ds1: ds1:
nacos: nacos:
server-addr: 127.0.0.1:8848 server-addr: 192.168.1.211:30006
namespace: dev
dataId: sentinel-ruoyi-gateway dataId: sentinel-ruoyi-gateway
groupId: DEFAULT_GROUP groupId: DEFAULT_GROUP
data-type: json data-type: json

@ -14,12 +14,14 @@ spring:
nacos: nacos:
discovery: discovery:
# 服务注册地址 # 服务注册地址
server-addr: 127.0.0.1:8848 server-addr: 192.168.1.211:30006
namespace: dev
config: config:
# 配置中心地址 # 配置中心地址
server-addr: 127.0.0.1:8848 server-addr: 192.168.1.211:30006
# 配置文件格式 # 配置文件格式
file-extension: yml file-extension: yml
namespace: dev
# 共享配置 # 共享配置
shared-configs: shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}

@ -0,0 +1,105 @@
package com.ruoyi.system.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
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.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.system.domain.WxUser;
import com.ruoyi.system.service.IWxUserService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author
* @date 2022-08-30
*/
@RestController
@RequestMapping("/wxUser")
public class WxUserController extends BaseController
{
@Autowired
private IWxUserService wxUserService;
/**
*
*/
@RequiresPermissions("system:wxUser:list")
@GetMapping("/list")
public TableDataInfo list(WxUser wxUser)
{
startPage();
List<WxUser> list = wxUserService.selectWxUserList(wxUser);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("system:wxUser:export")
@Log(title = "微信用户", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WxUser wxUser)
{
List<WxUser> list = wxUserService.selectWxUserList(wxUser);
ExcelUtil<WxUser> util = new ExcelUtil<WxUser>(WxUser.class);
util.exportExcel(response, list, "微信用户数据");
}
/**
*
*/
@RequiresPermissions("system:wxUser:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(wxUserService.selectWxUserById(id));
}
/**
*
*/
@RequiresPermissions("system:wxUser:add")
@Log(title = "微信用户", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WxUser wxUser)
{
return toAjax(wxUserService.insertWxUser(wxUser));
}
/**
*
*/
@RequiresPermissions("system:wxUser:edit")
@Log(title = "微信用户", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WxUser wxUser)
{
return toAjax(wxUserService.updateWxUser(wxUser));
}
/**
*
*/
@RequiresPermissions("system:wxUser:remove")
@Log(title = "微信用户", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(wxUserService.deleteWxUserByIds(ids));
}
}

@ -0,0 +1,351 @@
package com.ruoyi.system.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
/**
* user_info
*
* @author
* @date 2022-08-30
*/
public class WxUser extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 删除 */
@Excel(name = "删除")
private Long isDeleted;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date createdTime;
/** 创建人 */
@Excel(name = "创建人")
private String createdBy;
/** 最后修改人 */
@Excel(name = "最后修改人")
private String modifiedBy;
/** 最后修改时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "最后修改时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date lastUpdatedTime;
/** 登录名称 */
@Excel(name = "登录名称")
private String loginName;
/** 密码 */
@Excel(name = "密码")
private String passWord;
/** 角色 */
@Excel(name = "角色")
private String role;
/** 用户编码(小程序平台OPENID) */
@Excel(name = "用户编码(小程序平台OPENID)")
private String openid;
/** 头像地址 */
@Excel(name = "头像地址")
private String avatar;
/** 性别 */
@Excel(name = "性别")
private String gender;
/** 用户名称 */
@Excel(name = "用户名称")
private String userName;
/** 手机号 */
@Excel(name = "手机号")
private String telephone;
/** 生日 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "生日", width = 30, dateFormat = "yyyy-MM-dd")
private Date birthday;
/** 身高 */
@Excel(name = "身高")
private Long height;
/** 体重 */
@Excel(name = "体重")
private BigDecimal weight;
/** 球队位置 */
@Excel(name = "球队位置")
private String teamPosition;
/** 标签 */
@Excel(name = "标签")
private String tag;
/** 状态 */
@Excel(name = "状态")
private String enabled;
/** 微信多平台唯一ID */
@Excel(name = "微信多平台唯一ID")
private String unionid;
/** 公众号平台的openId */
@Excel(name = "公众号平台的openId")
private String officialAccountOpenid;
/** 真实姓名 */
@Excel(name = "真实姓名")
private String realName;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setIsDeleted(Long isDeleted)
{
this.isDeleted = isDeleted;
}
public Long getIsDeleted()
{
return isDeleted;
}
public void setCreatedTime(Date createdTime)
{
this.createdTime = createdTime;
}
public Date getCreatedTime()
{
return createdTime;
}
public void setCreatedBy(String createdBy)
{
this.createdBy = createdBy;
}
public String getCreatedBy()
{
return createdBy;
}
public void setModifiedBy(String modifiedBy)
{
this.modifiedBy = modifiedBy;
}
public String getModifiedBy()
{
return modifiedBy;
}
public void setLastUpdatedTime(Date lastUpdatedTime)
{
this.lastUpdatedTime = lastUpdatedTime;
}
public Date getLastUpdatedTime()
{
return lastUpdatedTime;
}
public void setLoginName(String loginName)
{
this.loginName = loginName;
}
public String getLoginName()
{
return loginName;
}
public void setPassWord(String passWord)
{
this.passWord = passWord;
}
public String getPassWord()
{
return passWord;
}
public void setRole(String role)
{
this.role = role;
}
public String getRole()
{
return role;
}
public void setOpenid(String openid)
{
this.openid = openid;
}
public String getOpenid()
{
return openid;
}
public void setAvatar(String avatar)
{
this.avatar = avatar;
}
public String getAvatar()
{
return avatar;
}
public void setGender(String gender)
{
this.gender = gender;
}
public String getGender()
{
return gender;
}
public void setUserName(String userName)
{
this.userName = userName;
}
public String getUserName()
{
return userName;
}
public void setTelephone(String telephone)
{
this.telephone = telephone;
}
public String getTelephone()
{
return telephone;
}
public void setBirthday(Date birthday)
{
this.birthday = birthday;
}
public Date getBirthday()
{
return birthday;
}
public void setHeight(Long height)
{
this.height = height;
}
public Long getHeight()
{
return height;
}
public void setWeight(BigDecimal weight)
{
this.weight = weight;
}
public BigDecimal getWeight()
{
return weight;
}
public void setTeamPosition(String teamPosition)
{
this.teamPosition = teamPosition;
}
public String getTeamPosition()
{
return teamPosition;
}
public void setTag(String tag)
{
this.tag = tag;
}
public String getTag()
{
return tag;
}
public void setEnabled(String enabled)
{
this.enabled = enabled;
}
public String getEnabled()
{
return enabled;
}
public void setUnionid(String unionid)
{
this.unionid = unionid;
}
public String getUnionid()
{
return unionid;
}
public void setOfficialAccountOpenid(String officialAccountOpenid)
{
this.officialAccountOpenid = officialAccountOpenid;
}
public String getOfficialAccountOpenid()
{
return officialAccountOpenid;
}
public void setRealName(String realName)
{
this.realName = realName;
}
public String getRealName()
{
return realName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("isDeleted", getIsDeleted())
.append("createdTime", getCreatedTime())
.append("createdBy", getCreatedBy())
.append("modifiedBy", getModifiedBy())
.append("lastUpdatedTime", getLastUpdatedTime())
.append("loginName", getLoginName())
.append("passWord", getPassWord())
.append("role", getRole())
.append("openid", getOpenid())
.append("avatar", getAvatar())
.append("gender", getGender())
.append("userName", getUserName())
.append("telephone", getTelephone())
.append("birthday", getBirthday())
.append("height", getHeight())
.append("weight", getWeight())
.append("teamPosition", getTeamPosition())
.append("tag", getTag())
.append("enabled", getEnabled())
.append("unionid", getUnionid())
.append("officialAccountOpenid", getOfficialAccountOpenid())
.append("realName", getRealName())
.toString();
}
}

@ -0,0 +1,61 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.WxUser;
/**
* Mapper
*
* @author
* @date 2022-08-30
*/
public interface WxUserMapper
{
/**
*
*
* @param id
* @return
*/
public WxUser selectWxUserById(Long id);
/**
*
*
* @param wxUser
* @return
*/
public List<WxUser> selectWxUserList(WxUser wxUser);
/**
*
*
* @param wxUser
* @return
*/
public int insertWxUser(WxUser wxUser);
/**
*
*
* @param wxUser
* @return
*/
public int updateWxUser(WxUser wxUser);
/**
*
*
* @param id
* @return
*/
public int deleteWxUserById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteWxUserByIds(Long[] ids);
}

@ -0,0 +1,61 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.WxUser;
/**
* Service
*
* @author
* @date 2022-08-30
*/
public interface IWxUserService
{
/**
*
*
* @param id
* @return
*/
public WxUser selectWxUserById(Long id);
/**
*
*
* @param wxUser
* @return
*/
public List<WxUser> selectWxUserList(WxUser wxUser);
/**
*
*
* @param wxUser
* @return
*/
public int insertWxUser(WxUser wxUser);
/**
*
*
* @param wxUser
* @return
*/
public int updateWxUser(WxUser wxUser);
/**
*
*
* @param ids
* @return
*/
public int deleteWxUserByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteWxUserById(Long id);
}

@ -0,0 +1,93 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.WxUserMapper;
import com.ruoyi.system.domain.WxUser;
import com.ruoyi.system.service.IWxUserService;
/**
* Service
*
* @author
* @date 2022-08-30
*/
@Service
public class WxUserServiceImpl implements IWxUserService
{
@Autowired
private WxUserMapper wxUserMapper;
/**
*
*
* @param id
* @return
*/
@Override
public WxUser selectWxUserById(Long id)
{
return wxUserMapper.selectWxUserById(id);
}
/**
*
*
* @param wxUser
* @return
*/
@Override
public List<WxUser> selectWxUserList(WxUser wxUser)
{
return wxUserMapper.selectWxUserList(wxUser);
}
/**
*
*
* @param wxUser
* @return
*/
@Override
public int insertWxUser(WxUser wxUser)
{
return wxUserMapper.insertWxUser(wxUser);
}
/**
*
*
* @param wxUser
* @return
*/
@Override
public int updateWxUser(WxUser wxUser)
{
return wxUserMapper.updateWxUser(wxUser);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteWxUserByIds(Long[] ids)
{
return wxUserMapper.deleteWxUserByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteWxUserById(Long id)
{
return wxUserMapper.deleteWxUserById(id);
}
}

@ -14,10 +14,12 @@ spring:
nacos: nacos:
discovery: discovery:
# 服务注册地址 # 服务注册地址
server-addr: 127.0.0.1:8848 server-addr: 192.168.1.211:30006
namespace: dev
config: config:
# 配置中心地址 # 配置中心地址
server-addr: 127.0.0.1:8848 server-addr: 192.168.1.211:30006
namespace: dev
# 配置文件格式 # 配置文件格式
file-extension: yml file-extension: yml
# 共享配置 # 共享配置

@ -0,0 +1,161 @@
<?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.system.mapper.WxUserMapper">
<resultMap type="WxUser" id="WxUserResult">
<result property="id" column="ID" />
<result property="isDeleted" column="IS_DELETED" />
<result property="createdTime" column="CREATED_TIME" />
<result property="createdBy" column="CREATED_BY" />
<result property="modifiedBy" column="MODIFIED_BY" />
<result property="lastUpdatedTime" column="LAST_UPDATED_TIME" />
<result property="loginName" column="LOGIN_NAME" />
<result property="passWord" column="PASS_WORD" />
<result property="role" column="ROLE" />
<result property="openid" column="OPENID" />
<result property="avatar" column="AVATAR" />
<result property="gender" column="GENDER" />
<result property="userName" column="USER_NAME" />
<result property="telephone" column="TELEPHONE" />
<result property="birthday" column="BIRTHDAY" />
<result property="height" column="HEIGHT" />
<result property="weight" column="WEIGHT" />
<result property="teamPosition" column="TEAM_POSITION" />
<result property="tag" column="TAG" />
<result property="enabled" column="ENABLED" />
<result property="unionid" column="UNIONID" />
<result property="officialAccountOpenid" column="OFFICIAL_ACCOUNT_OPENID" />
<result property="realName" column="real_name" />
</resultMap>
<sql id="selectWxUserVo">
select ID, IS_DELETED, CREATED_TIME, CREATED_BY, MODIFIED_BY, LAST_UPDATED_TIME, LOGIN_NAME, PASS_WORD, ROLE, OPENID, AVATAR, GENDER, USER_NAME, TELEPHONE, BIRTHDAY, HEIGHT, WEIGHT, TEAM_POSITION, TAG, ENABLED, UNIONID, OFFICIAL_ACCOUNT_OPENID, real_name from user_info
</sql>
<select id="selectWxUserList" parameterType="WxUser" resultMap="WxUserResult">
<include refid="selectWxUserVo"/>
<where>
<if test="isDeleted != null "> and IS_DELETED = #{isDeleted}</if>
<if test="createdTime != null "> and CREATED_TIME = #{createdTime}</if>
<if test="createdBy != null and createdBy != ''"> and CREATED_BY = #{createdBy}</if>
<if test="modifiedBy != null and modifiedBy != ''"> and MODIFIED_BY = #{modifiedBy}</if>
<if test="lastUpdatedTime != null "> and LAST_UPDATED_TIME = #{lastUpdatedTime}</if>
<if test="loginName != null and loginName != ''"> and LOGIN_NAME like concat('%', #{loginName}, '%')</if>
<if test="passWord != null and passWord != ''"> and PASS_WORD = #{passWord}</if>
<if test="role != null and role != ''"> and ROLE = #{role}</if>
<if test="openid != null and openid != ''"> and OPENID = #{openid}</if>
<if test="avatar != null and avatar != ''"> and AVATAR = #{avatar}</if>
<if test="gender != null and gender != ''"> and GENDER = #{gender}</if>
<if test="userName != null and userName != ''"> and USER_NAME like concat('%', #{userName}, '%')</if>
<if test="telephone != null and telephone != ''"> and TELEPHONE = #{telephone}</if>
<if test="birthday != null "> and BIRTHDAY = #{birthday}</if>
<if test="height != null "> and HEIGHT = #{height}</if>
<if test="weight != null "> and WEIGHT = #{weight}</if>
<if test="teamPosition != null and teamPosition != ''"> and TEAM_POSITION = #{teamPosition}</if>
<if test="tag != null and tag != ''"> and TAG = #{tag}</if>
<if test="enabled != null and enabled != ''"> and ENABLED = #{enabled}</if>
<if test="unionid != null and unionid != ''"> and UNIONID = #{unionid}</if>
<if test="officialAccountOpenid != null and officialAccountOpenid != ''"> and OFFICIAL_ACCOUNT_OPENID = #{officialAccountOpenid}</if>
<if test="realName != null and realName != ''"> and real_name like concat('%', #{realName}, '%')</if>
</where>
</select>
<select id="selectWxUserById" parameterType="Long" resultMap="WxUserResult">
<include refid="selectWxUserVo"/>
where ID = #{id}
</select>
<insert id="insertWxUser" parameterType="WxUser" useGeneratedKeys="true" keyProperty="id">
insert into user_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="isDeleted != null">IS_DELETED,</if>
<if test="createdTime != null">CREATED_TIME,</if>
<if test="createdBy != null">CREATED_BY,</if>
<if test="modifiedBy != null">MODIFIED_BY,</if>
<if test="lastUpdatedTime != null">LAST_UPDATED_TIME,</if>
<if test="loginName != null">LOGIN_NAME,</if>
<if test="passWord != null">PASS_WORD,</if>
<if test="role != null">ROLE,</if>
<if test="openid != null">OPENID,</if>
<if test="avatar != null">AVATAR,</if>
<if test="gender != null">GENDER,</if>
<if test="userName != null">USER_NAME,</if>
<if test="telephone != null">TELEPHONE,</if>
<if test="birthday != null">BIRTHDAY,</if>
<if test="height != null">HEIGHT,</if>
<if test="weight != null">WEIGHT,</if>
<if test="teamPosition != null">TEAM_POSITION,</if>
<if test="tag != null">TAG,</if>
<if test="enabled != null">ENABLED,</if>
<if test="unionid != null">UNIONID,</if>
<if test="officialAccountOpenid != null">OFFICIAL_ACCOUNT_OPENID,</if>
<if test="realName != null">real_name,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="isDeleted != null">#{isDeleted},</if>
<if test="createdTime != null">#{createdTime},</if>
<if test="createdBy != null">#{createdBy},</if>
<if test="modifiedBy != null">#{modifiedBy},</if>
<if test="lastUpdatedTime != null">#{lastUpdatedTime},</if>
<if test="loginName != null">#{loginName},</if>
<if test="passWord != null">#{passWord},</if>
<if test="role != null">#{role},</if>
<if test="openid != null">#{openid},</if>
<if test="avatar != null">#{avatar},</if>
<if test="gender != null">#{gender},</if>
<if test="userName != null">#{userName},</if>
<if test="telephone != null">#{telephone},</if>
<if test="birthday != null">#{birthday},</if>
<if test="height != null">#{height},</if>
<if test="weight != null">#{weight},</if>
<if test="teamPosition != null">#{teamPosition},</if>
<if test="tag != null">#{tag},</if>
<if test="enabled != null">#{enabled},</if>
<if test="unionid != null">#{unionid},</if>
<if test="officialAccountOpenid != null">#{officialAccountOpenid},</if>
<if test="realName != null">#{realName},</if>
</trim>
</insert>
<update id="updateWxUser" parameterType="WxUser">
update user_info
<trim prefix="SET" suffixOverrides=",">
<if test="isDeleted != null">IS_DELETED = #{isDeleted},</if>
<if test="createdTime != null">CREATED_TIME = #{createdTime},</if>
<if test="createdBy != null">CREATED_BY = #{createdBy},</if>
<if test="modifiedBy != null">MODIFIED_BY = #{modifiedBy},</if>
<if test="lastUpdatedTime != null">LAST_UPDATED_TIME = #{lastUpdatedTime},</if>
<if test="loginName != null">LOGIN_NAME = #{loginName},</if>
<if test="passWord != null">PASS_WORD = #{passWord},</if>
<if test="role != null">ROLE = #{role},</if>
<if test="openid != null">OPENID = #{openid},</if>
<if test="avatar != null">AVATAR = #{avatar},</if>
<if test="gender != null">GENDER = #{gender},</if>
<if test="userName != null">USER_NAME = #{userName},</if>
<if test="telephone != null">TELEPHONE = #{telephone},</if>
<if test="birthday != null">BIRTHDAY = #{birthday},</if>
<if test="height != null">HEIGHT = #{height},</if>
<if test="weight != null">WEIGHT = #{weight},</if>
<if test="teamPosition != null">TEAM_POSITION = #{teamPosition},</if>
<if test="tag != null">TAG = #{tag},</if>
<if test="enabled != null">ENABLED = #{enabled},</if>
<if test="unionid != null">UNIONID = #{unionid},</if>
<if test="officialAccountOpenid != null">OFFICIAL_ACCOUNT_OPENID = #{officialAccountOpenid},</if>
<if test="realName != null">real_name = #{realName},</if>
</trim>
where ID = #{id}
</update>
<delete id="deleteWxUserById" parameterType="Long">
delete from user_info where ID = #{id}
</delete>
<delete id="deleteWxUserByIds" parameterType="String">
delete from user_info where ID in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询微信用户列表
export function listWxUser(query) {
return request({
url: '/system/wxUser/list',
method: 'get',
params: query
})
}
// 查询微信用户详细
export function getWxUser(id) {
return request({
url: '/system/wxUser/' + id,
method: 'get'
})
}
// 新增微信用户
export function addWxUser(data) {
return request({
url: '/system/wxUser',
method: 'post',
data: data
})
}
// 修改微信用户
export function updateWxUser(data) {
return request({
url: '/system/wxUser',
method: 'put',
data: data
})
}
// 删除微信用户
export function delWxUser(id) {
return request({
url: '/system/wxUser/' + id,
method: 'delete'
})
}

@ -0,0 +1,382 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="登录名称" prop="loginName">
<el-input
v-model="queryParams.loginName"
placeholder="请输入登录名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="用户名称" prop="userName">
<el-input
v-model="queryParams.userName"
placeholder="请输入用户名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:wxUser:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:wxUser:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:wxUser:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:wxUser:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="wxUserList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键ID" align="center" prop="id" />
<el-table-column label="创建时间" align="center" prop="createdTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createdTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="创建人" align="center" prop="createdBy" />
<el-table-column label="登录名称" align="center" prop="loginName" />
<el-table-column label="角色" align="center" prop="role" />
<el-table-column label="OPENID" align="center" prop="openid" />
<el-table-column label="性别" align="center" prop="gender" >
<template slot-scope="scope">
<span v-if="scope.row.gender==1"></span>
<span v-if="scope.row.gender==0"></span>
</template>
</el-table-column>
<el-table-column label="用户名称" align="center" prop="userName" />
<el-table-column label="手机号" align="center" prop="telephone" />
<el-table-column label="生日" align="center" prop="birthday" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.birthday, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="enabled" >
<template slot-scope="scope">
<el-switch
disabled
v-model="scope.row.enabled"
active-value="1"
inactive-value="0"
></el-switch>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:wxUser:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:wxUser:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改微信用户对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="删除表示" prop="isDeleted">
<el-input v-model="form.isDeleted" placeholder="请输入删除表示" />
</el-form-item>
<el-form-item label="创建时间" prop="createdTime">
<el-date-picker clearable
v-model="form.createdTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择创建时间">
</el-date-picker>
</el-form-item>
<el-form-item label="创建人" prop="createdBy">
<el-input v-model="form.createdBy" placeholder="请输入创建人" />
</el-form-item>
<el-form-item label="修改人" prop="modifiedBy">
<el-input v-model="form.modifiedBy" placeholder="请输入修改人" />
</el-form-item>
<el-form-item label="最新更新时间" prop="lastUpdatedTime">
<el-date-picker clearable
v-model="form.lastUpdatedTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择最新更新时间">
</el-date-picker>
</el-form-item>
<el-form-item label="登录名称" prop="loginName">
<el-input v-model="form.loginName" placeholder="请输入登录名称" />
</el-form-item>
<el-form-item label="角色" prop="role">
<el-input v-model="form.role" placeholder="请输入角色" />
</el-form-item>
<el-form-item label="OPENID" prop="openid">
<el-input v-model="form.openid" placeholder="请输入OPENID" />
</el-form-item>
<el-form-item label="头像地址" prop="avatar">
<el-input v-model="form.avatar" placeholder="请输入头像地址" />
</el-form-item>
<el-form-item label="性别" prop="gender">
<el-input v-model="form.gender" placeholder="请输入性别" />
</el-form-item>
<el-form-item label="用户名称" prop="userName">
<el-input v-model="form.userName" placeholder="请输入用户名称" />
</el-form-item>
<el-form-item label="手机号" prop="telephone">
<el-input v-model="form.telephone" placeholder="请输入手机号" />
</el-form-item>
<el-form-item label="生日" prop="birthday">
<el-date-picker clearable
v-model="form.birthday"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择生日">
</el-date-picker>
</el-form-item>
<el-form-item label="身高" prop="height">
<el-input v-model="form.height" placeholder="请输入身高" />
</el-form-item>
<el-form-item label="体重" prop="weight">
<el-input v-model="form.weight" placeholder="请输入体重" />
</el-form-item>
<el-form-item label="球队位置【字典】" prop="teamPosition">
<el-input v-model="form.teamPosition" placeholder="请输入球队位置【字典】" />
</el-form-item>
<el-form-item label="标签【字典】" prop="tag">
<el-input v-model="form.tag" placeholder="请输入标签【字典】" />
</el-form-item>
<el-form-item label="状态" prop="enabled">
<el-input v-model="form.enabled" placeholder="请输入状态" />
</el-form-item>
<el-form-item label="微信多平台唯一ID" prop="unionid">
<el-input v-model="form.unionid" placeholder="请输入微信多平台唯一ID" />
</el-form-item>
<el-form-item label="公众号平台的openId" prop="officialAccountOpenid">
<el-input v-model="form.officialAccountOpenid" placeholder="请输入公众号平台的openId" />
</el-form-item>
<el-form-item label="真实姓名" prop="realName">
<el-input v-model="form.realName" placeholder="请输入真实姓名" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listWxUser, getWxUser, delWxUser, addWxUser, updateWxUser } from "@/api/system/wxUser";
export default {
name: "WxUser",
dicts: ['sys_data_status', 'sys_normal_disable'],
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
wxUserList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
loginName: null,
userName: null,
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询微信用户列表 */
getList() {
this.loading = true;
listWxUser(this.queryParams).then(response => {
this.wxUserList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
isDeleted: null,
createdTime: null,
createdBy: null,
modifiedBy: null,
lastUpdatedTime: null,
loginName: null,
passWord: null,
role: null,
openid: null,
avatar: null,
gender: null,
userName: null,
telephone: null,
birthday: null,
height: null,
weight: null,
teamPosition: null,
tag: null,
enabled: null,
unionid: null,
officialAccountOpenid: null,
realName: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加微信用户";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getWxUser(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改微信用户";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateWxUser(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addWxUser(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除微信用户编号为"' + ids + '"的数据项?').then(function() {
return delWxUser(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/wxUser/export', {
...this.queryParams
}, `wxUser_${new Date().getTime()}.xlsx`)
}
}
};
</script>
Loading…
Cancel
Save