关于java中VO,DTO的理解

@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class AllCodeCoverageRateSettingDto {
private Integer id;
private String dept;
private Long createTime;
private Long updateTime;
private Date dbUpdateTime;
private Date dbCreateTime;
}

以下是dao层

@Mapper
public interface AllDao {

int editSetting(AllDto allCodeCoverageRateSettingDto);
List<AllDto> querySettingByDept(String dept);
List<AllDto> querySettingAll();

}


以下是service层

@Service
public class AllServiceImpl implements IAllService {

@Autowired
AllDao allDao;

@Override
public Response editSetting(String dept, String executionSet) throws Exception {
    AllDto allDto = new AllDto();
    allDto.setDept(dept);
    allDto.setSet(executionSet);
    Long ts = System.currentTimeMillis()+8*60*60*1000;
    allDto.setUpdateTime(ts);
    allDto.setDbUpdateTime(new Timestamp(ts));
    try{
        allDao.editSetting(allDto);
    }catch (Exception e){
        return new Response(ResultCode.GLOBAL_PROJECT_SYSTEM_ERROR,e.getMessage(),"更新失败");
    }
    return new Response(ResultCode.GLOBAL_SUCCESSFUL,null,"更新成功",0);
}
posted @ 2022-10-23 15:11  dongye95  阅读(46)  评论(0编辑  收藏  举报