use of com.hccake.ballcat.common.log.operation.annotation.CreateOperationLogging in project ballcat by ballcat-projects.
the class SysUserController method addSysUser.
/**
* 新增用户
* @param sysUserDTO userInfo
* @return success/false
*/
@PostMapping
@CreateOperationLogging(msg = "新增系统用户")
@PreAuthorize("@per.hasPermission('system:user:add')")
@Operation(summary = "新增系统用户", description = "新增系统用户")
public R<Void> addSysUser(@Valid @RequestBody SysUserDTO sysUserDTO) {
SysUser user = sysUserService.getByUsername(sysUserDTO.getUsername());
if (user != null) {
return R.failed(BaseResultCode.LOGIC_CHECK_ERROR, "用户名已存在");
}
// 明文密码
String password = PasswordUtils.decodeAES(sysUserDTO.getPass(), securityProperties.getPasswordSecretKey());
sysUserDTO.setPassword(password);
return sysUserService.addSysUser(sysUserDTO) ? R.ok() : R.failed(BaseResultCode.UPDATE_DATABASE_ERROR, "新增系统用户失败");
}
use of com.hccake.ballcat.common.log.operation.annotation.CreateOperationLogging in project ballcat by ballcat-projects.
the class I18nDataController method save.
/**
* 新增国际化信息
* @param i18nDataCreateDTO 国际化信息
* @return R 通用返回体
*/
@CreateOperationLogging(msg = "新增国际化信息")
@PostMapping
@PreAuthorize("@per.hasPermission('i18n:i18n-data:add')")
@Operation(summary = "新增国际化信息", description = "新增国际化信息")
public R<Void> save(@Valid @RequestBody I18nDataCreateDTO i18nDataCreateDTO) {
// 转换为实体类列表
List<I18nData> list = new ArrayList<>();
List<I18nDataCreateDTO.LanguageText> languageTexts = i18nDataCreateDTO.getLanguageTexts();
for (I18nDataCreateDTO.LanguageText languageText : languageTexts) {
I18nData i18nData = new I18nData();
i18nData.setCode(i18nDataCreateDTO.getCode());
i18nData.setRemarks(i18nDataCreateDTO.getRemarks());
i18nData.setLanguageTag(languageText.getLanguageTag());
i18nData.setMessage(languageText.getMessage());
list.add(i18nData);
}
return i18nDataService.saveBatch(list) ? R.ok() : R.failed(BaseResultCode.UPDATE_DATABASE_ERROR, "新增国际化信息失败");
}
Aggregations