mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-11-06 18:53:45 +08:00
@@ -28,7 +28,7 @@ public class NoticeQueryForm extends PageParam {
|
||||
private String documentNumber;
|
||||
|
||||
@Schema(description = "创建人")
|
||||
private Long createUserId;
|
||||
private String createUserName;
|
||||
|
||||
@Schema(description = "删除标识")
|
||||
private Boolean deletedFlag;
|
||||
|
||||
@@ -208,6 +208,10 @@ public class NoticeService {
|
||||
}
|
||||
|
||||
NoticeUpdateFormVO updateFormVO = SmartBeanUtil.copy(noticeEntity, NoticeUpdateFormVO.class);
|
||||
NoticeTypeVO noticeType = noticeTypeService.getByNoticeTypeId(noticeEntity.getNoticeTypeId());
|
||||
updateFormVO.setNoticeTypeName(noticeType.getNoticeTypeName());
|
||||
updateFormVO.setPublishFlag(updateFormVO.getPublishTime() != null && updateFormVO.getPublishTime().isBefore(LocalDateTime.now()));
|
||||
|
||||
if (!updateFormVO.getAllVisibleFlag()) {
|
||||
List<NoticeVisibleRangeVO> noticeVisibleRangeList = noticeDao.queryVisibleRange(noticeId);
|
||||
List<Long> employeeIdList = noticeVisibleRangeList.stream().filter(e -> NoticeVisibleRangeDataTypeEnum.EMPLOYEE.getValue().equals(e.getDataType()))
|
||||
|
||||
@@ -5,7 +5,7 @@ import net.lab1024.sa.base.common.enumeration.BaseEnum;
|
||||
|
||||
|
||||
/**
|
||||
* 数据范围 种类
|
||||
* 数据可见范围类型
|
||||
*
|
||||
* @Author 1024创新实验室: 罗伊
|
||||
* @Date 2020/11/28 20:59:17
|
||||
|
||||
@@ -25,7 +25,7 @@ public class DataScopeSqlConfig {
|
||||
/**
|
||||
* join sql 具体实现类
|
||||
*/
|
||||
private Class joinSqlImplClazz;
|
||||
private Class<?> joinSqlImplClazz;
|
||||
|
||||
private String joinSql;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 数据范围
|
||||
* 数据可见范围
|
||||
*
|
||||
* @Author 1024创新实验室: 罗伊
|
||||
* @Date 2020/11/28 20:59:17
|
||||
|
||||
@@ -46,6 +46,11 @@ public class DataScopeSqlConfigService {
|
||||
|
||||
private static final String DEPARTMENT_PARAM = "#departmentIds";
|
||||
|
||||
/**
|
||||
* 用于拼接查看本人数据范围的 SQL
|
||||
*/
|
||||
private static final String CREATE_USER_ID_EQUALS = "create_user_id = ";
|
||||
|
||||
private final ConcurrentHashMap<String, DataScopeSqlConfig> dataScopeMethodMap = new ConcurrentHashMap<>();
|
||||
|
||||
@Resource
|
||||
@@ -94,14 +99,23 @@ public class DataScopeSqlConfigService {
|
||||
* 组装需要拼接的sql
|
||||
*/
|
||||
public String getJoinSql(Map<String, Object> paramMap, DataScopeSqlConfig sqlConfigDTO) {
|
||||
DataScopeTypeEnum dataScopeTypeEnum = sqlConfigDTO.getDataScopeType();
|
||||
String joinSql = sqlConfigDTO.getJoinSql();
|
||||
Long employeeId = SmartRequestUtil.getRequestUserId();
|
||||
if (employeeId == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
DataScopeTypeEnum dataScopeTypeEnum = sqlConfigDTO.getDataScopeType();
|
||||
DataScopeViewTypeEnum viewTypeEnum = dataScopeViewService.getEmployeeDataScopeViewType(dataScopeTypeEnum, employeeId);
|
||||
|
||||
// 数据权限设置为仅本人可见时 直接返回 create_user_id = employeeId
|
||||
if (DataScopeViewTypeEnum.ME == viewTypeEnum) {
|
||||
return CREATE_USER_ID_EQUALS + employeeId;
|
||||
}
|
||||
|
||||
String joinSql = sqlConfigDTO.getJoinSql();
|
||||
|
||||
if (DataScopeWhereInTypeEnum.CUSTOM_STRATEGY == sqlConfigDTO.getDataScopeWhereInType()) {
|
||||
Class strategyClass = sqlConfigDTO.getJoinSqlImplClazz();
|
||||
Class<?> strategyClass = sqlConfigDTO.getJoinSqlImplClazz();
|
||||
if (strategyClass == null) {
|
||||
log.warn("data scope custom strategy class is null");
|
||||
return "";
|
||||
@@ -111,11 +125,10 @@ public class DataScopeSqlConfigService {
|
||||
log.warn("data scope custom strategy class:{} ,bean is null", sqlConfigDTO.getJoinSqlImplClazz());
|
||||
return "";
|
||||
}
|
||||
DataScopeViewTypeEnum viewTypeEnum = dataScopeViewService.getEmployeeDataScopeViewType(dataScopeTypeEnum, employeeId);
|
||||
return powerStrategy.getCondition(viewTypeEnum,paramMap, sqlConfigDTO);
|
||||
}
|
||||
if (DataScopeWhereInTypeEnum.EMPLOYEE == sqlConfigDTO.getDataScopeWhereInType()) {
|
||||
List<Long> canViewEmployeeIds = dataScopeViewService.getCanViewEmployeeId(dataScopeTypeEnum, employeeId);
|
||||
List<Long> canViewEmployeeIds = dataScopeViewService.getCanViewEmployeeId(viewTypeEnum, employeeId);
|
||||
if (CollectionUtils.isEmpty(canViewEmployeeIds)) {
|
||||
return "";
|
||||
}
|
||||
@@ -124,7 +137,7 @@ public class DataScopeSqlConfigService {
|
||||
return sql;
|
||||
}
|
||||
if (DataScopeWhereInTypeEnum.DEPARTMENT == sqlConfigDTO.getDataScopeWhereInType()) {
|
||||
List<Long> canViewDepartmentIds = dataScopeViewService.getCanViewDepartmentId(dataScopeTypeEnum, employeeId);
|
||||
List<Long> canViewDepartmentIds = dataScopeViewService.getCanViewDepartmentId(viewTypeEnum, employeeId);
|
||||
if (CollectionUtils.isEmpty(canViewDepartmentIds)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -44,10 +44,9 @@ public class DataScopeViewService {
|
||||
private DepartmentService departmentService;
|
||||
|
||||
/**
|
||||
* 获取某人可以查看的所有人员信息
|
||||
* 获取某人可以查看的所有人员数据
|
||||
*/
|
||||
public List<Long> getCanViewEmployeeId(DataScopeTypeEnum dataScopeTypeEnum, Long employeeId) {
|
||||
DataScopeViewTypeEnum viewType = this.getEmployeeDataScopeViewType(dataScopeTypeEnum, employeeId);
|
||||
public List<Long> getCanViewEmployeeId(DataScopeViewTypeEnum viewType, Long employeeId) {
|
||||
if (DataScopeViewTypeEnum.ME == viewType) {
|
||||
return this.getMeEmployeeIdList(employeeId);
|
||||
}
|
||||
@@ -57,16 +56,17 @@ public class DataScopeViewService {
|
||||
if (DataScopeViewTypeEnum.DEPARTMENT_AND_SUB == viewType) {
|
||||
return this.getDepartmentAndSubEmployeeIdList(employeeId);
|
||||
}
|
||||
// 可以查看所有员工数据
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取某人可以查看的所有部门信息
|
||||
* 获取某人可以查看的所有部门数据
|
||||
*/
|
||||
public List<Long> getCanViewDepartmentId(DataScopeTypeEnum dataScopeTypeEnum, Long employeeId) {
|
||||
DataScopeViewTypeEnum viewType = this.getEmployeeDataScopeViewType(dataScopeTypeEnum, employeeId);
|
||||
public List<Long> getCanViewDepartmentId(DataScopeViewTypeEnum viewType, Long employeeId) {
|
||||
if (DataScopeViewTypeEnum.ME == viewType) {
|
||||
return this.getMeDepartmentIdList(employeeId);
|
||||
// 数据可见范围类型为本人时 不可以查看任何部门数据
|
||||
return Lists.newArrayList(0L);
|
||||
}
|
||||
if (DataScopeViewTypeEnum.DEPARTMENT == viewType) {
|
||||
return this.getMeDepartmentIdList(employeeId);
|
||||
@@ -74,6 +74,7 @@ public class DataScopeViewService {
|
||||
if (DataScopeViewTypeEnum.DEPARTMENT_AND_SUB == viewType) {
|
||||
return this.getDepartmentAndSubIdList(employeeId);
|
||||
}
|
||||
// 可以查看所有部门数据
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
|
||||
@@ -91,10 +92,16 @@ public class DataScopeViewService {
|
||||
* 根据员工id 获取各数据范围最大的可见范围 map<dataScopeType,viewType></>
|
||||
*/
|
||||
public DataScopeViewTypeEnum getEmployeeDataScopeViewType(DataScopeTypeEnum dataScopeTypeEnum, Long employeeId) {
|
||||
if (employeeId == null) {
|
||||
EmployeeEntity employeeEntity = employeeDao.selectById(employeeId);
|
||||
if (employeeEntity == null || employeeEntity.getEmployeeId() == null) {
|
||||
return DataScopeViewTypeEnum.ME;
|
||||
}
|
||||
|
||||
// 如果是超级管理员 则可查看全部
|
||||
if (employeeEntity.getAdministratorFlag()) {
|
||||
return DataScopeViewTypeEnum.ALL;
|
||||
}
|
||||
|
||||
List<Long> roleIdList = roleEmployeeDao.selectRoleIdByEmployeeId(employeeId);
|
||||
//未设置角色 默认本人
|
||||
if (CollectionUtils.isEmpty(roleIdList)) {
|
||||
|
||||
@@ -57,11 +57,11 @@ public class EmployeeController {
|
||||
return employeeService.updateEmployee(employeeUpdateForm);
|
||||
}
|
||||
|
||||
@Operation(summary = "更新登录人信息 @author 善逸")
|
||||
@PostMapping("/employee/update/login")
|
||||
public ResponseDTO<String> updateByLogin(@Valid @RequestBody EmployeeUpdateForm employeeUpdateForm) {
|
||||
employeeUpdateForm.setEmployeeId(SmartRequestUtil.getRequestUserId());
|
||||
return employeeService.updateEmployee(employeeUpdateForm);
|
||||
@Operation(summary = "更新员工个人中心信息 @author 善逸")
|
||||
@PostMapping("/employee/update/center")
|
||||
public ResponseDTO<String> updateCenter(@Valid @RequestBody EmployeeUpdateCenterForm updateCenterForm) {
|
||||
updateCenterForm.setEmployeeId(SmartRequestUtil.getRequestUserId());
|
||||
return employeeService.updateCenter(updateCenterForm);
|
||||
}
|
||||
|
||||
@Operation(summary = "更新登录人头像 @author 善逸")
|
||||
|
||||
@@ -34,31 +34,30 @@ public interface EmployeeDao extends BaseMapper<EmployeeEntity> {
|
||||
*/
|
||||
List<EmployeeVO> selectEmployeeByDisabledAndDeleted(@Param("disabledFlag") Boolean disabledFlag, @Param("deletedFlag") Boolean deletedFlag);
|
||||
|
||||
|
||||
/**
|
||||
* 更新单个
|
||||
* 更新禁用状态
|
||||
*/
|
||||
void updateDisableFlag(@Param("employeeId") Long employeeId, @Param("disabledFlag") Boolean disabledFlag);
|
||||
|
||||
|
||||
/**
|
||||
* 通过登录名查询
|
||||
*/
|
||||
EmployeeEntity getByLoginName(@Param("loginName") String loginName,
|
||||
@Param("disabledFlag") Boolean disabledFlag);
|
||||
|
||||
EmployeeEntity getByLoginName(@Param("loginName") String loginName, @Param("deletedFlag") Boolean deletedFlag);
|
||||
|
||||
/**
|
||||
* 通过姓名查询
|
||||
*/
|
||||
EmployeeEntity getByActualName(@Param("actualName") String actualName,
|
||||
@Param("disabledFlag") Boolean disabledFlag
|
||||
);
|
||||
EmployeeEntity getByActualName(@Param("actualName") String actualName, @Param("deletedFlag") Boolean deletedFlag);
|
||||
|
||||
/**
|
||||
* 通过手机号查询
|
||||
*/
|
||||
EmployeeEntity getByPhone(@Param("phone") String phone, @Param("disabledFlag") Boolean disabledFlag);
|
||||
EmployeeEntity getByPhone(@Param("phone") String phone, @Param("deletedFlag") Boolean deletedFlag);
|
||||
|
||||
/**
|
||||
* 通过邮箱账号查询
|
||||
*/
|
||||
EmployeeEntity getByEmail(@Param("email") String email, @Param("deletedFlag") Boolean deletedFlag);
|
||||
|
||||
/**
|
||||
* 获取所有员工
|
||||
@@ -67,7 +66,6 @@ public interface EmployeeDao extends BaseMapper<EmployeeEntity> {
|
||||
|
||||
/**
|
||||
* 获取某个部门员工数
|
||||
*
|
||||
*/
|
||||
Integer countByDepartmentId(@Param("departmentId") Long departmentId, @Param("deletedFlag") Boolean deletedFlag);
|
||||
|
||||
@@ -76,39 +74,35 @@ public interface EmployeeDao extends BaseMapper<EmployeeEntity> {
|
||||
*/
|
||||
List<EmployeeVO> getEmployeeByIds(@Param("employeeIds") Collection<Long> employeeIds);
|
||||
|
||||
|
||||
/**
|
||||
* 查询单个员工信息
|
||||
*/
|
||||
EmployeeVO getEmployeeById(@Param("employeeId") Long employeeId);
|
||||
|
||||
|
||||
/**
|
||||
* 获取某个部门的员工
|
||||
*/
|
||||
List<EmployeeEntity> selectByDepartmentId(@Param("departmentId") Long departmentId, @Param("disabledFlag") Boolean disabledFlag);
|
||||
|
||||
List<EmployeeEntity> selectByDepartmentId(@Param("departmentId") Long departmentId, @Param("deletedFlag") Boolean deletedFlag);
|
||||
|
||||
/**
|
||||
* 查询某些部门下用户名是xxx的员工
|
||||
*/
|
||||
List<EmployeeEntity> selectByActualName(@Param("departmentIdList") List<Long> departmentIdList, @Param("actualName") String actualName, @Param("disabledFlag") Boolean disabledFlag);
|
||||
|
||||
List<EmployeeEntity> selectByActualName(@Param("departmentIdList") List<Long> departmentIdList, @Param("actualName") String actualName, @Param("deletedFlag") Boolean deletedFlag);
|
||||
|
||||
/**
|
||||
* 获取某批部门的员工Id
|
||||
*/
|
||||
List<Long> getEmployeeIdByDepartmentIdList(@Param("departmentIds") List<Long> departmentIds, @Param("disabledFlag") Boolean disabledFlag);
|
||||
List<Long> getEmployeeIdByDepartmentIdList(@Param("departmentIds") List<Long> departmentIds, @Param("deletedFlag") Boolean deletedFlag);
|
||||
|
||||
/**
|
||||
* 获取所有
|
||||
*/
|
||||
List<Long> getEmployeeId(@Param("leaveFlag") Boolean leaveFlag, @Param("disabledFlag") Boolean disabledFlag);
|
||||
List<Long> getEmployeeId(@Param("leaveFlag") Boolean leaveFlag, @Param("deletedFlag") Boolean deletedFlag);
|
||||
|
||||
/**
|
||||
* 获取某个部门的员工Id
|
||||
*/
|
||||
List<Long> getEmployeeIdByDepartmentId(@Param("departmentId") Long departmentId, @Param("disabledFlag") Boolean disabledFlag);
|
||||
List<Long> getEmployeeIdByDepartmentId(@Param("departmentId") Long departmentId, @Param("deletedFlag") Boolean deletedFlag);
|
||||
|
||||
/**
|
||||
* 员工重置密码
|
||||
|
||||
@@ -51,17 +51,19 @@ public class EmployeeAddForm {
|
||||
@Pattern(regexp = SmartVerificationUtil.PHONE_REGEXP, message = "手机号格式不正确")
|
||||
private String phone;
|
||||
|
||||
@Schema(description = "邮箱")
|
||||
@Schema(description = "邮箱账号")
|
||||
@NotNull(message = "邮箱账号不能为空")
|
||||
@Pattern(regexp = SmartVerificationUtil.EMAIL, message = "邮箱账号格式不正确")
|
||||
private String email;
|
||||
|
||||
@Schema(description = "职务级别ID")
|
||||
private Long positionId;
|
||||
|
||||
@Schema(description = "角色列表")
|
||||
private List<Long> roleIdList;
|
||||
|
||||
@Schema(description = "备注")
|
||||
@Length(max = 30, message = "备注最多200字符")
|
||||
@Length(max = 200, message = "备注最多200字符")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "职务级别ID")
|
||||
private Long positionId;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package net.lab1024.sa.admin.module.system.employee.domain.form;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import lombok.Data;
|
||||
import net.lab1024.sa.base.common.enumeration.GenderEnum;
|
||||
import net.lab1024.sa.base.common.swagger.SchemaEnum;
|
||||
import net.lab1024.sa.base.common.util.SmartVerificationUtil;
|
||||
import net.lab1024.sa.base.common.validator.enumeration.CheckEnum;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
/**
|
||||
* 更新员工个人中心信息
|
||||
*
|
||||
* @Author 1024创新实验室: 开云
|
||||
* @Date 2021-12-20 21:06:49
|
||||
* @Wechat zhuoda1024
|
||||
* @Email lab1024@163.com
|
||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||
*/
|
||||
@Data
|
||||
public class EmployeeUpdateCenterForm {
|
||||
|
||||
@Schema(hidden = true)
|
||||
private Long employeeId;
|
||||
|
||||
@Schema(description = "姓名")
|
||||
@NotNull(message = "姓名不能为空")
|
||||
@Length(max = 30, message = "姓名最多30字符")
|
||||
private String actualName;
|
||||
|
||||
@SchemaEnum(GenderEnum.class)
|
||||
@CheckEnum(value = GenderEnum.class, message = "性别错误")
|
||||
private Integer gender;
|
||||
|
||||
@Schema(description = "手机号")
|
||||
@NotNull(message = "手机号不能为空")
|
||||
@Pattern(regexp = SmartVerificationUtil.PHONE_REGEXP, message = "手机号格式不正确")
|
||||
private String phone;
|
||||
|
||||
@Schema(description = "邮箱账号")
|
||||
@NotNull(message = "邮箱账号不能为空")
|
||||
@Pattern(regexp = SmartVerificationUtil.EMAIL, message = "邮箱账号格式不正确")
|
||||
private String email;
|
||||
|
||||
@Schema(description = "职务级别ID")
|
||||
private Long positionId;
|
||||
|
||||
@Schema(description = "头像")
|
||||
private String avatar;
|
||||
|
||||
@Schema(description = "备注")
|
||||
@Length(max = 200, message = "备注最多200字符")
|
||||
private String remark;
|
||||
}
|
||||
@@ -168,19 +168,14 @@ public class EmployeeService {
|
||||
return ResponseDTO.userErrorParam("部门不存在");
|
||||
}
|
||||
|
||||
|
||||
EmployeeEntity existEntity = employeeDao.getByLoginName(employeeUpdateForm.getLoginName(), null);
|
||||
if (null != existEntity && !Objects.equals(existEntity.getEmployeeId(), employeeId)) {
|
||||
return ResponseDTO.userErrorParam("登录名重复");
|
||||
// 检查唯一性
|
||||
ResponseDTO<String> checkResponse = checkUniqueness(employeeId, employeeUpdateForm.getLoginName(), employeeUpdateForm.getPhone(), employeeUpdateForm.getEmail());
|
||||
if (!checkResponse.getOk()) {
|
||||
return checkResponse;
|
||||
}
|
||||
|
||||
existEntity = employeeDao.getByPhone(employeeUpdateForm.getPhone(), null);
|
||||
if (null != existEntity && !Objects.equals(existEntity.getEmployeeId(), employeeId)) {
|
||||
return ResponseDTO.userErrorParam("手机号已存在");
|
||||
}
|
||||
|
||||
// 不更新密码
|
||||
EmployeeEntity entity = SmartBeanUtil.copy(employeeUpdateForm, EmployeeEntity.class);
|
||||
// 不更新密码
|
||||
entity.setLoginPwd(null);
|
||||
|
||||
// 更新数据
|
||||
@@ -192,6 +187,58 @@ public class EmployeeService {
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新员工个人中心信息
|
||||
*/
|
||||
public ResponseDTO<String> updateCenter(EmployeeUpdateCenterForm updateCenterForm) {
|
||||
|
||||
Long employeeId = updateCenterForm.getEmployeeId();
|
||||
EmployeeEntity employeeEntity = employeeDao.selectById(employeeId);
|
||||
if (null == employeeEntity) {
|
||||
return ResponseDTO.error(UserErrorCode.DATA_NOT_EXIST);
|
||||
}
|
||||
|
||||
// 检查唯一性 登录账号不能修改则不需要检查
|
||||
ResponseDTO<String> checkResponse = checkUniqueness(employeeId, "", updateCenterForm.getPhone(), updateCenterForm.getEmail());
|
||||
if (!checkResponse.getOk()) {
|
||||
return checkResponse;
|
||||
}
|
||||
|
||||
EmployeeEntity employee = SmartBeanUtil.copy(updateCenterForm, EmployeeEntity.class);
|
||||
// 不更新密码
|
||||
employee.setLoginPwd(null);
|
||||
|
||||
// 更新数据
|
||||
employeeDao.updateById(employee);
|
||||
|
||||
// 清除员工缓存
|
||||
loginService.clearLoginEmployeeCache(employeeId);
|
||||
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查唯一性
|
||||
*/
|
||||
private ResponseDTO<String> checkUniqueness(Long employeeId, String loginName, String phone, String email) {
|
||||
EmployeeEntity existEntity = employeeDao.getByLoginName(loginName, null);
|
||||
if (null != existEntity && !Objects.equals(existEntity.getEmployeeId(), employeeId)) {
|
||||
return ResponseDTO.userErrorParam("登录名重复");
|
||||
}
|
||||
|
||||
existEntity = employeeDao.getByPhone(phone, null);
|
||||
if (null != existEntity && !Objects.equals(existEntity.getEmployeeId(), employeeId)) {
|
||||
return ResponseDTO.userErrorParam("手机号已存在");
|
||||
}
|
||||
|
||||
existEntity = employeeDao.getByEmail(email, null);
|
||||
if (null != existEntity && !Objects.equals(existEntity.getEmployeeId(), employeeId)) {
|
||||
return ResponseDTO.userErrorParam("邮箱账号已存在");
|
||||
}
|
||||
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新登录人头像
|
||||
|
||||
@@ -46,6 +46,12 @@ public class RequestEmployee implements RequestUser {
|
||||
@Schema(description = "部门名称")
|
||||
private String departmentName;
|
||||
|
||||
@Schema(description = "职务级别ID")
|
||||
private Long positionId;
|
||||
|
||||
@Schema(description = "邮箱")
|
||||
private String email;
|
||||
|
||||
@Schema(description = "是否禁用")
|
||||
private Boolean disabledFlag;
|
||||
|
||||
|
||||
@@ -2,6 +2,28 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="net.lab1024.sa.admin.module.business.oa.notice.dao.NoticeDao">
|
||||
|
||||
<!-- 查询结果列 -->
|
||||
<sql id="base_columns">
|
||||
t_notice.notice_id,
|
||||
t_notice.notice_type_id,
|
||||
t_notice.title,
|
||||
t_notice.all_visible_flag,
|
||||
t_notice.scheduled_publish_flag,
|
||||
t_notice.publish_time,
|
||||
t_notice.content_text,
|
||||
t_notice.content_html,
|
||||
t_notice.attachment,
|
||||
t_notice.page_view_count,
|
||||
t_notice.user_view_count,
|
||||
t_notice.source,
|
||||
t_notice.author,
|
||||
t_notice.document_number,
|
||||
t_notice.deleted_flag,
|
||||
t_notice.create_user_id,
|
||||
t_notice.update_time,
|
||||
t_notice.create_time
|
||||
</sql>
|
||||
|
||||
<!-- ================================== 可见范围相关 ================================== -->
|
||||
|
||||
<insert id="insertVisibleRange">
|
||||
@@ -35,32 +57,30 @@
|
||||
<!-- 后管分页查询资讯 -->
|
||||
<select id="query" resultType="net.lab1024.sa.admin.module.business.oa.notice.domain.vo.NoticeVO">
|
||||
SELECT
|
||||
t_notice.* ,
|
||||
<include refid="base_columns"/>,
|
||||
t_notice_type.notice_type_name as noticeTypeName,
|
||||
t_employee.actual_name as createUserName,
|
||||
t_department.name as departmentName
|
||||
t_employee.actual_name as createUserName
|
||||
FROM t_notice
|
||||
left join t_notice_type on t_notice_type.notice_type_id = t_notice.notice_type_id
|
||||
left join t_employee on t_notice.create_user_id = t_employee.employee_id
|
||||
left join t_department on t_employee.department_id = t_department.department_id
|
||||
LEFT JOIN t_notice_type on t_notice.notice_type_id = t_notice_type.notice_type_id
|
||||
LEFT JOIN t_employee on t_notice.create_user_id = t_employee.employee_id
|
||||
<where>
|
||||
<if test="query.noticeTypeId != null">
|
||||
AND t_notice_type.notice_type_id = #{query.noticeTypeId}
|
||||
</if>
|
||||
<if test="query.keywords != null and query.keywords !=''">
|
||||
<if test="query.keywords != null and query.keywords != ''">
|
||||
AND ( INSTR(t_notice.title,#{query.keywords})
|
||||
OR INSTR(t_notice.author,#{query.keywords})
|
||||
OR INSTR(t_notice.source,#{query.keywords})
|
||||
)
|
||||
</if>
|
||||
<if test="query.documentNumber != null and query.documentNumber !=''">
|
||||
<if test="query.documentNumber != null and query.documentNumber != ''">
|
||||
AND INSTR(t_notice.document_number, #{query.documentNumber})
|
||||
</if>
|
||||
<if test="query.createUserId != null">
|
||||
AND t_notice.create_user_id = #{createUserId}
|
||||
<if test="query.createUserName != null and query.createUserName != ''">
|
||||
AND t_employee.actual_name = #{query.createUserName}
|
||||
</if>
|
||||
<if test="query.deletedFlag != null">
|
||||
and t_notice.deleted_flag = #{query.deletedFlag}
|
||||
AND t_notice.deleted_flag = #{query.deletedFlag}
|
||||
</if>
|
||||
<if test="query.createTimeBegin != null">
|
||||
AND DATE_FORMAT(t_notice.create_time, '%Y-%m-%d') >= DATE_FORMAT(#{query.createTimeBegin},
|
||||
@@ -84,10 +104,9 @@
|
||||
</select>
|
||||
|
||||
<!-- ================================== 通知公告【员工查看】相关 ================================== -->
|
||||
<select id="queryEmployeeNotice"
|
||||
resultType="net.lab1024.sa.admin.module.business.oa.notice.domain.vo.NoticeEmployeeVO">
|
||||
<select id="queryEmployeeNotice" resultType="net.lab1024.sa.admin.module.business.oa.notice.domain.vo.NoticeEmployeeVO">
|
||||
select
|
||||
t_notice.*,
|
||||
<include refid="base_columns"/>,
|
||||
t_notice_type.notice_type_name,
|
||||
(select count(*) from t_notice_view_record where t_notice_view_record.employee_id = #{requestEmployeeId} and
|
||||
t_notice_view_record.notice_id = t_notice.notice_id) as viewFlag
|
||||
@@ -142,12 +161,11 @@
|
||||
</where>
|
||||
order by t_notice.publish_time desc
|
||||
</select>
|
||||
<select id="queryEmployeeNotViewNotice"
|
||||
resultType="net.lab1024.sa.admin.module.business.oa.notice.domain.vo.NoticeEmployeeVO">
|
||||
<select id="queryEmployeeNotViewNotice" resultType="net.lab1024.sa.admin.module.business.oa.notice.domain.vo.NoticeEmployeeVO">
|
||||
select * from
|
||||
(
|
||||
select
|
||||
t_notice.*,
|
||||
<include refid="base_columns"/>,
|
||||
t_notice_type.notice_type_name,
|
||||
(select count(*) from t_notice_view_record where t_notice_view_record.employee_id = #{requestEmployeeId} and
|
||||
t_notice_view_record.notice_id = t_notice.notice_id) as viewFlag
|
||||
@@ -198,8 +216,7 @@
|
||||
) t where viewFlag = 0
|
||||
order by t.publish_time desc
|
||||
</select>
|
||||
<select id="queryNoticeViewRecordList"
|
||||
resultType="net.lab1024.sa.admin.module.business.oa.notice.domain.vo.NoticeViewRecordVO">
|
||||
<select id="queryNoticeViewRecordList" resultType="net.lab1024.sa.admin.module.business.oa.notice.domain.vo.NoticeViewRecordVO">
|
||||
select t_notice_view_record.*,
|
||||
t_employee.actual_name as employeeName,
|
||||
t_department.name as departmentName
|
||||
|
||||
@@ -33,21 +33,19 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<update id="updateDisableFlag">
|
||||
UPDATE t_employee
|
||||
SET disabled_flag = #{disabledFlag}
|
||||
WHERE employee_id = #{employeeId}
|
||||
</update>
|
||||
|
||||
|
||||
<select id="getByLoginName" resultType="net.lab1024.sa.admin.module.system.employee.domain.entity.EmployeeEntity">
|
||||
SELECT *
|
||||
FROM t_employee
|
||||
<where>
|
||||
login_name = #{loginName}
|
||||
<if test="disabledFlag != null">
|
||||
AND disabled_flag = #{disabledFlag}
|
||||
<if test="deletedFlag != null">
|
||||
AND deleted_flag = #{deletedFlag}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
@@ -57,24 +55,33 @@
|
||||
FROM t_employee
|
||||
<where>
|
||||
actual_name = #{actualName}
|
||||
<if test="disabledFlag != null">
|
||||
AND disabled_flag = #{disabledFlag}
|
||||
<if test="deletedFlag != null">
|
||||
AND deleted_flag = #{deletedFlag}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getByPhone" resultType="net.lab1024.sa.admin.module.system.employee.domain.entity.EmployeeEntity">
|
||||
SELECT *
|
||||
FROM t_employee
|
||||
<where>
|
||||
phone = #{phone}
|
||||
<if test="disabledFlag != null">
|
||||
AND disabled_flag = #{disabledFlag}
|
||||
<if test="deletedFlag != null">
|
||||
AND deleted_flag = #{deletedFlag}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getByEmail" resultType="net.lab1024.sa.admin.module.system.employee.domain.entity.EmployeeEntity">
|
||||
SELECT *
|
||||
FROM t_employee
|
||||
<where>
|
||||
email = #{email}
|
||||
<if test="deletedFlag != null">
|
||||
AND deleted_flag = #{deletedFlag}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="listAll" resultType="net.lab1024.sa.admin.module.system.employee.domain.vo.EmployeeVO">
|
||||
SELECT *
|
||||
@@ -88,22 +95,19 @@
|
||||
department_id = #{departmentId} AND deleted_flag = #{deletedFlag}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectByDepartmentId"
|
||||
resultType="net.lab1024.sa.admin.module.system.employee.domain.entity.EmployeeEntity">
|
||||
<select id="selectByDepartmentId" resultType="net.lab1024.sa.admin.module.system.employee.domain.entity.EmployeeEntity">
|
||||
SELECT *
|
||||
FROM t_employee
|
||||
<where>
|
||||
department_id = #{departmentId}
|
||||
<if test="disabledFlag != null">
|
||||
AND disabled_flag = #{disabledFlag}
|
||||
<if test="deletedFlag != null">
|
||||
AND deleted_flag = #{deletedFlag}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectByActualName"
|
||||
resultType="net.lab1024.sa.admin.module.system.employee.domain.entity.EmployeeEntity">
|
||||
<select id="selectByActualName" resultType="net.lab1024.sa.admin.module.system.employee.domain.entity.EmployeeEntity">
|
||||
SELECT * FROM t_employee
|
||||
<where>
|
||||
actual_name = #{actualName}
|
||||
@@ -111,8 +115,8 @@
|
||||
<foreach collection="departmentIdList" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
<if test="disabledFlag != null">
|
||||
AND disabled_flag = #{disabledFlag}
|
||||
<if test="deletedFlag != null">
|
||||
AND deleted_flag = #{deletedFlag}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
@@ -125,20 +129,19 @@
|
||||
<foreach collection="departmentIds" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
<if test="disabledFlag != null">
|
||||
AND disabled_flag = #{disabledFlag}
|
||||
<if test="deletedFlag != null">
|
||||
AND deleted_flag = #{deletedFlag}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getEmployeeId" resultType="java.lang.Long">
|
||||
SELECT employee_id
|
||||
FROM t_employee
|
||||
<where>
|
||||
<if test="disabledFlag != null">
|
||||
AND disabled_flag = #{disabledFlag}
|
||||
<if test="deletedFlag != null">
|
||||
AND deleted_flag = #{deletedFlag}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
@@ -148,8 +151,8 @@
|
||||
FROM t_employee
|
||||
<where>
|
||||
department_id = #{departmentId}
|
||||
<if test="disabledFlag != null">
|
||||
AND disabled_flag = #{disabledFlag}
|
||||
<if test="deletedFlag != null">
|
||||
AND deleted_flag = #{deletedFlag}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY create_time DESC
|
||||
@@ -164,7 +167,6 @@
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getEmployeeById" resultType="net.lab1024.sa.admin.module.system.employee.domain.vo.EmployeeVO">
|
||||
SELECT t_employee.*,
|
||||
t_department.name AS departmentName
|
||||
@@ -173,8 +175,7 @@
|
||||
where t_employee.employee_id = #{employeeId}
|
||||
</select>
|
||||
|
||||
<select id="selectEmployeeByDisabledAndDeleted"
|
||||
resultType="net.lab1024.sa.admin.module.system.employee.domain.vo.EmployeeVO">
|
||||
<select id="selectEmployeeByDisabledAndDeleted" resultType="net.lab1024.sa.admin.module.system.employee.domain.vo.EmployeeVO">
|
||||
SELECT
|
||||
t_employee.*,
|
||||
t_department.name AS departmentName
|
||||
@@ -196,5 +197,4 @@
|
||||
WHERE employee_id = #{employeeId}
|
||||
</update>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -37,14 +37,14 @@ public interface ${name.upperCamel}Dao extends BaseMapper<${name.upperCamel}Enti
|
||||
/**
|
||||
* 更新删除状态
|
||||
*/
|
||||
long updateDeleted(@Param("${primaryKeyFieldName}")${primaryKeyJavaType} ${primaryKeyFieldName},@Param("deletedFlag")boolean deletedFlag);
|
||||
long updateDeleted(@Param("${primaryKeyFieldName}") ${primaryKeyJavaType} ${primaryKeyFieldName}, @Param("deletedFlag") boolean deletedFlag);
|
||||
|
||||
#end
|
||||
#if($deleteInfo.deleteEnum == "Batch" || $deleteInfo.deleteEnum == "SingleAndBatch")
|
||||
/**
|
||||
* 批量更新删除状态
|
||||
*/
|
||||
void batchUpdateDeleted(@Param("idList")List<${primaryKeyJavaType}> idList,@Param("deletedFlag")boolean deletedFlag);
|
||||
void batchUpdateDeleted(@Param("idList") List<${primaryKeyJavaType}> idList, @Param("deletedFlag") boolean deletedFlag);
|
||||
|
||||
#end
|
||||
#end
|
||||
|
||||
@@ -10,13 +10,13 @@ SET @parent_id = NULL;
|
||||
SELECT t_menu.menu_id INTO @parent_id FROM t_menu WHERE t_menu.menu_name = '${basic.description}';
|
||||
|
||||
INSERT INTO t_menu ( menu_name, menu_type, parent_id, frame_flag, cache_flag, visible_flag, disabled_flag, api_perms, perms_type, context_menu_id, create_user_id )
|
||||
VALUES ( '查询', 3, @parent_id, false, true, true, false, '${name.lowerCamel}:query', 1, @parent_id, 1 );
|
||||
VALUES ( '查询', 3, @parent_id, false, false, true, false, '${name.lowerCamel}:query', 1, @parent_id, 1 );
|
||||
|
||||
INSERT INTO t_menu ( menu_name, menu_type, parent_id, frame_flag, cache_flag, visible_flag, disabled_flag, api_perms, perms_type, context_menu_id, create_user_id )
|
||||
VALUES ( '添加', 3, @parent_id, false, true, true, false, '${name.lowerCamel}:add', 1, @parent_id, 1 );
|
||||
VALUES ( '添加', 3, @parent_id, false, false, true, false, '${name.lowerCamel}:add', 1, @parent_id, 1 );
|
||||
|
||||
INSERT INTO t_menu ( menu_name, menu_type, parent_id, frame_flag, cache_flag, visible_flag, disabled_flag, api_perms, perms_type, context_menu_id, create_user_id )
|
||||
VALUES ( '更新', 3, @parent_id, false, true, true, false, '${name.lowerCamel}:update', 1, @parent_id, 1 );
|
||||
VALUES ( '更新', 3, @parent_id, false, false, true, false, '${name.lowerCamel}:update', 1, @parent_id, 1 );
|
||||
|
||||
INSERT INTO t_menu ( menu_name, menu_type, parent_id, frame_flag, cache_flag, visible_flag, disabled_flag, api_perms, perms_type, context_menu_id, create_user_id )
|
||||
VALUES ( '删除', 3, @parent_id, false, true, true, false, '${name.lowerCamel}:delete', 1, @parent_id, 1 );
|
||||
VALUES ( '删除', 3, @parent_id, false, false, true, false, '${name.lowerCamel}:delete', 1, @parent_id, 1 );
|
||||
|
||||
Reference in New Issue
Block a user