11 changed files with 823 additions and 2 deletions
@ -0,0 +1,149 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.dto; |
|||
|
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* 用户信息表 |
|||
* |
|||
* @author qu qu@gmail.com |
|||
* @since v1.0.0 2019-09-02 |
|||
*/ |
|||
@Data |
|||
public class UserDTO implements Serializable { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
private String id; |
|||
|
|||
private String nickname; |
|||
|
|||
private String mobile; |
|||
|
|||
private String password; |
|||
|
|||
private Date registerTime; |
|||
|
|||
private String faceImg; |
|||
|
|||
// @ApiModelProperty(value = "性别(女性-female,男性-male)")
|
|||
private String sex; |
|||
|
|||
// @ApiModelProperty(value = "生日")
|
|||
private Date birthday; |
|||
|
|||
// @ApiModelProperty(value = "邮箱")
|
|||
private String email; |
|||
|
|||
// @ApiModelProperty(value = "电话")
|
|||
private String telephone; |
|||
|
|||
// @ApiModelProperty(value = "邮编")
|
|||
private String zipCode; |
|||
|
|||
// @ApiModelProperty(value = "职业")
|
|||
private String profession; |
|||
|
|||
// @ApiModelProperty(value = "爱好")
|
|||
private String hobbies; |
|||
|
|||
// @ApiModelProperty(value = "个性签名")
|
|||
private String userSign; |
|||
|
|||
// @ApiModelProperty(value = "邀请码")
|
|||
private String invitationCode; |
|||
|
|||
// @ApiModelProperty(value = "最近登录时间")
|
|||
private Date lastLoginTime; |
|||
|
|||
// @ApiModelProperty(value = "最近登录IP")
|
|||
private String lastLoginIp; |
|||
|
|||
// @ApiModelProperty(value = "最近登录位置经度")
|
|||
private String lastLongitude; |
|||
|
|||
// @ApiModelProperty(value = "最近登录位置维度")
|
|||
private String lastLatitude; |
|||
|
|||
// @ApiModelProperty(value = "真实姓名")
|
|||
private String realName; |
|||
|
|||
// @ApiModelProperty(value = "身份证号")
|
|||
private String identityNo; |
|||
|
|||
// @ApiModelProperty(value = "居民住址")
|
|||
private String address; |
|||
|
|||
// @ApiModelProperty(value = "微信OPENID")
|
|||
private String wxOpenId; |
|||
|
|||
// @ApiModelProperty(value = "是否是党员(0-否,1-是)")
|
|||
private String partyFlag; |
|||
|
|||
// @ApiModelProperty(value = "注册方式(wx:微信注册)")
|
|||
private String registerWay; |
|||
|
|||
// @ApiModelProperty(value = "用户来源(wp:公众号)")
|
|||
private String registerSource; |
|||
|
|||
// @ApiModelProperty(value = "手机号所属省份")
|
|||
private String phoneProvince; |
|||
|
|||
// @ApiModelProperty(value = "手机号所属城市")
|
|||
private String phoneCity; |
|||
|
|||
// @ApiModelProperty(value = "手机号所属运营商")
|
|||
private String phoneCarrier; |
|||
|
|||
// @ApiModelProperty(value = "用户积分")
|
|||
private Integer points; |
|||
|
|||
// @ApiModelProperty(value = "邀请人ID")
|
|||
private String inviteUserId; |
|||
|
|||
// @ApiModelProperty(value = "乐观锁")
|
|||
private Integer revision; |
|||
|
|||
// @ApiModelProperty(value = "网格ID")
|
|||
private String gridId; |
|||
|
|||
// @ApiModelProperty(value = "创建人")
|
|||
private String createdBy; |
|||
|
|||
// @ApiModelProperty(value = "创建时间")
|
|||
private Date createdTime; |
|||
|
|||
// @ApiModelProperty(value = "更新人")
|
|||
private String updatedBy; |
|||
|
|||
// @ApiModelProperty(value = "更新时间")
|
|||
private Date updatedTime; |
|||
|
|||
// @ApiModelProperty(value = "删除标记")
|
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 审核状态 |
|||
*/ |
|||
private Integer state; |
|||
|
|||
} |
@ -0,0 +1,101 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.controller; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.commons.tools.utils.ExcelUtils; |
|||
import com.elink.esua.epdc.commons.tools.utils.Result; |
|||
import com.elink.esua.epdc.commons.tools.validator.AssertUtils; |
|||
import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils; |
|||
import com.elink.esua.epdc.commons.tools.validator.group.AddGroup; |
|||
import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup; |
|||
import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; |
|||
import com.elink.esua.epdc.dto.UserDTO; |
|||
import com.elink.esua.epdc.excel.UserExcel; |
|||
import com.elink.esua.epdc.service.UserService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* 用户信息表 |
|||
* |
|||
* @author qu qu@gmail.com |
|||
* @since v1.0.0 2019-09-02 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("epdc/user") |
|||
public class UserController { |
|||
@Autowired |
|||
private UserService userService; |
|||
|
|||
@GetMapping("page") |
|||
public Result<PageData<UserDTO>> page( @RequestParam Map<String, Object> params){ |
|||
PageData<UserDTO> page = userService.page(params); |
|||
|
|||
return new Result<PageData<UserDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<UserDTO> get(@PathVariable("id") String id){ |
|||
UserDTO data = userService.get(id); |
|||
|
|||
return new Result<UserDTO>().ok(data); |
|||
} |
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody UserDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
|
|||
userService.save(dto); |
|||
|
|||
return new Result(); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody UserDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
|
|||
userService.update(dto); |
|||
|
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
|
|||
userService.delete(ids); |
|||
|
|||
return new Result(); |
|||
} |
|||
|
|||
@GetMapping("export") |
|||
public void export( @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
|||
List<UserDTO> list = userService.list(params); |
|||
|
|||
ExcelUtils.exportExcelToTarget(response, null, list, UserExcel.class); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,33 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.dao; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
|||
import com.elink.esua.epdc.entity.UserEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 用户信息表 |
|||
* |
|||
* @author qu qu@gmail.com |
|||
* @since v1.0.0 2019-09-02 |
|||
*/ |
|||
@Mapper |
|||
public interface UserDao extends BaseDao<UserEntity> { |
|||
|
|||
} |
@ -0,0 +1,173 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.baomidou.mybatisplus.annotation.FieldFill; |
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 用户信息表 |
|||
* |
|||
* @author qu qu@gmail.com |
|||
* @since v1.0.0 2019-09-02 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("epdc_user") |
|||
public class UserEntity extends BaseEpdcEntity { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 昵称 |
|||
*/ |
|||
private String nickname; |
|||
/** |
|||
* 手机号 |
|||
*/ |
|||
private String mobile; |
|||
/** |
|||
* 密码 |
|||
*/ |
|||
private String password; |
|||
/** |
|||
* 注册时间 |
|||
*/ |
|||
private Date registerTime; |
|||
/** |
|||
* 头像 |
|||
*/ |
|||
private String faceImg; |
|||
/** |
|||
* 性别(女性-female,男性-male) |
|||
*/ |
|||
private String sex; |
|||
/** |
|||
* 生日 |
|||
*/ |
|||
private Date birthday; |
|||
/** |
|||
* 邮箱 |
|||
*/ |
|||
private String email; |
|||
/** |
|||
* 电话 |
|||
*/ |
|||
private String telephone; |
|||
/** |
|||
* 邮编 |
|||
*/ |
|||
private String zipCode; |
|||
/** |
|||
* 职业 |
|||
*/ |
|||
private String profession; |
|||
/** |
|||
* 爱好 |
|||
*/ |
|||
private String hobbies; |
|||
/** |
|||
* 个性签名 |
|||
*/ |
|||
private String userSign; |
|||
/** |
|||
* 邀请码 |
|||
*/ |
|||
private String invitationCode; |
|||
/** |
|||
* 最近登录时间 |
|||
*/ |
|||
private Date lastLoginTime; |
|||
/** |
|||
* 最近登录IP |
|||
*/ |
|||
private String lastLoginIp; |
|||
/** |
|||
* 最近登录位置经度 |
|||
*/ |
|||
private String lastLongitude; |
|||
/** |
|||
* 最近登录位置维度 |
|||
*/ |
|||
private String lastLatitude; |
|||
/** |
|||
* 真实姓名 |
|||
*/ |
|||
private String realName; |
|||
/** |
|||
* 身份证号 |
|||
*/ |
|||
private String identityNo; |
|||
/** |
|||
* 居民住址 |
|||
*/ |
|||
private String address; |
|||
/** |
|||
* 微信OPENID |
|||
*/ |
|||
private String wxOpenId; |
|||
/** |
|||
* 是否是党员(0-否,1-是) |
|||
*/ |
|||
private String partyFlag; |
|||
/** |
|||
* 注册方式(wx:微信注册) |
|||
*/ |
|||
private String registerWay; |
|||
/** |
|||
* 用户来源(wp:公众号) |
|||
*/ |
|||
private String registerSource; |
|||
/** |
|||
* 手机号所属省份 |
|||
*/ |
|||
private String phoneProvince; |
|||
/** |
|||
* 手机号所属城市 |
|||
*/ |
|||
private String phoneCity; |
|||
/** |
|||
* 手机号所属运营商 |
|||
*/ |
|||
private String phoneCarrier; |
|||
/** |
|||
* 用户积分 |
|||
*/ |
|||
private Integer points; |
|||
/** |
|||
* 邀请人ID |
|||
*/ |
|||
private String inviteUserId; |
|||
/** |
|||
* 网格ID |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 审核状态 |
|||
*/ |
|||
private Integer state; |
|||
|
|||
} |
@ -0,0 +1,110 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.excel; |
|||
|
|||
import cn.afterturn.easypoi.excel.annotation.Excel; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 用户信息表 |
|||
* |
|||
* @author qu qu@gmail.com |
|||
* @since v1.0.0 2019-09-02 |
|||
*/ |
|||
@Data |
|||
public class UserExcel { |
|||
@Excel(name = "主键") |
|||
private String id; |
|||
@Excel(name = "昵称") |
|||
private String nickname; |
|||
@Excel(name = "手机号") |
|||
private String mobile; |
|||
@Excel(name = "密码") |
|||
private String password; |
|||
@Excel(name = "注册时间") |
|||
private Date registerTime; |
|||
@Excel(name = "头像") |
|||
private String faceImg; |
|||
@Excel(name = "性别(女性-female,男性-male)") |
|||
private String sex; |
|||
@Excel(name = "生日") |
|||
private Date birthday; |
|||
@Excel(name = "邮箱") |
|||
private String email; |
|||
@Excel(name = "电话") |
|||
private String telephone; |
|||
@Excel(name = "邮编") |
|||
private String zipCode; |
|||
@Excel(name = "职业") |
|||
private String profession; |
|||
@Excel(name = "爱好") |
|||
private String hobbies; |
|||
@Excel(name = "个性签名") |
|||
private String userSign; |
|||
@Excel(name = "邀请码") |
|||
private String invitationCode; |
|||
@Excel(name = "最近登录时间") |
|||
private Date lastLoginTime; |
|||
@Excel(name = "最近登录IP") |
|||
private String lastLoginIp; |
|||
@Excel(name = "最近登录位置经度") |
|||
private String lastLongitude; |
|||
@Excel(name = "最近登录位置维度") |
|||
private String lastLatitude; |
|||
@Excel(name = "真实姓名") |
|||
private String realName; |
|||
@Excel(name = "身份证号") |
|||
private String identityNo; |
|||
@Excel(name = "居民住址") |
|||
private String address; |
|||
@Excel(name = "微信OPENID") |
|||
private String wxOpenId; |
|||
@Excel(name = "是否是党员(0-否,1-是)") |
|||
private String partyFlag; |
|||
@Excel(name = "注册方式(wx:微信注册)") |
|||
private String registerWay; |
|||
@Excel(name = "用户来源(wp:公众号)") |
|||
private String registerSource; |
|||
@Excel(name = "手机号所属省份") |
|||
private String phoneProvince; |
|||
@Excel(name = "手机号所属城市") |
|||
private String phoneCity; |
|||
@Excel(name = "手机号所属运营商") |
|||
private String phoneCarrier; |
|||
@Excel(name = "用户积分") |
|||
private Integer points; |
|||
@Excel(name = "邀请人ID") |
|||
private String inviteUserId; |
|||
@Excel(name = "乐观锁") |
|||
private Integer revision; |
|||
@Excel(name = "网格ID") |
|||
private String gridId; |
|||
@Excel(name = "创建人") |
|||
private String createdBy; |
|||
@Excel(name = "创建时间") |
|||
private Date createdTime; |
|||
@Excel(name = "更新人") |
|||
private String updatedBy; |
|||
@Excel(name = "更新时间") |
|||
private Date updatedTime; |
|||
@Excel(name = "删除标记") |
|||
private String delFlag; |
|||
|
|||
} |
@ -0,0 +1,46 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.redis; |
|||
import com.elink.esua.epdc.commons.tools.redis.RedisUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 用户信息表 |
|||
* |
|||
* @author qu qu@gmail.com |
|||
* @since v1.0.0 2019-09-02 |
|||
*/ |
|||
@Component |
|||
public class UserRedis { |
|||
@Autowired |
|||
private RedisUtils redisUtils; |
|||
|
|||
public void delete(Object[] ids) { |
|||
|
|||
} |
|||
|
|||
public void set(){ |
|||
|
|||
} |
|||
|
|||
public String get(String id){ |
|||
return null; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,47 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.service; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.service.BaseService; |
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.dto.UserDTO; |
|||
import com.elink.esua.epdc.entity.UserEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 用户信息表 |
|||
* |
|||
* @author qu qu@gmail.com |
|||
* @since v1.0.0 2019-09-02 |
|||
*/ |
|||
public interface UserService extends BaseService<UserEntity> { |
|||
|
|||
PageData<UserDTO> page(Map<String, Object> params); |
|||
|
|||
List<UserDTO> list(Map<String, Object> params); |
|||
|
|||
UserDTO get(String id); |
|||
|
|||
void save(UserDTO dto); |
|||
|
|||
void update(UserDTO dto); |
|||
|
|||
void delete(String[] ids); |
|||
} |
@ -0,0 +1,112 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.elink.esua.epdc.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.elink.esua.epdc.commons.tools.constant.Constant; |
|||
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|||
import com.elink.esua.epdc.dao.UserDao; |
|||
import com.elink.esua.epdc.dto.UserDTO; |
|||
import com.elink.esua.epdc.entity.UserEntity; |
|||
import com.elink.esua.epdc.redis.UserRedis; |
|||
import com.elink.esua.epdc.service.UserService; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 用户信息表 |
|||
* |
|||
* @author qu qu@gmail.com |
|||
* @since v1.0.0 2019-09-02 |
|||
*/ |
|||
@Service |
|||
public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implements UserService { |
|||
@Autowired |
|||
private UserRedis userRedis; |
|||
|
|||
@Override |
|||
public PageData<UserDTO> page(Map<String, Object> params) { |
|||
IPage<UserEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
|
|||
return getPageData(page, UserDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<UserDTO> list(Map<String, Object> params) { |
|||
List<UserEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, UserDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<UserEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get("id"); |
|||
|
|||
QueryWrapper<UserEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), "id", id); |
|||
//wrapper.eq(Constant.DEL_FLAG, DelFlagEnum.NORMAL.value());
|
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public UserDTO get(String id) { |
|||
UserEntity entity = baseDao.selectById(id); |
|||
|
|||
return ConvertUtils.sourceToTarget(entity, UserDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(UserDTO dto) { |
|||
UserEntity entity = ConvertUtils.sourceToTarget(dto, UserEntity.class); |
|||
|
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(UserDTO dto) { |
|||
UserEntity entity = ConvertUtils.sourceToTarget(dto, UserEntity.class); |
|||
|
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
//逻辑删除
|
|||
//logicDelete(ids, UserEntity.class);
|
|||
|
|||
//物理删除
|
|||
baseDao.deleteBatchIds(Arrays.asList(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.elink.esua.epdc.dao.UserDao"> |
|||
|
|||
<resultMap type="com.elink.esua.epdc.entity.UserEntity" id="userMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="nickname" column="NICKNAME"/> |
|||
<result property="mobile" column="MOBILE"/> |
|||
<result property="password" column="PASSWORD"/> |
|||
<result property="registerTime" column="REGISTER_TIME"/> |
|||
<result property="faceImg" column="FACE_IMG"/> |
|||
<result property="sex" column="SEX"/> |
|||
<result property="birthday" column="BIRTHDAY"/> |
|||
<result property="email" column="EMAIL"/> |
|||
<result property="telephone" column="TELEPHONE"/> |
|||
<result property="zipCode" column="ZIP_CODE"/> |
|||
<result property="profession" column="PROFESSION"/> |
|||
<result property="hobbies" column="HOBBIES"/> |
|||
<result property="userSign" column="USER_SIGN"/> |
|||
<result property="invitationCode" column="INVITATION_CODE"/> |
|||
<result property="lastLoginTime" column="LAST_LOGIN_TIME"/> |
|||
<result property="lastLoginIp" column="LAST_LOGIN_IP"/> |
|||
<result property="lastLongitude" column="LAST_LONGITUDE"/> |
|||
<result property="lastLatitude" column="LAST_LATITUDE"/> |
|||
<result property="realName" column="REAL_NAME"/> |
|||
<result property="identityNo" column="IDENTITY_NO"/> |
|||
<result property="address" column="ADDRESS"/> |
|||
<result property="wxOpenId" column="WX_OPEN_ID"/> |
|||
<result property="partyFlag" column="PARTY_FLAG"/> |
|||
<result property="registerWay" column="REGISTER_WAY"/> |
|||
<result property="registerSource" column="REGISTER_SOURCE"/> |
|||
<result property="phoneProvince" column="PHONE_PROVINCE"/> |
|||
<result property="phoneCity" column="PHONE_CITY"/> |
|||
<result property="phoneCarrier" column="PHONE_CARRIER"/> |
|||
<result property="points" column="POINTS"/> |
|||
<result property="inviteUserId" column="INVITE_USER_ID"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="gridId" column="GRID_ID"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="state" column="STATE"/> |
|||
</resultMap> |
|||
|
|||
|
|||
</mapper> |
Loading…
Reference in new issue