1C端用户接口
This commit is contained in:
parent
13a5b8560e
commit
7ebef46eb1
@ -1,13 +1,10 @@
|
||||
package com.ruoyi.system.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 角色和部门关联 sys_role_dept
|
||||
* 运营者子账号权限 xhpc_user_privilege
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
|
||||
@ -0,0 +1,58 @@
|
||||
package com.xhpc.user.controller;
|
||||
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||
import com.ruoyi.common.security.annotation.PreAuthorize;
|
||||
import com.xhpc.user.service.IXhpcAppUserUserService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* C端用户
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/app/user")
|
||||
public class XhpcAppUserController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IXhpcAppUserUserService iXhpcAppUserUserService;
|
||||
|
||||
/**
|
||||
* C端用户详情
|
||||
*/
|
||||
@ApiOperation("C端用户详情")
|
||||
@PreAuthorize(hasPermi = "app:user:info")
|
||||
@GetMapping("/info")
|
||||
public AjaxResult info(@RequestBody Long appUserId) {
|
||||
return AjaxResult.success(iXhpcAppUserUserService.info(appUserId));
|
||||
}
|
||||
|
||||
/**
|
||||
* C端用户分页列表
|
||||
*/
|
||||
@PreAuthorize(hasPermi = "app:user:page")
|
||||
@GetMapping("/page")
|
||||
public TableDataInfo page(String phone) {
|
||||
startPage();
|
||||
List<Map<String, Object>> list = iXhpcAppUserUserService.selectAppUserList(phone);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 禁用/启用C端用户
|
||||
*/
|
||||
@ApiOperation("禁用/启用C端用户")
|
||||
@PreAuthorize(hasPermi = "app:user:status")
|
||||
@PostMapping("/status")
|
||||
public AjaxResult status(@RequestBody Long appUserId) {
|
||||
iXhpcAppUserUserService.status(appUserId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
@ -121,8 +121,8 @@ public class XhpcInternetUserController extends BaseController {
|
||||
@ApiOperation("禁用/启用流量用户")
|
||||
@PreAuthorize(hasPermi = "user:internet:status")
|
||||
@PostMapping("/status")
|
||||
public AjaxResult status(@RequestBody Long id) {
|
||||
iXhpcInternetUserService.status(id);
|
||||
public AjaxResult status(@RequestBody Long internetUserId) {
|
||||
iXhpcInternetUserService.status(internetUserId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
@ -129,8 +129,8 @@ public class XhpcOperatorController extends BaseController {
|
||||
@ApiOperation("禁用/启用运营商")
|
||||
@PreAuthorize(hasPermi = "user:operator:status")
|
||||
@PostMapping("/status")
|
||||
public AjaxResult status(@RequestBody Long id) {
|
||||
iXhpcOperatorService.status(id);
|
||||
public AjaxResult status(@RequestBody Long operatorId) {
|
||||
iXhpcOperatorService.status(operatorId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,130 @@
|
||||
package com.xhpc.user.domain;
|
||||
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
|
||||
|
||||
/**
|
||||
* C端用户 xhpc_app_user
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class XhpcAppUser extends BaseEntity {
|
||||
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long appUserId;
|
||||
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* weixin_open_id
|
||||
*/
|
||||
private String weixinOpenId;
|
||||
|
||||
/**
|
||||
* alipay_open_id
|
||||
*/
|
||||
private String alipayOpenId;
|
||||
|
||||
/**
|
||||
* 头像地址
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 余额
|
||||
*/
|
||||
private Double balance;
|
||||
|
||||
/**
|
||||
* 密码(加密)
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 帐号状态
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
private String delFlag;
|
||||
|
||||
public Long getAppUserId() {
|
||||
return appUserId;
|
||||
}
|
||||
|
||||
public void setAppUserId(Long appUserId) {
|
||||
this.appUserId = appUserId;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getWeixinOpenId() {
|
||||
return weixinOpenId;
|
||||
}
|
||||
|
||||
public void setWeixinOpenId(String weixinOpenId) {
|
||||
this.weixinOpenId = weixinOpenId;
|
||||
}
|
||||
|
||||
public String getAlipayOpenId() {
|
||||
return alipayOpenId;
|
||||
}
|
||||
|
||||
public void setAlipayOpenId(String alipayOpenId) {
|
||||
this.alipayOpenId = alipayOpenId;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public Double getBalance() {
|
||||
return balance;
|
||||
}
|
||||
|
||||
public void setBalance(Double balance) {
|
||||
this.balance = balance;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(String delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
package com.xhpc.user.mapper;
|
||||
|
||||
import com.xhpc.user.domain.XhpcAppUser;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* C端用户信息 数据层
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface XhpcAppUserMapper {
|
||||
|
||||
/**
|
||||
* 修改C端用户信息
|
||||
*
|
||||
* @param xhpcAppUser C端用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int update(XhpcAppUser xhpcAppUser);
|
||||
|
||||
|
||||
/**
|
||||
* 查询C端用户详情
|
||||
*
|
||||
* @param appUserId C端用户id
|
||||
* @return 结果
|
||||
*/
|
||||
public Map<String, Object> info(@Param("appUserId") Long appUserId);
|
||||
|
||||
/**
|
||||
* C端用户分页列表
|
||||
*
|
||||
* @param phone 手机号
|
||||
* @return 结果
|
||||
*/
|
||||
public List<Map<String, Object>> selectAppUserList(@Param("phone") String phone);
|
||||
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
package com.xhpc.user.service;
|
||||
|
||||
import com.xhpc.user.domain.XhpcAppUser;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* C端用户信息 服务层
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface IXhpcAppUserUserService {
|
||||
|
||||
/**
|
||||
* 更新C端用户
|
||||
*
|
||||
* @param xhpcAppUser C端用户
|
||||
*/
|
||||
public int update(XhpcAppUser xhpcAppUser);
|
||||
|
||||
|
||||
/**
|
||||
* C端用户详情
|
||||
*
|
||||
* @param appUserId C端用户id
|
||||
* @return 结果
|
||||
*/
|
||||
public Map<String, Object> info(Long appUserId);
|
||||
|
||||
/**
|
||||
* C端用户分页列表
|
||||
*
|
||||
* @param phone 手机号
|
||||
* @return 结果
|
||||
*/
|
||||
public List<Map<String, Object>> selectAppUserList(String phone);
|
||||
|
||||
/**
|
||||
* 禁用/启用C端用户
|
||||
*
|
||||
* @param appUserId C端用户id
|
||||
* @return 结果
|
||||
*/
|
||||
public void status(Long appUserId);
|
||||
}
|
||||
@ -0,0 +1,73 @@
|
||||
package com.xhpc.user.service.impl;
|
||||
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.xhpc.user.domain.XhpcAppUser;
|
||||
import com.xhpc.user.mapper.XhpcAppUserMapper;
|
||||
import com.xhpc.user.service.IXhpcAppUserUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* C端用户信息 服务层
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
||||
|
||||
@Autowired
|
||||
private XhpcAppUserMapper xhpcAppUserMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 更新C端用户
|
||||
*
|
||||
* @param xhpcAppUser C端用户
|
||||
*/
|
||||
@Override
|
||||
public int update(XhpcAppUser xhpcAppUser) {
|
||||
return xhpcAppUserMapper.update(xhpcAppUser);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* C端用户详情
|
||||
*
|
||||
* @param appUserId C端用户id
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> info(Long appUserId) {
|
||||
return xhpcAppUserMapper.info(appUserId);
|
||||
}
|
||||
|
||||
/**
|
||||
* C端用户分页列表
|
||||
*
|
||||
* @param phone 手机号
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> selectAppUserList(String phone) {
|
||||
return xhpcAppUserMapper.selectAppUserList(phone);
|
||||
}
|
||||
|
||||
/**
|
||||
* 禁用/启用C端用户
|
||||
*
|
||||
* @param appUserId C端用户id
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public void status(Long appUserId) {
|
||||
Map<String, Object> map = xhpcAppUserMapper.info(appUserId);
|
||||
String status = StringUtils.valueOf(map.get("status"));
|
||||
XhpcAppUser xhpcAppUser = new XhpcAppUser();
|
||||
xhpcAppUser.setAppUserId(appUserId);
|
||||
xhpcAppUser.setStatus("0".equals(status) ? 1 : 0);
|
||||
update(xhpcAppUser);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
<?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.xhpc.user.mapper.XhpcAppUserMapper">
|
||||
|
||||
<resultMap type="com.xhpc.user.domain.XhpcAppUser" id="XhpcAppUserResult">
|
||||
<result column="app_user_id" property="appUserId"/>
|
||||
<result column="phone" property="phone"/>
|
||||
<result column="weixin_open_id" property="weixinOpenId"/>
|
||||
<result column="alipay_open_id" property="alipayOpenId"/>
|
||||
<result column="avatar" property="avatar"/>
|
||||
<result column="balance" property="balance"/>
|
||||
<result column="password" property="password"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="del_flag" property="delFlag"/>
|
||||
<result column="create_by" property="createBy"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_by" property="updateBy"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="remark" property="remark"/>
|
||||
</resultMap>
|
||||
|
||||
<update id="update" parameterType="com.xhpc.user.domain.XhpcInternetUser">
|
||||
UPDATE xhpc_app_user
|
||||
<set>
|
||||
<if test="null != phone and '' != phone">phone = #{phone},</if>
|
||||
<if test="null != weixinOpenId and '' != weixinOpenId">weixin_open_id = #{weixinOpenId},</if>
|
||||
<if test="null != alipayOpenId and '' != alipayOpenId">alipay_open_id = #{alipayOpenId},</if>
|
||||
<if test="null != avatar and '' != avatar">avatar = #{avatar},</if>
|
||||
<if test="null != balance and '' != balance">balance = #{balance},</if>
|
||||
<if test="null != password and '' != password">password = #{password},</if>
|
||||
<if test="null != status and '' != status">status = #{status},</if>
|
||||
<if test="null != delFlag and '' != delFlag">del_flag = #{delFlag},</if>
|
||||
<if test="null != createBy and '' != createBy">create_by = #{createBy},</if>
|
||||
<if test="null != createTime and '' != createTime">create_time = #{createTime},</if>
|
||||
<if test="null != updateBy and '' != updateBy">update_by = #{updateBy},</if>
|
||||
<if test="null != updateTime and '' != updateTime">update_time = #{updateTime},</if>
|
||||
<if test="null != remark and '' != remark">remark = #{remark}</if>
|
||||
</set>
|
||||
WHERE app_user_id = #{appUserId}
|
||||
</update>
|
||||
|
||||
<select id="info" parameterType="java.lang.Long" resultType="java.util.Map">
|
||||
select app_user_id appUserId, phone, weixin_open_id weixinOpenId,
|
||||
alipay_open_id alipayOpenId, avatar, balance, password,
|
||||
`status`,create_by createBy ,create_time createTime,
|
||||
update_time updateTime, update_by updateBy,
|
||||
del_flag delflag, remark,
|
||||
CASE WHEN xiu.`status` = 0 THEN '正常' else '禁用' end statusName,
|
||||
from xhpc_app_user
|
||||
WHERE del_flag = 0 and app_user_id = #{appUserId}
|
||||
</select>
|
||||
|
||||
<select id="selectAppUserList" parameterType="java.lang.Long" resultType="java.util.Map">
|
||||
select app_user_id appUserId, phone, balance,
|
||||
`status`,create_time createTime,
|
||||
CASE WHEN xiu.`status` = 0 THEN '正常' else '禁用' end statusName
|
||||
from xhpc_app_user
|
||||
WHERE del_flag = 0
|
||||
<if test="phone != null and phone != ''">
|
||||
and phone like concat(concat('%', #{phone}), '%')
|
||||
</if>
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
Loading…
x
Reference in New Issue
Block a user