|
@@ -1,11 +1,15 @@
|
|
|
package com.gyee.frame.service;
|
|
|
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
|
import com.gyee.frame.common.base.BaseService;
|
|
|
import com.gyee.frame.common.support.Convert;
|
|
|
import com.gyee.frame.mapper.auto.Alertrule2Mapper;
|
|
|
import com.gyee.frame.model.auto.Alertrule2;
|
|
|
import com.gyee.frame.model.auto.Alertrule2Example;
|
|
|
+import com.gyee.frame.model.custom.Tablepar;
|
|
|
import com.gyee.frame.util.SnowflakeIdWorker;
|
|
|
+import com.gyee.frame.util.StringUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
@@ -14,82 +18,182 @@ import java.util.List;
|
|
|
|
|
|
@Service
|
|
|
public class Alertrule2ervice implements BaseService<Alertrule2, Alertrule2Example> {
|
|
|
- @Resource
|
|
|
- private Alertrule2Mapper alertrule2Mapper;
|
|
|
-
|
|
|
-
|
|
|
- @Override
|
|
|
- public int deleteByPrimaryKey(String ids) {
|
|
|
-
|
|
|
- List<String> lista=Convert.toListStrArray(ids);
|
|
|
- Alertrule2Example example=new Alertrule2Example();
|
|
|
- example.createCriteria().andIdIn(lista);
|
|
|
- return alertrule2Mapper.deleteByExample(example);
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @Override
|
|
|
- public Alertrule2 selectByPrimaryKey(String id) {
|
|
|
-
|
|
|
- return alertrule2Mapper.selectByPrimaryKey(id);
|
|
|
-
|
|
|
- }
|
|
|
+ @Resource
|
|
|
+ private Alertrule2Mapper alertrule2Mapper;
|
|
|
|
|
|
-
|
|
|
- @Override
|
|
|
- public int updateByPrimaryKeySelective(Alertrule2 record) {
|
|
|
- return alertrule2Mapper.updateByPrimaryKeySelective(record);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 添加
|
|
|
- */
|
|
|
- @Override
|
|
|
- public int insertSelective(Alertrule2 record) {
|
|
|
-
|
|
|
- //添加雪花主键id
|
|
|
- record.setId(SnowflakeIdWorker.getUUID());
|
|
|
-
|
|
|
-
|
|
|
- return alertrule2Mapper.insertSelective(record);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @Override
|
|
|
- public int updateByExampleSelective(Alertrule2 record, Alertrule2Example example) {
|
|
|
-
|
|
|
- return alertrule2Mapper.updateByExampleSelective(record, example);
|
|
|
- }
|
|
|
|
|
|
-
|
|
|
- @Override
|
|
|
- public int updateByExample(Alertrule2 record, Alertrule2Example example) {
|
|
|
-
|
|
|
- return alertrule2Mapper.updateByExample(record, example);
|
|
|
+ @Override
|
|
|
+ public int deleteByPrimaryKey(String ids) {
|
|
|
+
|
|
|
+ List<String> lista = Convert.toListStrArray(ids);
|
|
|
+ Alertrule2Example example = new Alertrule2Example();
|
|
|
+ example.createCriteria().andIdIn(lista);
|
|
|
+ return alertrule2Mapper.deleteByExample(example);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Alertrule2 selectByPrimaryKey(String id) {
|
|
|
+
|
|
|
+ return alertrule2Mapper.selectByPrimaryKey(id);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int updateByPrimaryKeySelective(Alertrule2 record) {
|
|
|
+ return alertrule2Mapper.updateByPrimaryKeySelective(record);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public int insertSelective(Alertrule2 record) {
|
|
|
+
|
|
|
+ //添加雪花主键id
|
|
|
+ record.setId(SnowflakeIdWorker.getUUID());
|
|
|
+
|
|
|
+
|
|
|
+ return alertrule2Mapper.insertSelective(record);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int updateByExampleSelective(Alertrule2 record, Alertrule2Example example) {
|
|
|
+
|
|
|
+ return alertrule2Mapper.updateByExampleSelective(record, example);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int updateByExample(Alertrule2 record, Alertrule2Example example) {
|
|
|
+
|
|
|
+ return alertrule2Mapper.updateByExample(record, example);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Alertrule2> selectByExample(Alertrule2Example example) {
|
|
|
+
|
|
|
+ return alertrule2Mapper.selectByExample(example);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public long countByExample(Alertrule2Example example) {
|
|
|
+
|
|
|
+ return alertrule2Mapper.countByExample(example);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int deleteByExample(Alertrule2Example example) {
|
|
|
+
|
|
|
+ return alertrule2Mapper.deleteByExample(example);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public PageInfo<Alertrule2> getAlertruleList(Tablepar tablepar, String name, String category, String rank) {
|
|
|
+
|
|
|
+
|
|
|
+ PageInfo<Alertrule2> pageInfo = new PageInfo<>();
|
|
|
+
|
|
|
+
|
|
|
+ Alertrule2Example example = new Alertrule2Example();
|
|
|
+ example.setOrderByClause("name DESC");
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(tablepar.getOrderByColumn())) {
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ sb.append(" ").append(tablepar.getOrderByColumn());
|
|
|
+ if (StringUtils.isNotEmpty(tablepar.getIsAsc())) {
|
|
|
+ sb.append(" ").append(tablepar.getIsAsc());
|
|
|
+ } else {
|
|
|
+ sb.append(" asc ");
|
|
|
+ }
|
|
|
+ example.setOrderByClause(String.valueOf(sb));
|
|
|
+ } else {
|
|
|
+ example.setOrderByClause("name ASC");
|
|
|
+ }
|
|
|
+
|
|
|
+ Alertrule2Example.Criteria criteia = example.createCriteria();
|
|
|
+
|
|
|
+ if (StringUtils.notEmp(name)) {
|
|
|
+
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ sb.append("%").append(name).append("%");
|
|
|
+ criteia.andNameLike(String.valueOf(name));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.notEmp(category)) {
|
|
|
+
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ sb.append("%").append(category).append("%");
|
|
|
+ criteia.andCategoryLike(String.valueOf(category));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.notEmp(rank)) {
|
|
|
+
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ sb.append("%").append(rank).append("%");
|
|
|
+ criteia.andRankLike(String.valueOf(rank));
|
|
|
+ }
|
|
|
+
|
|
|
+ PageHelper.startPage(tablepar.getPageNum(), tablepar.getPageSize());
|
|
|
+ List<Alertrule2> vos = alertrule2Mapper.selectByExample(example);
|
|
|
+ pageInfo = new PageInfo<Alertrule2>(vos);
|
|
|
+
|
|
|
+ return pageInfo;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public Alertrule2 findAlertrule2ById(String id) {
|
|
|
+
|
|
|
+
|
|
|
+ Alertrule2 po = new Alertrule2();
|
|
|
+
|
|
|
+ po = alertrule2Mapper.selectByPrimaryKey(id);
|
|
|
+
|
|
|
+ return po;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public List<Alertrule2> selectByExample(Alertrule2Example example) {
|
|
|
-
|
|
|
- return alertrule2Mapper.selectByExample(example);
|
|
|
+ public int updateAlertrule2(Alertrule2 po) {
|
|
|
+
|
|
|
+ int result =-1;
|
|
|
+ if(StringUtils.notEmp(po) && StringUtils.notEmp(po.getId()))
|
|
|
+ {
|
|
|
+ result =alertrule2Mapper.updateByPrimaryKeySelective(po);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- @Override
|
|
|
- public long countByExample(Alertrule2Example example) {
|
|
|
-
|
|
|
- return alertrule2Mapper.countByExample(example);
|
|
|
+ public int insertAlertrule2(Alertrule2 po) {
|
|
|
+
|
|
|
+ int result =-1;
|
|
|
+ if(StringUtils.notEmp(po) )
|
|
|
+ {
|
|
|
+ result = alertrule2Mapper.insertSelective(po);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return result;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- @Override
|
|
|
- public int deleteByExample(Alertrule2Example example) {
|
|
|
-
|
|
|
- return alertrule2Mapper.deleteByExample(example);
|
|
|
+ public int deleteAlertrule2(String id) {
|
|
|
+
|
|
|
+ int result =-1;
|
|
|
+ if(StringUtils.notEmp(id))
|
|
|
+ {
|
|
|
+ result =alertrule2Mapper.deleteByPrimaryKey(id);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
|
|
|
}
|