| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- package cn.com.lzt.alarm.service.impl;
- import cn.com.lzt.alarm.service.AlarmService;
- import cn.com.lzt.common.util.StringUtil;
- import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
- import com.baomidou.mybatisplus.core.metadata.IPage;
- import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
- import com.daju.common.util.DataPage;
- import com.daju.mix.dao.entity.TBAlarm;
- import com.daju.mix.dao.mapper.TBAlarmMapper;
- import com.daju.mix.dao.service.impl.BaseServiceImpl;
- import org.apache.commons.lang3.StringUtils;
- import org.jeecgframework.core.util.JeecgDataAutorUtils;
- import org.springframework.stereotype.Service;
- import java.util.Map;
- /**
- * @author :sahib.kio.m
- * @date :Created in 2021/8/3 上午10:37
- */
- @Service
- public class AlarmServiceImpl extends BaseServiceImpl<TBAlarmMapper, TBAlarm> implements AlarmService {
- public DataPage alarmList(Map<String, String> param) {
- DataPage result = new DataPage();
- int page = 1;
- if(param.containsKey("page")){
- page = Integer.valueOf(param.get("page"));
- }
- int rows = 999;
- if(param.containsKey("rows")){
- rows = Integer.valueOf(param.get("rows"));
- }
- String code = param.get("code");
- String context = param.get("context");
- String alarmFrom = param.get("alarm.from");
- String alarmType = param.get("alarm.type");
- String start = param.get("alarm_time_begin1");
- String end = param.get("alarm_time_end2");
- QueryWrapper<?> queryWrapper = new QueryWrapper<>();
- String selectSql = " SELECT TBA.* " +
- "FROM T_B_ALARM TBA WHERE 1 = 1\n";
- if(!StringUtil.isEmpty(code)){
- selectSql += "and TBA.code = '" + code + "'";
- }
- if(!StringUtil.isEmpty(context)){
- selectSql += "and TBA.context LIKE '%" + context + "%'";
- }
- String MENU_DATA_AUTHOR_RULE_SQL = JeecgDataAutorUtils.loadDataSearchConditonSQLString();
- if(StringUtils.isNotEmpty(MENU_DATA_AUTHOR_RULE_SQL)){
- if(MENU_DATA_AUTHOR_RULE_SQL.contains(",")){
- MENU_DATA_AUTHOR_RULE_SQL = MENU_DATA_AUTHOR_RULE_SQL.replaceAll(",","','");
- }
- selectSql += " " + MENU_DATA_AUTHOR_RULE_SQL + "";
- }
- if(!StringUtil.isEmpty(alarmFrom)){
- selectSql += "and TBA.alarm_From = '" + alarmFrom + "'";
- }
- if(!StringUtil.isEmpty(alarmType)){
- selectSql += "and TBA.alarm_Type = '" + alarmType + "'";
- }
- if(!StringUtil.isEmpty(start)){
- selectSql += "and TBA.alarm_time >= '" + start + "'";
- }
- if(!StringUtil.isEmpty(end)){
- selectSql += "and TBA.alarm_time <= '" + end + "'";
- }
- selectSql += " order by TBA.alarm_time desc ";
- IPage<Map<String, Object>> mapPage = getBaseMapper().queryMapPageBySql(new Page<>(page, rows), queryWrapper, selectSql);
- result.setList(mapPage.getRecords());
- result.setTotalCount((int) mapPage.getTotal());
- return result;
- }
- }
|