通用实体
package com.aaa.util; /** * @Author: 0808 * @Date: 2020/7/13 0013 10:39 * @Version 1.0 * 常量类 */ public class MyConstants { /**保存操作*/ public static final String SAVE_OPERATION="save"; /**修改操作*/ public static final String UPDATE_OPERATION="update"; /**加密算法*/ public static final String ALGORITHM_NAME="MD5"; /**加密次数*/ public static final int HASH_ITERATIONS=1000; /** 操作成功信息 */ public static final String OPERATION_SUCCESS_MESSAGE="操作成功"; /** 操作成功代码 */ public static final int OPERATION_SUCCESS_CODE=0; /** 操作失败信息 */ public static final String OPERATION_FAIL_MESSAGE="操作失败"; /** 操作失败代码 */ public static final int OPERATION_FAIL_CODE=1; /** 柴油(大型加油站)阈值第一条数据 */ public static final int DIESELOIL_BIG=0; /** 柴油(中型加油站)阈值第二条数据 */ public static final int DIESELOIL_BETWEEN=1; /** 柴油(小型加油站)阈值第三条数据 */ public static final int DIESELOIL_SMALL=2; /** 汽油(大型加油站)阈值第四条数据 */ public static final int GASOLINEOIL_BIG=3; /** 汽油(中型加油站)阈值第五条数据 */ public static final int GASOLINEOIL_BETWEEN=4; /** 汽油(小型加油站)阈值第六条数据 */ public static final int GASOLINEOIL_SMALL=5; /** 变量为0的值 */ public static final int INTVALUE_ZERO=0; }
状态码
package com.cws.db_car.entity; import lombok.Data; import java.util.List; /** * @Author: 0808 * @Date: 2020/7/10 0010 16:10 * @Version 1.0 */ @Data public class LayUiTable { private int code; private String msg; private Integer count; private List<?> data; }
查询&&模糊&&分页
/** * 查询所有汽车和模糊查询分页 * @param page * @param limit * @param searchTypename * @return */ @RequestMapping("/listCar") @ResponseBody public LayUiTable listCar(Integer page, Integer limit , String searchTypename) { LayUiTable table = new LayUiTable(); //多条件查询所需要的集合 Map<String ,Object> condition= new HashMap(16); Wrapper wrapper = new EntityWrapper(); //添加模糊查询的条件 if (null != searchTypename && !"".equals(searchTypename)) { condition.put("typename", searchTypename); } int i = tCarService.selectCount(wrapper); if(i>0){ //获取当前的系统毫秒数 Page<TCarVo> pageInfo = new Page(page, limit); List<TCarVo> tCarVoList = tCarService.selectList(pageInfo, condition); //从分页结果中提取list集合 table.setCode(MyConstants.OPERATION_SUCCESS_CODE); table.setMsg(MyConstants.OPERATION_SUCCESS_MESSAGE); table.setData(tCarVoList); table.setCount(i); } return table; }