com.invms.x.controllers.basis.UserController Maven / Gradle / Ivy
package com.invms.x.controllers.basis;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.invms.x.builders.ArgsBuilder;
import com.invms.x.components.DefaultConfigurer;
import com.invms.x.controllers.BaseController;
import com.invms.x.entities.basis.UserEntity;
import com.invms.x.filters.ActionFilter;
import com.invms.x.filters.LogFilter;
import com.invms.x.models.DataModel;
import com.invms.x.services.EntityService;
import com.invms.x.services.basis.UserService;
@ActionFilter(markOnly = true, code = UserEntity.BASE_CODE, name = "用户管理")
@LogFilter(message = "用户管理", category = LogFilter.CATEGORY_INFO)
@RestController
@RequestMapping(value = "/basis/user")
public class UserController extends BaseController {
@Autowired
private EntityService entityService;
@Autowired
private UserService userService;
@ActionFilter(code = UserEntity.BASE_CODE + "_user_setEnabled", name = "设置用户启用", sortIndex = UserEntity.BASE_SORT_INDEX + 21, parentCode = UserEntity.BASE_CODE)
@LogFilter(message = "设置用户启用", category = LogFilter.CATEGORY_INFO)
@RequestMapping(value = "/setEnabled")
public Object setEnabled() throws Exception {
ArgsBuilder argsBuilder = createArgsBuilder();
argsBuilder.setValue(DefaultConfigurer.entityClass, UserEntity.class);
userService.verifyEnabled(argsBuilder);
Object data = entityService.update(argsBuilder);
return DataModel.createTrue(data);
}
@LogFilter(message = "获取用户权限", category = LogFilter.CATEGORY_INFO)
@RequestMapping(value = "/getPowers")
public Object getPowers() throws Exception {
ArgsBuilder argsBuilder = createArgsBuilder();
Object data = userService.getPowers(argsBuilder);
return DataModel.createTrue(data);
}
@ActionFilter(code = UserEntity.BASE_CODE + "_setPowers", name = "设置用户权限", sortIndex = UserEntity.BASE_SORT_INDEX + 22, parentCode = UserEntity.BASE_CODE)
@LogFilter(message = "设置用户权限", category = LogFilter.CATEGORY_INFO)
@RequestMapping(value = "/setPowers")
public Object setPowers() throws Exception {
ArgsBuilder argsBuilder = createArgsBuilder();
Object data = userService.setPowers(argsBuilder);
return DataModel.createTrue(data);
}
@ActionFilter(code = UserEntity.BASE_CODE + "_resetPassword", name = "重置用户密码", sortIndex = UserEntity.BASE_SORT_INDEX + 23, parentCode = UserEntity.BASE_CODE)
@LogFilter(message = "重置用户密码", category = LogFilter.CATEGORY_INFO)
@RequestMapping(value = "/resetPassword")
public Object resetPassword() throws Exception {
ArgsBuilder argsBuilder = createArgsBuilder();
argsBuilder.setValue(DefaultConfigurer.entityClass, UserEntity.class);
userService.verifyPassword(argsBuilder);
Object data = entityService.update(argsBuilder);
return DataModel.createTrue(data);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy