提交 e314e448 authored 作者: zhu's avatar zhu

fix

上级 1da8961c
...@@ -21,7 +21,8 @@ import org.springframework.format.annotation.DateTimeFormat; ...@@ -21,7 +21,8 @@ import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.xwd.hospital.server.base.BaseDomain; import com.xwd.hospital.server.base.BaseDomain;
import com.xwd.hospital.server.enums.UserSourceEnum; import com.xwd.hospital.server.enums.UserTypeEnum;
import com.xwd.hospital.server.enums.RegisterSourceEnum;
import com.xwd.hospital.server.enums.YesNoEnum; import com.xwd.hospital.server.enums.YesNoEnum;
@Data @Data
...@@ -59,9 +60,15 @@ public class User extends BaseDomain { ...@@ -59,9 +60,15 @@ public class User extends BaseDomain {
/** /**
* 用户类型 * 用户类型
*/ */
@TableField(value = "user_source") @TableField(value = "user_type")
@Schema(description = "用户类型", nullable = false) @Schema(description = "用户类型", nullable = false)
private UserSourceEnum userSource; private UserTypeEnum userType;
/**
* 注册来源
*/
@TableField(value = "register_source")
@Schema(description = "注册来源", nullable = false)
private RegisterSourceEnum registerSource;
/** /**
* 关联对象(doctor_info、user_info) * 关联对象(doctor_info、user_info)
*/ */
...@@ -131,8 +138,11 @@ public class User extends BaseDomain { ...@@ -131,8 +138,11 @@ public class User extends BaseDomain {
*/ */
@Override @Override
public User setDefault() { public User setDefault() {
if (this.getUserSource() == null) { if (this.getUserType() == null) {
this.setUserSource(UserSourceEnum.ADMIN); this.setUserType(UserTypeEnum.ADMIN);
}
if (this.getRegisterSource() == null) {
this.setRegisterSource(RegisterSourceEnum.WX);
} }
if (this.getDeleteStatus() == null) { if (this.getDeleteStatus() == null) {
this.setDeleteStatus(YesNoEnum.NO); this.setDeleteStatus(YesNoEnum.NO);
...@@ -183,12 +193,18 @@ public class User extends BaseDomain { ...@@ -183,12 +193,18 @@ public class User extends BaseDomain {
} }
return false; return false;
} }
if (this.getUserSource() == null) { if (this.getUserType() == null) {
if (throwException) { if (throwException) {
throw new ApiCode.ApiException(-1, "用户类型不能为空!"); throw new ApiCode.ApiException(-1, "用户类型不能为空!");
} }
return false; return false;
} }
if (this.getRegisterSource() == null) {
if (throwException) {
throw new ApiCode.ApiException(-1, "注册来源不能为空!");
}
return false;
}
if (this.getObjId() == null) { if (this.getObjId() == null) {
if (throwException) { if (throwException) {
throw new ApiCode.ApiException(-1, "关联对象(doctor_info、user_info)不能为空!"); throw new ApiCode.ApiException(-1, "关联对象(doctor_info、user_info)不能为空!");
......
/**
* 项目:互联网医疗
* @Author: xiongwei
* @Date: 2023-09-05 09:42:00
*/
package com.xwd.hospital.server.enums;
/**
* 用户注册来源
*/
public enum RegisterSourceEnum {
WX("微信"),
PLATFORM("平台");
RegisterSourceEnum(String name) {
this.name = name;
}
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
/**
* 项目:互联网医疗
* @Author: xiongwei
* @Date: 2023-09-05 09:42:00
*/
package com.xwd.hospital.server.enums;
/**
* 注册来源类型
*/
public enum UserTypeEnum {
PATIENT("患者"),
DOCTOR("医生"),
ADMIN("平台");
UserTypeEnum(String name) {
this.name = name;
}
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
...@@ -17,7 +17,8 @@ import lombok.*; ...@@ -17,7 +17,8 @@ import lombok.*;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import com.xwd.hospital.server.base.BaseParam; import com.xwd.hospital.server.base.BaseParam;
import com.xwd.hospital.server.enums.UserSourceEnum; import com.xwd.hospital.server.enums.UserTypeEnum;
import com.xwd.hospital.server.enums.RegisterSourceEnum;
import com.xwd.hospital.server.enums.YesNoEnum; import com.xwd.hospital.server.enums.YesNoEnum;
import com.xwd.hospital.server.domain.User; import com.xwd.hospital.server.domain.User;
...@@ -51,12 +52,22 @@ public class UserParam extends BaseParam<User> { ...@@ -51,12 +52,22 @@ public class UserParam extends BaseParam<User> {
* 用户类型 * 用户类型
*/ */
@Parameter(description = "用户类型") @Parameter(description = "用户类型")
private UserSourceEnum userSource; private UserTypeEnum userType;
/** /**
* 用户类型 IN值List * 用户类型 IN值List
*/ */
@Parameter(description = "用户类型 IN值List") @Parameter(description = "用户类型 IN值List")
private List<String> userSourceList; private List<String> userTypeList;
/**
* 注册来源
*/
@Parameter(description = "注册来源")
private RegisterSourceEnum registerSource;
/**
* 注册来源 IN值List
*/
@Parameter(description = "注册来源 IN值List")
private List<String> registerSourceList;
/** /**
* 关联对象(doctor_info、user_info) * 关联对象(doctor_info、user_info)
*/ */
...@@ -180,8 +191,10 @@ public class UserParam extends BaseParam<User> { ...@@ -180,8 +191,10 @@ public class UserParam extends BaseParam<User> {
wrapper.eq(columnPrefix + "open_id", this.getOpenId()); wrapper.eq(columnPrefix + "open_id", this.getOpenId());
} }
} }
wrapper.eq(this.getUserSource() != null, columnPrefix + "user_source", this.getUserSource()); wrapper.eq(this.getUserType() != null, columnPrefix + "user_type", this.getUserType());
wrapper.in(this.getUserSourceList() != null && this.getUserSourceList().size() > 0, columnPrefix + "user_source", this.getUserSourceList()); wrapper.in(this.getUserTypeList() != null && this.getUserTypeList().size() > 0, columnPrefix + "user_type", this.getUserTypeList());
wrapper.eq(this.getRegisterSource() != null, columnPrefix + "register_source", this.getRegisterSource());
wrapper.in(this.getRegisterSourceList() != null && this.getRegisterSourceList().size() > 0, columnPrefix + "register_source", this.getRegisterSourceList());
wrapper.eq(this.getObjId() != null, columnPrefix + "obj_id", this.getObjId()); wrapper.eq(this.getObjId() != null, columnPrefix + "obj_id", this.getObjId());
wrapper.eq(this.getDeleteStatus() != null, columnPrefix + "delete_status", this.getDeleteStatus()); wrapper.eq(this.getDeleteStatus() != null, columnPrefix + "delete_status", this.getDeleteStatus());
wrapper.in(this.getDeleteStatusList() != null && this.getDeleteStatusList().size() > 0, columnPrefix + "delete_status", this.getDeleteStatusList()); wrapper.in(this.getDeleteStatusList() != null && this.getDeleteStatusList().size() > 0, columnPrefix + "delete_status", this.getDeleteStatusList());
......
...@@ -536,7 +536,8 @@ create table `sys_user` ...@@ -536,7 +536,8 @@ create table `sys_user`
id int(11) auto_increment not null comment 'Id', id int(11) auto_increment not null comment 'Id',
username varchar(255) not null comment '用户名', username varchar(255) not null comment '用户名',
open_id varchar(255) not null comment '微信open_id', open_id varchar(255) not null comment '微信open_id',
user_source varchar(50) not null default ADMIN comment '用户类型 [PATIENT.患者 DOCTOR.医生 ADMIN.平台]', user_type varchar(50) not null default ADMIN comment '用户类型 [PATIENT.患者 DOCTOR.医生 ADMIN.平台]',
register_source varchar(50) not null default WX comment '注册来源 [WX.微信 PLATFORM.平台]',
obj_id int(11) not null comment '关联对象(doctor_info、user_info)', obj_id int(11) not null comment '关联对象(doctor_info、user_info)',
delete_status varchar(50) not null default 'NO' comment '是否删除 [YES.是 NO.否]', delete_status varchar(50) not null default 'NO' comment '是否删除 [YES.是 NO.否]',
password varchar(255) null comment '密码', password varchar(255) null comment '密码',
......
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
<id column="id" jdbcType="BIGINT" property="id" /> <id column="id" jdbcType="BIGINT" property="id" />
<result column="username" jdbcType="VARCHAR" property="username" /> <result column="username" jdbcType="VARCHAR" property="username" />
<result column="open_id" jdbcType="VARCHAR" property="openId" /> <result column="open_id" jdbcType="VARCHAR" property="openId" />
<result column="user_source" jdbcType="VARCHAR" property="userSource" /> <result column="user_type" jdbcType="VARCHAR" property="userType" />
<result column="register_source" jdbcType="VARCHAR" property="registerSource" />
<result column="obj_id" jdbcType="BIGINT" property="objId" /> <result column="obj_id" jdbcType="BIGINT" property="objId" />
<result column="delete_status" jdbcType="VARCHAR" property="deleteStatus" /> <result column="delete_status" jdbcType="VARCHAR" property="deleteStatus" />
<result column="password" jdbcType="VARCHAR" property="password" /> <result column="password" jdbcType="VARCHAR" property="password" />
...@@ -21,10 +22,10 @@ ...@@ -21,10 +22,10 @@
<collection column="id" property="roleList" select="queryRoleById" /> <collection column="id" property="roleList" select="queryRoleById" />
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
`id`, `username`, `open_id`, `user_source`, `obj_id`, `delete_status`, `password`, `real_name`, `phone`, `avatar`, `editor_id`, `editor_name`, `create_time`, `update_time` `id`, `username`, `open_id`, `user_type`, `register_source`, `obj_id`, `delete_status`, `password`, `real_name`, `phone`, `avatar`, `editor_id`, `editor_name`, `create_time`, `update_time`
</sql> </sql>
<sql id="Base_Column_List_With_Prefix"> <sql id="Base_Column_List_With_Prefix">
t.`id`, t.`username`, t.`open_id`, t.`user_source`, t.`obj_id`, t.`delete_status`, t.`password`, t.`real_name`, t.`phone`, t.`avatar`, t.`editor_id`, t.`editor_name`, t.`create_time`, t.`update_time` t.`id`, t.`username`, t.`open_id`, t.`user_type`, t.`register_source`, t.`obj_id`, t.`delete_status`, t.`password`, t.`real_name`, t.`phone`, t.`avatar`, t.`editor_id`, t.`editor_name`, t.`create_time`, t.`update_time`
</sql> </sql>
<select id="queryRoleById" resultMap="com.xwd.hospital.server.repository.base.RoleBaseMapper.ResultMap"> <select id="queryRoleById" resultMap="com.xwd.hospital.server.repository.base.RoleBaseMapper.ResultMap">
select select
...@@ -36,12 +37,12 @@ ...@@ -36,12 +37,12 @@
</select> </select>
<insert id="batchInsert"> <insert id="batchInsert">
insert into sys_user ( insert into sys_user (
`username`, `open_id`, `user_source`, `obj_id`, `delete_status`, `password`, `real_name`, `phone`, `avatar`, `editor_id`, `editor_name` `username`, `open_id`, `user_type`, `register_source`, `obj_id`, `delete_status`, `password`, `real_name`, `phone`, `avatar`, `editor_id`, `editor_name`
) )
values values
<foreach collection="records" item="record" separator=","> <foreach collection="records" item="record" separator=",">
( (
#{record.username, jdbcType=VARCHAR}, #{record.openId, jdbcType=VARCHAR}, #{record.userSource, jdbcType=VARCHAR}, #{record.objId, jdbcType=BIGINT}, #{record.deleteStatus, jdbcType=VARCHAR}, #{record.password, jdbcType=VARCHAR}, #{record.realName, jdbcType=VARCHAR}, #{record.phone, jdbcType=VARCHAR}, #{record.avatar, jdbcType=VARCHAR}, #{record.editorId, jdbcType=BIGINT}, #{record.editorName, jdbcType=VARCHAR} #{record.username, jdbcType=VARCHAR}, #{record.openId, jdbcType=VARCHAR}, #{record.userType, jdbcType=VARCHAR}, #{record.registerSource, jdbcType=VARCHAR}, #{record.objId, jdbcType=BIGINT}, #{record.deleteStatus, jdbcType=VARCHAR}, #{record.password, jdbcType=VARCHAR}, #{record.realName, jdbcType=VARCHAR}, #{record.phone, jdbcType=VARCHAR}, #{record.avatar, jdbcType=VARCHAR}, #{record.editorId, jdbcType=BIGINT}, #{record.editorName, jdbcType=VARCHAR}
) )
</foreach> </foreach>
</insert> </insert>
...@@ -50,7 +51,8 @@ ...@@ -50,7 +51,8 @@
<trim suffixOverrides=","> <trim suffixOverrides=",">
username = #{et.username, jdbcType=VARCHAR}, username = #{et.username, jdbcType=VARCHAR},
open_id = #{et.openId, jdbcType=VARCHAR}, open_id = #{et.openId, jdbcType=VARCHAR},
user_source = #{et.userSource, jdbcType=VARCHAR}, user_type = #{et.userType, jdbcType=VARCHAR},
register_source = #{et.registerSource, jdbcType=VARCHAR},
obj_id = #{et.objId, jdbcType=BIGINT}, obj_id = #{et.objId, jdbcType=BIGINT},
delete_status = #{et.deleteStatus, jdbcType=VARCHAR}, delete_status = #{et.deleteStatus, jdbcType=VARCHAR},
password = #{et.password, jdbcType=VARCHAR}, password = #{et.password, jdbcType=VARCHAR},
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论