Commit 5e84c730 by jinfeng.wang

fix

parent 8a9bf83c
......@@ -2,7 +2,6 @@ package com.mobvista.apptag.controller;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.pagehelper.PageHelper;
import com.mobvista.apptag.config.WebSecurityConfig;
import com.mobvista.apptag.entity.Feat;
import com.mobvista.apptag.entity.Tag;
......@@ -25,7 +24,6 @@ import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -142,7 +140,8 @@ public class ResultController {
public PageUtil list(@SessionAttribute(WebSecurityConfig.SESSION_KEY) String username, @RequestBody Query query) {
// PageHelper.startPage(query.getOffset() / query.getLimit() + 1, query.getLimit());
List<TagResult> results = resultService.list(username, query);
int total = resultService.count(username);
String search = query.getSearch();
int total = resultService.count(username, search);
PageUtil pageUtil = new PageUtil(results, total);
return pageUtil;
}
......
package com.mobvista.apptag.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.pagehelper.PageHelper;
......@@ -18,22 +14,18 @@ import com.mobvista.apptag.service.TagService;
import com.mobvista.apptag.utils.PageUtil;
import com.mobvista.apptag.utils.Query;
import com.mobvista.apptag.utils.R;
import net.sf.json.JSONArray;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.SessionAttribute;
import org.springframework.web.bind.annotation.*;
import net.sf.json.JSONArray;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author wangjf
......@@ -147,8 +139,9 @@ public class TagController {
public PageUtil list(@RequestBody Query query,
@RequestParam(name = "tag", required = false, defaultValue = "0") int tag) {
PageHelper.startPage(query.getOffset() / query.getLimit() + 1, query.getLimit());
List<Tag> tags = tagDao.list(tag);
int total = tagDao.count(tag);
String search = query.getSearch();
List<Tag> tags = tagDao.list(search, tag);
int total = tagDao.count(search, tag);
PageUtil pageUtil = new PageUtil(tags, total);
return pageUtil;
}
......
package com.mobvista.apptag.controller;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpSession;
import com.github.pagehelper.PageHelper;
import com.mobvista.apptag.config.WebSecurityConfig;
import com.mobvista.apptag.entity.User;
......@@ -13,18 +8,16 @@ import com.mobvista.apptag.service.UserService;
import com.mobvista.apptag.utils.PageUtil;
import com.mobvista.apptag.utils.Query;
import com.mobvista.apptag.utils.R;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.SessionAttribute;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpSession;
import java.util.List;
import java.util.Map;
/**
* @author wangjf
......@@ -55,7 +48,7 @@ public class UserController {
@PostMapping(path = "/loginPost")
@ResponseBody
R loginPost(@RequestParam(name = "username") String username, @RequestParam(name = "password") String password,
HttpSession session) {
HttpSession session) {
if (!userService.validate(username, password)) {
return R.error("用户名或密码错误,请重新登录!");
}
......@@ -117,8 +110,9 @@ public class UserController {
@ResponseBody
public PageUtil list(@SessionAttribute(WebSecurityConfig.SESSION_KEY) String username, @RequestBody Query query) {
PageHelper.startPage(query.getOffset() / query.getLimit() + 1, query.getLimit());
List<User> users = userDao.list();
int total = userDao.count();
String search = query.getSearch();
List<User> users = userDao.list(search.toLowerCase());
int total = userDao.count(search);
PageUtil pageUtil = new PageUtil(users, total);
return pageUtil;
}
......
package com.mobvista.apptag.mapper;
import java.util.List;
import com.mobvista.apptag.entity.TagResult;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* @author wangjf
......@@ -28,6 +25,7 @@ public interface ResultDao {
@Result(property = "updateTime", column = "update_time")})
TagResult find(String packageName);
/*
@Select("SELECT * FROM tag_result WHERE user_id = #{userId}")
@Results({@Result(property = "packageName", column = "package_name"),
@Result(property = "appName", column = "app_name"),
......@@ -37,7 +35,29 @@ public interface ResultDao {
@Result(property = "userId", column = "user_id"),
@Result(property = "updateTime", column = "update_time")})
List<TagResult> list(String userId);
*/
@SelectProvider(type = ListMapperProvider.class, method = "list")
@Results({@Result(property = "packageName", column = "package_name"),
@Result(property = "appName", column = "app_name"),
@Result(property = "platform", column = "platform"),
@Result(property = "featId", column = "feat_id"),
@Result(property = "comments", column = "comments"),
@Result(property = "userId", column = "user_id"),
@Result(property = "updateTime", column = "update_time")})
List<TagResult> list(String userId, String search);
class ListMapperProvider {
public String list(String userId, String search) {
String sql = "SELECT * FROM tag_result WHERE user_id = #{userId}";
if (StringUtils.isNotBlank(search)) {
sql += " AND LOWER(package_name) LIKE '%" + search + "%'";
}
return sql;
}
}
/*
@Select("SELECT * FROM tag_result")
@Results({@Result(property = "packageName", column = "package_name"),
@Result(property = "appName", column = "app_name"),
......@@ -46,11 +66,62 @@ public interface ResultDao {
@Result(property = "comments", column = "comments"),
@Result(property = "userId", column = "user_id"),
@Result(property = "updateTime", column = "update_time")})
List<TagResult> listAll();
List<TagResult> listAll(String search);
*/
@SelectProvider(type = ListAllMapperProvider.class, method = "listAll")
@Results({@Result(property = "packageName", column = "package_name"),
@Result(property = "appName", column = "app_name"),
@Result(property = "platform", column = "platform"),
@Result(property = "featId", column = "feat_id"),
@Result(property = "comments", column = "comments"),
@Result(property = "userId", column = "user_id"),
@Result(property = "updateTime", column = "update_time")})
List<TagResult> listAll(String search);
class ListAllMapperProvider {
public String listAll(String search) {
String sql = "SELECT * FROM tag_result";
if (StringUtils.isNotBlank(search)) {
sql += " WHERE LOWER(package_name) LIKE '%" + search + "%'";
}
return sql;
}
}
/*
@Select("SELECT COUNT(1) FROM tag_result WHERE user_id = #{userId}")
int count(String userId);
*/
@SelectProvider(type = CountMapperProvider.class, method = "count")
int count(String userId, String search);
class CountMapperProvider {
public String count(String userId, String search) {
String sql = "SELECT COUNT(1) FROM tag_result WHERE user_id = #{userId}";
if (StringUtils.isNotBlank(search)) {
sql += " AND LOWER(package_name) LIKE '%" + search + "%'";
}
return sql;
}
}
/*
@Select("SELECT COUNT(1) FROM tag_result")
int countAll();
int countAll(String search);
*/
@SelectProvider(type = CountAllMapperProvider.class, method = "countAll")
int countAll(String search);
class CountAllMapperProvider {
public String countAll(String search) {
String sql = "SELECT COUNT(1) FROM tag_result";
if (StringUtils.isNotBlank(search)) {
sql += " WHERE LOWER(package_name) LIKE '%" + search + "%'";
}
return sql;
}
}
}
\ No newline at end of file
package com.mobvista.apptag.mapper;
import java.util.List;
import com.mobvista.apptag.entity.Tag;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;
/**
* @author wangjf
*/
public interface TagDao {
@Update("UPDATE tag_list SET user_id = #{userId}, tag = #{tag},update_time = #{updateTime} WHERE package_name = #{packageName}")
boolean update(Tag tag);
@Select("SELECT * FROM tag_list WHERE tag = #{tag} ORDER BY install DESC")
@Results({ @Result(property = "packageName", column = "package_name"),
@Result(property = "appName", column = "app_name"),
@Result(property = "platform", column = "platform"),
@Result(property = "category", column = "category"), @Result(property = "url", column = "url"),
@Result(property = "install", column = "install"), @Result(property = "tag", column = "tag"),
@Result(property = "userId", column = "user_id"),
@Result(property = "updateTime", column = "update_time") })
List<Tag> list(int tag);
@Select("SELECT * FROM tag_list WHERE tag = #{tag} ORDER BY install DESC")
@Results({ @Result(property = "packageName", column = "package_name"),
@Result(property = "appName", column = "app_name"),
@Result(property = "platform", column = "platform"),
@Result(property = "category", column = "category"), @Result(property = "url", column = "url"),
@Result(property = "install", column = "install"), @Result(property = "tag", column = "tag"),
@Result(property = "userId", column = "user_id"),
@Result(property = "updateTime", column = "update_time") })
List<Tag> listAll(int tag);
@Select("SELECT * FROM tag_list ORDER BY install DESC LIMIT 1")
@Results({ @Result(property = "packageName", column = "package_name"),
@Result(property = "appName", column = "app_name"),
@Result(property = "platform", column = "platform"),
@Result(property = "category", column = "category"), @Result(property = "url", column = "url"),
@Result(property = "install", column = "install"), @Result(property = "tag", column = "tag"),
@Result(property = "userId", column = "user_id"),
@Result(property = "updateTime", column = "update_time") })
Tag one();
@Select("SELECT * FROM tag_list WHERE package_name = #{packageName}")
@Results({ @Result(property = "packageName", column = "package_name"),
@Result(property = "appName", column = "app_name"),
@Result(property = "platform", column = "platform"),
@Result(property = "category", column = "category"), @Result(property = "url", column = "url"),
@Result(property = "install", column = "install"), @Result(property = "tag", column = "tag"),
@Result(property = "userId", column = "user_id"),
@Result(property = "updateTime", column = "update_time") })
Tag find(String package_name);
@Select("SELECT COUNT(1) FROM tag_list WHERE tag = #{tag}")
int count(int tag);
@Update("UPDATE tag_list SET user_id = #{userId}, tag = #{tag},update_time = #{updateTime} WHERE package_name = #{packageName}")
boolean update(Tag tag);
/*
@Select("SELECT * FROM tag_list WHERE tag = #{tag} ORDER BY install DESC")
@Results({@Result(property = "packageName", column = "package_name"),
@Result(property = "appName", column = "app_name"),
@Result(property = "platform", column = "platform"),
@Result(property = "category", column = "category"), @Result(property = "url", column = "url"),
@Result(property = "install", column = "install"), @Result(property = "tag", column = "tag"),
@Result(property = "userId", column = "user_id"),
@Result(property = "updateTime", column = "update_time")})
List<Tag> list(int tag);
*/
@SelectProvider(type = ListMapperProvider.class, method = "list")
@Results({@Result(property = "packageName", column = "package_name"),
@Result(property = "appName", column = "app_name"),
@Result(property = "platform", column = "platform"),
@Result(property = "category", column = "category"), @Result(property = "url", column = "url"),
@Result(property = "install", column = "install"), @Result(property = "tag", column = "tag"),
@Result(property = "userId", column = "user_id"),
@Result(property = "updateTime", column = "update_time")})
List<Tag> list(String search, int tag);
class ListMapperProvider {
public String list(String search, int tag) {
String sql = "SELECT * FROM tag_list WHERE tag = #{tag}";
if (StringUtils.isNotBlank(search)) {
sql += " AND LOWER(package_name) LIKE '%" + search + "%'";
}
return sql + " ORDER BY install DESC";
}
}
@Select("SELECT * FROM tag_list WHERE tag = #{tag} ORDER BY install DESC")
@Results({@Result(property = "packageName", column = "package_name"),
@Result(property = "appName", column = "app_name"),
@Result(property = "platform", column = "platform"),
@Result(property = "category", column = "category"), @Result(property = "url", column = "url"),
@Result(property = "install", column = "install"), @Result(property = "tag", column = "tag"),
@Result(property = "userId", column = "user_id"),
@Result(property = "updateTime", column = "update_time")})
List<Tag> listAll(int tag);
@Select("SELECT * FROM tag_list ORDER BY install DESC LIMIT 1")
@Results({@Result(property = "packageName", column = "package_name"),
@Result(property = "appName", column = "app_name"),
@Result(property = "platform", column = "platform"),
@Result(property = "category", column = "category"), @Result(property = "url", column = "url"),
@Result(property = "install", column = "install"), @Result(property = "tag", column = "tag"),
@Result(property = "userId", column = "user_id"),
@Result(property = "updateTime", column = "update_time")})
Tag one();
@Select("SELECT * FROM tag_list WHERE package_name = #{packageName}")
@Results({@Result(property = "packageName", column = "package_name"),
@Result(property = "appName", column = "app_name"),
@Result(property = "platform", column = "platform"),
@Result(property = "category", column = "category"), @Result(property = "url", column = "url"),
@Result(property = "install", column = "install"), @Result(property = "tag", column = "tag"),
@Result(property = "userId", column = "user_id"),
@Result(property = "updateTime", column = "update_time")})
Tag find(String package_name);
/*
@Select("SELECT COUNT(1) FROM tag_list WHERE tag = #{tag}")
int count(int tag);
*/
@SelectProvider(type = CountMapperProvider.class, method = "count")
int count(String search, int tag);
class CountMapperProvider {
public String count(String search, int tag) {
String sql = "SELECT COUNT(1) FROM tag_list WHERE tag = #{tag}";
if (StringUtils.isNotBlank(search)) {
sql += " AND LOWER(package_name) LIKE '%" + search + "%'";
}
return sql;
}
}
}
\ No newline at end of file
package com.mobvista.apptag.mapper;
import java.util.List;
import com.mobvista.apptag.entity.User;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;
/**
* @author wangjf
......@@ -16,28 +12,63 @@ import org.apache.ibatis.annotations.Update;
public interface UserDao {
@Insert("REPLACE INTO user(user_id,user_name,password,state,role,update_time,count) VALUES(#{userId},#{userName},#{password},#{state},#{role},#{updateTime},${count})")
boolean save(User user);
@Update("UPDATE user SET role = #{role}, update_time = #{updateTime}, count = #{count} WHERE user_id = #{userId}")
void update(User user);
@Select("SELECT * FROM user WHERE user_id = #{userId}")
@Results({ @Result(property = "userId", column = "user_id"),
@Result(property = "userName", column = "user_name"),
@Result(property = "count", column = "count"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "role", column = "role") })
User find(String userId);
@Select("SELECT * FROM user")
@Results({ @Result(property = "userId", column = "user_id"),
@Result(property = "userName", column = "user_name"),
@Result(property = "count", column = "count"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "role", column = "role") })
List<User> list();
@Select("SELECT COUNT(1) FROM user")
int count();
@Insert("REPLACE INTO user(user_id,user_name,password,state,role,update_time,count) VALUES(#{userId},#{userName},#{password},#{state},#{role},#{updateTime},${count})")
boolean save(User user);
@Update("UPDATE user SET role = #{role}, update_time = #{updateTime}, count = #{count} WHERE user_id = #{userId}")
void update(User user);
@Select("SELECT * FROM user WHERE user_id = #{userId}")
@Results({@Result(property = "userId", column = "user_id"),
@Result(property = "userName", column = "user_name"),
@Result(property = "count", column = "count"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "role", column = "role")})
User find(String userId);
/*
@Select("SELECT * FROM user")
@Results({@Result(property = "userId", column = "user_id"),
@Result(property = "userName", column = "user_name"),
@Result(property = "count", column = "count"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "role", column = "role")})
List<User> list(String search);
*/
@SelectProvider(type = ListMapperProvider.class, method = "list")
@Results({@Result(property = "userId", column = "user_id"),
@Result(property = "userName", column = "user_name"),
@Result(property = "count", column = "count"),
@Result(property = "updateTime", column = "update_time"),
@Result(property = "role", column = "role")})
List<User> list(String search);
class ListMapperProvider {
public String list(String search) {
String sql = "SELECT * FROM user";
if (StringUtils.isNotBlank(search)) {
sql += " WHERE LOWER(user_name) LIKE '%" + search + "%'";
}
return sql;
}
}
/*
@Select("SELECT COUNT(1) FROM user")
int count();
*/
@SelectProvider(type = CountMapperProvider.class, method = "count")
int count(String search);
class CountMapperProvider {
public String count(String search) {
String sql = "SELECT count(1) FROM user ";
if (StringUtils.isNotBlank(search)) {
sql += " WHERE LOWER(user_name) LIKE '%" + search + "%'";
}
return sql;
}
}
}
\ No newline at end of file
......@@ -18,5 +18,5 @@ public interface ResultService {
List<TagResult> list(String userId, Query query);
int count(String userId);
int count(String userId, String search);
}
\ No newline at end of file
package com.mobvista.apptag.service;
import java.util.List;
import com.mobvista.apptag.entity.Tag;
/**
......@@ -13,5 +11,5 @@ public interface TagService {
Tag find(String packageName);
List<Tag> list(int pageNum, int pageSize);
// List<Tag> list(int pageNum, int pageSize);
}
\ No newline at end of file
package com.mobvista.apptag.service;
import java.util.Map;
import com.mobvista.apptag.entity.User;
import java.util.Map;
/**
* @author wangjf
*/
public interface UserService {
boolean createUser(Map<String,Object> uMap, String userId);
boolean createUser(Map<String, Object> uMap, String userId);
void updateUser(User user);
Map<String, Object> find(String userId);
/*
Map<String, Object> list();
*/
Boolean validate(String userId, String password);
......
package com.mobvista.apptag.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.mobvista.apptag.entity.Tag;
......@@ -13,11 +9,14 @@ import com.mobvista.apptag.mapper.ResultDao;
import com.mobvista.apptag.mapper.TagDao;
import com.mobvista.apptag.mapper.UserDao;
import com.mobvista.apptag.service.ResultService;
import com.mobvista.apptag.utils.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @author wangjf
*/
......@@ -69,9 +68,9 @@ public class ResultServiceImpl implements ResultService {
List<TagResult> results;
PageHelper.startPage(query.getOffset() / query.getLimit() + 1, query.getLimit());
if (user.getRole() == 0) {
results = resultDao.list(userId);
results = resultDao.list(userId, query.getSearch().toLowerCase());
} else {
results = resultDao.listAll();
results = resultDao.listAll(query.getSearch().toLowerCase());
}
List<TagResult> results2 = new ArrayList<>();
......@@ -84,12 +83,12 @@ public class ResultServiceImpl implements ResultService {
}
@Override
public int count(String userId) {
public int count(String userId, String search) {
User user = userDao.find(userId);
if (user.getRole() == 0) {
return resultDao.count(userId);
return resultDao.count(userId, search);
} else {
return resultDao.countAll();
return resultDao.countAll(search);
}
}
}
\ No newline at end of file
......@@ -41,9 +41,11 @@ public class TagServiceImpl implements TagService {
return tagDao.find(packageName);
}
/*
@Override
public List<Tag> list(int pageNum, int pageSize) {
PageHelper.startPage(pageNum, pageSize);
return tagDao.list(1);
}
*/
}
\ No newline at end of file
......@@ -54,6 +54,7 @@ public class UserServiceImpl implements UserService {
return attributes;
}
/*
@Override
public Map<String, Object> list() {
Map<String, Object> attributes = new HashMap<>();
......@@ -62,6 +63,7 @@ public class UserServiceImpl implements UserService {
attributes.put("userDto", new User());
return attributes;
}
*/
@Override
public Boolean validate(String user_id, String password) {
......
......@@ -22,4 +22,9 @@ public class MD5Util {
throw new Exception("MD5加密出现错误," + e.toString());
}
}
public static void main(String[] args) throws Exception {
String str = getMD5Str("123456");
System.out.println(str);
}
}
\ No newline at end of file
......@@ -16,6 +16,8 @@ public class Query implements Serializable {
private String order;
private String search;
/**
* @return the limit
*/
......@@ -58,4 +60,17 @@ public class Query implements Serializable {
this.offset = offset;
}
/**
* @return the search
*/
public String getSearch() {
return search;
}
/**
* @param search the search to set
*/
public void setSearch(String search) {
this.search = search;
}
}
\ No newline at end of file
var prefix = "result";
$(function () {
load();
load();
});
function load() {
$("#exampleTable").bootstrapTable({
method: "post", // 服务器数据的请求方式 get or post
url: prefix + "/list", // 服务器数据的加载地址
striped: true, // 设置为true会有隔行变色效果
dataType: "json", // 服务器返回的数据类型
pagination: true, // 设置为true会在底部显示分页条
// queryParamsType : "limit",
// //设置为limit则会发送符合RESTFull格式的参数
singleSelect: false, // 设置为true将禁止多选
iconSize: "outline",
toolbar: "#exampleToolbar",
// contentType : "application/x-www-form-urlencoded",
// //发送到服务器的数据编码类型
pageSize: 10, // 如果设置了分页,每页数据条数
pageNumber: 1, // 如果设置了分布,首页页码
// search: true, // 是否显示搜索框
showColumns: true, // 是否显示内容下拉框(选择显示的列)
sidePagination: "server", // 设置在哪里进行分页,可选值为"client" 或者 "server"
// queryParams : queryParams,
// //请求服务器数据时,你可以通过重写参数的方式添加一些额外的参数,例如 toolbar 中的参数 如果
// queryParamsType = 'limit' ,返回参数必须包含
// limit, offset, search, sort, order 否则, 需要包含:
// pageSize, pageNumber, searchText, sortName,
// sortOrder.
// 返回false将会终止请求
columns: [{
// 列配置项
// 数据类型,详细参数配置参见文档http://bootstrap-table.wenzhixin.net.cn/zh-cn/documentation/
checkbox: true
// 列表中显示复选框
},
{
field: "packageName", // 列字段名
title: "包名", // 列标题
align: "center"
},
{
field: "appName",
title: "应用名称",
align: "center"
},
{
field: "platform",
title: "平台",
align: "center"
},
{
field: "featId",
title: "已标标签",
align: "center"
},
{
title: "操作",
field: "packageName",
align: "center",
formatter: function (value, row, index) {
var e =
'<a class="btn btn-primary btn-sm ' +
s_edit_h +
'" href="#" mce_href="#" title="编辑" onclick="edit(\'' +
row.packageName +
'\')"><i class="fa fa-edit"></i></a> ';
return e;
}
}
]
});
$("#exampleTable").bootstrapTable({
method: "post", // 服务器数据的请求方式 get or post
url: prefix + "/list", // 服务器数据的加载地址
striped: true, // 设置为true会有隔行变色效果
dataType: "json", // 服务器返回的数据类型
pagination: true, // 设置为true会在底部显示分页条
// queryParamsType : "limit",
// //设置为limit则会发送符合RESTFull格式的参数
singleSelect: false, // 设置为true将禁止多选
iconSize: "outline",
toolbar: "#exampleToolbar",
// contentType : "application/x-www-form-urlencoded",
// //发送到服务器的数据编码类型
pageSize: 10, // 如果设置了分页,每页数据条数
pageNumber: 1, // 如果设置了分布,首页页码
// search: true, // 是否显示搜索框
showColumns: true, // 是否显示内容下拉框(选择显示的列)
sidePagination: "server", // 设置在哪里进行分页,可选值为"client" 或者 "server"
// queryParams : queryParams,
queryParams: function (params) {
return {
// 说明:传入后台的参数包括offset开始索引,limit步长,sort排序列,order:desc或者,以及所有列的键值对
limit: params.limit,
offset: params.offset,
search: $('#searchName').val()
};
},
// //请求服务器数据时,你可以通过重写参数的方式添加一些额外的参数,例如 toolbar 中的参数 如果
// queryParamsType = 'limit' ,返回参数必须包含
// limit, offset, search, sort, order 否则, 需要包含:
// pageSize, pageNumber, searchText, sortName,
// sortOrder.
// 返回false将会终止请求
columns: [{
// 列配置项
// 数据类型,详细参数配置参见文档http://bootstrap-table.wenzhixin.net.cn/zh-cn/documentation/
checkbox: true
// 列表中显示复选框
},
{
field: "packageName", // 列字段名
title: "包名", // 列标题
align: "center"
},
{
field: "appName",
title: "应用名称",
align: "center"
},
{
field: "platform",
title: "平台",
align: "center"
},
{
field: "featId",
title: "已标标签",
align: "center"
},
{
title: "操作",
field: "packageName",
align: "center",
formatter: function (value, row, index) {
var e =
'<a class="btn btn-primary btn-sm ' +
s_edit_h +
'" href="#" mce_href="#" title="编辑" onclick="edit(\'' +
row.packageName +
'\')"><i class="fa fa-edit"></i></a> ';
return e;
}
}
]
});
}
function reLoad(type) {
if (type == 1) {
var opt = {
query: {
offset: 0
}
};
$("#exampleTable").bootstrapTable("refresh", opt);
} else {
$("#exampleTable").bootstrapTable("refresh");
}
if (type == 1) {
var opt = {
query: {
offset: 0
}
};
$("#exampleTable").bootstrapTable("refresh", opt);
} else {
$("#exampleTable").bootstrapTable("refresh");
}
}
function edit(package_name) {
layer.open({
type: 2,
title: "标签标注",
maxmin: true,
shadeClose: true, // 点击遮罩关闭层
area: ["800px", "580px"],
content: prefix + "/edit?packageName=" + package_name // iframe的url
});
layer.open({
type: 2,
title: "标签标注",
maxmin: true,
shadeClose: true, // 点击遮罩关闭层
area: ["800px", "580px"],
content: prefix + "/edit?packageName=" + package_name // iframe的url
});
}
\ No newline at end of file
var prefix = "tag";
$(function () {
load();
load();
});
function load() {
$("#exampleTable").bootstrapTable({
method: "post", // 服务器数据的请求方式 get or post
url: prefix + "/list", // 服务器数据的加载地址
striped: true, // 设置为true会有隔行变色效果
dataType: "json", // 服务器返回的数据类型
pagination: true, // 设置为true会在底部显示分页条
// queryParamsType : "limit",
// //设置为limit则会发送符合RESTFull格式的参数
singleSelect: false, // 设置为true将禁止多选
iconSize: "outline",
toolbar: "#exampleToolbar",
// contentType : "application/x-www-form-urlencoded",
// //发送到服务器的数据编码类型
pageSize: 10, // 如果设置了分页,每页数据条数
pageNumber: 1, // 如果设置了分布,首页页码
// search: true, // 是否显示搜索框
showColumns: true, // 是否显示内容下拉框(选择显示的列)
sidePagination: "server", // 设置在哪里进行分页,可选值为"client" 或者 "server"
// queryParams : queryParams,
// //请求服务器数据时,你可以通过重写参数的方式添加一些额外的参数,例如 toolbar 中的参数 如果
// queryParamsType = 'limit' ,返回参数必须包含
// limit, offset, search, sort, order 否则, 需要包含:
// pageSize, pageNumber, searchText, sortName,
// sortOrder.
// 返回false将会终止请求
columns: [{
// 列配置项
// 数据类型,详细参数配置参见文档http://bootstrap-table.wenzhixin.net.cn/zh-cn/documentation/
checkbox: true
// 列表中显示复选框
},
{
field: "packageName", // 列字段名
title: "包名", // 列标题
align: "center"
},
{
field: "appName",
title: "应用名称",
align: "center"
},
{
field: "platform",
title: "平台",
align: "center"
},
{
field: "category",
title: "商店类别",
align: "center"
},
{
field: "install",
title: "安装量",
align: "center"
},
{
title: "操作",
field: "packageName",
align: "center",
formatter: function (value, row, index) {
var e =
'<a class="btn btn-primary btn-sm ' +
s_edit_h +
'" href="#" mce_href="#" title="编辑" onclick="edit(\'' +
row.packageName +
'\')"><i class="fa fa-edit"></i></a> ';
return e;
}
}
]
});
$("#exampleTable").bootstrapTable({
method: "post", // 服务器数据的请求方式 get or post
url: prefix + "/list", // 服务器数据的加载地址
striped: true, // 设置为true会有隔行变色效果
dataType: "json", // 服务器返回的数据类型
pagination: true, // 设置为true会在底部显示分页条
// queryParamsType : "limit",
// //设置为limit则会发送符合RESTFull格式的参数
singleSelect: false, // 设置为true将禁止多选
iconSize: "outline",
toolbar: "#exampleToolbar",
// contentType : "application/x-www-form-urlencoded",
// //发送到服务器的数据编码类型
pageSize: 10, // 如果设置了分页,每页数据条数
pageNumber: 1, // 如果设置了分布,首页页码
// search: true, // 是否显示搜索框
showColumns: true, // 是否显示内容下拉框(选择显示的列)
sidePagination: "server", // 设置在哪里进行分页,可选值为"client" 或者 "server"
// queryParams : queryParams,
queryParams: function (params) {
return {
// 说明:传入后台的参数包括offset开始索引,limit步长,sort排序列,order:desc或者,以及所有列的键值对
limit: params.limit,
offset: params.offset,
search: $('#searchName').val()
};
},
// //请求服务器数据时,你可以通过重写参数的方式添加一些额外的参数,例如 toolbar 中的参数 如果
// queryParamsType = 'limit' ,返回参数必须包含
// limit, offset, search, sort, order 否则, 需要包含:
// pageSize, pageNumber, searchText, sortName,
// sortOrder.
// 返回false将会终止请求
columns: [{
// 列配置项
// 数据类型,详细参数配置参见文档http://bootstrap-table.wenzhixin.net.cn/zh-cn/documentation/
checkbox: true
// 列表中显示复选框
},
{
field: "packageName", // 列字段名
title: "包名", // 列标题
align: "center"
},
{
field: "appName",
title: "应用名称",
align: "center"
},
{
field: "platform",
title: "平台",
align: "center"
},
{
field: "category",
title: "商店类别",
align: "center"
},
{
field: "install",
title: "安装量",
align: "center"
},
{
title: "操作",
field: "packageName",
align: "center",
formatter: function (value, row, index) {
var e =
'<a class="btn btn-primary btn-sm ' +
s_edit_h +
'" href="#" mce_href="#" title="编辑" onclick="edit(\'' +
row.packageName +
'\')"><i class="fa fa-edit"></i></a> ';
return e;
}
}
]
});
}
function reLoad(type) {
if (type == 1) {
var opt = {
query: {
offset: 0
}
};
$("#exampleTable").bootstrapTable("refresh", opt);
} else {
$("#exampleTable").bootstrapTable("refresh");
}
if (type == 1) {
var opt = {
query: {
offset: 0
}
};
$("#exampleTable").bootstrapTable("refresh", opt);
} else {
$("#exampleTable").bootstrapTable("refresh");
}
}
function edit(package_name) {
layer.open({
type: 2,
title: "标签标注",
maxmin: true,
shadeClose: false, // 点击遮罩关闭层
area: ["800px", "580px"],
content: prefix + "/edit?packageName=" + package_name // iframe的url
});
layer.open({
type: 2,
title: "标签标注",
maxmin: true,
shadeClose: false, // 点击遮罩关闭层
area: ["800px", "580px"],
content: prefix + "/edit?packageName=" + package_name // iframe的url
});
}
\ No newline at end of file
var prefix = "user";
$(function () {
load();
load();
});
function load() {
$("#exampleTable").bootstrapTable({
method: "post", // 服务器数据的请求方式 get or post
url: prefix + "/list", // 服务器数据的加载地址
striped: true, // 设置为true会有隔行变色效果
dataType: "json", // 服务器返回的数据类型
pagination: true, // 设置为true会在底部显示分页条
// queryParamsType : "limit",
// //设置为limit则会发送符合RESTFull格式的参数
singleSelect: false, // 设置为true将禁止多选
iconSize: "outline",
toolbar: "#exampleToolbar",
// contentType : "application/x-www-form-urlencoded",
// //发送到服务器的数据编码类型
pageSize: 10, // 如果设置了分页,每页数据条数
pageNumber: 1, // 如果设置了分布,首页页码
// search: true, // 是否显示搜索框
showColumns: true, // 是否显示内容下拉框(选择显示的列)
sidePagination: "server", // 设置在哪里进行分页,可选值为"client" 或者 "server"
// queryParams : queryParams,
// //请求服务器数据时,你可以通过重写参数的方式添加一些额外的参数,例如 toolbar 中的参数 如果
// queryParamsType = 'limit' ,返回参数必须包含
// limit, offset, search, sort, order 否则, 需要包含:
// pageSize, pageNumber, searchText, sortName,
// sortOrder.
// 返回false将会终止请求
columns: [{
// 列配置项
// 数据类型,详细参数配置参见文档http://bootstrap-table.wenzhixin.net.cn/zh-cn/documentation/
checkbox: true
// 列表中显示复选框
},
{
field: "userName", // 列字段名
title: "用户名", // 列标题
align: "center"
},
{
field: "state",
title: "用户状态",
align: "center",
formatter: function (value, row, index) {
if (row.state == 0) {
return "禁用";
} else {
return "正常";
}
}
},
{
field: "role",
title: "角色",
align: "center",
formatter: function (value, row, index) {
if (row.role == 0) {
return "普通用户";
} else {
return "管理员";
}
}
},
{
field: "count",
title: "标注数量",
align: "center"
},
{
title: "操作",
field: "userId",
align: "center",
formatter: function (value, row, index) {
var e =
'<a class="btn btn-primary btn-sm ' +
s_edit_h +
'" href="#" mce_href="#" title="编辑" onclick="edit(\'' +
row.userId +
'\')"><i class="fa fa-edit"></i></a> ';
return e;
}
}
]
});
$("#exampleTable").bootstrapTable({
method: "post", // 服务器数据的请求方式 get or post
url: prefix + "/list", // 服务器数据的加载地址
striped: true, // 设置为true会有隔行变色效果
dataType: "json", // 服务器返回的数据类型
pagination: true, // 设置为true会在底部显示分页条
// queryParamsType : "limit",
// //设置为limit则会发送符合RESTFull格式的参数
singleSelect: false, // 设置为true将禁止多选
iconSize: "outline",
toolbar: "#exampleToolbar",
// contentType : "application/x-www-form-urlencoded",
// //发送到服务器的数据编码类型
pageSize: 10, // 如果设置了分页,每页数据条数
pageNumber: 1, // 如果设置了分布,首页页码
// search: true, // 是否显示搜索框
showColumns: true, // 是否显示内容下拉框(选择显示的列)
sidePagination: "server", // 设置在哪里进行分页,可选值为"client" 或者 "server"
// queryParams : queryParams,
queryParams: function (params) {
return {
// 说明:传入后台的参数包括offset开始索引,limit步长,sort排序列,order:desc或者,以及所有列的键值对
limit: params.limit,
offset: params.offset,
search: $('#searchName').val()
};
},
// //请求服务器数据时,你可以通过重写参数的方式添加一些额外的参数,例如 toolbar 中的参数 如果
// queryParamsType = 'limit' ,返回参数必须包含
// limit, offset, search, sort, order 否则, 需要包含:
// pageSize, pageNumber, searchText, sortName,
// sortOrder.
// 返回false将会终止请求
columns: [{
// 列配置项
// 数据类型,详细参数配置参见文档http://bootstrap-table.wenzhixin.net.cn/zh-cn/documentation/
checkbox: true
// 列表中显示复选框
},
{
field: "userName", // 列字段名
title: "用户名", // 列标题
align: "center"
},
{
field: "state",
title: "用户状态",
align: "center",
formatter: function (value, row, index) {
if (row.state == 0) {
return "禁用";
} else {
return "正常";
}
}
},
{
field: "role",
title: "角色",
align: "center",
formatter: function (value, row, index) {
if (row.role == 0) {
return "普通用户";
} else {
return "管理员";
}
}
},
{
field: "count",
title: "标注数量",
align: "center"
},
{
title: "操作",
field: "userId",
align: "center",
formatter: function (value, row, index) {
var e =
'<a class="btn btn-primary btn-sm ' +
s_edit_h +
'" href="#" mce_href="#" title="编辑" onclick="edit(\'' +
row.userId +
'\')"><i class="fa fa-edit"></i></a> ';
return e;
}
}
]
});
}
function reLoad(type) {
if (type == 1) {
var opt = {
query: {
offset: 0
}
};
$("#exampleTable").bootstrapTable("refresh", opt);
} else {
$("#exampleTable").bootstrapTable("refresh");
}
if (type == 1) {
var opt = {
query: {
offset: 0
}
};
$("#exampleTable").bootstrapTable("refresh", opt);
} else {
$("#exampleTable").bootstrapTable("refresh");
}
}
function edit(userId) {
layer.open({
type: 2,
title: "编辑用户",
maxmin: true,
shadeClose: false, // 点击遮罩关闭层
area: ["800px", "300px"],
content: prefix + "/edit?userId=" + userId // iframe的url
});
layer.open({
type: 2,
title: "编辑用户",
maxmin: true,
shadeClose: false, // 点击遮罩关闭层
area: ["800px", "300px"],
content: prefix + "/edit?userId=" + userId // iframe的url
});
}
function add() {
// iframe层
layer.open({
type : 2,
title : '增加用户',
maxmin : true,
shadeClose : false, // 点击遮罩关闭层
area : [ '800px', '450px' ],
content : prefix + '/add'
});
// iframe层
layer.open({
type: 2,
title: '增加用户',
maxmin: true,
shadeClose: false, // 点击遮罩关闭层
area: ['800px', '450px'],
content: prefix + '/add'
});
}
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org"
xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<div class="wrapper wrapper-content ">
<div class="col-sm-12">
<div class="ibox">
<div class="ibox-body">
<table id="exampleTable" data-mobile-responsive="true">
</table>
</div>
</div>
</div>
<div>
<script type="text/javascript">
var s_edit_h = 'hidden';
</script>
</div>
<div shiro:hasPermission="sys:user:edit">
<script type="text/javascript">
s_edit_h = '';
</script>
</div>
</div>
<div th:include="include :: footer"></div>
<script type="text/javascript" src="/js/appjs/result/list.js"></script>
<div class="wrapper wrapper-content ">
<div class="col-sm-12">
<div class="ibox">
<div class="ibox-body">
<div class="fixed-table-toolbar">
<div class="columns pull-right">
<button class="btn btn-success" onclick="reLoad(1)">查询</button>
</div>
<div class="columns pull-right col-md-2 nopadding">
<input id="searchName" type="text" class="form-control"
placeholder="packageName">
</div>
</div>
<table id="exampleTable" data-mobile-responsive="true">
</table>
</div>
</div>
</div>
<div>
<script type="text/javascript">
var s_edit_h = 'hidden';
</script>
</div>
<div shiro:hasPermission="sys:user:edit">
<script type="text/javascript">
s_edit_h = '';
</script>
</div>
</div>
<div th:include="include :: footer"></div>
<script type="text/javascript" src="/js/appjs/result/list.js"></script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org"
xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<div class="wrapper wrapper-content ">
<div class="col-sm-12">
<div class="ibox">
<div class="ibox-body">
<table id="exampleTable" data-mobile-responsive="true">
</table>
</div>
</div>
</div>
<div>
<script type="text/javascript">
var s_edit_h = 'hidden';
</script>
</div>
<div shiro:hasPermission="sys:user:edit">
<script type="text/javascript">
s_edit_h = '';
</script>
</div>
</div>
<div th:include="include :: footer"></div>
<script type="text/javascript" src="/js/appjs/tag/list.js"></script>
<div class="wrapper wrapper-content ">
<div class="col-sm-12">
<div class="ibox">
<div class="ibox-body">
<div class="fixed-table-toolbar">
<div class="columns pull-right">
<button class="btn btn-success" onclick="reLoad(1)">查询</button>
</div>
<div class="columns pull-right col-md-2 nopadding">
<input id="searchName" type="text" class="form-control"
placeholder="packageName">
</div>
</div>
<table id="exampleTable" data-mobile-responsive="true">
</table>
</div>
</div>
</div>
<div>
<script type="text/javascript">
var s_edit_h = 'hidden';
</script>
</div>
<div shiro:hasPermission="sys:user:edit">
<script type="text/javascript">
s_edit_h = '';
</script>
</div>
</div>
<div th:include="include :: footer"></div>
<script type="text/javascript" src="/js/appjs/tag/list.js"></script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org"
xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<div class="wrapper wrapper-content ">
<div class="col-sm-12">
<div class="ibox">
<div class="ibox-body">
<div id="exampleToolbar" role="group">
<button type="button"
class="btn btn-primary" onclick="add()">
<i class="fa fa-plus" aria-hidden="true"></i>增加用户
</button>
</div>
<table id="exampleTable" data-mobile-responsive="true">
</table>
</div>
</div>
</div>
<div>
<script type="text/javascript">
var s_edit_h = 'hidden';
</script>
</div>
<div shiro:hasPermission="sys:user:edit">
<script type="text/javascript">
s_edit_h = '';
</script>
</div>
</div>
<div th:include="include :: footer"></div>
<script type="text/javascript" src="/js/appjs/user/list.js"></script>
<div class="wrapper wrapper-content ">
<div class="col-sm-12">
<div class="ibox">
<div class="ibox-body">
<div class="fixed-table-toolbar">
<div id="exampleToolbar" role="group">
<button type="button"
class="btn btn-primary" onclick="add()">
<i class="fa fa-plus" aria-hidden="true"></i>增加用户
</button>
</div>
<div class="columns pull-right">
<button class="btn btn-success" onclick="reLoad(1)">查询</button>
</div>
<div class="columns pull-right col-md-2 nopadding">
<input id="searchName" type="text" class="form-control"
placeholder="姓名">
</div>
</div>
<table id="exampleTable" data-mobile-responsive="true">
</table>
</div>
</div>
</div>
<div>
<script type="text/javascript">
var s_edit_h = 'hidden';
</script>
</div>
<div shiro:hasPermission="sys:user:edit">
<script type="text/javascript">
s_edit_h = '';
</script>
</div>
</div>
<div th:include="include :: footer"></div>
<script type="text/javascript" src="/js/appjs/user/list.js"></script>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment