sysuser 获取orgname 使用easy trans方式获取,去掉表关联

This commit is contained in:
wanglei 2022-12-06 11:44:37 +08:00
parent 0511718368
commit 0eb4da078b
2 changed files with 7 additions and 2 deletions

View File

@ -2,9 +2,13 @@ package net.maku.system.vo;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fhs.core.trans.anno.Trans;
import com.fhs.core.trans.constant.TransType;
import com.fhs.core.trans.vo.TransPojo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import net.maku.framework.common.utils.DateUtils; import net.maku.framework.common.utils.DateUtils;
import net.maku.system.entity.SysOrgEntity;
import org.hibernate.validator.constraints.Range; import org.hibernate.validator.constraints.Range;
import javax.validation.constraints.Email; import javax.validation.constraints.Email;
@ -21,7 +25,7 @@ import java.util.List;
*/ */
@Data @Data
@Schema(description = "用户") @Schema(description = "用户")
public class SysUserVO implements Serializable { public class SysUserVO implements Serializable, TransPojo {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Schema(description = "id") @Schema(description = "id")
@ -56,6 +60,7 @@ public class SysUserVO implements Serializable {
@Schema(description = "机构ID", required = true) @Schema(description = "机构ID", required = true)
@NotNull(message = "机构ID不能为空") @NotNull(message = "机构ID不能为空")
@Trans(type = TransType.SIMPLE,target = SysOrgEntity.class,fields = "name",ref = "orgName")
private Long orgId; private Long orgId;
@Schema(description = "状态 0停用 1正常", required = true) @Schema(description = "状态 0停用 1正常", required = true)

View File

@ -4,7 +4,7 @@
<mapper namespace="net.maku.system.dao.SysUserDao"> <mapper namespace="net.maku.system.dao.SysUserDao">
<select id="getList" resultType="net.maku.system.entity.SysUserEntity"> <select id="getList" resultType="net.maku.system.entity.SysUserEntity">
select t1.*, (select t2.name from sys_org t2 where t2.id = t1.org_id) orgName select t1.*
from sys_user t1 where t1.super_admin = 0 and t1.deleted = 0 from sys_user t1 where t1.super_admin = 0 and t1.deleted = 0
<if test="username != null and username.trim() != ''"> <if test="username != null and username.trim() != ''">
and t1.username = #{username} and t1.username = #{username}