parent
31448dfa10
commit
e84672f72f
@ -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.MemberAddressConvert;
|
||||
import com.cyl.ums.domain.MemberAddress;
|
||||
import com.cyl.ums.pojo.query.MemberAddressQuery;
|
||||
import com.cyl.ums.service.MemberAddressService;
|
||||
import com.cyl.ums.pojo.vo.MemberAddressVO;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
/**
|
||||
* 会员收货地址Controller
|
||||
*
|
||||
* @author zcc
|
||||
* @date 2022-11-27
|
||||
*/
|
||||
@Api(description ="会员收货地址接口列表")
|
||||
@RestController
|
||||
@RequestMapping("/ums/memberAddress")
|
||||
public class MemberAddressController extends BaseController {
|
||||
@Autowired
|
||||
private MemberAddressService service;
|
||||
@Autowired
|
||||
private MemberAddressConvert convert;
|
||||
|
||||
@ApiOperation("查询会员收货地址列表")
|
||||
@PreAuthorize("@ss.hasPermi('ums:memberAddress:list')")
|
||||
@PostMapping("/list")
|
||||
public ResponseEntity<Page<MemberAddress>> list(@RequestBody MemberAddressQuery query, Pageable page) {
|
||||
List<MemberAddress> list = service.selectList(query, page);
|
||||
return ResponseEntity.ok(new PageImpl<>(list, page, ((com.github.pagehelper.Page)list).getTotal()));
|
||||
}
|
||||
|
||||
@ApiOperation("导出会员收货地址列表")
|
||||
@PreAuthorize("@ss.hasPermi('ums:memberAddress:export')")
|
||||
@Log(title = "会员收货地址", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public ResponseEntity<String> export(MemberAddressQuery query) {
|
||||
List<MemberAddress> list = service.selectList(query, null);
|
||||
ExcelUtil<MemberAddressVO> util = new ExcelUtil<>(MemberAddressVO.class);
|
||||
return ResponseEntity.ok(util.writeExcel(convert.dos2vos(list), "会员收货地址数据"));
|
||||
}
|
||||
|
||||
@ApiOperation("获取会员收货地址详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('ums:memberAddress:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public ResponseEntity<MemberAddress> getInfo(@PathVariable("id") Long id) {
|
||||
return ResponseEntity.ok(service.selectById(id));
|
||||
}
|
||||
|
||||
@ApiOperation("新增会员收货地址")
|
||||
@PreAuthorize("@ss.hasPermi('ums:memberAddress:add')")
|
||||
@Log(title = "会员收货地址", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public ResponseEntity<Integer> add(@RequestBody MemberAddress memberAddress) {
|
||||
return ResponseEntity.ok(service.insert(memberAddress));
|
||||
}
|
||||
|
||||
@ApiOperation("修改会员收货地址")
|
||||
@PreAuthorize("@ss.hasPermi('ums:memberAddress:edit')")
|
||||
@Log(title = "会员收货地址", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public ResponseEntity<Integer> edit(@RequestBody MemberAddress memberAddress) {
|
||||
return ResponseEntity.ok(service.update(memberAddress));
|
||||
}
|
||||
|
||||
@ApiOperation("删除会员收货地址")
|
||||
@PreAuthorize("@ss.hasPermi('ums:memberAddress:remove')")
|
||||
@Log(title = "会员收货地址", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public ResponseEntity<Integer> remove(@PathVariable Long[] ids) {
|
||||
return ResponseEntity.ok(service.deleteByIds(ids));
|
||||
}
|
||||
}
|
||||
@ -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.MemberConvert;
|
||||
import com.cyl.ums.domain.Member;
|
||||
import com.cyl.ums.pojo.query.MemberQuery;
|
||||
import com.cyl.ums.service.MemberService;
|
||||
import com.cyl.ums.pojo.vo.MemberVO;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
/**
|
||||
* 会员信息Controller
|
||||
*
|
||||
* @author zcc
|
||||
* @date 2022-11-27
|
||||
*/
|
||||
@Api(description ="会员信息接口列表")
|
||||
@RestController
|
||||
@RequestMapping("/ums/member")
|
||||
public class MemberController extends BaseController {
|
||||
@Autowired
|
||||
private MemberService service;
|
||||
@Autowired
|
||||
private MemberConvert convert;
|
||||
|
||||
@ApiOperation("查询会员信息列表")
|
||||
@PreAuthorize("@ss.hasPermi('ums:member:list')")
|
||||
@PostMapping("/list")
|
||||
public ResponseEntity<Page<Member>> list(@RequestBody MemberQuery query, Pageable page) {
|
||||
List<Member> list = service.selectList(query, page);
|
||||
return ResponseEntity.ok(new PageImpl<>(list, page, ((com.github.pagehelper.Page)list).getTotal()));
|
||||
}
|
||||
|
||||
@ApiOperation("导出会员信息列表")
|
||||
@PreAuthorize("@ss.hasPermi('ums:member:export')")
|
||||
@Log(title = "会员信息", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public ResponseEntity<String> export(MemberQuery query) {
|
||||
List<Member> list = service.selectList(query, null);
|
||||
ExcelUtil<MemberVO> util = new ExcelUtil<>(MemberVO.class);
|
||||
return ResponseEntity.ok(util.writeExcel(convert.dos2vos(list), "会员信息数据"));
|
||||
}
|
||||
|
||||
@ApiOperation("获取会员信息详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('ums:member:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public ResponseEntity<Member> getInfo(@PathVariable("id") Long id) {
|
||||
return ResponseEntity.ok(service.selectById(id));
|
||||
}
|
||||
|
||||
@ApiOperation("新增会员信息")
|
||||
@PreAuthorize("@ss.hasPermi('ums:member:add')")
|
||||
@Log(title = "会员信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public ResponseEntity<Integer> add(@RequestBody Member member) {
|
||||
return ResponseEntity.ok(service.insert(member));
|
||||
}
|
||||
|
||||
@ApiOperation("修改会员信息")
|
||||
@PreAuthorize("@ss.hasPermi('ums:member:edit')")
|
||||
@Log(title = "会员信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public ResponseEntity<Integer> edit(@RequestBody Member member) {
|
||||
return ResponseEntity.ok(service.update(member));
|
||||
}
|
||||
|
||||
@ApiOperation("删除会员信息")
|
||||
@PreAuthorize("@ss.hasPermi('ums:member: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.MemberAddress;
|
||||
import com.cyl.ums.pojo.vo.MemberAddressVO;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 会员收货地址 DO <=> DTO <=> VO / BO / Query
|
||||
*
|
||||
* @author zcc
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface MemberAddressConvert {
|
||||
|
||||
List<MemberAddressVO> dos2vos(List<MemberAddress> list);
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.cyl.ums.convert;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import com.cyl.ums.domain.Member;
|
||||
import com.cyl.ums.pojo.vo.MemberVO;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 会员信息 DO <=> DTO <=> VO / BO / Query
|
||||
*
|
||||
* @author zcc
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface MemberConvert {
|
||||
|
||||
List<MemberVO> dos2vos(List<Member> list);
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package com.cyl.ums.domain;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
/**
|
||||
* 会员收货地址对象 ums_member_address
|
||||
*
|
||||
* @author zcc
|
||||
*/
|
||||
@ApiModel(description="会员收货地址对象")
|
||||
@Data
|
||||
@TableName("ums_member_address")
|
||||
public class MemberAddress {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("ID")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("MEMBER_ID")
|
||||
@Excel(name = "MEMBER_ID")
|
||||
private Long memberId;
|
||||
|
||||
@ApiModelProperty("收货人名称")
|
||||
@Excel(name = "收货人名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("PHONE")
|
||||
@Excel(name = "PHONE")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty("是否为默认")
|
||||
@Excel(name = "是否为默认")
|
||||
private Integer defaultStatus;
|
||||
|
||||
@ApiModelProperty("邮政编码")
|
||||
@Excel(name = "邮政编码")
|
||||
private String postCode;
|
||||
|
||||
@ApiModelProperty("省份/直辖市")
|
||||
@Excel(name = "省份/直辖市")
|
||||
private String province;
|
||||
|
||||
@ApiModelProperty("城市")
|
||||
@Excel(name = "城市")
|
||||
private String city;
|
||||
|
||||
@ApiModelProperty("区")
|
||||
@Excel(name = "区")
|
||||
private String district;
|
||||
|
||||
@ApiModelProperty("详细地址(街道)")
|
||||
@Excel(name = "详细地址(街道)")
|
||||
private String detailAddress;
|
||||
|
||||
@ApiModelProperty("是否默认")
|
||||
@Excel(name = "是否默认")
|
||||
private Integer isDefault;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ApiModelProperty("修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
@ -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.MemberAddress;
|
||||
|
||||
/**
|
||||
* 会员收货地址Mapper接口
|
||||
*
|
||||
* @author zcc
|
||||
*/
|
||||
public interface MemberAddressMapper extends BaseMapper<MemberAddress> {
|
||||
/**
|
||||
* 查询会员收货地址列表
|
||||
*
|
||||
* @param memberAddress 会员收货地址
|
||||
* @return 会员收货地址集合
|
||||
*/
|
||||
List<MemberAddress> selectByEntity(MemberAddress memberAddress);
|
||||
|
||||
/**
|
||||
* 批量软删除
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
int updateDelFlagByIds(@Param("ids") Long[] ids);
|
||||
}
|
||||
@ -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.Member;
|
||||
|
||||
/**
|
||||
* 会员信息Mapper接口
|
||||
*
|
||||
* @author zcc
|
||||
*/
|
||||
public interface MemberMapper extends BaseMapper<Member> {
|
||||
/**
|
||||
* 查询会员信息列表
|
||||
*
|
||||
* @param member 会员信息
|
||||
* @return 会员信息集合
|
||||
*/
|
||||
List<Member> selectByEntity(Member member);
|
||||
|
||||
/**
|
||||
* 批量软删除
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
int updateDelFlagByIds(@Param("ids") Long[] ids);
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
package com.cyl.ums.pojo.query;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Data;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* 会员收货地址 查询 对象
|
||||
*
|
||||
* @author zcc
|
||||
*/
|
||||
@ApiModel(description="会员收货地址 查询 对象")
|
||||
@Data
|
||||
public class MemberAddressQuery {
|
||||
@ApiModelProperty("MEMBER_ID 精确匹配")
|
||||
private Long memberId;
|
||||
|
||||
@ApiModelProperty("收货人名称 精确匹配")
|
||||
private String nameLike;
|
||||
|
||||
@ApiModelProperty("PHONE 精确匹配")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty("是否为默认 精确匹配")
|
||||
private Integer defaultStatus;
|
||||
|
||||
@ApiModelProperty("邮政编码 精确匹配")
|
||||
private String postCode;
|
||||
|
||||
@ApiModelProperty("省份/直辖市 精确匹配")
|
||||
private String province;
|
||||
|
||||
@ApiModelProperty("城市 精确匹配")
|
||||
private String city;
|
||||
|
||||
@ApiModelProperty("区 精确匹配")
|
||||
private String district;
|
||||
|
||||
@ApiModelProperty("详细地址 精确匹配")
|
||||
private String detailAddress;
|
||||
|
||||
@ApiModelProperty("是否默认 精确匹配")
|
||||
private Integer isDefault;
|
||||
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
package com.cyl.ums.pojo.vo;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
/**
|
||||
* 会员收货地址 数据视图对象
|
||||
*
|
||||
* @author zcc
|
||||
*/
|
||||
@Data
|
||||
public class MemberAddressVO {
|
||||
/** ID */
|
||||
private Long id;
|
||||
/** MEMBER_ID */
|
||||
@Excel(name = "MEMBER_ID")
|
||||
private Long memberId;
|
||||
/** 收货人名称 */
|
||||
@Excel(name = "收货人名称")
|
||||
private String name;
|
||||
/** PHONE */
|
||||
@Excel(name = "PHONE")
|
||||
private String phone;
|
||||
/** 是否为默认 */
|
||||
@Excel(name = "是否为默认")
|
||||
private Integer defaultStatus;
|
||||
/** 邮政编码 */
|
||||
@Excel(name = "邮政编码")
|
||||
private String postCode;
|
||||
/** 省份/直辖市 */
|
||||
@Excel(name = "省份/直辖市")
|
||||
private String province;
|
||||
/** 城市 */
|
||||
@Excel(name = "城市")
|
||||
private String city;
|
||||
/** 区 */
|
||||
@Excel(name = "区")
|
||||
private String district;
|
||||
/** 详细地址(街道) */
|
||||
@Excel(name = "详细地址(街道)")
|
||||
private String detailAddress;
|
||||
/** 是否默认 */
|
||||
@Excel(name = "是否默认")
|
||||
private Integer isDefault;
|
||||
/** 创建时间 */
|
||||
private LocalDateTime createTime;
|
||||
/** 修改时间 */
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
@ -0,0 +1,136 @@
|
||||
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.MemberAddressMapper;
|
||||
import com.cyl.ums.domain.MemberAddress;
|
||||
import com.cyl.ums.pojo.query.MemberAddressQuery;
|
||||
|
||||
/**
|
||||
* 会员收货地址Service业务层处理
|
||||
*
|
||||
*
|
||||
* @author zcc
|
||||
*/
|
||||
@Service
|
||||
public class MemberAddressService {
|
||||
@Autowired
|
||||
private MemberAddressMapper memberAddressMapper;
|
||||
|
||||
/**
|
||||
* 查询会员收货地址
|
||||
*
|
||||
* @param id 会员收货地址主键
|
||||
* @return 会员收货地址
|
||||
*/
|
||||
public MemberAddress selectById(Long id) {
|
||||
return memberAddressMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询会员收货地址列表
|
||||
*
|
||||
* @param query 查询条件
|
||||
* @param page 分页条件
|
||||
* @return 会员收货地址
|
||||
*/
|
||||
public List<MemberAddress> selectList(MemberAddressQuery query, Pageable page) {
|
||||
if (page != null) {
|
||||
PageHelper.startPage(page.getPageNumber() + 1, page.getPageSize());
|
||||
}
|
||||
QueryWrapper<MemberAddress> qw = new QueryWrapper<>();
|
||||
qw.eq("del_flag",0);
|
||||
Long memberId = query.getMemberId();
|
||||
if (memberId != null) {
|
||||
qw.eq("member_id", memberId);
|
||||
}
|
||||
String nameLike = query.getNameLike();
|
||||
if (!StringUtils.isEmpty(nameLike)) {
|
||||
qw.like("name", nameLike);
|
||||
}
|
||||
String phone = query.getPhone();
|
||||
if (!StringUtils.isEmpty(phone)) {
|
||||
qw.eq("phone", phone);
|
||||
}
|
||||
Integer defaultStatus = query.getDefaultStatus();
|
||||
if (defaultStatus != null) {
|
||||
qw.eq("default_status", defaultStatus);
|
||||
}
|
||||
String postCode = query.getPostCode();
|
||||
if (!StringUtils.isEmpty(postCode)) {
|
||||
qw.eq("post_code", postCode);
|
||||
}
|
||||
String province = query.getProvince();
|
||||
if (!StringUtils.isEmpty(province)) {
|
||||
qw.eq("province", province);
|
||||
}
|
||||
String city = query.getCity();
|
||||
if (!StringUtils.isEmpty(city)) {
|
||||
qw.eq("city", city);
|
||||
}
|
||||
String district = query.getDistrict();
|
||||
if (!StringUtils.isEmpty(district)) {
|
||||
qw.eq("district", district);
|
||||
}
|
||||
String detailAddress = query.getDetailAddress();
|
||||
if (!StringUtils.isEmpty(detailAddress)) {
|
||||
qw.eq("detail_address", detailAddress);
|
||||
}
|
||||
Integer isDefault = query.getIsDefault();
|
||||
if (isDefault != null) {
|
||||
qw.eq("is_default", isDefault);
|
||||
}
|
||||
return memberAddressMapper.selectList(qw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增会员收货地址
|
||||
*
|
||||
* @param memberAddress 会员收货地址
|
||||
* @return 结果
|
||||
*/
|
||||
public int insert(MemberAddress memberAddress) {
|
||||
memberAddress.setDelFlag(0);
|
||||
memberAddress.setCreateTime(LocalDateTime.now());
|
||||
return memberAddressMapper.insert(memberAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改会员收货地址
|
||||
*
|
||||
* @param memberAddress 会员收货地址
|
||||
* @return 结果
|
||||
*/
|
||||
public int update(MemberAddress memberAddress) {
|
||||
return memberAddressMapper.updateById(memberAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除会员收货地址
|
||||
*
|
||||
* @param ids 需要删除的会员收货地址主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteByIds(Long[] ids) {
|
||||
return memberAddressMapper.updateDelFlagByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除会员收货地址信息
|
||||
*
|
||||
* @param id 会员收货地址主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteById(Long id) {
|
||||
Long[] ids = {id};
|
||||
return memberAddressMapper.updateDelFlagByIds(ids);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,147 @@
|
||||
package com.cyl.ums.service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.time.LocalDate;
|
||||
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.MemberMapper;
|
||||
import com.cyl.ums.domain.Member;
|
||||
import com.cyl.ums.pojo.query.MemberQuery;
|
||||
|
||||
/**
|
||||
* 会员信息Service业务层处理
|
||||
*
|
||||
*
|
||||
* @author zcc
|
||||
*/
|
||||
@Service
|
||||
public class MemberService {
|
||||
@Autowired
|
||||
private MemberMapper memberMapper;
|
||||
|
||||
/**
|
||||
* 查询会员信息
|
||||
*
|
||||
* @param id 会员信息主键
|
||||
* @return 会员信息
|
||||
*/
|
||||
public Member selectById(Long id) {
|
||||
return memberMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询会员信息列表
|
||||
*
|
||||
* @param query 查询条件
|
||||
* @param page 分页条件
|
||||
* @return 会员信息
|
||||
*/
|
||||
public List<Member> selectList(MemberQuery query, Pageable page) {
|
||||
if (page != null) {
|
||||
PageHelper.startPage(page.getPageNumber() + 1, page.getPageSize());
|
||||
}
|
||||
QueryWrapper<Member> qw = new QueryWrapper<>();
|
||||
qw.eq("del_flag",0);
|
||||
String nicknameLike = query.getNicknameLike();
|
||||
if (!StringUtils.isEmpty(nicknameLike)) {
|
||||
qw.like("nickname", nicknameLike);
|
||||
}
|
||||
String password = query.getPassword();
|
||||
if (!StringUtils.isEmpty(password)) {
|
||||
qw.eq("password", password);
|
||||
}
|
||||
String phone = query.getPhone();
|
||||
if (!StringUtils.isEmpty(phone)) {
|
||||
qw.eq("phone", phone);
|
||||
}
|
||||
String mark = query.getMark();
|
||||
if (!StringUtils.isEmpty(mark)) {
|
||||
qw.eq("mark", mark);
|
||||
}
|
||||
Integer status = query.getStatus();
|
||||
if (status != null) {
|
||||
qw.eq("status", status);
|
||||
}
|
||||
String avatar = query.getAvatar();
|
||||
if (!StringUtils.isEmpty(avatar)) {
|
||||
qw.eq("avatar", avatar);
|
||||
}
|
||||
Integer gender = query.getGender();
|
||||
if (gender != null) {
|
||||
qw.eq("gender", gender);
|
||||
}
|
||||
LocalDate birthday = query.getBirthday();
|
||||
if (birthday != null) {
|
||||
qw.eq("birthday", birthday);
|
||||
}
|
||||
Long spreadUid = query.getSpreadUid();
|
||||
if (spreadUid != null) {
|
||||
qw.eq("spread_uid", spreadUid);
|
||||
}
|
||||
LocalDateTime spreadTime = query.getSpreadTime();
|
||||
if (spreadTime != null) {
|
||||
qw.eq("spread_time", spreadTime);
|
||||
}
|
||||
Integer level = query.getLevel();
|
||||
if (level != null) {
|
||||
qw.eq("level", level);
|
||||
}
|
||||
BigDecimal integral = query.getIntegral();
|
||||
if (integral != null) {
|
||||
qw.eq("integral", integral);
|
||||
}
|
||||
return memberMapper.selectList(qw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增会员信息
|
||||
*
|
||||
* @param member 会员信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insert(Member member) {
|
||||
member.setDelFlag(0);
|
||||
member.setCreateTime(LocalDateTime.now());
|
||||
return memberMapper.insert(member);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改会员信息
|
||||
*
|
||||
* @param member 会员信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int update(Member member) {
|
||||
return memberMapper.updateById(member);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除会员信息
|
||||
*
|
||||
* @param ids 需要删除的会员信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteByIds(Long[] ids) {
|
||||
return memberMapper.updateDelFlagByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除会员信息信息
|
||||
*
|
||||
* @param id 会员信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteById(Long id) {
|
||||
Long[] ids = {id};
|
||||
return memberMapper.updateDelFlagByIds(ids);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
<?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.MemberAddressMapper">
|
||||
|
||||
<resultMap type="MemberAddress" id="MemberAddressResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="memberId" column="member_id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="phone" column="phone"/>
|
||||
<result property="defaultStatus" column="default_status"/>
|
||||
<result property="postCode" column="post_code"/>
|
||||
<result property="province" column="province"/>
|
||||
<result property="city" column="city"/>
|
||||
<result property="district" column="district"/>
|
||||
<result property="detailAddress" column="detail_address"/>
|
||||
<result property="isDefault" column="is_default"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectMemberAddressVo">
|
||||
select id, member_id, name, phone, default_status, post_code, province, city, district, detail_address, is_default, create_time, update_time from ums_member_address
|
||||
</sql>
|
||||
|
||||
<select id="selectByEntity" parameterType="MemberAddress" resultMap="MemberAddressResult">
|
||||
<include refid="selectMemberAddressVo"/>
|
||||
<where>
|
||||
<if test="memberId != null "> and member_id = #{memberId}</if>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
|
||||
<if test="defaultStatus != null "> and default_status = #{defaultStatus}</if>
|
||||
<if test="postCode != null and postCode != ''"> and post_code = #{postCode}</if>
|
||||
<if test="province != null and province != ''"> and province = #{province}</if>
|
||||
<if test="city != null and city != ''"> and city = #{city}</if>
|
||||
<if test="district != null and district != ''"> and district = #{district}</if>
|
||||
<if test="detailAddress != null and detailAddress != ''"> and detail_address = #{detailAddress}</if>
|
||||
<if test="isDefault != null "> and is_default = #{isDefault}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<update id="updateDelFlagByIds">
|
||||
update ums_member_address set del_flag=1
|
||||
<where>
|
||||
id in <foreach collection="ids" open="(" item="it" close=")" separator=",">#{it}</foreach>
|
||||
</where>
|
||||
</update>
|
||||
</mapper>
|
||||
@ -0,0 +1,53 @@
|
||||
<?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.MemberMapper">
|
||||
|
||||
<resultMap type="Member" id="MemberResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="nickname" column="nickname"/>
|
||||
<result property="password" column="password"/>
|
||||
<result property="phone" column="phone"/>
|
||||
<result property="mark" column="mark"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="avatar" column="avatar"/>
|
||||
<result property="gender" column="gender"/>
|
||||
<result property="birthday" column="birthday"/>
|
||||
<result property="spreadUid" column="spread_uid"/>
|
||||
<result property="spreadTime" column="spread_time"/>
|
||||
<result property="level" column="level"/>
|
||||
<result property="integral" column="integral"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectMemberVo">
|
||||
select id, nickname, password, phone, mark, status, avatar, gender, birthday, spread_uid, spread_time, level, integral, create_time, update_time from ums_member
|
||||
</sql>
|
||||
|
||||
<select id="selectByEntity" parameterType="Member" resultMap="MemberResult">
|
||||
<include refid="selectMemberVo"/>
|
||||
<where>
|
||||
<if test="nickname != null and nickname != ''"> and nickname like concat('%', #{nickname}, '%')</if>
|
||||
<if test="password != null and password != ''"> and password = #{password}</if>
|
||||
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
|
||||
<if test="mark != null and mark != ''"> and mark = #{mark}</if>
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
<if test="avatar != null and avatar != ''"> and avatar = #{avatar}</if>
|
||||
<if test="gender != null "> and gender = #{gender}</if>
|
||||
<if test="birthday != null "> and birthday = #{birthday}</if>
|
||||
<if test="spreadUid != null "> and spread_uid = #{spreadUid}</if>
|
||||
<if test="spreadTime != null "> and spread_time = #{spreadTime}</if>
|
||||
<if test="level != null "> and level = #{level}</if>
|
||||
<if test="integral != null "> and integral = #{integral}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<update id="updateDelFlagByIds">
|
||||
update ums_member 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', 'member', 'ums/member/index', 1, 0, 'C', '0', '0', 'ums:member: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:member: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:member: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:member: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:member: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:member:export', '#', 1, sysdate(), '', null, '');
|
||||
@ -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', 'memberAddress', 'ums/memberAddress/index', 1, 0, 'C', '0', '0', 'ums:memberAddress: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:memberAddress: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:memberAddress: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:memberAddress: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:memberAddress: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:memberAddress:export', '#', 1, sysdate(), '', null, '');
|
||||
Loading…
Reference in new issue