Commit 52088261 by XiaHou

修复相关接口

parent 0358c142
......@@ -9,6 +9,7 @@ import com.macro.mall.domain.vo.UmsMemberVo;
import com.macro.mall.domain.vo.member.UmsMemberTagVo;
import com.macro.mall.model.UmsMember;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.model.dto.quanxing.UmsMemberDto;
import com.macro.mall.service.member.UmsMemberService;
import com.macro.mall.service.member.UmsMemberTagService;
import io.swagger.annotations.*;
......@@ -56,22 +57,25 @@ public class UmsMemberController {
@ApiOperation("权星后台_得到商家会员信息")
@RequestMapping(value = "/getMerchantMember", method = RequestMethod.POST)
@ResponseBody
public CommonResult getMerchantMember(@ApiParam("传入2即可 账户类型(0管理员1供应商2分销商)") @RequestParam("accouuntType")Integer accouuntType){
public CommonResult<List<UmsMember>> getMerchantMember(@ApiParam("传入2即可 账户类型(0管理员1供应商2分销商)") @RequestParam("accouuntType")Integer accouuntType){
return CommonResult.success(this.memberService.getMemberListByAccountType(accouuntType));
}
@ApiOperation("权星后台_查询会员分页数据")
@ResponseBody
@RequestMapping(value = "/getPageList", method = RequestMethod.GET)
public CommonResult<CommonPage<UmsMember>> getPageList(@ApiParam("页数") @RequestParam("pageNum")Integer pageNum, @ApiParam("每页大小")@RequestParam("pageSize")Integer pageSize,
@ApiParam("不传则查询所有角色 账户类型(0管理员1供应商2分销商)") @RequestParam("accouuntType")Integer accouuntType){
return CommonResult.success(CommonPage.restPage(this.memberService.getPageList(pageNum,pageSize,accouuntType)));
public CommonResult<CommonPage<UmsMemberDto>> getPageList(@ApiParam("页数") @RequestParam("pageNum")Integer pageNum, @ApiParam("每页大小")@RequestParam("pageSize")Integer pageSize,
@ApiParam("不传则查询所有角色 账户类型(0管理员1供应商2分销商)") @RequestParam("accouuntType")Integer accouuntType,
@ApiParam("名字") @RequestParam("name")String name,
@ApiParam("手机号") @RequestParam("phone")String phone,
@ApiParam("启用禁用") @RequestParam("status")Integer status){
return CommonResult.success(this.memberService.getPageList(pageNum,pageSize,accouuntType));
}
@ApiOperation("权星后台_根据会员id查询一条会员数据")
@RequestMapping(value = "/selectOneById", method = RequestMethod.POST)
@ResponseBody
public CommonResult selectOneById(@ApiParam("id") @RequestParam("id")Long id){
public CommonResult<UmsMember> selectOneById(@ApiParam("id") @RequestParam("id")Long id){
return CommonResult.success(this.memberService.selectOneById(id));
}
......
package com.macro.mall.model.dto.quanxing;
import com.macro.mall.model.PmsSupplierAudit;
import com.macro.mall.model.UmsMember;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
public class UmsMemberDto extends UmsMember implements Serializable {
@ApiModelProperty(value = "会员相关审核信息对象")
private PmsSupplierAudit pmsSupplierAudit;
}
......@@ -139,13 +139,10 @@
</if>
</delete>
<insert id="insert" parameterType="com.macro.mall.model.UmsMember">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into ums_member (member_level_id, username, password,
nickname, phone, status,
icon, gender, birthday,
city, job, personalized_signature,
insert into ums_member (id, member_level_id, username,
password, nickname, phone,
status, icon, gender,
birthday, city, job, personalized_signature,
source_type, integration, growth,
create_date, create_by, update_date,
update_by, delete_status, name,
......@@ -156,10 +153,10 @@
invitation_code, invitation_code_id, union_id,
label, distribution_level, accouunt_type,
login_time)
values (#{memberLevelId,jdbcType=BIGINT}, #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
#{nickname,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},
#{icon,jdbcType=VARCHAR}, #{gender,jdbcType=INTEGER}, #{birthday,jdbcType=DATE},
#{city,jdbcType=VARCHAR}, #{job,jdbcType=VARCHAR}, #{personalizedSignature,jdbcType=VARCHAR},
values (#{id,jdbcType=BIGINT}, #{memberLevelId,jdbcType=BIGINT}, #{username,jdbcType=VARCHAR},
#{password,jdbcType=VARCHAR}, #{nickname,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR},
#{status,jdbcType=INTEGER}, #{icon,jdbcType=VARCHAR}, #{gender,jdbcType=INTEGER},
#{birthday,jdbcType=DATE}, #{city,jdbcType=VARCHAR}, #{job,jdbcType=VARCHAR}, #{personalizedSignature,jdbcType=VARCHAR},
#{sourceType,jdbcType=INTEGER}, #{integration,jdbcType=INTEGER}, #{growth,jdbcType=INTEGER},
#{createDate,jdbcType=TIMESTAMP}, #{createBy,jdbcType=BIGINT}, #{updateDate,jdbcType=TIMESTAMP},
#{updateBy,jdbcType=BIGINT}, #{deleteStatus,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR},
......@@ -172,11 +169,11 @@
#{loginTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.UmsMember">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into ums_member
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="memberLevelId != null">
member_level_id,
</if>
......@@ -293,6 +290,9 @@
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="memberLevelId != null">
#{memberLevelId,jdbcType=BIGINT},
</if>
......
package com.macro.mall.service.member;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.domain.UmsMemberVerified;
import com.macro.mall.domain.dto.UmsMemberParam;
......@@ -8,6 +9,7 @@ import com.macro.mall.domain.vo.UmsMemberVo;
import com.macro.mall.model.UmsAdmin;
import com.macro.mall.model.UmsMember;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.model.dto.quanxing.UmsMemberDto;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.transaction.annotation.Transactional;
......@@ -188,7 +190,7 @@ public interface UmsMemberService {
* @param accouuntType
* @return
*/
List<UmsMember> getPageList(Integer pageNum,Integer pageSize,Integer accouuntType);
CommonPage<UmsMemberDto> getPageList(Integer pageNum, Integer pageSize, Integer accouuntType,String name,String phone,Integer status);
/**
* 根据id查询一条会员信息
......
package com.macro.mall.service.member.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.common.api.DateUtils;
import com.macro.mall.dao.UmsMemberDao;
import com.macro.mall.dao.quanxing.PmsSupplierAuditDao;
import com.macro.mall.domain.MemberDetails;
import com.macro.mall.domain.dto.UmsMemberParam;
import com.macro.mall.domain.dto.UmsMemberReview;
......@@ -15,6 +18,8 @@ import com.macro.mall.mapper.UmsMemberMapper;
import com.macro.mall.model.*;
import com.macro.mall.domain.UmsMemberVerified;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.model.dto.PmsSupplierAuditDto;
import com.macro.mall.model.dto.quanxing.UmsMemberDto;
import com.macro.mall.service.member.UmsMemberAccountService;
import com.macro.mall.service.member.UmsMemberService;
import com.macro.mall.security.util.CodingUtil;
......@@ -24,6 +29,7 @@ import com.macro.mall.service.system.RedisService;
import com.macro.mall.service.system.UmsAdminService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.authentication.BadCredentialsException;
......@@ -74,6 +80,8 @@ public class UmsMemberServiceImpl implements UmsMemberService {
private OmsOrderSonMapper orderSonMapper;
@Autowired
private IPmsSupplierAuditService pmsSupplierAuditService;
@Resource
private PmsSupplierAuditDao pmsSupplierAuditDao;
@Value("${redis.key.prefix.authCode}")
private String REDIS_KEY_PREFIX_AUTH_CODE;
......@@ -755,17 +763,44 @@ public class UmsMemberServiceImpl implements UmsMemberService {
* @return
*/
@Override
public List<UmsMember> getPageList(Integer pageNum,Integer pageSize,Integer accouuntType){
public CommonPage<UmsMemberDto> getPageList(Integer pageNum, Integer pageSize, Integer accouuntType,String name,String phone,Integer status){
PageHelper.startPage(pageNum, pageSize);
UmsMemberExample example = new UmsMemberExample();
UmsMemberExample.Criteria criteria = example.createCriteria();
if(accouuntType != null){//如果账号类型不为空
criteria.andAccouuntTypeEqualTo(accouuntType);
}
if(name != null && !"".equals(name)){
criteria.andNameLike("name"+"%");
}
if(phone != null && !"".equals(phone)){
criteria.andPhoneLike("phone"+"%");
}
if(status != null){//如果账号类型不为空
criteria.andStatusEqualTo(status);
}
//过滤已删除的数据
criteria.andDeleteStatusEqualTo(0);//删除标识0 未删除 1已删除
List<UmsMember> umsMemberList = this.umsMemberMapper.selectByExample(example);
return umsMemberList;
List<UmsMember> dataList = this.umsMemberMapper.selectByExample(example);
//记录下 pagehelper第一次分页查询的 返回得总条数 等信息
PageInfo<UmsMember> pageInfo = new PageInfo<>(dataList);
//创建List对象
List<UmsMemberDto> umdList = new ArrayList<>();
dataList.forEach(umsMember -> {
UmsMemberDto umsMemberDto = new UmsMemberDto();
//将属性赋值到另一个对象中去
BeanUtils.copyProperties(umsMember,umsMemberDto);
umsMemberDto.setPmsSupplierAudit(this.pmsSupplierAuditDao.selectOneByMemberId(umsMember.getId()));
umdList.add(umsMemberDto);
});
//因为进行了第二次查询 所以pageHelp得分页总数得到了变化 导致不准确 因此我们需要手动校准一下
CommonPage<UmsMemberDto> result = new CommonPage<UmsMemberDto>();
result.setTotalPage(pageInfo.getPages());
result.setPageNum(pageInfo.getPageNum());
result.setPageSize(pageInfo.getPageSize());
result.setTotal(pageInfo.getTotal());
result.setList(umdList);
return result;
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment