Commit 3976dd89 authored by hongguangwu's avatar hongguangwu

数据权限

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