Merge branch 'master' into docker_package

This commit is contained in:
wangliwen 2022-07-07 19:26:26 +08:00
commit 27e7aa8654
3 changed files with 13 additions and 14 deletions

View File

@ -692,14 +692,11 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
updateWrapper.lambda().eq(ResourceEntity::getId, resourceEntity.getId()) updateWrapper.lambda().eq(ResourceEntity::getId, resourceEntity.getId())
.eq(ResourceEntity::getDelFlag, ResourceEntityDelFlag.NORMAL.getFlag()); .eq(ResourceEntity::getDelFlag, ResourceEntityDelFlag.NORMAL.getFlag());
resourceDao.update(entity, updateWrapper); resourceDao.update(entity, updateWrapper);
// ResourceBrowseEntity browseEntity = new ResourceBrowseEntity();
// browseEntity.setResourceId(id); Integer num = jdbcTemplate.queryForObject("SELECT round(tb_data_resource_assignmark.total) FROM tb_data_resource_assignmark WHERE id =" + id, Integer.class);
// browseEntity.setUserId(SecurityUser.getUserId());
// browseEntity.setState(0); String sql = String.format("update tb_data_resource SET total = %d WHERE id = %s", num.intValue(), id.toString());
// resourceBrowseDao.insert(browseEntity); jdbcTemplate.update(sql);
jdbcTemplate.update("update tb_data_resource,\n" +
"tb_data_resource_assignmark\n" +
"SET tb_data_resource.total = round(tb_data_resource_assignmark.total) WHERE tb_data_resource.id =" + id);
} }

View File

@ -74,9 +74,10 @@ public class ResourceCollectionServiceImpl extends CrudServiceImpl<ResourceColle
if (collectionEntities.isEmpty()) { if (collectionEntities.isEmpty()) {
resourceCollectionDao.insert(item); resourceCollectionDao.insert(item);
jdbcTemplate.update("update tb_data_resource,\n" + Integer num = jdbcTemplate.queryForObject("SELECT round(tb_data_resource_assignmark.total) FROM tb_data_resource_assignmark WHERE id =" + item.getResourceId(), Integer.class);
"tb_data_resource_assignmark\n" +
"SET tb_data_resource.total = round(tb_data_resource_assignmark.total) WHERE tb_data_resource.id =" + item.getResourceId()); String sql = String.format("update tb_data_resource SET total = %d WHERE id = %s", num.intValue(), item.getResourceId().toString());
jdbcTemplate.update(sql);
} else { } else {
collectionEntities.stream().forEach(index -> { collectionEntities.stream().forEach(index -> {

View File

@ -33,9 +33,10 @@ public class ResourceScoreServiceImpl extends CrudServiceImpl<ResourceScoreDao,
@Override @Override
public void save(ResourceScoreDTO dto) { public void save(ResourceScoreDTO dto) {
super.save(dto); super.save(dto);
jdbcTemplate.update("update tb_data_resource,\n" + Integer num = jdbcTemplate.queryForObject("SELECT round(tb_data_resource_assignmark.total) FROM tb_data_resource_assignmark WHERE id =" + dto.getResourceId(), Integer.class);
"tb_data_resource_assignmark\n" +
"SET tb_data_resource.total = round(tb_data_resource_assignmark.total) WHERE tb_data_resource.id =" + dto.getResourceId()); String sql = String.format("update tb_data_resource SET total = %d WHERE id = %s", num.intValue(), dto.getResourceId());
jdbcTemplate.update(sql);
} }