2022-1-19条件查询

1.前端Html

在这里插入图片描述

  <form class="layui-form queryFrom" action="" lay-filter="white-query-form">
        <div class="layui-form-item">
              <label class="layui-form-label">操作人</label>
                <div class="layui-input-inline">
                    <input type="text" name="operateName" placeholder="" class="layui-input">
                </div>
                <label class="layui-form-label">访问时间</label>
                <div class="layui-input-inline">
                    <input type="text" name="startTime"
                           placeholder="请选择开始日期" class="layui-input date_date_currentLater"
                           id="startDate"/>
                </div>
                <div class="layui-form-mid">-</div>
                <div class="layui-input-inline">
                    <input type="text" name="endTime"
                           placeholder="请选择结束日期" class="layui-input date_date_currentLater"
                           id="endDate" />
                </div>
                <button type="button" class="pear-btn pear-btn-md pear-btn-primary" lay-submit lay-filter="log-query">
                    <i class="layui-icon layui-icon-search"></i>
                    查询
                </button>
                <button type="reset" class="pear-btn pear-btn-md">
                    <i class="layui-icon layui-icon-refresh"></i>
                    重置
                </button>
            </div>
        </form>

2.Controller

   @GetMapping("operateLog")
    public ResultTable operateLog(PageDomain pageDomain,String title,String operateName,String success, String startTime, String endTime) {
        PageHelper.startPage(pageDomain.getPage(), pageDomain.getLimit());
        PageInfo<SysLog> pageInfo = new PageInfo<>(sysLogService.data(LoggingType.OPERATE,title,operateName,success,startTime,endTime));
        return ResultController.pageTable(pageInfo.getList(), pageInfo.getTotal());
    }

条件查询:传递参数:String operateName, String startTime, String endTime

3.service

 List<SysLog> data(LoggingType loggingType, String title, String operateName, String success, String startTime, String endTime);

  @Override
 public List<SysLog> data(LoggingType loggingType,String title,String operateName,String success,String startTime,String endTime) {
        return sysLogMapper.selectList(loggingType,title,operateName,success,startTime,endTime);
    }

4.mapper

    List<SysLog> selectList(@Param("loggingType") LoggingType loggingType,@Param("title") String title, @Param("operateName") String operateName, @Param("success") String success,@Param("startTime")  String startTime,@Param("endTime")  String endTime);

  <select id="selectList" resultType="SysLog">
        select
        id as id,
        title as title,
        method as method,
        business_type as businessType,
        request_method as requestMethod,
        operate_name as operateName,
        operate_url as operateUrl,
        operate_address as operateAddress,
        request_param as requestParam,
        response_body as responseBody,
        success as success,
        error_msg as errorMsg,
        create_time as createTime,
        description as description,
        request_body as requestBody,
        logging_type as loggingType,
        browser as browser,
        system_os as systemOs
        from sys_logging
        where  logging_type = #{loggingType}
        <if test="title != null and title != ''">
            and title = #{title}
        </if>
        <if test="success!= null and success != ''">
            and success = #{success}
        </if>
        <if test="operateName!= null and operateName != ''">
            and operate_name = #{operateName}
        </if>
        <if test="startTime != null and startTime != ''">
            and create_time &gt;= str_to_date(#{startTime},'%Y-%m-%d %H:%i:%s')
        </if>
        <if test="endTime != null and endTime != ''">
            and create_time &lt;= str_to_date(#{endTime},'%Y-%m-%d %H:%i:%s')
        </if>
        order by create_time desc
    </select>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值