New file |
| | |
| | | package com.kidgrow.oprationcenter.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.kidgrow.common.constant.CommonConstant; |
| | | import com.kidgrow.common.constant.SecurityConstants; |
| | | import com.kidgrow.common.model.PageResult; |
| | | import com.kidgrow.common.service.impl.SuperServiceImpl; |
| | | import com.kidgrow.oprationcenter.mapper.BusinessRecordsMapper; |
| | | import com.kidgrow.oprationcenter.model.BusinessRecords; |
| | | import com.kidgrow.oprationcenter.service.IBusinessRecordsService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.MapUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br> |
| | | * @Description: 业务操作记录<br> |
| | | * @Project: 用户中心<br> |
| | | * @CreateDate: Created in 2020-04-01 09:37:05 <br> |
| | | * @Author: <a href="4345453@kidgrow.com">liuke</a> |
| | | * @version 1.0 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class BusinessRecordsServiceImpl extends SuperServiceImpl<BusinessRecordsMapper, BusinessRecords> implements IBusinessRecordsService { |
| | | |
| | | @Autowired |
| | | private HttpServletRequest httpServletRequest; |
| | | |
| | | /** |
| | | * 列表 |
| | | * @param params |
| | | * @return |
| | | */ |
| | | @Override |
| | | public PageResult<BusinessRecords> findList(Map<String, Object> params){ |
| | | Page<BusinessRecords> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit")); |
| | | List<BusinessRecords> list = baseMapper.findList(page, params); |
| | | return PageResult.<BusinessRecords>builder().data(list).code(0).count(page.getTotal()).build(); |
| | | } |
| | | |
| | | /** |
| | | * 根据BusinessRecords对象当做查询条件进行查询 |
| | | * @param businessRecords |
| | | * @return BusinessRecords |
| | | */ |
| | | @Override |
| | | public BusinessRecords findByObject(BusinessRecords businessRecords){ |
| | | return baseMapper.findByObject(businessRecords); |
| | | } |
| | | |
| | | /** |
| | | * 写入系统业务日志 |
| | | * @param recordTitle |
| | | * @param recordNote |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean recordBusinessData(String recordTitle,String recordNote) |
| | | { |
| | | BusinessRecords businessRecords=new BusinessRecords(); |
| | | businessRecords.setAppName(httpServletRequest.getHeader(SecurityConstants.TENANT_HEADER)); |
| | | businessRecords.setUserId(Long.valueOf(httpServletRequest.getHeader(SecurityConstants.USER_ID_HEADER))); |
| | | businessRecords.setUserName(httpServletRequest.getHeader(SecurityConstants.USER_HEADER)); |
| | | businessRecords.setRecordTitle(recordTitle); |
| | | businessRecords.setRecordIp(httpServletRequest.getHeader(CommonConstant.USER_AGENT_IP)); |
| | | businessRecords.setRecordDetail(recordNote); |
| | | return baseMapper.insert(businessRecords)>0; |
| | | } |
| | | } |