<commit_before>package com.ism.admin.controllers

class AdminController {

    def userService;
    def index() {
        return redirect(action:'login')
    }
    def login(){
        if(params.size()==2){
            return render(view:'login');
        }else{
            def result = userService.login(params);
            if(result.success){
                return redirect(controller:'goodsMgr',action:'index')
            }else{
                return render(view:'login',model:[result:result]);
            }
        }
    }
}<commit_msg>修改Admin C层<commit_after>package com.ism.admin.controllers

import com.ism.user.domains.User
import org.codehaus.groovy.grails.web.json.JSONArray
import org.codehaus.groovy.grails.web.json.JSONObject

class AdminController {

    def userService;
    def index() {
        return redirect(action:'index')
    }
    def login(){
        if(params.size()==2){
            return render(view:'login');
        }else{
            def result = userService.login(params);
            if(result.success){
                return redirect(controller:'goodsMgr',action:'index')
            }else{
                return render(view:'login',model:[result:result]);
            }
        }
    }
  def list(){
      JSONArray result;//返回的json
      def page=params.page;
      def rows=params.rows;
      int intPage = Integer.parseInt((page == null || page == "0") ? "1":page);
      //每页显示条数
      int number = Integer.parseInt((rows == null || rows == "0") ? "10":rows);
      //每页的开始记录  第一页为1  第二页为number +1
      int start = (intPage-1)*number;
      List<User> list=null;
      int total=User.findAll().size();
      if(total>0){
          list=User.findAll();
      }
      Map<String, Object> jsonMap = new HashMap<String, Object>();//定义map
      jsonMap.put("total", total);//total键 存放总记录数，必须的
      jsonMap.put("rows", list);//rows键 存放每页记录 list
      return render(view:'user',model:[result:jsonMap]);
  }
}
{'fraction_non_alphanumeric': 0.14564102564102563, 'fraction_numerical': 0.0056410256410256415, 'mean_word_length': 2.295608108108108, 'pattern_counts': {'":': 2, '<': 6, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1374546', 'n_tokens_mistral': 613, 'n_tokens_neox': 624, 'n_words': 108}