Commit b0068098 by yuwei

项目初始化

parent 7bef1cf6
package cn.datax.service.email.dao;
import cn.datax.common.base.BaseDao;
import cn.datax.service.email.api.entity.EmailEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface EmailDao extends BaseDao<EmailEntity> {
}
package cn.datax.service.file.dao;
import cn.datax.service.file.api.entity.FileEntity;
import cn.datax.common.base.BaseDao;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author yuwei
* @since 2019-09-17
*/
@Mapper
public interface FileDao extends BaseDao<FileEntity> {
}
package cn.datax.service.system.api.entity;
import cn.datax.common.base.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.time.LocalDate;
import java.util.List;
/**
* <p>
......@@ -19,7 +21,7 @@ import java.time.LocalDate;
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("sys_user")
@TableName(value = "sys_user", resultMap = "BaseResultMap")
public class UserEntity extends BaseEntity {
private static final long serialVersionUID=1L;
......@@ -54,4 +56,12 @@ public class UserEntity extends BaseEntity {
*/
private LocalDate birthday;
@TableField(exist = false)
private List<DeptEntity> depts;
@TableField(exist = false)
private List<RoleEntity> roles;
@TableField(exist = false)
private List<PostEntity> posts;
}
......@@ -24,4 +24,13 @@
parent_id, dept_name, status
</sql>
<sql id="Dept_Column_List">
${alias}.id,
${alias}.create_by,
${alias}.create_time,
${alias}.update_by,
${alias}.update_time,
${alias}.parent_id, ${alias}.dept_name, ${alias}.status
</sql>
</mapper>
......@@ -23,4 +23,13 @@
post_name, status
</sql>
<sql id="Post_Column_List">
${alias}.id,
${alias}.create_by,
${alias}.create_time,
${alias}.update_by,
${alias}.update_time,
${alias}.post_name, ${alias}.status
</sql>
</mapper>
......@@ -24,4 +24,13 @@
role_name, role_code, status
</sql>
<sql id="Role_Column_List">
${alias}.id,
${alias}.create_by,
${alias}.create_time,
${alias}.update_by,
${alias}.update_time,
${alias}.role_name, ${alias}.role_code, ${alias}.status
</sql>
</mapper>
......@@ -16,6 +16,9 @@
<result column="phone" property="phone" />
<result column="birthday" property="birthday" />
<result column="status" property="status" />
<collection property="depts" column="{userId=id}" select="getDeptList"></collection>
<collection property="roles" column="{userId=id}" select="getRoleList"></collection>
<collection property="posts" column="{userId=id}" select="getPostList"></collection>
</resultMap>
<!-- 通用查询结果列 -->
......@@ -32,4 +35,42 @@
update sys_user set password = #{password} where id = #{id}
</update>
<select id="getDeptList" resultType="cn.datax.service.system.api.entity.DeptEntity">
select
<include refid="cn.datax.service.system.dao.DeptDao.Dept_Column_List">
<property name="alias" value="d"/>
</include>
from sys_dept d
left join sys_user_dept ud on d.id = ud.dept_id
where 1 = 1 and d.status = 1
<if test="null != userId and '' != userId">
and ud.user_id = #{userId}
</if>
</select>
<select id="getRoleList" resultType="cn.datax.service.system.api.entity.RoleEntity">
select
<include refid="cn.datax.service.system.dao.RoleDao.Role_Column_List">
<property name="alias" value="r"/>
</include>
from sys_role r
left join sys_user_role ur on d.id = ur.role_id
where 1 = 1 and r.status = 1
<if test="null != userId and '' != userId">
and ur.user_id = #{userId}
</if>
</select>
<select id="getPostList" resultType="cn.datax.service.system.api.entity.PostEntity">
select
<include refid="cn.datax.service.system.dao.PostDao.Post_Column_List">
<property name="alias" value="p"/>
</include>
from sys_post p
left join sys_user_post up on d.id = up.post_id
where 1 = 1 and p.status = 1
<if test="null != userId and '' != userId">
and up.user_id = #{userId}
</if>
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment