Commit d4f4b9c1 by wangqi

帮扶组维护的修改

parent 85320c88
......@@ -71,6 +71,7 @@ public class SysUserController extends BaseController
@GetMapping("/rylist")
public TableDataInfo rylist(SysUser user)
{
startPage();
List<SysUser> list = userService.selectUserList(user);
return getDataTable(list);
}
......
......@@ -60,4 +60,6 @@ public interface SysUserRoleMapper
* @return 结果
*/
public int deleteUserRoleInfos(@Param("roleId") Long roleId, @Param("userIds") Long[] userIds);
public int insertUserRole(SysUserRole userRole);
}
......@@ -67,6 +67,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userName != null and userName != ''">
AND u.user_name like concat('%', #{userName}, '%')
</if>
<if test="nickName != null and nickName != ''">
AND u.nick_name like concat('%', #{nickName}, '%')
</if>
<if test="status != null and status != ''">
AND u.status = #{status}
</if>
......
......@@ -41,4 +41,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{userId}
</foreach>
</delete>
<insert id="insertUserRole" parameterType="SysUserRole" >
insert into sys_user_role
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">user_id,</if>
<if test="roleId != null">role_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},</if>
<if test="roleId != null">#{roleId},</if>
</trim>
</insert>
</mapper>
......@@ -4,7 +4,9 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.qianhe.common.core.domain.entity.SysDept;
import com.qianhe.common.core.domain.entity.SysRole;
import com.qianhe.common.utils.SecurityUtils;
import com.qianhe.common.utils.StringUtils;
import com.qianhe.domain.SjBfzwh;
import com.qianhe.service.ISjBfzwhService;
import com.qianhe.system.service.ISysDeptService;
......@@ -46,13 +48,16 @@ public class SjBfzwhController extends BaseController
@GetMapping("/list")
public TableDataInfo list(SjBfzwh sjBfzwh)
{
// 获取当前用户名
String username = SecurityUtils.getUsername();
if(username.equals("admin") || username.equals("sjgly") ){
}else{
sjBfzwh.setLxr(username);
sjBfzwh.setLxr(SecurityUtils.getUserId());
// 拿到角色如果是管理员 不限制。不是管理员只能看到自己的帮扶组
List<SysRole> rolelist = SecurityUtils.getLoginUser().getUser().getRoles();
if(StringUtils.isNotEmpty(rolelist)){
for (SysRole role :rolelist){
Long roleid = role.getRoleId();
if(roleid==1||roleid==100){
sjBfzwh.setLxr(null);
}
}
}
startPage();
List<SjBfzwh> list = sjBfzwhService.selectSjBfzwhList(sjBfzwh);
......@@ -66,9 +71,8 @@ public class SjBfzwhController extends BaseController
public TableDataInfo xlklist(SjBfzwh sjBfzwh)
{
// 获取当前用户名
String username = SecurityUtils.getUsername();
sjBfzwh.setLxr(username);
// 获取当前登陆人
sjBfzwh.setLxr(SecurityUtils.getUserId());
List<SjBfzwh> list = sjBfzwhService.selectSjBfzwhList(sjBfzwh);
return getDataTable(list);
......@@ -82,9 +86,9 @@ public class SjBfzwhController extends BaseController
@PostMapping("/export")
public void export(HttpServletResponse response, SjBfzwh sjBfzwh)
{
// 获取当前用户名
String username = SecurityUtils.getUsername();
sjBfzwh.setLxr(username);
// 获取当前登陆人
sjBfzwh.setLxr(SecurityUtils.getUserId());
List<SjBfzwh> list = sjBfzwhService.selectSjBfzwhList(sjBfzwh);
ExcelUtil<SjBfzwh> util = new ExcelUtil<SjBfzwh>(SjBfzwh.class);
util.exportExcel(response, list, "三基帮扶组维护数据");
......@@ -93,7 +97,6 @@ public class SjBfzwhController extends BaseController
/**
* 获取三基帮扶组维护详细信息
*/
@PreAuthorize("@ss.hasPermi('system:bfzwh:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
......
......@@ -26,7 +26,9 @@ public class SjBfzwh extends BaseEntity
/** 联系人 */
@Excel(name = "联系人")
private String lxr;
private Long lxr;
private String lxrname;
/** 年度 */
@Excel(name = "年度")
......@@ -75,12 +77,12 @@ public class SjBfzwh extends BaseEntity
{
return bfzmc;
}
public void setLxr(String lxr)
public void setLxr(Long lxr)
{
this.lxr = lxr;
}
public String getLxr()
public Long getLxr()
{
return lxr;
}
......@@ -161,4 +163,12 @@ public class SjBfzwh extends BaseEntity
public void setDeptIds(Long[] deptIds) {
this.deptIds = deptIds;
}
public String getLxrname() {
return lxrname;
}
public void setLxrname(String lxrname) {
this.lxrname = lxrname;
}
}
......@@ -8,10 +8,13 @@ import java.util.stream.Collectors;
import com.qianhe.common.annotation.DataScope;
import com.qianhe.common.core.domain.TreeSelect;
import com.qianhe.common.core.domain.entity.SysDept;
import com.qianhe.common.utils.SecurityUtils;
import com.qianhe.domain.SjBfzbfdx;
import com.qianhe.domain.SjBfzwh;
import com.qianhe.mapper.SjBfzwhMapper;
import com.qianhe.service.ISjBfzwhService;
import com.qianhe.system.domain.SysUserRole;
import com.qianhe.system.mapper.SysUserRoleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -62,6 +65,8 @@ public class SjBfzwhServiceImpl implements ISjBfzwhService
return sjBfzwhMapper.selectSjBfzwhList(sjBfzwh);
}
@Autowired
private SysUserRoleMapper userRoleMapper;
/**
* 新增三基帮扶组维护
*
......@@ -72,6 +77,13 @@ public class SjBfzwhServiceImpl implements ISjBfzwhService
@Transactional
public int insertSjBfzwh(SjBfzwh sjBfzwh)
{
// 给联系人一个帮扶组角色
SysUserRole userRole = new SysUserRole();
userRole.setUserId(sjBfzwh.getLxr());
userRole.setRoleId(new Long(104));
userRoleMapper.deleteUserRoleInfo(userRole);
userRoleMapper.insertUserRole(userRole);
sjBfzwhMapper.insertSjBfzwh(sjBfzwh);
return insertBfzBfdx(sjBfzwh);
}
......@@ -83,7 +95,6 @@ public class SjBfzwhServiceImpl implements ISjBfzwhService
public int insertBfzBfdx(SjBfzwh sjBfzwh)
{
int rows = 1;
// 新增用户与角色管理
List<SjBfzbfdx> list = new ArrayList<SjBfzbfdx>();
for (Long deptId : sjBfzwh.getDeptIds())
{
......@@ -109,8 +120,15 @@ public class SjBfzwhServiceImpl implements ISjBfzwhService
@Transactional
public int updateSjBfzwh(SjBfzwh sjBfzwh)
{
// 给联系人一个帮扶组角色
SysUserRole userRole = new SysUserRole();
userRole.setUserId(sjBfzwh.getLxr());
userRole.setRoleId(new Long(104));
userRoleMapper.deleteUserRoleInfo(userRole);
userRoleMapper.insertUserRole(userRole);
sjBfzwhMapper.updateSjBfzwh(sjBfzwh);
// 删除角色与菜单关联
// 删除帮扶组与帮扶对象关联
sjBfzwhMapper.deleteBfzBfdxById(sjBfzwh.getId());
return insertBfzBfdx(sjBfzwh);
}
......
......@@ -17,8 +17,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectSjBfzwhVo">
select id, bfzmc, lxr, nd, lrr, lrsj, xgr, xgsj, bz
from sj_bfzwh
select a.id, a.bfzmc, a.lxr, a.nd, a.lrr, s.nick_name lxrname, a.lrsj, a.xgr, a.xgsj, a.bz
from sj_bfzwh a
left join sys_user s on a.lxr = s.user_id
</sql>
<select id="selectSjBfzwhList" parameterType="SjBfzwh" resultMap="SjBfzwhResult">
......
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