Commit d4f4b9c1 by wangqi

帮扶组维护的修改

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