Java代码学习Day2

tech2023-02-01  115

Java项目学习

Controller

ApplicationController

CleanCacheController

CompanyController

CompanyListController

Function:Get all company uuid public List<String> getAllCompanyUuids() { return companyService.listAllCompanyUuids(); }

where companyService from CompanyService inteface, and its relative function is below:

@Override public List<String> listAllCompanyUuids() { List<Company> companyIds = companyMapper.selectAll(); if (CollectionUtils.isEmpty(companyIds)) { return Collections.EMPTY_LIST; } return companyIds.stream().map(item -> item.getId() + "").collect(Collectors.toList()); }

Stream java.util.Collection.stream() Returns a sequential Stream with this collection as its source.

CompanyUserController

Function :ui-api

CompanyV2Controller

Function: Company information management, including get basic information etc.

ConfigEmailController

1.Function: configuration of email, such as save, get, delete and send.

ConfigWorkController

1.Function:Configuration of compnay wechat redis也同步操作 save, get ,delete

CustomParityController

1.Function:The subsystem abstractions group-related interfaces,including save,queryList, update, queryById, deleteById

GroupController

1.Function: Group-related api

LicenseFetchController

1.Function: License setting

LogoController

1.Function:Operation of logo

NavigationController

1.Function:各项组件的操作,如添加,删除等

NotificationObjectController

1.Function:消息通知类 2.其中一个实现类,如下

@Override public List<NotificationObject> getNotificationObjectById(String company, Long notificationId) { return notificationObjectMapper.select(new NotificationObject() { { setCompanyUuid(company); setNotificationId(notificationId); } }); }

NotificationObjectController

1.Function:通知对象控制层,获取列表,获取消息通知对象,新增通知对象,删除通知对象 2.功能实现

@ApiOperation("删除通知对象") @DeleteMapping public ResponseEntity<Object> delConfig(@RequestParam Long id) { notificationObjectService.delObjectUser(id); return ResponseEntity.ok().build(); }

notificationObjectService的实现

@Override public void delObjectUser(Long id) { notificationObjectMapper.delete(new NotificationObject() { { setId(id); } }); }

PermissionController

** Function**:permission实现代码 @PutMapping("/{id}") @ApiOperation(value = "修改", notes = "修改") public ResponseEntity update(@PathVariable String company, @PathVariable Long id, @RequestBody PermissionVO vo) { permissionService.updateByIdAndCompany(company, id, vo); return ResponseEntity.status(HttpStatus.CREATED) .body(AdminResponse.result(GlobalConstant.SUCCESS, "修改成功!")); }

对一个的permissionService的实现如下:

@Override public void updateByIdAndCompany(String company, Long id, PermissionVO vo) { Example example = new ExamplePlus(Permission.class); Example.Criteria criteria = example.createCriteria(); criteria.andEqualTo("id", id); criteria.andEqualTo("companyUuid", company); Permission entity = new Permission(); BeanUtils.copyProperties(vo, entity); entity.setUpdateTime(new Date()); //获取当前用户信息 BaseUserDetails currentLogin = AuthUtils.getCurrentLogin(); if (null != currentLogin) { entity.setUpdateUser(currentLogin.getUserId()); } permissionMapper.updateByExampleSelective(entity, example); }
最新回复(0)