|
|
|
@ -39,7 +39,6 @@ import com.utils.MD5Util;
|
|
|
|
|
import com.utils.MPUtil;
|
|
|
|
|
import com.utils.CommonUtil;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 用户
|
|
|
|
|
* 后端接口
|
|
|
|
@ -47,141 +46,139 @@ import com.utils.CommonUtil;
|
|
|
|
|
* @email
|
|
|
|
|
* @date 2023-02-21 09:46:06
|
|
|
|
|
*/
|
|
|
|
|
@RestController // 标记这是一个REST控制器
|
|
|
|
|
@RequestMapping("/yonghu") // 设置请求路径的前缀为/yonghu
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping("/yonghu")
|
|
|
|
|
public class YonghuController {
|
|
|
|
|
@Autowired
|
|
|
|
|
private YonghuService yonghuService; // 自动注入YonghuService服务
|
|
|
|
|
private YonghuService yonghuService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private TokenService tokenService; // 自动注入TokenService服务
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 登录
|
|
|
|
|
*/
|
|
|
|
|
@IgnoreAuth // 忽略权限验证
|
|
|
|
|
@RequestMapping(value = "/login") // 设置请求路径为/login
|
|
|
|
|
public R login(String username, String password, String captcha, HttpServletRequest request) {
|
|
|
|
|
// 根据用户名查询用户
|
|
|
|
|
YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("zhanghao", username));
|
|
|
|
|
// 验证用户名和密码
|
|
|
|
|
if(u==null || !u.getMima().equals(password)) {
|
|
|
|
|
return R.error("账号或密码不正确");
|
|
|
|
|
}
|
|
|
|
|
// 生成并返回token
|
|
|
|
|
String token = tokenService.generateToken(u.getId(), username,"yonghu", "用户" );
|
|
|
|
|
return R.ok().put("token", token);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private TokenService tokenService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 登录
|
|
|
|
|
*/
|
|
|
|
|
@IgnoreAuth
|
|
|
|
|
@RequestMapping(value = "/login")
|
|
|
|
|
public R login(String username, String password, String captcha, HttpServletRequest request) {
|
|
|
|
|
YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("zhanghao", username));
|
|
|
|
|
if(u==null || !u.getMima().equals(password)) {
|
|
|
|
|
return R.error("账号或密码不正确");
|
|
|
|
|
}
|
|
|
|
|
String token = tokenService.generateToken(u.getId(), username,"yonghu", "用户" );
|
|
|
|
|
return R.ok().put("token", token);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 注册
|
|
|
|
|
*/
|
|
|
|
|
@IgnoreAuth // 忽略权限验证
|
|
|
|
|
@RequestMapping("/register") // 设置请求路径为/register
|
|
|
|
|
@IgnoreAuth
|
|
|
|
|
@RequestMapping("/register")
|
|
|
|
|
public R register(@RequestBody YonghuEntity yonghu){
|
|
|
|
|
// 检查用户是否已存在
|
|
|
|
|
YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("zhanghao", yonghu.getZhanghao()));
|
|
|
|
|
if(u!=null) {
|
|
|
|
|
return R.error("注册用户已存在");
|
|
|
|
|
}
|
|
|
|
|
// 生成用户ID并插入用户数据
|
|
|
|
|
Long uId = new Date().getTime();
|
|
|
|
|
yonghu.setId(uId);
|
|
|
|
|
//ValidatorUtils.validateEntity(yonghu);
|
|
|
|
|
YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("zhanghao", yonghu.getZhanghao()));
|
|
|
|
|
if(u!=null) {
|
|
|
|
|
return R.error("注册用户已存在");
|
|
|
|
|
}
|
|
|
|
|
Long uId = new Date().getTime();
|
|
|
|
|
yonghu.setId(uId);
|
|
|
|
|
yonghuService.insert(yonghu);
|
|
|
|
|
return R.ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 退出
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping("/logout") // 设置请求路径为/logout
|
|
|
|
|
public R logout(HttpServletRequest request) {
|
|
|
|
|
// 使当前会话失效
|
|
|
|
|
request.getSession().invalidate();
|
|
|
|
|
return R.ok("退出成功");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 退出
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping("/logout")
|
|
|
|
|
public R logout(HttpServletRequest request) {
|
|
|
|
|
request.getSession().invalidate();
|
|
|
|
|
return R.ok("退出成功");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取用户的session用户信息
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping("/session") // 设置请求路径为/session
|
|
|
|
|
@RequestMapping("/session")
|
|
|
|
|
public R getCurrUser(HttpServletRequest request){
|
|
|
|
|
// 从session中获取用户ID
|
|
|
|
|
Long id = (Long)request.getSession().getAttribute("userId");
|
|
|
|
|
// 根据ID查询用户信息
|
|
|
|
|
Long id = (Long)request.getSession().getAttribute("userId");
|
|
|
|
|
YonghuEntity u = yonghuService.selectById(id);
|
|
|
|
|
return R.ok().put("data", u);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 密码重置
|
|
|
|
|
*/
|
|
|
|
|
@IgnoreAuth // 忽略权限验证
|
|
|
|
|
@RequestMapping(value = "/resetPass") // 设置请求路径为/resetPass
|
|
|
|
|
@IgnoreAuth
|
|
|
|
|
@RequestMapping(value = "/resetPass")
|
|
|
|
|
public R resetPass(String username, HttpServletRequest request){
|
|
|
|
|
// 根据用户名查询用户
|
|
|
|
|
YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("zhanghao", username));
|
|
|
|
|
if(u==null) {
|
|
|
|
|
return R.error("账号不存在");
|
|
|
|
|
}
|
|
|
|
|
// 重置密码为123456
|
|
|
|
|
YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("zhanghao", username));
|
|
|
|
|
if(u==null) {
|
|
|
|
|
return R.error("账号不存在");
|
|
|
|
|
}
|
|
|
|
|
u.setMima("123456");
|
|
|
|
|
yonghuService.updateById(u);
|
|
|
|
|
return R.ok("密码已重置为:123456");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 后端列表
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping("/page") // 设置请求路径为/page
|
|
|
|
|
@RequestMapping("/page")
|
|
|
|
|
public R page(@RequestParam Map<String, Object> params,YonghuEntity yonghu,
|
|
|
|
|
HttpServletRequest request){
|
|
|
|
|
HttpServletRequest request){
|
|
|
|
|
|
|
|
|
|
EntityWrapper<YonghuEntity> ew = new EntityWrapper<YonghuEntity>();
|
|
|
|
|
// 分页查询用户列表
|
|
|
|
|
PageUtils page = yonghuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yonghu), params), params));
|
|
|
|
|
request.setAttribute("data", page);
|
|
|
|
|
|
|
|
|
|
PageUtils page = yonghuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yonghu), params), params));
|
|
|
|
|
request.setAttribute("data", page);
|
|
|
|
|
return R.ok().put("data", page);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 前端列表
|
|
|
|
|
*/
|
|
|
|
|
@IgnoreAuth // 忽略权限验证
|
|
|
|
|
@RequestMapping("/list") // 设置请求路径为/list
|
|
|
|
|
@IgnoreAuth
|
|
|
|
|
@RequestMapping("/list")
|
|
|
|
|
public R list(@RequestParam Map<String, Object> params,YonghuEntity yonghu,
|
|
|
|
|
HttpServletRequest request){
|
|
|
|
|
HttpServletRequest request){
|
|
|
|
|
EntityWrapper<YonghuEntity> ew = new EntityWrapper<YonghuEntity>();
|
|
|
|
|
// 分页查询用户列表
|
|
|
|
|
PageUtils page = yonghuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yonghu), params), params));
|
|
|
|
|
request.setAttribute("data", page);
|
|
|
|
|
|
|
|
|
|
PageUtils page = yonghuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yonghu), params), params));
|
|
|
|
|
request.setAttribute("data", page);
|
|
|
|
|
return R.ok().put("data", page);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
/**
|
|
|
|
|
* 列表
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping("/lists") // 设置请求路径为/lists
|
|
|
|
|
@RequestMapping("/lists")
|
|
|
|
|
public R list( YonghuEntity yonghu){
|
|
|
|
|
EntityWrapper<YonghuEntity> ew = new EntityWrapper<YonghuEntity>();
|
|
|
|
|
ew.allEq(MPUtil.allEQMapPre( yonghu, "yonghu"));
|
|
|
|
|
EntityWrapper<YonghuEntity> ew = new EntityWrapper<YonghuEntity>();
|
|
|
|
|
ew.allEq(MPUtil.allEQMapPre( yonghu, "yonghu"));
|
|
|
|
|
return R.ok().put("data", yonghuService.selectListView(ew));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
/**
|
|
|
|
|
* 查询
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping("/query") // 设置请求路径为/query
|
|
|
|
|
@RequestMapping("/query")
|
|
|
|
|
public R query(YonghuEntity yonghu){
|
|
|
|
|
EntityWrapper< YonghuEntity> ew = new EntityWrapper< YonghuEntity>();
|
|
|
|
|
ew.allEq(MPUtil.allEQMapPre( yonghu, "yonghu"));
|
|
|
|
|
YonghuView yonghuView = yonghuService.selectView(ew);
|
|
|
|
|
return R.ok("查询用户成功").put("data", yonghuView);
|
|
|
|
|
ew.allEq(MPUtil.allEQMapPre( yonghu, "yonghu"));
|
|
|
|
|
YonghuView yonghuView = yonghuService.selectView(ew);
|
|
|
|
|
return R.ok("查询用户成功").put("data", yonghuView);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 后端详情
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping("/info/{id}") // 设置请求路径为/info/{id}
|
|
|
|
|
@RequestMapping("/info/{id}")
|
|
|
|
|
public R info(@PathVariable("id") Long id){
|
|
|
|
|
YonghuEntity yonghu = yonghuService.selectById(id);
|
|
|
|
|
return R.ok().put("data", yonghu);
|
|
|
|
@ -190,108 +187,126 @@ public class YonghuController {
|
|
|
|
|
/**
|
|
|
|
|
* 前端详情
|
|
|
|
|
*/
|
|
|
|
|
@IgnoreAuth // 忽略权限验证
|
|
|
|
|
@RequestMapping("/detail/{id}") // 设置请求路径为/detail/{id}
|
|
|
|
|
@IgnoreAuth
|
|
|
|
|
@RequestMapping("/detail/{id}")
|
|
|
|
|
public R detail(@PathVariable("id") Long id){
|
|
|
|
|
YonghuEntity yonghu = yonghuService.selectById(id);
|
|
|
|
|
return R.ok().put("data", yonghu);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 后端保存
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping("/save") // 设置请求路径为/save
|
|
|
|
|
@RequestMapping("/save")
|
|
|
|
|
public R save(@RequestBody YonghuEntity yonghu, HttpServletRequest request){
|
|
|
|
|
yonghu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
|
|
|
|
|
YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("zhanghao", yonghu.getZhanghao()));
|
|
|
|
|
if(u!=null) {
|
|
|
|
|
return R.error("用户已存在");
|
|
|
|
|
}
|
|
|
|
|
yonghu.setId(new Date().getTime());
|
|
|
|
|
yonghu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
|
|
|
|
|
//ValidatorUtils.validateEntity(yonghu);
|
|
|
|
|
YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("zhanghao", yonghu.getZhanghao()));
|
|
|
|
|
if(u!=null) {
|
|
|
|
|
return R.error("用户已存在");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
yonghu.setId(new Date().getTime());
|
|
|
|
|
yonghuService.insert(yonghu);
|
|
|
|
|
return R.ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 前端保存
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping("/add") // 设置请求路径为/add
|
|
|
|
|
@RequestMapping("/add")
|
|
|
|
|
public R add(@RequestBody YonghuEntity yonghu, HttpServletRequest request){
|
|
|
|
|
yonghu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
|
|
|
|
|
YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("zhanghao", yonghu.getZhanghao()));
|
|
|
|
|
if(u!=null) {
|
|
|
|
|
return R.error("用户已存在");
|
|
|
|
|
}
|
|
|
|
|
yonghu.setId(new Date().getTime());
|
|
|
|
|
yonghu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
|
|
|
|
|
//ValidatorUtils.validateEntity(yonghu);
|
|
|
|
|
YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("zhanghao", yonghu.getZhanghao()));
|
|
|
|
|
if(u!=null) {
|
|
|
|
|
return R.error("用户已存在");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
yonghu.setId(new Date().getTime());
|
|
|
|
|
yonghuService.insert(yonghu);
|
|
|
|
|
return R.ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 修改
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping("/update") // 设置请求路径为/update
|
|
|
|
|
@Transactional // 开启事务
|
|
|
|
|
@RequestMapping("/update")
|
|
|
|
|
@Transactional
|
|
|
|
|
public R update(@RequestBody YonghuEntity yonghu, HttpServletRequest request){
|
|
|
|
|
//ValidatorUtils.validateEntity(yonghu);
|
|
|
|
|
yonghuService.updateById(yonghu);//全部更新
|
|
|
|
|
return R.ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping("/delete") // 设置请求路径为/delete
|
|
|
|
|
@RequestMapping("/delete")
|
|
|
|
|
public R delete(@RequestBody Long[] ids){
|
|
|
|
|
yonghuService.deleteBatchIds(Arrays.asList(ids));
|
|
|
|
|
return R.ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 提醒接口
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping("/remind/{columnName}/{type}") // 设置请求路径为/remind/{columnName}/{type}
|
|
|
|
|
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
|
|
|
|
|
@PathVariable("type") String type,@RequestParam Map<String, Object> map) {
|
|
|
|
|
map.put("column", columnName);
|
|
|
|
|
map.put("type", type);
|
|
|
|
|
|
|
|
|
|
if(type.equals("2")) {
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
Calendar c = Calendar.getInstance();
|
|
|
|
|
Date remindStartDate = null;
|
|
|
|
|
Date remindEndDate = null;
|
|
|
|
|
if(map.get("remindstart")!=null) {
|
|
|
|
|
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
|
|
|
|
|
c.setTime(new Date());
|
|
|
|
|
c.add(Calendar.DAY_OF_MONTH,remindStart);
|
|
|
|
|
remindStartDate = c.getTime();
|
|
|
|
|
map.put("remindstart", sdf.format(remindStartDate));
|
|
|
|
|
}
|
|
|
|
|
if(map.get("remindend")!=null) {
|
|
|
|
|
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
|
|
|
|
|
c.setTime(new Date());
|
|
|
|
|
c.add(Calendar.DAY_OF_MONTH,remindEnd);
|
|
|
|
|
remindEndDate = c.getTime();
|
|
|
|
|
map.put("remindend", sdf.format(remindEndDate));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Wrapper<YonghuEntity> wrapper = new EntityWrapper<YonghuEntity>();
|
|
|
|
|
if(map.get("remindstart")!=null) {
|
|
|
|
|
wrapper.ge(columnName, map.get("remindstart"));
|
|
|
|
|
}
|
|
|
|
|
if(map.get("remindend")!=null) {
|
|
|
|
|
wrapper.le(columnName, map.get("remindend"));
|
|
|
|
|
}
|
|
|
|
|
@RequestMapping("/remind/{columnName}/{type}")
|
|
|
|
|
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
|
|
|
|
|
@PathVariable("type") String type,@RequestParam Map<String, Object> map) {
|
|
|
|
|
map.put("column", columnName);
|
|
|
|
|
map.put("type", type);
|
|
|
|
|
|
|
|
|
|
if(type.equals("2")) {
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
Calendar c = Calendar.getInstance();
|
|
|
|
|
Date remindStartDate = null;
|
|
|
|
|
Date remindEndDate = null;
|
|
|
|
|
if(map.get("remindstart")!=null) {
|
|
|
|
|
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
|
|
|
|
|
c.setTime(new Date());
|
|
|
|
|
c.add(Calendar.DAY_OF_MONTH,remindStart);
|
|
|
|
|
remindStartDate = c.getTime();
|
|
|
|
|
map.put("remindstart", sdf.format(remindStartDate));
|
|
|
|
|
}
|
|
|
|
|
if(map.get("remindend")!=null) {
|
|
|
|
|
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
|
|
|
|
|
c.setTime(new Date());
|
|
|
|
|
c.add(Calendar.DAY_OF_MONTH,remindEnd);
|
|
|
|
|
remindEndDate = c.getTime();
|
|
|
|
|
map.put("remindend", sdf.format(remindEndDate));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Wrapper<YonghuEntity> wrapper = new EntityWrapper<YonghuEntity>();
|
|
|
|
|
if(map.get("remindstart")!=null) {
|
|
|
|
|
wrapper.ge(columnName, map.get("remindstart"));
|
|
|
|
|
}
|
|
|
|
|
if(map.get("remindend")!=null) {
|
|
|
|
|
wrapper.le(columnName, map.get("remindend"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int count = yonghuService.selectCount(wrapper);
|
|
|
|
|
return R.ok().put("count", count);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int count = yonghuService.selectCount(wrapper);
|
|
|
|
|
return R.ok().put("count", count);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* (按值统计)
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping("/value/{xColumnName}/{yColumnName}") // 设置请求路径为/value/{xColumnName}/{yColumnName}
|
|
|
|
|
@RequestMapping("/value/{xColumnName}/{yColumnName}")
|
|
|
|
|
public R value(@PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName,HttpServletRequest request) {
|
|
|
|
|
Map<String, Object> params = new HashMap<String, Object>();
|
|
|
|
|
params.put("xColumn", xColumnName);
|
|
|
|
@ -312,7 +327,7 @@ public class YonghuController {
|
|
|
|
|
/**
|
|
|
|
|
* (按值统计)时间统计类型
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping("/value/{xColumnName}/{yColumnName}/{timeStatType}") // 设置请求路径为/value/{xColumnName}/{yColumnName}/{timeStatType}
|
|
|
|
|
@RequestMapping("/value/{xColumnName}/{yColumnName}/{timeStatType}")
|
|
|
|
|
public R valueDay(@PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName, @PathVariable("timeStatType") String timeStatType,HttpServletRequest request) {
|
|
|
|
|
Map<String, Object> params = new HashMap<String, Object>();
|
|
|
|
|
params.put("xColumn", xColumnName);
|
|
|
|
@ -330,11 +345,11 @@ public class YonghuController {
|
|
|
|
|
}
|
|
|
|
|
return R.ok().put("data", result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 分组统计
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping("/group/{columnName}") // 设置请求路径为/group/{columnName}
|
|
|
|
|
@RequestMapping("/group/{columnName}")
|
|
|
|
|
public R group(@PathVariable("columnName") String columnName,HttpServletRequest request) {
|
|
|
|
|
Map<String, Object> params = new HashMap<String, Object>();
|
|
|
|
|
params.put("column", columnName);
|
|
|
|
@ -351,13 +366,18 @@ public class YonghuController {
|
|
|
|
|
return R.ok().put("data", result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 总数量
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping("/count") // 设置请求路径为/count
|
|
|
|
|
@RequestMapping("/count")
|
|
|
|
|
public R count(@RequestParam Map<String, Object> params,YonghuEntity yonghu, HttpServletRequest request){
|
|
|
|
|
EntityWrapper<YonghuEntity> ew = new EntityWrapper<YonghuEntity>();
|
|
|
|
|
int count = yonghuService.selectCount(MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yonghu), params), params));
|
|
|
|
|
return R.ok().put("data", count);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|