forked from rongchao/epmet-cloud-rizhao
21 changed files with 728 additions and 8 deletions
@ -0,0 +1,66 @@ |
|||
package com.epmet.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @Description |
|||
* @ClassName UserDTO |
|||
* @Author wangc |
|||
* @date 2020.03.28 15:11 |
|||
*/ |
|||
@Data |
|||
public class UserDTO implements Serializable{ |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
|
|||
/** |
|||
* 唯一标识 |
|||
*/ |
|||
private String id; |
|||
|
|||
|
|||
/** |
|||
* 来源App |
|||
* */ |
|||
private String fromApp; |
|||
|
|||
/** |
|||
* 来源client |
|||
* */ |
|||
private String fromClient; |
|||
|
|||
/** |
|||
* 删除标识:0.未删除 1.已删除 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,108 @@ |
|||
package com.epmet.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @Description |
|||
* @ClassName UserWechatDTO |
|||
* @Author wangc |
|||
* @date 2020.03.28 15:14 |
|||
*/ |
|||
@Data |
|||
public class UserWechatDTO implements Serializable{ |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 唯一标识 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 用户ID |
|||
* */ |
|||
private String userId; |
|||
|
|||
/** |
|||
* 微信openId |
|||
*/ |
|||
private String wxOpenId; |
|||
|
|||
/** |
|||
* 微信unionId |
|||
*/ |
|||
private String unionId; |
|||
|
|||
/** |
|||
* 手机号 |
|||
*/ |
|||
private String mobile; |
|||
|
|||
/** |
|||
* 昵称 |
|||
*/ |
|||
private String nickname; |
|||
|
|||
/** |
|||
* 性别:0.未知 1.男性2女性 |
|||
*/ |
|||
private Integer sex; |
|||
|
|||
/** |
|||
* 头像 |
|||
*/ |
|||
private String headImgUrl; |
|||
|
|||
/** |
|||
* 国家 |
|||
*/ |
|||
private String country; |
|||
|
|||
/** |
|||
* 省份 |
|||
*/ |
|||
private String province; |
|||
|
|||
/** |
|||
* 城市 |
|||
*/ |
|||
private String city; |
|||
|
|||
/** |
|||
* 语言 |
|||
*/ |
|||
private String language; |
|||
|
|||
/** |
|||
* 删除标识:0.未删除 1.已删除 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
} |
@ -0,0 +1,36 @@ |
|||
package com.epmet.constant; |
|||
|
|||
/** |
|||
* @Description |
|||
* @IntefaceName UserConstant |
|||
* @Author wangc |
|||
* @date 2020.03.28 16:51 |
|||
*/ |
|||
public interface UserConstant { |
|||
|
|||
/** |
|||
* 政府端 |
|||
* */ |
|||
String APP_GOV = "gov"; |
|||
|
|||
/** |
|||
* 居民端 |
|||
* */ |
|||
String APP_RESI = "resi"; |
|||
|
|||
/** |
|||
* 运营端 |
|||
* */ |
|||
String APP_OPER = "oper"; |
|||
|
|||
/** |
|||
* PC端 |
|||
* */ |
|||
String CLIENT_WEB = "web"; |
|||
|
|||
/** |
|||
* 微信端 |
|||
* */ |
|||
String CLIENT_WX = "wxmp"; |
|||
|
|||
} |
@ -0,0 +1,85 @@ |
|||
package com.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.dto.UserDTO; |
|||
import com.epmet.dto.UserWechatDTO; |
|||
import com.epmet.entity.UserEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @Description 用户DAO |
|||
* @IntefaceName UserDao |
|||
* @Author wangc |
|||
* @date 2020.03.28 14:45 |
|||
*/ |
|||
@Mapper |
|||
public interface UserDao extends BaseDao<UserEntity> { |
|||
|
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<UserWechatDTO> |
|||
* @author generator |
|||
* @date 2020-03-18 |
|||
*/ |
|||
PageData<UserWechatDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<UserWechatDTO> |
|||
* @author generator |
|||
* @date 2020-03-18 |
|||
*/ |
|||
List<UserWechatDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return UserWechatDTO |
|||
* @author generator |
|||
* @date 2020-03-18 |
|||
*/ |
|||
UserDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-03-18 |
|||
*/ |
|||
void save(UserWechatDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-03-18 |
|||
*/ |
|||
void update(UserWechatDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-03-18 |
|||
*/ |
|||
void delete(String[] ids); |
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,35 @@ |
|||
package com.epmet.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.dto.UserWechatDTO; |
|||
import com.epmet.entity.UserWechatEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* @Description 用户-微信关系DAO |
|||
* @IntefaceName UserWechatDao |
|||
* @Author wangc |
|||
* @date 2020.03.28 14:45 |
|||
*/ |
|||
@Mapper |
|||
public interface UserWechatDao extends BaseDao<UserWechatEntity>{ |
|||
|
|||
/** |
|||
* @Description 根据userId更新 用户-微信关系表里的属性 |
|||
* @Param userWechatDTO |
|||
* @return int |
|||
* @Author wangc |
|||
* @Date 2020.03.28 16:25 |
|||
**/ |
|||
int updateByUserId(UserWechatDTO userWechatDTO); |
|||
|
|||
/** |
|||
* @Description 根据openId查询系统下用户信息,不区分用户、政府端、运营端 |
|||
* @Param openId |
|||
* @return userId |
|||
* @Author wangc |
|||
* @Date 2020.03.28 13:25 |
|||
**/ |
|||
String selectUserIdByOpenId(String openId); |
|||
|
|||
} |
@ -0,0 +1,34 @@ |
|||
package com.epmet.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
/** |
|||
* @Description 用户表 存储运营人员 政府端工作人员 居民用户的唯一标识 |
|||
* @ClassName UserEntity |
|||
* @Author wangc |
|||
* @date 2020.03.28 13:54 |
|||
*/ |
|||
|
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("user") |
|||
public class UserEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 来源App |
|||
* */ |
|||
private String fromApp; |
|||
|
|||
/** |
|||
* 来源client |
|||
* */ |
|||
private String fromClient; |
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,78 @@ |
|||
package com.epmet.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
/** |
|||
* @Description |
|||
* @ClassName UserWechatEntity |
|||
* @Author wangc |
|||
* @date 2020.03.28 13:57 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("user_wechat") |
|||
public class UserWechatEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
|
|||
/** |
|||
* 用户ID |
|||
* */ |
|||
private String userId; |
|||
|
|||
/** |
|||
* 微信openId |
|||
*/ |
|||
private String wxOpenId; |
|||
|
|||
/** |
|||
* 微信unionId |
|||
*/ |
|||
private String unionId; |
|||
|
|||
/** |
|||
* 手机号 |
|||
*/ |
|||
private String mobile; |
|||
|
|||
/** |
|||
* 昵称 |
|||
*/ |
|||
private String nickname; |
|||
|
|||
/** |
|||
* 性别:0.未知 1.男性2女性 |
|||
*/ |
|||
private Integer sex; |
|||
|
|||
/** |
|||
* 头像 |
|||
*/ |
|||
private String headImgUrl; |
|||
|
|||
/** |
|||
* 国家 |
|||
*/ |
|||
private String country; |
|||
|
|||
/** |
|||
* 省份 |
|||
*/ |
|||
private String province; |
|||
|
|||
/** |
|||
* 城市 |
|||
*/ |
|||
private String city; |
|||
|
|||
/** |
|||
* 语言 |
|||
*/ |
|||
private String language; |
|||
|
|||
|
|||
} |
@ -0,0 +1,79 @@ |
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.dto.UserDTO; |
|||
import com.epmet.entity.UserEntity; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @Description |
|||
* @IntefaceName UserService |
|||
* @Author wangc |
|||
* @date 2020.03.28 14:34 |
|||
*/ |
|||
public interface UserService extends BaseService<UserEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<UserDTO> |
|||
* @author generator |
|||
* @date 2020-03-18 |
|||
*/ |
|||
PageData<UserDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<UserDTO> |
|||
* @author generator |
|||
* @date 2020-03-18 |
|||
*/ |
|||
List<UserDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return UserDTO |
|||
* @author generator |
|||
* @date 2020-03-18 |
|||
*/ |
|||
UserDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-03-18 |
|||
*/ |
|||
void save(UserDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-03-18 |
|||
*/ |
|||
void update(UserDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-03-18 |
|||
*/ |
|||
void delete(String[] ids); |
|||
|
|||
} |
@ -0,0 +1,14 @@ |
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.entity.UserWechatEntity; |
|||
|
|||
/** |
|||
* @Description |
|||
* @IntefaceName UserWechatService |
|||
* @Author wangc |
|||
* @date 2020.03.28 14:35 |
|||
*/ |
|||
public interface UserWechatService extends BaseService<UserWechatEntity> { |
|||
|
|||
} |
@ -0,0 +1,51 @@ |
|||
package com.epmet.service.impl; |
|||
|
|||
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.dao.UserDao; |
|||
import com.epmet.dto.UserDTO; |
|||
import com.epmet.entity.UserEntity; |
|||
import com.epmet.service.UserService; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* @Description |
|||
* @ClassName UserServiceImpl |
|||
* @Author wangc |
|||
* @date 2020.03.28 14:41 |
|||
*/ |
|||
public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implements UserService { |
|||
|
|||
@Override |
|||
public PageData<UserDTO> page(Map<String, Object> params) { |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public List<UserDTO> list(Map<String, Object> params) { |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public UserDTO get(String id) { |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public void save(UserDTO dto) { |
|||
|
|||
} |
|||
|
|||
@Override |
|||
public void update(UserDTO dto) { |
|||
|
|||
} |
|||
|
|||
@Override |
|||
public void delete(String[] ids) { |
|||
|
|||
} |
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.epmet.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|||
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.epmet.dao.UserWechatDao; |
|||
import com.epmet.entity.UserWechatEntity; |
|||
import com.epmet.service.UserWechatService; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Collection; |
|||
|
|||
/** |
|||
* @Description |
|||
* @ClassName UserWechatServiceImpl |
|||
* @Author wangc |
|||
* @date 2020.03.28 14:42 |
|||
*/ |
|||
public class UserWechatServiceImpl extends BaseServiceImpl<UserWechatDao, UserWechatEntity> implements UserWechatService{ |
|||
|
|||
} |
@ -0,0 +1,7 @@ |
|||
<?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.epmet.dao.UserDao"> |
|||
|
|||
|
|||
</mapper> |
@ -0,0 +1,56 @@ |
|||
<?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.epmet.dao.UserWechatDao"> |
|||
|
|||
<!-- 根据userId更新 用户-微信关系表里的属性 --> |
|||
<update id="updateByUserId"> |
|||
|
|||
UPDATE user_wechat |
|||
<set> |
|||
<if test='null != city and "" != city '> |
|||
CITY = #{city}, |
|||
</if> |
|||
|
|||
<if test='null != nickname and "" != nickname '> |
|||
NICKNAME = #{nickname}, |
|||
</if> |
|||
|
|||
<if test='null != country and "" != country '> |
|||
COUNTRY = #{country}, |
|||
</if> |
|||
|
|||
<if test='null != province and "" != province '> |
|||
PROVINCE = #{province}, |
|||
</if> |
|||
|
|||
<if test='null != sex and "" != sex '> |
|||
SEX = #{sex}, |
|||
</if> |
|||
<if test='null != wxOpenId and "" != wxOpenId'> |
|||
WX_OPEN_ID = #{wxOpenId}, |
|||
</if> |
|||
<if test='null != updatedBy and "" != updatedBy'> |
|||
UPDATED_BY = #{updatedBy}, |
|||
</if> |
|||
UPDATED_TIME = sysdate |
|||
|
|||
</set> |
|||
|
|||
WHERE |
|||
USER_ID = #{userId} |
|||
|
|||
</update> |
|||
|
|||
|
|||
<!-- 根据openId查询系统下(所有身份)用户信息 --> |
|||
<select id="selectUserIdByOpenId" parameterType="java.lang.String" resultType="java.lang.String"> |
|||
SELECT |
|||
uw.user_id as id |
|||
FROM |
|||
user_wechat uw |
|||
WHERE |
|||
uw.DEL_FLAG = '0' |
|||
AND uw.WX_OPEN_ID = #{openId} |
|||
</select> |
|||
</mapper> |
Loading…
Reference in new issue