Commit ae693bf2 authored by 鲍德's avatar 鲍德

项目用户岗位信息

parent 600c3ade
package com.censoft.censoftrongtong.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.censoft.censoftrongtong.domain.ProjectUserPost;
import com.censoft.censoftrongtong.service.IProjectUserPostService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 项目用户岗位关系Controller
*
* @author ruoyi
* @date 2023-11-30
*/
@RestController
@RequestMapping("/system/currentProject")
public class ProjectUserPostController extends BaseController
{
@Autowired
private IProjectUserPostService projectUserPostService;
/**
* 查询项目用户岗位关系列表
*/
@PreAuthorize("@ss.hasPermi('system:currentProject:list')")
@GetMapping("/list")
public TableDataInfo list(ProjectUserPost projectUserPost)
{
startPage();
List<ProjectUserPost> list = projectUserPostService.selectProjectUserPostList(projectUserPost);
return getDataTable(list);
}
/**
* 导出项目用户岗位关系列表
*/
@PreAuthorize("@ss.hasPermi('system:currentProject:export')")
@Log(title = "项目用户岗位关系", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ProjectUserPost projectUserPost)
{
List<ProjectUserPost> list = projectUserPostService.selectProjectUserPostList(projectUserPost);
ExcelUtil<ProjectUserPost> util = new ExcelUtil<ProjectUserPost>(ProjectUserPost.class);
util.exportExcel(response, list, "项目用户岗位关系数据");
}
/**
* 获取项目用户岗位关系详细信息
*/
@PreAuthorize("@ss.hasPermi('system:currentProject:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(projectUserPostService.selectProjectUserPostById(id));
}
/**
* 新增项目用户岗位关系
*/
@PreAuthorize("@ss.hasPermi('system:currentProject:add')")
@Log(title = "项目用户岗位关系", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ProjectUserPost projectUserPost)
{
return toAjax(projectUserPostService.insertProjectUserPost(projectUserPost));
}
/**
* 修改项目用户岗位关系
*/
@PreAuthorize("@ss.hasPermi('system:currentProject:edit')")
@Log(title = "项目用户岗位关系", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ProjectUserPost projectUserPost)
{
return toAjax(projectUserPostService.updateProjectUserPost(projectUserPost));
}
/**
* 删除项目用户岗位关系
*/
@PreAuthorize("@ss.hasPermi('system:currentProject:remove')")
@Log(title = "项目用户岗位关系", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(projectUserPostService.deleteProjectUserPostByIds(ids));
}
}
package com.censoft.censoftrongtong.domain;
import com.ruoyi.common.core.domain.BaseEntityClean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 项目用户岗位关系对象 project_user_post
*
* @author ruoyi
* @date 2023-11-30
*/
@Data
@ApiModel("项目用户岗位关系对象")
public class ProjectUserPost extends BaseEntityClean
{
private static final long serialVersionUID = 1L;
/** 主键 id */
@ApiModelProperty("项目 id")
private Long id;
/** 项目 id */
@Excel(name = "项目 id")
@ApiModelProperty("项目 id")
private Long projectId;
/** 用户 id */
@Excel(name = "用户 id")
@ApiModelProperty("用户 id")
private Long userId;
/** 岗位 id */
@Excel(name = "岗位 id")
@ApiModelProperty("岗位 id")
private Long postId;
}
package com.censoft.censoftrongtong.mapper;
import java.util.List;
import com.censoft.censoftrongtong.domain.ProjectUserPost;
import com.github.yulichang.base.MPJBaseMapper;
/**
* 项目用户岗位关系Mapper接口
*
* @author ruoyi
* @date 2023-11-30
*/
public interface ProjectUserPostMapper extends MPJBaseMapper<ProjectUserPost>
{
/**
* 查询项目用户岗位关系
*
* @param id 项目用户岗位关系主键
* @return 项目用户岗位关系
*/
public ProjectUserPost selectProjectUserPostById(Long id);
/**
* 查询项目用户岗位关系列表
*
* @param projectUserPost 项目用户岗位关系
* @return 项目用户岗位关系集合
*/
public List<ProjectUserPost> selectProjectUserPostList(ProjectUserPost projectUserPost);
/**
* 新增项目用户岗位关系
*
* @param projectUserPost 项目用户岗位关系
* @return 结果
*/
public int insertProjectUserPost(ProjectUserPost projectUserPost);
/**
* 修改项目用户岗位关系
*
* @param projectUserPost 项目用户岗位关系
* @return 结果
*/
public int updateProjectUserPost(ProjectUserPost projectUserPost);
/**
* 删除项目用户岗位关系
*
* @param id 项目用户岗位关系主键
* @return 结果
*/
public int deleteProjectUserPostById(Long id);
/**
* 批量删除项目用户岗位关系
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteProjectUserPostByIds(Long[] ids);
}
package com.censoft.censoftrongtong.service;
import java.util.List;
import com.censoft.censoftrongtong.domain.ProjectUserPost;
import com.github.yulichang.base.MPJBaseService;
/**
* 项目用户岗位关系Service接口
*
* @author ruoyi
* @date 2023-11-30
*/
public interface IProjectUserPostService extends MPJBaseService<ProjectUserPost>
{
/**
* 查询项目用户岗位关系
*
* @param id 项目用户岗位关系主键
* @return 项目用户岗位关系
*/
public ProjectUserPost selectProjectUserPostById(Long id);
/**
* 查询项目用户岗位关系列表
*
* @param projectUserPost 项目用户岗位关系
* @return 项目用户岗位关系集合
*/
public List<ProjectUserPost> selectProjectUserPostList(ProjectUserPost projectUserPost);
/**
* 新增项目用户岗位关系
*
* @param projectUserPost 项目用户岗位关系
* @return 结果
*/
public int insertProjectUserPost(ProjectUserPost projectUserPost);
/**
* 修改项目用户岗位关系
*
* @param projectUserPost 项目用户岗位关系
* @return 结果
*/
public int updateProjectUserPost(ProjectUserPost projectUserPost);
/**
* 批量删除项目用户岗位关系
*
* @param ids 需要删除的项目用户岗位关系主键集合
* @return 结果
*/
public int deleteProjectUserPostByIds(Long[] ids);
/**
* 删除项目用户岗位关系信息
*
* @param id 项目用户岗位关系主键
* @return 结果
*/
public int deleteProjectUserPostById(Long id);
}
package com.censoft.censoftrongtong.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.censoft.censoftrongtong.mapper.ProjectUserPostMapper;
import com.censoft.censoftrongtong.domain.ProjectUserPost;
import com.censoft.censoftrongtong.service.IProjectUserPostService;
import com.github.yulichang.base.MPJBaseServiceImpl;
/**
* 项目用户岗位关系Service业务层处理
*
* @author ruoyi
* @date 2023-11-30
*/
@Service
public class ProjectUserPostServiceImpl extends MPJBaseServiceImpl<ProjectUserPostMapper, ProjectUserPost> implements IProjectUserPostService
{
@Autowired
private ProjectUserPostMapper projectUserPostMapper;
/**
* 查询项目用户岗位关系
*
* @param id 项目用户岗位关系主键
* @return 项目用户岗位关系
*/
@Override
public ProjectUserPost selectProjectUserPostById(Long id)
{
return projectUserPostMapper.selectProjectUserPostById(id);
}
/**
* 查询项目用户岗位关系列表
*
* @param projectUserPost 项目用户岗位关系
* @return 项目用户岗位关系
*/
@Override
public List<ProjectUserPost> selectProjectUserPostList(ProjectUserPost projectUserPost)
{
return projectUserPostMapper.selectProjectUserPostList(projectUserPost);
}
/**
* 新增项目用户岗位关系
*
* @param projectUserPost 项目用户岗位关系
* @return 结果
*/
@Override
public int insertProjectUserPost(ProjectUserPost projectUserPost)
{
return projectUserPostMapper.insertProjectUserPost(projectUserPost);
}
/**
* 修改项目用户岗位关系
*
* @param projectUserPost 项目用户岗位关系
* @return 结果
*/
@Override
public int updateProjectUserPost(ProjectUserPost projectUserPost)
{
return projectUserPostMapper.updateProjectUserPost(projectUserPost);
}
/**
* 批量删除项目用户岗位关系
*
* @param ids 需要删除的项目用户岗位关系主键
* @return 结果
*/
@Override
public int deleteProjectUserPostByIds(Long[] ids)
{
return projectUserPostMapper.deleteProjectUserPostByIds(ids);
}
/**
* 删除项目用户岗位关系信息
*
* @param id 项目用户岗位关系主键
* @return 结果
*/
@Override
public int deleteProjectUserPostById(Long id)
{
return projectUserPostMapper.deleteProjectUserPostById(id);
}
}
<?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.censoft.censoftrongtong.mapper.ProjectUserPostMapper">
<resultMap type="com.censoft.censoftrongtong.domain.ProjectUserPost" id="ProjectUserPostResult">
<result property="id" column="id" />
<result property="projectId" column="project_id" />
<result property="userId" column="user_id" />
<result property="postId" column="post_id" />
</resultMap>
<sql id="selectProjectUserPostVo">
select id, project_id, user_id, post_id from project_user_post
</sql>
<select id="selectProjectUserPostList" parameterType="com.censoft.censoftrongtong.domain.ProjectUserPost" resultMap="ProjectUserPostResult">
<include refid="selectProjectUserPostVo"/>
<where>
<if test="projectId != null "> and project_id = #{projectId}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="postId != null "> and post_id = #{postId}</if>
</where>
</select>
<select id="selectProjectUserPostById" parameterType="Long" resultMap="ProjectUserPostResult">
<include refid="selectProjectUserPostVo"/>
where id = #{id}
</select>
<insert id="insertProjectUserPost" parameterType="com.censoft.censoftrongtong.domain.ProjectUserPost">
insert into project_user_post
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="projectId != null">project_id,</if>
<if test="userId != null">user_id,</if>
<if test="postId != null">post_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="projectId != null">#{projectId},</if>
<if test="userId != null">#{userId},</if>
<if test="postId != null">#{postId},</if>
</trim>
</insert>
<update id="updateProjectUserPost" parameterType="com.censoft.censoftrongtong.domain.ProjectUserPost">
update project_user_post
<trim prefix="SET" suffixOverrides=",">
<if test="projectId != null">project_id = #{projectId},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="postId != null">post_id = #{postId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteProjectUserPostById" parameterType="Long">
delete from project_user_post where id = #{id}
</delete>
<delete id="deleteProjectUserPostByIds" parameterType="String">
delete from project_user_post where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
...@@ -89,11 +89,41 @@ public class SysUser extends BaseEntity ...@@ -89,11 +89,41 @@ public class SysUser extends BaseEntity
/** 角色ID */ /** 角色ID */
private Long roleId; private Long roleId;
private String projectId;
private String postId;
private String postName;
public SysUser() public SysUser()
{ {
} }
public String getPostId() {
return postId;
}
public void setPostId(String postId) {
this.postId = postId;
}
public String getPostName() {
return postName;
}
public void setPostName(String postName) {
this.postName = postName;
}
public String getProjectId() {
return projectId;
}
public void setProjectId(String projectId) {
this.projectId = projectId;
}
public SysUser(Long userId) public SysUser(Long userId)
{ {
this.userId = userId; this.userId = userId;
......
...@@ -23,6 +23,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -23,6 +23,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="remark" column="remark" /> <result property="remark" column="remark" />
<result property="postId" column="post_id" />
<result property="postName" column="post_name" />
<association property="dept" column="dept_id" javaType="SysDept" resultMap="deptResult" /> <association property="dept" column="dept_id" javaType="SysDept" resultMap="deptResult" />
<collection property="roles" javaType="java.util.List" resultMap="RoleResult" /> <collection property="roles" javaType="java.util.List" resultMap="RoleResult" />
</resultMap> </resultMap>
...@@ -57,8 +59,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -57,8 +59,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql> </sql>
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult"> <select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status,
u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
d.dept_name, d.leader
<if test="projectId != null and projectId != ''">
, b.post_id,b.post_name
</if>
from sys_user u
left join sys_dept d on u.dept_id = d.dept_id left join sys_dept d on u.dept_id = d.dept_id
<if test="projectId != null and projectId != ''">
LEFT JOIN project_user_post a on a.user_id = u.user_id and a.project_id = #{projectId}
LEFT JOIN sys_post b on a.post_id = b.post_id
</if>
where u.del_flag = '0' where u.del_flag = '0'
<if test="userId != null and userId != 0"> <if test="userId != null and userId != 0">
AND u.user_id = #{userId} AND u.user_id = #{userId}
......
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