pang.jiabao
2025-05-25 be61c90200910a3e48c72596f3bbd459a2a73f25
src/main/java/com/zy/common/web/BaseController.java
@@ -30,11 +30,11 @@
    @Autowired
    private UserService userService;
    protected Long getUserId(){
    protected Long getUserId() {
        return Long.parseLong(String.valueOf(request.getAttribute("userId")));
    }
    protected User getUser(){
    protected User getUser() {
        User user = userService.selectById(getUserId());
        if (null == user) {
            throw new CoolException(BaseRes.DENIED);
@@ -42,10 +42,10 @@
        return user;
    }
    protected String getComment(Class<?> cls, String fieldName){
    protected String getComment(Class<?> cls, String fieldName) {
        Field[] fields = Cools.getAllFields(cls);
        for (Field field : fields){
            if (fieldName.equals(field.getName())){
        for (Field field : fields) {
            if (fieldName.equals(field.getName())) {
                return field.getAnnotation(ApiModelProperty.class).value();
            }
        }
@@ -58,15 +58,15 @@
     * @param set 排除字段集合
     * @param condition 搜索内容
     */
    protected <T> void allLike(Class<T> cls, Set<String> set, EntityWrapper<T> wrapper, String condition){
    protected <T> void allLike(Class<T> cls, Set<String> set, EntityWrapper<T> wrapper, String condition) {
        if (Cools.isEmpty(condition)) {
            return;
        }
        List<String> columns = new ArrayList<>();
        for (Field field :Cools.getAllFields(cls)){
        for (Field field : Cools.getAllFields(cls)) {
            if (Modifier.isFinal(field.getModifiers())
                    || Modifier.isStatic(field.getModifiers())
                    || Modifier.isTransient(field.getModifiers())){
                    || Modifier.isTransient(field.getModifiers())) {
                continue;
            }
            String column = null;
@@ -83,8 +83,8 @@
        if (columns.isEmpty()) {
            return;
        }
        for (int i=0;i<columns.size();i++){
            if (i==0){
        for (int i = 0; i < columns.size(); i++) {
            if (i == 0) {
                wrapper.andNew();
            } else {
                wrapper.or();