Commit 3976dd89 authored by hongguangwu's avatar hongguangwu

数据权限

parent 47ce58a4
...@@ -70,6 +70,12 @@ public class TCertRecord extends BaseEntity { ...@@ -70,6 +70,12 @@ public class TCertRecord extends BaseEntity {
private String empIdcard; private String empIdcard;
/** /**
* 项目id
*/
@ExcelAttribute(name = "项目id" )
@Schema(description ="项目id")
private String deptId;
/**
* 项目名称 * 项目名称
*/ */
@ExcelAttribute(name = "项目名称" ) @ExcelAttribute(name = "项目名称" )
......
...@@ -22,6 +22,7 @@ import com.alibaba.excel.annotation.write.style.ColumnWidth; ...@@ -22,6 +22,7 @@ import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute; import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttributeConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttributeConstants;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
...@@ -38,7 +39,7 @@ import java.util.List; ...@@ -38,7 +39,7 @@ import java.util.List;
*/ */
@Data @Data
@ColumnWidth(15) @ColumnWidth(15)
public class EmployeeProjectExportVO{ public class EmployeeProjectExportVO extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -23,8 +23,13 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.TCertRecord; ...@@ -23,8 +23,13 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.TCertRecord;
import com.yifu.cloud.plus.v1.yifu.archives.service.TCertRecordService; import com.yifu.cloud.plus.v1.yifu.archives.service.TCertRecordService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.CertRecordSearchVo; import com.yifu.cloud.plus.v1.yifu.archives.vo.CertRecordSearchVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TCertRecordVo; import com.yifu.cloud.plus.v1.yifu.archives.vo.TCertRecordVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.MenuUtil;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog; import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
...@@ -50,7 +55,7 @@ import java.util.List; ...@@ -50,7 +55,7 @@ import java.util.List;
public class TCertRecordController { public class TCertRecordController {
private final TCertRecordService tCertRecordService; private final TCertRecordService tCertRecordService;
private final MenuUtil menuUtil;
/** /**
* 分页查询 * 分页查询
* @param page 分页对象 * @param page 分页对象
...@@ -61,6 +66,11 @@ public class TCertRecordController { ...@@ -61,6 +66,11 @@ public class TCertRecordController {
@GetMapping("/page" ) @GetMapping("/page" )
//@PreAuthorize("@pms.hasPermission('demo_tcertrecord_get')" ) //@PreAuthorize("@pms.hasPermission('demo_tcertrecord_get')" )
public R<IPage<TCertRecord>> getTCertRecordPage(Page page, CertRecordSearchVo searchVo) { public R<IPage<TCertRecord>> getTCertRecordPage(Page page, CertRecordSearchVo searchVo) {
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
menuUtil.setAuthSql(user, searchVo);
return R.ok(tCertRecordService.pageDiy(page, searchVo)); return R.ok(tCertRecordService.pageDiy(page, searchVo));
} }
/** /**
...@@ -72,6 +82,11 @@ public class TCertRecordController { ...@@ -72,6 +82,11 @@ public class TCertRecordController {
@GetMapping("/noPage" ) @GetMapping("/noPage" )
//@PreAuthorize("@pms.hasPermission('demo_tcertrecord_get')" ) //@PreAuthorize("@pms.hasPermission('demo_tcertrecord_get')" )
public R<List<TCertRecord>> getTCertRecordNoPage(CertRecordSearchVo searchVo) { public R<List<TCertRecord>> getTCertRecordNoPage(CertRecordSearchVo searchVo) {
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
menuUtil.setAuthSql(user, searchVo);
return R.ok(tCertRecordService.getTCertRecordNoPage(searchVo)); return R.ok(tCertRecordService.getTCertRecordNoPage(searchVo));
} }
......
...@@ -303,6 +303,13 @@ public class TEmployeeInfoController { ...@@ -303,6 +303,13 @@ public class TEmployeeInfoController {
// @ResponseExcel // @ResponseExcel
@PostMapping("/exportEmployee") @PostMapping("/exportEmployee")
public void exportEmployee(@RequestBody(required = false) TEmployeeInfo employeeInfo, HttpServletResponse response) { public void exportEmployee(@RequestBody(required = false) TEmployeeInfo employeeInfo, HttpServletResponse response) {
YifuUser user = SecurityUtils.getUser();
if (user != null && Common.isEmpty(user.getId())) {
menuUtil.setAuthSql(user, employeeInfo);
if (Common.isNotNull(employeeInfo.getAuthSql()) && employeeInfo.getAuthSql().contains(CommonConstants.A_DEPT_ID)) {
employeeInfo.setAuthSql(employeeInfo.getAuthSql().replace(CommonConstants.A_DEPT_ID, "b.id"));
}
}
tEmployeeInfoService.exportEmployee(employeeInfo, response); tEmployeeInfoService.exportEmployee(employeeInfo, response);
} }
...@@ -317,6 +324,13 @@ public class TEmployeeInfoController { ...@@ -317,6 +324,13 @@ public class TEmployeeInfoController {
// @ResponseExcel // @ResponseExcel
@PostMapping("/exportLeaveEmployee") @PostMapping("/exportLeaveEmployee")
public void exportLeaveEmployee(@RequestBody(required = false) TEmployeeInfo employeeInfo, HttpServletResponse response) { public void exportLeaveEmployee(@RequestBody(required = false) TEmployeeInfo employeeInfo, HttpServletResponse response) {
YifuUser user = SecurityUtils.getUser();
if (user != null && Common.isEmpty(user.getId())) {
menuUtil.setAuthSql(user, employeeInfo);
if (Common.isNotNull(employeeInfo.getAuthSql()) && employeeInfo.getAuthSql().contains(CommonConstants.A_DEPT_ID)) {
employeeInfo.setAuthSql(employeeInfo.getAuthSql().replace(CommonConstants.A_DEPT_ID, "b.id"));
}
}
tEmployeeInfoService.exportLeaveEmployee(employeeInfo, response); tEmployeeInfoService.exportLeaveEmployee(employeeInfo, response);
} }
......
...@@ -25,10 +25,14 @@ import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeProjectService; ...@@ -25,10 +25,14 @@ import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeProjectService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectExportVO; import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectExportVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.UpProjectSocialFundVo; import com.yifu.cloud.plus.v1.yifu.archives.vo.UpProjectSocialFundVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage; import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.MenuUtil;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog; import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner; import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
...@@ -57,6 +61,8 @@ public class TEmployeeProjectController { ...@@ -57,6 +61,8 @@ public class TEmployeeProjectController {
private final TEmployeeProjectService tEmployeeProjectService; private final TEmployeeProjectService tEmployeeProjectService;
private final MenuUtil menuUtil;
/** /**
* @param empId 人员档案id * @param empId 人员档案id
* @Description: 根据人员档案id获取项目list * @Description: 根据人员档案id获取项目list
...@@ -82,6 +88,11 @@ public class TEmployeeProjectController { ...@@ -82,6 +88,11 @@ public class TEmployeeProjectController {
@Operation(summary = "分页查询", description = "分页查询") @Operation(summary = "分页查询", description = "分页查询")
@GetMapping("/page" ) @GetMapping("/page" )
public R<IPage<TEmployeeProject>> getTEmployeeProjectPage(Page page, TEmployeeProject tEmployeeProject) { public R<IPage<TEmployeeProject>> getTEmployeeProjectPage(Page page, TEmployeeProject tEmployeeProject) {
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
menuUtil.setAuthSql(user, tEmployeeProject);
return R.ok(tEmployeeProjectService.getTEmployeeProjectInfoPage(page,tEmployeeProject)); return R.ok(tEmployeeProjectService.getTEmployeeProjectInfoPage(page,tEmployeeProject));
} }
...@@ -252,6 +263,10 @@ public class TEmployeeProjectController { ...@@ -252,6 +263,10 @@ public class TEmployeeProjectController {
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, @RequestParam(name = "idstr", required = false)String idstr, public void export(HttpServletResponse response, @RequestParam(name = "idstr", required = false)String idstr,
@RequestBody List<String> exportFields, EmployeeProjectExportVO projectDTO) { @RequestBody List<String> exportFields, EmployeeProjectExportVO projectDTO) {
YifuUser user = SecurityUtils.getUser();
if (user != null && Common.isEmpty(user.getId())) {
menuUtil.setAuthSql(user, projectDTO);
}
tEmployeeProjectService.listExportProject(response,projectDTO,idstr,exportFields); tEmployeeProjectService.listExportProject(response,projectDTO,idstr,exportFields);
} }
......
...@@ -121,6 +121,7 @@ public class TCertRecordServiceImpl extends ServiceImpl<TCertRecordMapper, TCert ...@@ -121,6 +121,7 @@ public class TCertRecordServiceImpl extends ServiceImpl<TCertRecordMapper, TCert
@Override @Override
public IPage<TCertRecord> pageDiy(Page page, CertRecordSearchVo searchVo) { public IPage<TCertRecord> pageDiy(Page page, CertRecordSearchVo searchVo) {
LambdaQueryWrapper<TCertRecord> wrapper = buildQueryWrapper(searchVo); LambdaQueryWrapper<TCertRecord> wrapper = buildQueryWrapper(searchVo);
wrapper.last(searchVo.getAuthSql());
wrapper.orderByDesc(TCertRecord::getCreateTime); wrapper.orderByDesc(TCertRecord::getCreateTime);
return baseMapper.selectPage(page,wrapper); return baseMapper.selectPage(page,wrapper);
} }
...@@ -132,6 +133,7 @@ public class TCertRecordServiceImpl extends ServiceImpl<TCertRecordMapper, TCert ...@@ -132,6 +133,7 @@ public class TCertRecordServiceImpl extends ServiceImpl<TCertRecordMapper, TCert
if (Common.isNotNull(idList)){ if (Common.isNotNull(idList)){
wrapper.in(TCertRecord::getId,idList); wrapper.in(TCertRecord::getId,idList);
} }
wrapper.last(searchVo.getAuthSql());
return baseMapper.selectList(wrapper); return baseMapper.selectList(wrapper);
} }
private LambdaQueryWrapper buildQueryWrapper(CertRecordSearchVo entity){ private LambdaQueryWrapper buildQueryWrapper(CertRecordSearchVo entity){
......
...@@ -50,5 +50,6 @@ ...@@ -50,5 +50,6 @@
<result property="openTime" column="OPEN_TIME"/> <result property="openTime" column="OPEN_TIME"/>
<result property="introductionUnit" column="INTRODUCTION_UNIT"/> <result property="introductionUnit" column="INTRODUCTION_UNIT"/>
<result property="socialTime" column="SOCIAL_TIME"/> <result property="socialTime" column="SOCIAL_TIME"/>
<result property="deptId" column="DEPT_ID"/>
</resultMap> </resultMap>
</mapper> </mapper>
...@@ -633,6 +633,9 @@ ...@@ -633,6 +633,9 @@
<where> <where>
a.DELETE_FLAG = '0' and b.DELETE_FLAG = '0' a.DELETE_FLAG = '0' and b.DELETE_FLAG = '0'
<include refid="employeeInfo_where"/> <include refid="employeeInfo_where"/>
<if test="tEmployeeInfo.authSql != null and tEmployeeInfo.authSql.trim() != ''">
${tEmployeeInfo.authSql}
</if>
</where> </where>
GROUP BY a.id order by a.CREATE_TIME desc GROUP BY a.id order by a.CREATE_TIME desc
</select> </select>
...@@ -653,6 +656,9 @@ ...@@ -653,6 +656,9 @@
<where> <where>
a.DELETE_FLAG = '0' and b.DELETE_FLAG = '0' a.DELETE_FLAG = '0' and b.DELETE_FLAG = '0'
<include refid="employeeInfo_where"/> <include refid="employeeInfo_where"/>
<if test="tEmployeeInfo.authSql != null and tEmployeeInfo.authSql.trim() != ''">
${tEmployeeInfo.authSql}
</if>
</where> </where>
GROUP BY a.id order by a.CREATE_TIME desc GROUP BY a.id order by a.CREATE_TIME desc
) b ) b
......
...@@ -781,6 +781,9 @@ ...@@ -781,6 +781,9 @@
<where> <where>
a.DELETE_FLAG = '0' a.DELETE_FLAG = '0'
<include refid="tEmployeeProject_where"/> <include refid="tEmployeeProject_where"/>
<if test="tEmployeeProject.authSql != null and tEmployeeProject.authSql.trim() != ''">
${tEmployeeProject.authSql}
</if>
</where> </where>
order by a.CREATE_TIME desc order by a.CREATE_TIME desc
</select> </select>
...@@ -793,6 +796,10 @@ ...@@ -793,6 +796,10 @@
<where> <where>
a.DELETE_FLAG = '0' a.DELETE_FLAG = '0'
<include refid="exportTEmployeeProject_where"/> <include refid="exportTEmployeeProject_where"/>
<if test="tEmployeeProject.authSql != null and tEmployeeProject.authSql.trim() != ''">
${tEmployeeProject.authSql}
</if>
</where> </where>
order by a.CREATE_TIME desc
</select> </select>
</mapper> </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