| | |
| | | insert into lf.sys_user (depid,uid,uname,pwd,create_user) values (21,'cky','ç©¿è·¨è¶å®¤','000000',1); |
| | | insert into lf.sys_user (depid,uid,uname,pwd,create_user) values (22,'tj','å建室','000000',1); |
| | | insert into lf.sys_user (depid,uid,uname,pwd,create_user) values (38,'kc','åå¯å®¤','000000',1);*/ |
| | | update lf.sys_user set pwd='b37f70636f1164e86cc8796201737933f65af63918d8442b'; |
| | | |
| | | select * from lf.sys_user; |
| | | ----------------------------------------------------------------------------------------------------- 5.ç»å½æ¥å¿è¡¨ |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ¥è¯¢è®°å½æ°") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "userid", value = "ç»å½äººID", dataType = "String", paramType = "query", required = false, example = "sys_login") |
| | | @ApiImplicitParam(name = "uname", value = "ç¨æ·å", dataType = "String", paramType = "query", example = "管çå"), |
| | | @ApiImplicitParam(name = "type", value = "ç±»å", dataType = "Integer", paramType = "query", example = "1"), |
| | | @ApiImplicitParam(name = "start", value = "å¼å§æ¶é´", dataType = "Timestamp", paramType = "query", example = "2022-10-09 09:00:00"), |
| | | @ApiImplicitParam(name = "end", value = "ç»ææ¶é´", dataType = "Timestamp", paramType = "query", example = "2022-10-10 17:00:00") |
| | | }) |
| | | @GetMapping({"/selectCount"}) |
| | | public ResponseMsg<Integer> selectCount(String userid) { |
| | | public ResponseMsg<Integer> selectCount(String uname, Integer type, Timestamp start, Timestamp end) { |
| | | try { |
| | | int count = loginService.selectCount(userid); |
| | | int count = loginService.selectCount(uname, type, start, end); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | |
| | | @SysLog() |
| | | @ApiOperation(value = "å页æ¥è¯¢") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "userid", value = "ç»å½äººID", dataType = "String", paramType = "query", example = "sys_login"), |
| | | @ApiImplicitParam(name = "uname", value = "ç¨æ·å", dataType = "String", paramType = "query", example = "管çå"), |
| | | @ApiImplicitParam(name = "type", value = "ç±»å", dataType = "Integer", paramType = "query", example = "1"), |
| | | @ApiImplicitParam(name = "start", value = "å¼å§æ¶é´", dataType = "Timestamp", paramType = "query", example = "2022-10-09 09:00:00"), |
| | | @ApiImplicitParam(name = "end", value = "ç»ææ¶é´", dataType = "Timestamp", paramType = "query", example = "2022-10-10 17:00:00"), |
| | | @ApiImplicitParam(name = "pageSize", value = "æ¯é¡µæ¡æ°", dataType = "Integer", paramType = "query", example = "10"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "å页æ°ï¼ä»1å¼å§ï¼", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/selectByPage") |
| | | public ResponseMsg<List<LoginEntity>> selectByPage(String userid, Integer pageSize, Integer pageIndex) { |
| | | public ResponseMsg<List<LoginEntity>> selectByPage(String uname, Integer type, Timestamp start, Timestamp end, Integer pageSize, Integer pageIndex) { |
| | | try { |
| | | if (pageSize < 1 || pageIndex < 1) { |
| | | return fail("æ¯é¡µé¡µæ°æå页æ°å°äº1", null); |
| | | } |
| | | List<LoginEntity> rs = loginService.selectByPage(userid, pageSize, pageSize * (pageIndex - 1)); |
| | | List<LoginEntity> rs = loginService.selectByPage(uname, type, start, end, pageSize, pageSize * (pageIndex - 1)); |
| | | |
| | | return success(rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | |
| | | @SysLog() |
| | | @ApiOperation(value = "å页æ¥è¯¢å¹¶è¿åè®°å½æ°") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "userid", value = "ç»å½äººID", dataType = "String", paramType = "query", example = "1"), |
| | | @ApiImplicitParam(name = "uname", value = "ç¨æ·å", dataType = "String", paramType = "query", example = "管çå"), |
| | | @ApiImplicitParam(name = "type", value = "ç±»å", dataType = "Integer", paramType = "query", example = "1"), |
| | | @ApiImplicitParam(name = "start", value = "å¼å§æ¶é´", dataType = "Timestamp", paramType = "query", example = "2022-10-09 09:00:00"), |
| | | @ApiImplicitParam(name = "end", value = "ç»ææ¶é´", dataType = "Timestamp", paramType = "query", example = "2022-10-10 17:00:00"), |
| | | @ApiImplicitParam(name = "pageSize", value = "æ¯é¡µæ¡æ°", dataType = "Integer", paramType = "query", example = "10"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "å页æ°ï¼ä»1å¼å§ï¼", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/selectByPageAndCount") |
| | | public ResponseMsg<List<LoginEntity>> selectByPageAndCount(String userid, Integer pageSize, Integer pageIndex) { |
| | | public ResponseMsg<List<LoginEntity>> selectByPageAndCount(String uname, Integer type, Timestamp start, Timestamp end, Integer pageSize, Integer pageIndex) { |
| | | try { |
| | | if (pageSize < 1 || pageIndex < 1) { |
| | | return fail("æ¯é¡µé¡µæ°æå页æ°å°äº1", null); |
| | | } |
| | | |
| | | int count = loginService.selectCount(userid); |
| | | int count = loginService.selectCount(uname, type, start, end); |
| | | if (count == 0) { |
| | | return success(0, null); |
| | | } |
| | | |
| | | List<LoginEntity> rs = loginService.selectByPage(userid, pageSize, pageSize * (pageIndex - 1)); |
| | | List<LoginEntity> rs = loginService.selectByPage(uname, type, start, end, pageSize, pageSize * (pageIndex - 1)); |
| | | |
| | | return success(count, rs); |
| | | } catch (Exception ex) { |
| | |
| | | |
| | | private int id; |
| | | |
| | | private String uname; |
| | | |
| | | private int appid; |
| | | |
| | | private String ip; |
| | |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getUname() { |
| | | return uname; |
| | | } |
| | | |
| | | public void setUname(String uname) { |
| | | this.uname = uname; |
| | | } |
| | | |
| | | public int getAppid() { |
| | | return appid; |
| | | } |
| | |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | /** |
| | | * æ ¹æ®è¡¨åæ¥è¯¢è®°å½æ° |
| | | * |
| | | * @param userid ç»å½äººID |
| | | * @return è®°å½æ° |
| | | * @param uname |
| | | * @param type |
| | | * @param start |
| | | * @param end |
| | | * @return |
| | | */ |
| | | public Integer selectCount(String userid); |
| | | public Integer selectCount(String uname, Integer type, Timestamp start, Timestamp end); |
| | | |
| | | /** |
| | | * æ ¹æ®è¡¨åå页æ¥è¯¢ |
| | | * |
| | | * @param userid 表å |
| | | * @param limit è®°å½è¡¨ |
| | | * @param offset åç§»é |
| | | * @return å表 |
| | | * @param uname |
| | | * @param type |
| | | * @param start |
| | | * @param end |
| | | * @param limit |
| | | * @param offset |
| | | * @return |
| | | */ |
| | | public List<LoginEntity> selectByPage(String userid, Integer limit, Integer offset); |
| | | public List<LoginEntity> selectByPage(String uname, Integer type, Timestamp start, Timestamp end, Integer limit, Integer offset); |
| | | |
| | | /** |
| | | * æ·»å æ°æ® |
| | |
| | | * @return |
| | | */ |
| | | public List<LoginEntity> selectLoginAll(); |
| | | |
| | | } |
| | | } |
| | |
| | | package com.lf.server.service.sys; |
| | | |
| | | import com.lf.server.entity.sys.LoginEntity; |
| | | import com.lf.server.helper.StringHelper; |
| | | import com.lf.server.helper.WebHelper; |
| | | import com.lf.server.mapper.sys.LoginMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.sql.Timestamp; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | LoginMapper loginMapper; |
| | | |
| | | @Override |
| | | public Integer selectCount(String userid) { |
| | | return loginMapper.selectCount(userid); |
| | | public Integer selectCount(String uname, Integer type, Timestamp start, Timestamp end) { |
| | | uname = StringHelper.isNull(uname) ? null : "%" + uname.trim() + "%"; |
| | | |
| | | return loginMapper.selectCount(uname, type, start, end); |
| | | } |
| | | |
| | | @Override |
| | | public List<LoginEntity> selectByPage(String userid, Integer limit, Integer offset) { |
| | | return loginMapper.selectByPage(userid, limit, offset); |
| | | public List<LoginEntity> selectByPage(String uname, Integer type, Timestamp start, Timestamp end, Integer limit, Integer offset) { |
| | | uname = StringHelper.isNull(uname) ? null : "%" + uname.trim() + "%"; |
| | | |
| | | return loginMapper.selectByPage(uname, type, start, end, limit, offset); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public Integer selectCount(String title) { |
| | | title = "%" + (StringHelper.isNull(title) ? "" : title.trim()) + "%"; |
| | | title = StringHelper.isNull(title) ? null : "%" + title.trim() + "%"; |
| | | |
| | | return msgMapper.selectCount(title); |
| | | } |
| | | |
| | | @Override |
| | | public List<MsgEntity> selectByPage(String title, Integer limit, Integer offset) { |
| | | title = "%" + (StringHelper.isNull(title) ? "" : title.trim()) + "%"; |
| | | title = StringHelper.isNull(title) ? null : "%" + title.trim() + "%"; |
| | | |
| | | return msgMapper.selectByPage(title, limit, offset); |
| | | } |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.lf.server.mapper.sys.LoginMapper"> |
| | | |
| | | <!-- ç»è®¡è¡æ° --> |
| | | <select id="selectCount" resultType="java.lang.Integer" parameterType="java.lang.String"> |
| | | select count(*) from lf.sys_login |
| | | select count(*) from lf.sys_login a inner join lf.sys_user b on a.userid = b.id |
| | | <where> |
| | | <if test="userid != null"> |
| | | userid = #{userid} |
| | | 1 = 1 |
| | | <if test="uname != null"> |
| | | and b.uname like #{uname} |
| | | </if> |
| | | <if test="type != null"> |
| | | and a.type = #{type} |
| | | </if> |
| | | <if test="start != null"> |
| | | and a.optime >= #{start} |
| | | </if> |
| | | <if test="end != null"> |
| | | and a.optime <= #{end} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!-- å页æ¥è¯¢ --> |
| | | <select id="selectByPage" resultType="com.lf.server.entity.sys.LoginEntity"> |
| | | select * from lf.sys_login |
| | | select a.*,b.uname from lf.sys_login a inner join lf.sys_user b on a.userid = b.id |
| | | <where> |
| | | <if test="userid != null"> |
| | | userid = #{userid} |
| | | 1 = 1 |
| | | <if test="uname != null"> |
| | | and b.uname like #{uname} |
| | | </if> |
| | | <if test="type != null"> |
| | | and a.type = #{type} |
| | | </if> |
| | | <if test="start != null"> |
| | | and a.optime >= #{start} |
| | | </if> |
| | | <if test="end != null"> |
| | | and a.optime <= #{end} |
| | | </if> |
| | | </where> |
| | | order by id |
| | | order by a.id |
| | | limit #{limit} offset #{offset} |
| | | </select> |
| | | |