微信用户模块初始化提交
parent
b8637a122d
commit
a5d5cf0058
@ -0,0 +1,106 @@
|
||||
package com.flossom.system.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.flossom.common.core.utils.poi.ExcelUtil;
|
||||
import com.flossom.common.core.web.controller.BaseController;
|
||||
import com.flossom.common.core.web.domain.AjaxResult;
|
||||
import com.flossom.common.core.web.page.TableDataInfo;
|
||||
import com.flossom.common.log.annotation.Log;
|
||||
import com.flossom.common.log.enums.BusinessType;
|
||||
import com.flossom.common.security.annotation.RequiresPermissions;
|
||||
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.flossom.system.domain.WxUserMember;
|
||||
import com.flossom.system.service.IWxUserMemberService;
|
||||
|
||||
/**
|
||||
* 用户Controller
|
||||
*
|
||||
* @author flossom
|
||||
* @date 2023-12-08
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/member")
|
||||
public class WxUserMemberController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IWxUserMemberService wxUserMemberService;
|
||||
|
||||
/**
|
||||
* 查询用户列表
|
||||
*/
|
||||
@RequiresPermissions("system:member:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(WxUserMember wxUserMember)
|
||||
{
|
||||
startPage();
|
||||
List<WxUserMember> list = wxUserMemberService.selectWxUserMemberList(wxUserMember);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出用户列表
|
||||
*/
|
||||
@RequiresPermissions("system:member:export")
|
||||
@Log(title = "用户", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, WxUserMember wxUserMember)
|
||||
{
|
||||
List<WxUserMember> list = wxUserMemberService.selectWxUserMemberList(wxUserMember);
|
||||
ExcelUtil<WxUserMember> util = new ExcelUtil<WxUserMember>(WxUserMember.class);
|
||||
util.exportExcel(response, list, "用户数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户详细信息
|
||||
*/
|
||||
@RequiresPermissions("system:member:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(wxUserMemberService.selectWxUserMemberById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户
|
||||
*/
|
||||
@RequiresPermissions("system:member:add")
|
||||
@Log(title = "用户", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody WxUserMember wxUserMember)
|
||||
{
|
||||
return toAjax(wxUserMemberService.insertWxUserMember(wxUserMember));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
*/
|
||||
@RequiresPermissions("system:member:edit")
|
||||
@Log(title = "用户", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody WxUserMember wxUserMember)
|
||||
{
|
||||
return toAjax(wxUserMemberService.updateWxUserMember(wxUserMember));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
*/
|
||||
@RequiresPermissions("system:member:remove")
|
||||
@Log(title = "用户", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(wxUserMemberService.deleteWxUserMemberByIds(ids));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
package com.flossom.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.flossom.system.domain.WxUserMember;
|
||||
|
||||
/**
|
||||
* 用户Mapper接口
|
||||
*
|
||||
* @author flossom
|
||||
* @date 2023-12-08
|
||||
*/
|
||||
public interface WxUserMemberMapper
|
||||
{
|
||||
/**
|
||||
* 查询用户
|
||||
*
|
||||
* @param id 用户主键
|
||||
* @return 用户
|
||||
*/
|
||||
public WxUserMember selectWxUserMemberById(Long id);
|
||||
|
||||
/**
|
||||
* 查询用户列表
|
||||
*
|
||||
* @param wxUserMember 用户
|
||||
* @return 用户集合
|
||||
*/
|
||||
public List<WxUserMember> selectWxUserMemberList(WxUserMember wxUserMember);
|
||||
|
||||
/**
|
||||
* 新增用户
|
||||
*
|
||||
* @param wxUserMember 用户
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertWxUserMember(WxUserMember wxUserMember);
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
*
|
||||
* @param wxUserMember 用户
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateWxUserMember(WxUserMember wxUserMember);
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
*
|
||||
* @param id 用户主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWxUserMemberById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除用户
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWxUserMemberByIds(Long[] ids);
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
package com.flossom.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.flossom.system.domain.WxUserMember;
|
||||
|
||||
/**
|
||||
* 用户Service接口
|
||||
*
|
||||
* @author flossom
|
||||
* @date 2023-12-08
|
||||
*/
|
||||
public interface IWxUserMemberService
|
||||
{
|
||||
/**
|
||||
* 查询用户
|
||||
*
|
||||
* @param id 用户主键
|
||||
* @return 用户
|
||||
*/
|
||||
public WxUserMember selectWxUserMemberById(Long id);
|
||||
|
||||
/**
|
||||
* 查询用户列表
|
||||
*
|
||||
* @param wxUserMember 用户
|
||||
* @return 用户集合
|
||||
*/
|
||||
public List<WxUserMember> selectWxUserMemberList(WxUserMember wxUserMember);
|
||||
|
||||
/**
|
||||
* 新增用户
|
||||
*
|
||||
* @param wxUserMember 用户
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertWxUserMember(WxUserMember wxUserMember);
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
*
|
||||
* @param wxUserMember 用户
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateWxUserMember(WxUserMember wxUserMember);
|
||||
|
||||
/**
|
||||
* 批量删除用户
|
||||
*
|
||||
* @param ids 需要删除的用户主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWxUserMemberByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除用户信息
|
||||
*
|
||||
* @param id 用户主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWxUserMemberById(Long id);
|
||||
}
|
||||
@ -0,0 +1,97 @@
|
||||
package com.flossom.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.flossom.common.core.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.flossom.system.mapper.WxUserMemberMapper;
|
||||
import com.flossom.system.domain.WxUserMember;
|
||||
import com.flossom.system.service.IWxUserMemberService;
|
||||
|
||||
/**
|
||||
* 用户Service业务层处理
|
||||
*
|
||||
* @author flossom
|
||||
* @date 2023-12-08
|
||||
*/
|
||||
@Service
|
||||
public class WxUserMemberServiceImpl implements IWxUserMemberService
|
||||
{
|
||||
@Autowired
|
||||
private WxUserMemberMapper wxUserMemberMapper;
|
||||
|
||||
/**
|
||||
* 查询用户
|
||||
*
|
||||
* @param id 用户主键
|
||||
* @return 用户
|
||||
*/
|
||||
@Override
|
||||
public WxUserMember selectWxUserMemberById(Long id)
|
||||
{
|
||||
return wxUserMemberMapper.selectWxUserMemberById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户列表
|
||||
*
|
||||
* @param wxUserMember 用户
|
||||
* @return 用户
|
||||
*/
|
||||
@Override
|
||||
public List<WxUserMember> selectWxUserMemberList(WxUserMember wxUserMember)
|
||||
{
|
||||
return wxUserMemberMapper.selectWxUserMemberList(wxUserMember);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户
|
||||
*
|
||||
* @param wxUserMember 用户
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertWxUserMember(WxUserMember wxUserMember)
|
||||
{
|
||||
wxUserMember.setCreateTime(DateUtils.getNowDate());
|
||||
return wxUserMemberMapper.insertWxUserMember(wxUserMember);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
*
|
||||
* @param wxUserMember 用户
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateWxUserMember(WxUserMember wxUserMember)
|
||||
{
|
||||
wxUserMember.setUpdateTime(DateUtils.getNowDate());
|
||||
return wxUserMemberMapper.updateWxUserMember(wxUserMember);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除用户
|
||||
*
|
||||
* @param ids 需要删除的用户主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteWxUserMemberByIds(Long[] ids)
|
||||
{
|
||||
return wxUserMemberMapper.deleteWxUserMemberByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户信息
|
||||
*
|
||||
* @param id 用户主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteWxUserMemberById(Long id)
|
||||
{
|
||||
return wxUserMemberMapper.deleteWxUserMemberById(id);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,191 @@
|
||||
<?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.flossom.system.mapper.WxUserMemberMapper">
|
||||
|
||||
<resultMap type="WxUserMember" id="WxUserMemberResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="nickname" column="nickname" />
|
||||
<result property="headimg" column="headimg" />
|
||||
<result property="username" column="username" />
|
||||
<result property="credit" column="credit" />
|
||||
<result property="openid" column="openid" />
|
||||
<result property="unionid" column="unionid" />
|
||||
<result property="userType" column="user_type" />
|
||||
<result property="level" column="level" />
|
||||
<result property="mobile" column="mobile" />
|
||||
<result property="password" column="password" />
|
||||
<result property="userQr" column="user_qr" />
|
||||
<result property="province" column="province" />
|
||||
<result property="city" column="city" />
|
||||
<result property="area" column="area" />
|
||||
<result property="birthday" column="birthday" />
|
||||
<result property="clock" column="clock" />
|
||||
<result property="activity" column="activity" />
|
||||
<result property="wechat" column="wechat" />
|
||||
<result property="code" column="code" />
|
||||
<result property="isAbutment" column="is_abutment" />
|
||||
<result property="collagenDay" column="collagen_day" />
|
||||
<result property="collagenMount" column="collagen_mount" />
|
||||
<result property="loginTime" column="login_time" />
|
||||
<result property="status" column="status" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectWxUserMemberVo">
|
||||
select id, nickname, headimg, username, credit, openid, unionid, user_type, level, mobile, password, user_qr, province, city, area, birthday, clock, activity, wechat, code, is_abutment, collagen_day, collagen_mount, login_time, status, create_by, create_time, update_by, update_time, remark from wx_user_member
|
||||
</sql>
|
||||
|
||||
<select id="selectWxUserMemberList" parameterType="WxUserMember" resultMap="WxUserMemberResult">
|
||||
<include refid="selectWxUserMemberVo"/>
|
||||
<where>
|
||||
<if test="nickname != null and nickname != ''"> and nickname like concat('%', #{nickname}, '%')</if>
|
||||
<if test="headimg != null and headimg != ''"> and headimg = #{headimg}</if>
|
||||
<if test="username != null and username != ''"> and username like concat('%', #{username}, '%')</if>
|
||||
<if test="credit != null "> and credit = #{credit}</if>
|
||||
<if test="openid != null and openid != ''"> and openid = #{openid}</if>
|
||||
<if test="unionid != null and unionid != ''"> and unionid = #{unionid}</if>
|
||||
<if test="userType != null "> and user_type = #{userType}</if>
|
||||
<if test="level != null "> and level = #{level}</if>
|
||||
<if test="mobile != null and mobile != ''"> and mobile = #{mobile}</if>
|
||||
<if test="password != null and password != ''"> and password = #{password}</if>
|
||||
<if test="userQr != null and userQr != ''"> and user_qr = #{userQr}</if>
|
||||
<if test="province != null and province != ''"> and province = #{province}</if>
|
||||
<if test="city != null and city != ''"> and city = #{city}</if>
|
||||
<if test="area != null and area != ''"> and area = #{area}</if>
|
||||
<if test="birthday != null "> and birthday = #{birthday}</if>
|
||||
<if test="clock != null "> and clock = #{clock}</if>
|
||||
<if test="activity != null "> and activity = #{activity}</if>
|
||||
<if test="wechat != null and wechat != ''"> and wechat = #{wechat}</if>
|
||||
<if test="code != null and code != ''"> and code = #{code}</if>
|
||||
<if test="isAbutment != null "> and is_abutment = #{isAbutment}</if>
|
||||
<if test="collagenDay != null "> and collagen_day = #{collagenDay}</if>
|
||||
<if test="collagenMount != null "> and collagen_mount = #{collagenMount}</if>
|
||||
<if test="loginTime != null "> and login_time = #{loginTime}</if>
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectWxUserMemberById" parameterType="Long" resultMap="WxUserMemberResult">
|
||||
<include refid="selectWxUserMemberVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertWxUserMember" parameterType="WxUserMember" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into wx_user_member
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="nickname != null">nickname,</if>
|
||||
<if test="headimg != null">headimg,</if>
|
||||
<if test="username != null">username,</if>
|
||||
<if test="credit != null">credit,</if>
|
||||
<if test="openid != null">openid,</if>
|
||||
<if test="unionid != null">unionid,</if>
|
||||
<if test="userType != null">user_type,</if>
|
||||
<if test="level != null">level,</if>
|
||||
<if test="mobile != null">mobile,</if>
|
||||
<if test="password != null">password,</if>
|
||||
<if test="userQr != null">user_qr,</if>
|
||||
<if test="province != null">province,</if>
|
||||
<if test="city != null">city,</if>
|
||||
<if test="area != null">area,</if>
|
||||
<if test="birthday != null">birthday,</if>
|
||||
<if test="clock != null">clock,</if>
|
||||
<if test="activity != null">activity,</if>
|
||||
<if test="wechat != null">wechat,</if>
|
||||
<if test="code != null">code,</if>
|
||||
<if test="isAbutment != null">is_abutment,</if>
|
||||
<if test="collagenDay != null">collagen_day,</if>
|
||||
<if test="collagenMount != null">collagen_mount,</if>
|
||||
<if test="loginTime != null">login_time,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="nickname != null">#{nickname},</if>
|
||||
<if test="headimg != null">#{headimg},</if>
|
||||
<if test="username != null">#{username},</if>
|
||||
<if test="credit != null">#{credit},</if>
|
||||
<if test="openid != null">#{openid},</if>
|
||||
<if test="unionid != null">#{unionid},</if>
|
||||
<if test="userType != null">#{userType},</if>
|
||||
<if test="level != null">#{level},</if>
|
||||
<if test="mobile != null">#{mobile},</if>
|
||||
<if test="password != null">#{password},</if>
|
||||
<if test="userQr != null">#{userQr},</if>
|
||||
<if test="province != null">#{province},</if>
|
||||
<if test="city != null">#{city},</if>
|
||||
<if test="area != null">#{area},</if>
|
||||
<if test="birthday != null">#{birthday},</if>
|
||||
<if test="clock != null">#{clock},</if>
|
||||
<if test="activity != null">#{activity},</if>
|
||||
<if test="wechat != null">#{wechat},</if>
|
||||
<if test="code != null">#{code},</if>
|
||||
<if test="isAbutment != null">#{isAbutment},</if>
|
||||
<if test="collagenDay != null">#{collagenDay},</if>
|
||||
<if test="collagenMount != null">#{collagenMount},</if>
|
||||
<if test="loginTime != null">#{loginTime},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateWxUserMember" parameterType="WxUserMember">
|
||||
update wx_user_member
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="nickname != null">nickname = #{nickname},</if>
|
||||
<if test="headimg != null">headimg = #{headimg},</if>
|
||||
<if test="username != null">username = #{username},</if>
|
||||
<if test="credit != null">credit = #{credit},</if>
|
||||
<if test="openid != null">openid = #{openid},</if>
|
||||
<if test="unionid != null">unionid = #{unionid},</if>
|
||||
<if test="userType != null">user_type = #{userType},</if>
|
||||
<if test="level != null">level = #{level},</if>
|
||||
<if test="mobile != null">mobile = #{mobile},</if>
|
||||
<if test="password != null">password = #{password},</if>
|
||||
<if test="userQr != null">user_qr = #{userQr},</if>
|
||||
<if test="province != null">province = #{province},</if>
|
||||
<if test="city != null">city = #{city},</if>
|
||||
<if test="area != null">area = #{area},</if>
|
||||
<if test="birthday != null">birthday = #{birthday},</if>
|
||||
<if test="clock != null">clock = #{clock},</if>
|
||||
<if test="activity != null">activity = #{activity},</if>
|
||||
<if test="wechat != null">wechat = #{wechat},</if>
|
||||
<if test="code != null">code = #{code},</if>
|
||||
<if test="isAbutment != null">is_abutment = #{isAbutment},</if>
|
||||
<if test="collagenDay != null">collagen_day = #{collagenDay},</if>
|
||||
<if test="collagenMount != null">collagen_mount = #{collagenMount},</if>
|
||||
<if test="loginTime != null">login_time = #{loginTime},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteWxUserMemberById" parameterType="Long">
|
||||
delete from wx_user_member where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteWxUserMemberByIds" parameterType="String">
|
||||
delete from wx_user_member 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 listMember(query) {
|
||||
return request({
|
||||
url: '/system/member/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询用户详细
|
||||
export function getMember(id) {
|
||||
return request({
|
||||
url: '/system/member/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增用户
|
||||
export function addMember(data) {
|
||||
return request({
|
||||
url: '/system/member',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改用户
|
||||
export function updateMember(data) {
|
||||
return request({
|
||||
url: '/system/member',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除用户
|
||||
export function delMember(id) {
|
||||
return request({
|
||||
url: '/system/member/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
Loading…
Reference in New Issue