Merge remote-tracking branch 'origin/dev-tmp1' into dev-tmp1
commit
983d75efbd
|
|
@ -63,6 +63,11 @@
|
|||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.qinan</groupId>
|
||||
<artifactId>safety-eval-client</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MapStruct -->
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
|
|
@ -75,6 +80,10 @@
|
|||
<version>${mapstruct.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.qinan</groupId>
|
||||
<artifactId>safety-eval-infrastructure</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
|||
|
|
@ -5,18 +5,13 @@ import io.swagger.annotations.Api;
|
|||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.qinan.cedu.model.dto.CourseManagementDTO;
|
||||
import org.qinan.cedu.model.query.CourseManagementPageQuery;
|
||||
import org.qinan.cedu.model.dto.CourseManagementVO;
|
||||
import org.qinan.cedu.model.dto.PageResponse;
|
||||
import org.qinan.cedu.model.dto.SingleResponse;
|
||||
import org.qinan.cedu.model.query.CourseManagementPageQuery;
|
||||
import org.qinan.cedu.service.CourseManagementService;
|
||||
import org.qinan.safetyeval.client.dto.PageResponse;
|
||||
import org.qinan.safetyeval.client.dto.SingleResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 课程管理
|
||||
|
|
|
|||
|
|
@ -6,16 +6,11 @@ import io.swagger.annotations.ApiOperation;
|
|||
import io.swagger.annotations.ApiParam;
|
||||
import org.qinan.cedu.model.dto.CourseRelCoursewareDTO;
|
||||
import org.qinan.cedu.model.dto.CourseRelCoursewareVO;
|
||||
import org.qinan.cedu.model.dto.PageResponse;
|
||||
import org.qinan.cedu.model.dto.SingleResponse;
|
||||
import org.qinan.cedu.service.CourseRelCoursewareService;
|
||||
import org.qinan.safetyeval.client.dto.PageResponse;
|
||||
import org.qinan.safetyeval.client.dto.SingleResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,18 +5,13 @@ import io.swagger.annotations.Api;
|
|||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.qinan.cedu.model.dto.CoursewareManagementDTO;
|
||||
import org.qinan.cedu.model.query.CoursewareManagementPageQuery;
|
||||
import org.qinan.cedu.model.dto.CoursewareManagementVO;
|
||||
import org.qinan.cedu.model.dto.PageResponse;
|
||||
import org.qinan.cedu.model.dto.SingleResponse;
|
||||
import org.qinan.cedu.model.query.CoursewareManagementPageQuery;
|
||||
import org.qinan.cedu.service.CoursewareManagementService;
|
||||
import org.qinan.safetyeval.client.dto.PageResponse;
|
||||
import org.qinan.safetyeval.client.dto.SingleResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 课件管理
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 课程管理
|
||||
|
|
@ -64,4 +65,7 @@ public class CourseManagementDTO{
|
|||
*/
|
||||
@ApiModelProperty("是否已被使用(0-未使用,1-已使用)")
|
||||
private Integer used;
|
||||
|
||||
@ApiModelProperty("归属课件")
|
||||
private List<CourseRelCoursewareDTO> courseRelCoursewareDTOList;
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ import lombok.Data;
|
|||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 课程管理
|
||||
|
|
@ -61,4 +62,7 @@ public class CourseManagementVO extends BaseVO {
|
|||
*/
|
||||
@ApiModelProperty("是否已被使用(0-未使用,1-已使用)")
|
||||
private Integer used;
|
||||
|
||||
@ApiModelProperty("归属课件")
|
||||
private List<CourseRelCoursewareVO> courseRelCoursewareVOList;
|
||||
}
|
||||
|
|
@ -73,4 +73,7 @@ public class CoursewareManagementVO extends BaseVO {
|
|||
*/
|
||||
@ApiModelProperty("课件描述")
|
||||
private String coursewareDescription;
|
||||
|
||||
@ApiModelProperty("习题数")
|
||||
private Long exerciseCount;
|
||||
}
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
package org.qinan.cedu.model.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 通用分页响应体
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class PageResponse<T> extends SingleResponse<List<T>> {
|
||||
|
||||
@ApiModelProperty(value = "总条数")
|
||||
private Long total;
|
||||
|
||||
public static <T> PageResponse<T> of(List<T> list, Long total) {
|
||||
PageResponse<T> response = new PageResponse<>();
|
||||
response.setSuccess(true);
|
||||
response.setCode("0");
|
||||
response.setData(list);
|
||||
response.setTotal(total);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
package org.qinan.cedu.model.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 通用单条数据响应体
|
||||
*/
|
||||
@Data
|
||||
public class SingleResponse<T> {
|
||||
|
||||
@ApiModelProperty(value = "是否成功")
|
||||
private boolean success;
|
||||
|
||||
@ApiModelProperty(value = "响应码")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "响应消息")
|
||||
private String message;
|
||||
|
||||
@ApiModelProperty(value = "错误响应消息")
|
||||
private String errMessage;
|
||||
|
||||
@ApiModelProperty(value = "响应数据")
|
||||
private T data;
|
||||
|
||||
public static <T> SingleResponse<T> success(T data) {
|
||||
SingleResponse<T> response = new SingleResponse<>();
|
||||
response.setSuccess(true);
|
||||
response.setCode("0");
|
||||
response.setData(data);
|
||||
return response;
|
||||
}
|
||||
|
||||
public static SingleResponse<Void> success() {
|
||||
SingleResponse<Void> response = new SingleResponse<>();
|
||||
response.setSuccess(true);
|
||||
response.setCode("0");
|
||||
return response;
|
||||
}
|
||||
|
||||
public static <T> SingleResponse<T> error(String code, String message) {
|
||||
SingleResponse<T> response = new SingleResponse<>();
|
||||
response.setSuccess(false);
|
||||
response.setCode(code);
|
||||
response.setMessage(message);
|
||||
response.setErrMessage(message);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
|
@ -16,4 +16,10 @@ public class CourseManagementPageQuery extends BasePageQuery {
|
|||
|
||||
@ApiModelProperty("状态(1启用/0禁用)")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 培训类型
|
||||
*/
|
||||
@ApiModelProperty("培训类型")
|
||||
private String trainingType;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,4 +16,10 @@ public class CoursewareManagementPageQuery extends BasePageQuery {
|
|||
|
||||
@ApiModelProperty("状态(1启用/0禁用)")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 培训类型
|
||||
*/
|
||||
@ApiModelProperty("培训类型")
|
||||
private String trainingType;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,21 +1,28 @@
|
|||
package org.qinan.cedu.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.qinan.cedu.convertor.CourseManagementConvertor;
|
||||
import org.qinan.cedu.convertor.CourseRelCoursewareConvertor;
|
||||
import org.qinan.cedu.enums.DeleteEnum;
|
||||
import org.qinan.cedu.mapper.CourseManagementMapper;
|
||||
import org.qinan.cedu.mapper.CourseRelCoursewareMapper;
|
||||
import org.qinan.cedu.model.dto.CourseManagementDTO;
|
||||
import org.qinan.cedu.model.query.CourseManagementPageQuery;
|
||||
import org.qinan.cedu.model.dto.CourseManagementVO;
|
||||
import org.qinan.cedu.model.entity.CourseManagementDO;
|
||||
import org.qinan.cedu.enums.DeleteEnum;
|
||||
import org.qinan.cedu.mapper.CourseManagementMapper;
|
||||
import org.qinan.cedu.model.entity.CourseRelCoursewareDO;
|
||||
import org.qinan.cedu.service.CourseManagementService;
|
||||
import org.qinan.safetyeval.infrastructure.support.InsertFieldDefaults;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 课程管理服务实现
|
||||
|
|
@ -26,18 +33,30 @@ public class CourseManagementServiceImpl extends ServiceImpl<CourseManagementMap
|
|||
|
||||
@Autowired
|
||||
private CourseManagementConvertor courseManagementConvertor;
|
||||
@Autowired
|
||||
private CourseRelCoursewareConvertor courseRelCoursewareConvertor;
|
||||
@Autowired
|
||||
private CourseRelCoursewareMapper courseRelCoursewareMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public IPage<CourseManagementVO> pageQuery(CourseManagementPageQuery query) {
|
||||
long current = query.getCurrent() == null ? 1L : query.getCurrent();
|
||||
long size = query.getSize() == null ? 10L : query.getSize();
|
||||
IPage<CourseManagementDO> page = this.lambdaQuery()
|
||||
.eq(CourseManagementDO::getDeleteEnum, DeleteEnum.FALSE.getCode())
|
||||
.like(StringUtils.hasText(query.getCourseName()), CourseManagementDO::getCourseName, query.getCourseName())
|
||||
.eq(query.getStatus() != null, CourseManagementDO::getStatus, query.getStatus())
|
||||
.eq(query.getTrainingType() != null, CourseManagementDO::getTrainingType, query.getTrainingType())
|
||||
.orderByDesc(CourseManagementDO::getCreateTime)
|
||||
.page(new Page<>(current, size));
|
||||
return page.convert(courseManagementConvertor::convertEToVo);
|
||||
.page(new Page<>(query.getCurrent(), query.getSize()));
|
||||
IPage<CourseManagementVO> convert = page.convert(courseManagementConvertor::convertEToVo);
|
||||
convert.getRecords().forEach(vo -> {
|
||||
vo.setCourseRelCoursewareVOList(courseRelCoursewareConvertor.convertEListToVoList(
|
||||
courseRelCoursewareMapper.selectList(new LambdaQueryWrapper<CourseRelCoursewareDO>()
|
||||
.eq(CourseRelCoursewareDO::getCourseId, vo.getId())
|
||||
.orderByAsc(CourseRelCoursewareDO::getSort))
|
||||
));
|
||||
});
|
||||
return convert;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -46,27 +65,48 @@ public class CourseManagementServiceImpl extends ServiceImpl<CourseManagementMap
|
|||
.eq(CourseManagementDO::getId, id)
|
||||
.eq(CourseManagementDO::getDeleteEnum, DeleteEnum.FALSE.getCode())
|
||||
.one();
|
||||
return courseManagementConvertor.convertEToVo(entity);
|
||||
CourseManagementVO courseManagementVO = courseManagementConvertor.convertEToVo(entity);
|
||||
courseManagementVO.setCourseRelCoursewareVOList(courseRelCoursewareConvertor.convertEListToVoList(
|
||||
courseRelCoursewareMapper.selectList(new LambdaQueryWrapper<CourseRelCoursewareDO>()
|
||||
.eq(CourseRelCoursewareDO::getCourseId, courseManagementVO.getId())
|
||||
.orderByAsc(CourseRelCoursewareDO::getSort))
|
||||
));
|
||||
return courseManagementVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean saveCourse(CourseManagementDTO dto) {
|
||||
CourseManagementDO entity = courseManagementConvertor.convertDtoToE(dto);
|
||||
InsertFieldDefaults.applyIgnoreOrgId(entity);
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
entity.setCreateTime(now);
|
||||
entity.setUpdateTime(now);
|
||||
entity.setVersion(0);
|
||||
if (entity.getUsed() == null) {
|
||||
entity.setUsed(0);
|
||||
}
|
||||
return this.save(entity);
|
||||
this.save(entity);
|
||||
List<CourseRelCoursewareDO> courseRelCoursewareDOS = courseRelCoursewareConvertor.convertDtoListToEList(dto.getCourseRelCoursewareDTOList());
|
||||
for (CourseRelCoursewareDO courseRelCoursewareDO : courseRelCoursewareDOS) {
|
||||
courseRelCoursewareDO.setCourseId(entity.getId());
|
||||
courseRelCoursewareMapper.insert(courseRelCoursewareDO);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean updateCourse(CourseManagementDTO dto) {
|
||||
CourseManagementDO entity = courseManagementConvertor.convertDtoToE(dto);
|
||||
entity.setUpdateTime(LocalDateTime.now());
|
||||
return this.updateById(entity);
|
||||
InsertFieldDefaults.applyForUpdateIgnoreOrgId(entity);
|
||||
this.updateById(entity);
|
||||
courseRelCoursewareMapper.delete(new LambdaQueryWrapper<CourseRelCoursewareDO>()
|
||||
.eq(CourseRelCoursewareDO::getCourseId, entity.getId()));
|
||||
List<CourseRelCoursewareDO> courseRelCoursewareDOS = courseRelCoursewareConvertor.convertDtoListToEList(dto.getCourseRelCoursewareDTOList());
|
||||
for (CourseRelCoursewareDO courseRelCoursewareDO : courseRelCoursewareDOS) {
|
||||
courseRelCoursewareDO.setCourseId(entity.getId());
|
||||
courseRelCoursewareMapper.insert(courseRelCoursewareDO);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.qinan.cedu.convertor.CourseRelCoursewareConvertor;
|
||||
import org.qinan.cedu.mapper.CourseRelCoursewareMapper;
|
||||
import org.qinan.cedu.model.dto.CourseRelCoursewareDTO;
|
||||
import org.qinan.cedu.model.dto.CourseRelCoursewareVO;
|
||||
import org.qinan.cedu.model.entity.CourseRelCoursewareDO;
|
||||
import org.qinan.cedu.mapper.CourseRelCoursewareMapper;
|
||||
import org.qinan.cedu.service.CourseRelCoursewareService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
|
|||
|
|
@ -1,16 +1,20 @@
|
|||
package org.qinan.cedu.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.qinan.cedu.convertor.CoursewareManagementConvertor;
|
||||
import org.qinan.cedu.model.dto.CoursewareManagementDTO;
|
||||
import org.qinan.cedu.model.query.CoursewareManagementPageQuery;
|
||||
import org.qinan.cedu.model.dto.CoursewareManagementVO;
|
||||
import org.qinan.cedu.model.entity.CoursewareManagementDO;
|
||||
import org.qinan.cedu.enums.DeleteEnum;
|
||||
import org.qinan.cedu.mapper.CoursewareManagementMapper;
|
||||
import org.qinan.cedu.mapper.QuestionMapper;
|
||||
import org.qinan.cedu.model.dto.CoursewareManagementDTO;
|
||||
import org.qinan.cedu.model.dto.CoursewareManagementVO;
|
||||
import org.qinan.cedu.model.entity.CoursewareManagementDO;
|
||||
import org.qinan.cedu.model.entity.QuestionDO;
|
||||
import org.qinan.cedu.model.query.CoursewareManagementPageQuery;
|
||||
import org.qinan.cedu.service.CoursewareManagementService;
|
||||
import org.qinan.safetyeval.infrastructure.support.InsertFieldDefaults;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
|
@ -26,18 +30,24 @@ public class CoursewareManagementServiceImpl extends ServiceImpl<CoursewareManag
|
|||
|
||||
@Autowired
|
||||
private CoursewareManagementConvertor coursewareManagementConvertor;
|
||||
@Autowired
|
||||
private QuestionMapper questionMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public IPage<CoursewareManagementVO> pageQuery(CoursewareManagementPageQuery query) {
|
||||
long current = query.getCurrent() == null ? 1L : query.getCurrent();
|
||||
long size = query.getSize() == null ? 10L : query.getSize();
|
||||
IPage<CoursewareManagementDO> page = this.lambdaQuery()
|
||||
.eq(CoursewareManagementDO::getDeleteEnum, DeleteEnum.FALSE.getCode())
|
||||
.like(StringUtils.hasText(query.getCoursewareName()), CoursewareManagementDO::getCoursewareName, query.getCoursewareName())
|
||||
.eq(query.getStatus() != null, CoursewareManagementDO::getStatus, query.getStatus())
|
||||
.eq(query.getTrainingType() != null, CoursewareManagementDO::getTrainingType, query.getTrainingType())
|
||||
.orderByDesc(CoursewareManagementDO::getCreateTime)
|
||||
.page(new Page<>(current, size));
|
||||
return page.convert(coursewareManagementConvertor::convertEToVo);
|
||||
.page(new Page<>(query.getCurrent(), query.getSize()));
|
||||
IPage<CoursewareManagementVO> convert = page.convert(coursewareManagementConvertor::convertEToVo);
|
||||
for (CoursewareManagementVO record : convert.getRecords()) {
|
||||
record.setExerciseCount(questionMapper.selectCount(new LambdaQueryWrapper<QuestionDO>().eq(QuestionDO::getCoursewareId, record.getId())));
|
||||
}
|
||||
return convert;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -46,23 +56,22 @@ public class CoursewareManagementServiceImpl extends ServiceImpl<CoursewareManag
|
|||
.eq(CoursewareManagementDO::getId, id)
|
||||
.eq(CoursewareManagementDO::getDeleteEnum, DeleteEnum.FALSE.getCode())
|
||||
.one();
|
||||
return coursewareManagementConvertor.convertEToVo(entity);
|
||||
CoursewareManagementVO coursewareManagementVO = coursewareManagementConvertor.convertEToVo(entity);
|
||||
coursewareManagementVO.setExerciseCount(questionMapper.selectCount(new LambdaQueryWrapper<QuestionDO>().eq(QuestionDO::getCoursewareId, coursewareManagementVO.getId())));
|
||||
return coursewareManagementVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveCourseware(CoursewareManagementDTO dto) {
|
||||
CoursewareManagementDO entity = coursewareManagementConvertor.convertDtoToE(dto);
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
entity.setCreateTime(now);
|
||||
entity.setUpdateTime(now);
|
||||
entity.setVersion(0);
|
||||
InsertFieldDefaults.applyIgnoreOrgId(entity);
|
||||
return this.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateCourseware(CoursewareManagementDTO dto) {
|
||||
CoursewareManagementDO entity = coursewareManagementConvertor.convertDtoToE(dto);
|
||||
entity.setUpdateTime(LocalDateTime.now());
|
||||
InsertFieldDefaults.applyForUpdateIgnoreOrgId(entity);
|
||||
return this.updateById(entity);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -116,6 +116,23 @@ public final class InsertFieldDefaults {
|
|||
}
|
||||
}
|
||||
|
||||
public static void applyForUpdateIgnoreOrgId(Object dataObject) {
|
||||
if (dataObject == null) {
|
||||
return;
|
||||
}
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
Long userId = AuthUserContextAdapter.getCurrentUserId();
|
||||
String userName = AuthUserContextAdapter.getCurrentUserName();
|
||||
|
||||
setIfNull(dataObject, "updateTime", now);
|
||||
if (userId != null) {
|
||||
setIfNull(dataObject, "updateId", userId);
|
||||
}
|
||||
if (userName != null) {
|
||||
setIfNull(dataObject, "updateName", userName);
|
||||
}
|
||||
}
|
||||
|
||||
private static void setIfNull(Object target, String property, Object value) {
|
||||
try {
|
||||
String getterName = "get" + Character.toUpperCase(property.charAt(0)) + property.substring(1);
|
||||
|
|
|
|||
Loading…
Reference in New Issue