| | |
| | | |
| | | @Query("select count(id) from User u where u.type2=?1") |
| | | int countByType(int type); |
| | | |
| | | List<User> findByType2(int type); |
| | | } |
| | |
| | | void updateDepartmentTitle(String departmentId, String departmentTitle); |
| | | |
| | | int countByType(int type); |
| | | |
| | | List<User> findByType2(int type); |
| | | } |
| | |
| | | public int countByType(int type) { |
| | | return userDao.countByType(type); |
| | | } |
| | | |
| | | @Override |
| | | public List<User> findByType2(int type) { |
| | | return userDao.findByType2(type); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | throw new XbootException("该手机号已被注册"); |
| | | } |
| | | } |
| | | |
| | | @RequestMapping(value = "/findByType2", method = RequestMethod.GET) |
| | | @ApiOperation(value = "获取全部用户数据") |
| | | public Result<List<User>> findByType2(int type) { |
| | | |
| | | List<User> list = userService.findByType2(type); |
| | | // 清除持久上下文环境 避免后面语句导致持久化 |
| | | entityManager.clear(); |
| | | for (User u : list) { |
| | | u.setPassword(null); |
| | | } |
| | | return new ResultUtil<List<User>>().setData(list); |
| | | } |
| | | } |
| | |
| | | import cn.exrick.xboot.core.common.utils.ResultUtil; |
| | | import cn.exrick.xboot.core.common.vo.PageVo; |
| | | import cn.exrick.xboot.core.common.vo.Result; |
| | | import cn.exrick.xboot.your.entity.AddOil; |
| | | import cn.exrick.xboot.your.entity.Car; |
| | | import cn.exrick.xboot.your.entity.DrivingRecord; |
| | | import cn.exrick.xboot.your.entity.Suggest; |
| | | import cn.exrick.xboot.your.entity.*; |
| | | import cn.exrick.xboot.your.service.IAddOilService; |
| | | import cn.exrick.xboot.your.service.ICarService; |
| | | import cn.exrick.xboot.your.service.IDrivingRecordService; |
| | | import cn.exrick.xboot.your.service.IOrderTaskService; |
| | | import cn.exrick.xboot.your.vo.CarVo; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | |
| | | private IAddOilService iAddOilService; |
| | | @Autowired |
| | | private IDrivingRecordService iDrivingRecordService; |
| | | @Autowired |
| | | private IOrderTaskService iOrderTaskService; |
| | | |
| | | |
| | | @RequestMapping(value = "/get/{id}", method = RequestMethod.GET) |
| | | @ApiOperation(value = "通过id获取") |
| | |
| | | |
| | | @RequestMapping(value = "/getAll", method = RequestMethod.GET) |
| | | @ApiOperation(value = "获取全部数据") |
| | | public Result<List<CarVo>> getAll(String beginTime,String endTime) { |
| | | public Result<List<CarVo>> getAll(String beginTime,String endTime,PageVo page) { |
| | | List<CarVo> carVos = new ArrayList<>(); |
| | | List<Car> list = iCarService.getAll2(); |
| | | for (Car car:list){ |
| | | |
| | | IPage<Car> list = iCarService.getAll2(PageUtil.initMpPage(page)); |
| | | for (Car car:list.getRecords()){ |
| | | CarVo carVo = new CarVo(); |
| | | //加油信息 |
| | | QueryWrapper<AddOil> queryWrapper = new QueryWrapper<>(); |
| | |
| | | wrapper.le(endTime!=null && endTime!="","in_time",endTime); |
| | | queryWrapper.le(endTime!=null && endTime!="","add_date",beginTime); |
| | | |
| | | QueryWrapper<OrderTask> wrapper1 = new QueryWrapper<>(); |
| | | |
| | | |
| | | wrapper1.eq("car_id",car.getId()); |
| | | wrapper1.ge(beginTime!=null && beginTime!="","send_date",beginTime); |
| | | wrapper1.le(endTime!=null && endTime!="","send_date",endTime); |
| | | |
| | | OrderTask orderTask = iOrderTaskService.getOne(wrapper1); |
| | | |
| | | DrivingRecord drivingRecord = iDrivingRecordService.getOne(wrapper); |
| | | |
| | | AddOil addOil = iAddOilService.getOne(queryWrapper); |
| | | |
| | | |
| | | |
| | | if (addOil!=null){ |
| | | carVo.setMoney(addOil.getMoney()); |
| | |
| | | |
| | | carVo.setCar(car); |
| | | carVos.add(carVo); |
| | | carVo.setTotal(list.getTotal()); |
| | | } |
| | | return new ResultUtil<List<CarVo>>().setData(carVos); |
| | | } |
| | |
| | | package cn.exrick.xboot.your.mapper; |
| | | import cn.exrick.xboot.your.entity.Area; |
| | | import cn.exrick.xboot.your.vo.CarVo; |
| | | import cn.exrick.xboot.your.vo.Month; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Constants; |
| | |
| | | IPage<Car> page2(Page initMpPage, @Param(Constants.WRAPPER) QueryWrapper<Car> wrapper); |
| | | |
| | | @Select("SELECT c.*,u.nickname,a.`name` AS area_name FROM t_car c LEFT JOIN t_user AS u ON c.user_id=u.id LEFT JOIN t_area AS a ON a.user_id=u.id") |
| | | List<Car> getAll2(); |
| | | IPage<Car> getAll2(Page initMpPage); |
| | | |
| | | @Select("SELECT\n" + |
| | | "\tc.*,(SUM(amount)) AS allAmount,SUM(money) AS allMoney,(MAX(mileage)) AS allMileage\n" + |
| | |
| | | "LEFT JOIN t_add_oil a ON c.id = a.car_id ${ew.customSqlSegment}") |
| | | List<Car> getCarInfo2(@Param(Constants.WRAPPER) QueryWrapper<Car> wrapper); |
| | | |
| | | @Select("select \n" + |
| | | "sum(case when month(create_time) < 2 && year(create_time) <= #{year} then 1 else 0 end) as january,\n" + |
| | | "sum(case when month(create_time) < 3 && year(create_time) <= #{year} then 1 else 0 end) as february,\n" + |
| | | "sum(case when month(create_time) < 4 && year(create_time) <= #{year} then 1 else 0 end) as march,\n" + |
| | | "sum(case when month(create_time) < 5 && year(create_time) <= #{year} then 1 else 0 end) as april,\n" + |
| | | "sum(case when month(create_time) < 6 && year(create_time) <= #{year} then 1 else 0 end) as may,\n" + |
| | | "sum(case when month(create_time) < 7 && year(create_time) <= #{year} then 1 else 0 end) as june,\n" + |
| | | "sum(case when month(create_time) < 8 && year(create_time) <= #{year} then 1 else 0 end) as july,\n" + |
| | | "sum(case when month(create_time) < 9 && year(create_time) <= #{year} then 1 else 0 end) as august,\n" + |
| | | "sum(case when month(create_time) < 10 && year(create_time) <= #{year} then 1 else 0 end) as september,\n" + |
| | | "sum(case when month(create_time) < 11 && year(create_time) <= #{year} then 1 else 0 end) as october,\n" + |
| | | "sum(case when month(create_time) < 12 && year(create_time) <= #{year} then 1 else 0 end) as november,\n" + |
| | | "sum(case when month(create_time) < 13 && year(create_time) <= #{year} then 1 else 0 end) as december\n" + |
| | | "from t_car") |
| | | Month getCarCount(@Param("year")Integer year); |
| | | |
| | | } |
| | |
| | | package cn.exrick.xboot.your.mapper; |
| | | |
| | | import cn.exrick.xboot.your.vo.Month; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import cn.exrick.xboot.your.entity.Customer; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Select; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 商户表数据处理层 |
| | |
| | | |
| | | @Select("select count(id) from t_customer") |
| | | int count(); |
| | | |
| | | @Select("select \n" + |
| | | "sum(case when month(create_time) < 2 && year(create_time) <= #{year} then 1 else 0 end) as january,\n" + |
| | | "sum(case when month(create_time) < 3 && year(create_time) <= #{year} then 1 else 0 end) as february,\n" + |
| | | "sum(case when month(create_time) < 4 && year(create_time) <= #{year} then 1 else 0 end) as march,\n" + |
| | | "sum(case when month(create_time) < 5 && year(create_time) <= #{year} then 1 else 0 end) as april,\n" + |
| | | "sum(case when month(create_time) < 6 && year(create_time) <= #{year} then 1 else 0 end) as may,\n" + |
| | | "sum(case when month(create_time) < 7 && year(create_time) <= #{year} then 1 else 0 end) as june,\n" + |
| | | "sum(case when month(create_time) < 8 && year(create_time) <= #{year} then 1 else 0 end) as july,\n" + |
| | | "sum(case when month(create_time) < 9 && year(create_time) <= #{year} then 1 else 0 end) as august,\n" + |
| | | "sum(case when month(create_time) < 10 && year(create_time) <= #{year} then 1 else 0 end) as september,\n" + |
| | | "sum(case when month(create_time) < 11 && year(create_time) <= #{year} then 1 else 0 end) as october,\n" + |
| | | "sum(case when month(create_time) < 12 && year(create_time) <= #{year} then 1 else 0 end) as november,\n" + |
| | | "sum(case when month(create_time) < 13 && year(create_time) <= #{year} then 1 else 0 end) as december\n" + |
| | | "from t_customer") |
| | | Month getCustomerCount(@Param("year")Integer year); |
| | | } |
| | |
| | | package cn.exrick.xboot.your.mapper; |
| | | |
| | | import cn.exrick.xboot.your.vo.Month; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import cn.exrick.xboot.your.entity.EventLog; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Select; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | */ |
| | | public interface EventLogMapper extends BaseMapper<EventLog> { |
| | | |
| | | @Select("select \n" + |
| | | "sum(case month(create_time) when '1' then 1 else 0 end) as january,\n" + |
| | | "sum(case month(create_time) when '2' then 1 else 0 end) as february,\n" + |
| | | "sum(case month(create_time) when '3' then 1 else 0 end) as march,\n" + |
| | | "sum(case month(create_time) when '4' then 1 else 0 end) as april,\n" + |
| | | "sum(case month(create_time) when '5' then 1 else 0 end) as may,\n" + |
| | | "sum(case month(create_time) when '6' then 1 else 0 end) as june,\n" + |
| | | "sum(case month(create_time) when '7' then 1 else 0 end) as july,\n" + |
| | | "sum(case month(create_time) when '8' then 1 else 0 end) as august,\n" + |
| | | "sum(case month(create_time) when '9' then 1 else 0 end) as september,\n" + |
| | | "sum(case month(create_time) when '10' then 1 else 0 end) as october,\n" + |
| | | "sum(case month(create_time) when '11' then 1 else 0 end) as november,\n" + |
| | | "sum(case month(create_time) when '12' then 1 else 0 end) as december\n" + |
| | | "from t_event_log e\n" + |
| | | "where year(create_time)=#{year} and type=#{type}") |
| | | Month getEventNum(@Param("year")int year,@Param("type")int type); |
| | | } |
| | |
| | | package cn.exrick.xboot.your.mapper; |
| | | |
| | | import cn.exrick.xboot.your.entity.AddOil; |
| | | import cn.exrick.xboot.your.vo.Month; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import cn.exrick.xboot.your.entity.OrderTask; |
| | |
| | | @Select("select sum(time) as time2,send_date from t_order_task where date_sub(curdate(), interval 1 month) <= date(send_date) and area_section_id=#{arg0} GROUP BY send_date") |
| | | @Results({@Result(column="time2", property="time", jdbcType = JdbcType.INTEGER)}) |
| | | List<OrderTask> sumTime(String id); |
| | | |
| | | @Select("select \n" + |
| | | "sum(case month(t.send_date) when '1' then d.num else 0 end) as january,\n" + |
| | | "sum(case month(t.send_date) when '2' then d.num else 0 end) as february,\n" + |
| | | "sum(case month(t.send_date) when '3' then d.num else 0 end) as march,\n" + |
| | | "sum(case month(t.send_date) when '4' then d.num else 0 end) as april,\n" + |
| | | "sum(case month(t.send_date) when '5' then d.num else 0 end) as may,\n" + |
| | | "sum(case month(t.send_date) when '6' then d.num else 0 end) as june,\n" + |
| | | "sum(case month(t.send_date) when '7' then d.num else 0 end) as july,\n" + |
| | | "sum(case month(t.send_date) when '8' then d.num else 0 end) as august,\n" + |
| | | "sum(case month(t.send_date) when '9' then d.num else 0 end) as september,\n" + |
| | | "sum(case month(t.send_date) when '10' then d.num else 0 end) as october,\n" + |
| | | "sum(case month(t.send_date) when '11' then d.num else 0 end) as november,\n" + |
| | | "sum(case month(t.send_date) when '12' then d.num else 0 end) as december\n" + |
| | | "from t_order_task t LEFT JOIN t_order_detail d ON t.id=d.order_id\n" + |
| | | "where year(t.send_date)=#{year}") |
| | | Month getSendNum(@Param("year")int year); |
| | | } |
| | |
| | | package cn.exrick.xboot.your.service; |
| | | |
| | | import cn.exrick.xboot.your.vo.CarVo; |
| | | import cn.exrick.xboot.your.vo.Month; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | |
| | | IPage<Car> page2(Page initMpPage, QueryWrapper<Car> wrapper); |
| | | |
| | | List<Car> getAll2(); |
| | | IPage<Car> getAll2(Page initMpPage); |
| | | |
| | | List<Car> getCarInfo(); |
| | | |
| | | List<Car> getCarInfo2(QueryWrapper<Car> wrapper); |
| | | |
| | | Month getCarCount(Integer year); |
| | | } |
| | |
| | | package cn.exrick.xboot.your.service; |
| | | |
| | | import cn.exrick.xboot.your.vo.Month; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import cn.exrick.xboot.your.entity.Customer; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 商户表接口 |
| | |
| | | public interface ICustomerService extends IService<Customer> { |
| | | |
| | | int countOpenId(); |
| | | |
| | | Month getCustomerCount(Integer year); |
| | | } |
| | |
| | | package cn.exrick.xboot.your.service; |
| | | |
| | | import cn.exrick.xboot.your.vo.Month; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import cn.exrick.xboot.your.entity.EventLog; |
| | | |
| | |
| | | */ |
| | | public interface IEventLogService extends IService<EventLog> { |
| | | |
| | | Month getEventNum(int year,int type); |
| | | } |
| | |
| | | package cn.exrick.xboot.your.service; |
| | | |
| | | import cn.exrick.xboot.your.vo.Month; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import cn.exrick.xboot.your.entity.OrderTask; |
| | |
| | | |
| | | List<OrderTask> list3(String date); |
| | | |
| | | Month getSendNum(int year); |
| | | |
| | | List<OrderTask> sumTime(String id); |
| | | } |
| | |
| | | package cn.exrick.xboot.your.serviceimpl; |
| | | |
| | | import cn.exrick.xboot.your.vo.Month; |
| | | import cn.exrick.xboot.your.mapper.CarMapper; |
| | | import cn.exrick.xboot.your.entity.Car; |
| | | import cn.exrick.xboot.your.service.ICarService; |
| | | import cn.exrick.xboot.your.vo.CarVo; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<Car> getAll2() { |
| | | return carMapper.getAll2(); |
| | | public IPage<Car> getAll2(Page initMpPage) { |
| | | return carMapper.getAll2(initMpPage); |
| | | } |
| | | |
| | | public List<Car> getCarInfo(){ |
| | |
| | | public List<Car> getCarInfo2(QueryWrapper<Car> wrapper){ |
| | | return carMapper.getCarInfo2(wrapper); |
| | | } |
| | | |
| | | @Override |
| | | public Month getCarCount(Integer year) { |
| | | return carMapper.getCarCount(year); |
| | | } |
| | | } |
| | |
| | | package cn.exrick.xboot.your.serviceimpl; |
| | | |
| | | import cn.exrick.xboot.your.vo.Month; |
| | | import cn.exrick.xboot.your.mapper.CustomerMapper; |
| | | import cn.exrick.xboot.your.entity.Customer; |
| | | import cn.exrick.xboot.your.service.ICustomerService; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 商户表接口实现 |
| | |
| | | return (i*100)/i2; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public Month getCustomerCount(Integer year) { |
| | | return customerMapper.getCustomerCount(year); |
| | | } |
| | | } |
| | |
| | | import cn.exrick.xboot.your.mapper.EventLogMapper; |
| | | import cn.exrick.xboot.your.entity.EventLog; |
| | | import cn.exrick.xboot.your.service.IEventLogService; |
| | | import cn.exrick.xboot.your.vo.Month; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | @Autowired |
| | | private EventLogMapper eventLogMapper; |
| | | |
| | | @Override |
| | | public Month getEventNum(int year, int type) { |
| | | return eventLogMapper.getEventNum(year,type); |
| | | } |
| | | } |
| | |
| | | import cn.exrick.xboot.your.mapper.OrderTaskMapper; |
| | | import cn.exrick.xboot.your.entity.OrderTask; |
| | | import cn.exrick.xboot.your.service.IOrderTaskService; |
| | | import cn.exrick.xboot.your.vo.Month; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | public List<OrderTask> sumTime(String id) { |
| | | return orderTaskMapper.sumTime(id); |
| | | } |
| | | @Override |
| | | public Month getSendNum(int year){ |
| | | return orderTaskMapper.getSendNum(year); |
| | | } |
| | | } |
| | |
| | | |
| | | private double oilWear; |
| | | |
| | | private long total; |
| | | |
| | | } |