parent
3396738145
commit
80bb643c6c
@ -0,0 +1,189 @@ |
||||
package com.bweb.controller; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.github.pagehelper.PageHelper; |
||||
import com.github.pagehelper.PageInfo; |
||||
import com.hfkj.common.exception.ErrorCode; |
||||
import com.hfkj.common.exception.ErrorHelp; |
||||
import com.hfkj.common.exception.SysCode; |
||||
import com.hfkj.common.security.UserCenter; |
||||
import com.hfkj.common.utils.ResponseMsgUtil; |
||||
import com.hfkj.entity.BsGasClassGroup; |
||||
import com.hfkj.entity.BsGasClassGroupTask; |
||||
import com.hfkj.entity.BsGasStaff; |
||||
import com.hfkj.entity.BsMerchant; |
||||
import com.hfkj.model.ResponseData; |
||||
import com.hfkj.model.SecUserSessionObject; |
||||
import com.hfkj.service.BsMerchantService; |
||||
import com.hfkj.service.gas.BsGasClassGroupService; |
||||
import com.hfkj.service.gas.BsGasClassGroupTaskService; |
||||
import com.hfkj.service.gas.BsGasStaffService; |
||||
import com.hfkj.sysenum.SecUserObjectTypeEnum; |
||||
import com.hfkj.sysenum.gas.GasClassGroupTaskStatus; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.apache.commons.lang3.StringUtils; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 加油站班组 |
||||
* @author hurui |
||||
*/ |
||||
@Controller |
||||
@RequestMapping(value = "/gasClassGroup") |
||||
@Api(value = "加油站班组") |
||||
public class BsGasClassGroupController { |
||||
|
||||
private static Logger log = LoggerFactory.getLogger(BsGasClassGroupController.class); |
||||
|
||||
@Resource |
||||
private BsGasClassGroupService gasClassGroupService; |
||||
|
||||
@Resource |
||||
private BsGasClassGroupTaskService gasClassGroupTaskService; |
||||
@Resource |
||||
private BsGasStaffService gasStaffService; |
||||
@Resource |
||||
private BsMerchantService merchantService; |
||||
|
||||
@Resource |
||||
private UserCenter userCenter; |
||||
|
||||
@RequestMapping(value = "/editClassGroup", method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "编辑班组") |
||||
public ResponseData editClassGroup(@RequestBody JSONObject body) { |
||||
try { |
||||
SecUserSessionObject userInfoModel = userCenter.getSessionModel(SecUserSessionObject.class); |
||||
if (userInfoModel == null |
||||
|| userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode())) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR); |
||||
} |
||||
if (body == null |
||||
|| StringUtils.isBlank(body.getString("name")) |
||||
|| StringUtils.isBlank(body.getString("principalName")) |
||||
|| StringUtils.isBlank(body.getString("principalPhone"))) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
|
||||
BsGasClassGroup gasClassGroup; |
||||
|
||||
if (body.getLong("id") != null) { |
||||
// 查询班组
|
||||
gasClassGroup = gasClassGroupService.getDetailById(body.getLong("id")); |
||||
if (gasClassGroup == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
} else { |
||||
gasClassGroup = new BsGasClassGroup(); |
||||
// 查询商户
|
||||
BsMerchant merchant = merchantService.getMerchant(userInfoModel.getAccount().getObjectId()); |
||||
if (merchant == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
gasClassGroup.setMerId(merchant.getId()); |
||||
gasClassGroup.setMerName(merchant.getMerName()); |
||||
} |
||||
|
||||
gasClassGroup.setName(body.getString("name")); |
||||
gasClassGroup.setPrincipalName(body.getString("principalName")); |
||||
gasClassGroup.setPrincipalPhone(body.getString("principalPhone")); |
||||
gasClassGroupService.editGroup(gasClassGroup); |
||||
|
||||
return ResponseMsgUtil.success("操作成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("HighGasClassGroupController --> editClassGroup() error!", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value = "/delClassGroup", method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "删除班组") |
||||
public ResponseData delClassGroup(@RequestBody JSONObject body) { |
||||
try { |
||||
if (body == null || body.getLong("id") == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
|
||||
Map<String, Object> param = new HashMap<>(); |
||||
param.put("gasClassGroupId", body.getLong("id")); |
||||
param.put("status", GasClassGroupTaskStatus.status1.getStatus()); |
||||
List<BsGasClassGroupTask> groupTaskList = gasClassGroupTaskService.getGroupTaskList(param); |
||||
if (groupTaskList.size() > 0) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "班组有任务进行中,暂时无法删除"); |
||||
} |
||||
|
||||
gasClassGroupService.delGroup(body.getLong("id")); |
||||
|
||||
return ResponseMsgUtil.success("操作成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("HighGasClassGroupController --> delClassGroup() error!", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value = "/getClassGroupById", method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询班组详情") |
||||
public ResponseData getClassGroupById(@RequestParam(name = "groupId", required = true) Long groupId) { |
||||
try { |
||||
|
||||
return ResponseMsgUtil.success(gasClassGroupService.getDetailById(groupId)); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("HighGasClassGroupController --> getClassGroupById() error!", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value = "/getClassGroupList", method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询班组列表") |
||||
public ResponseData getClassGroupList(@RequestParam(name = "name", required = false) String name, |
||||
@RequestParam(name = "principalName", required = false) String principalName, |
||||
@RequestParam(name = "principalPhone", required = false) String principalPhone, |
||||
@RequestParam(name = "pageNum", required = true) Integer pageNum, |
||||
@RequestParam(name = "pageSize", required = true) Integer pageSize) { |
||||
try { |
||||
SecUserSessionObject userInfoModel = userCenter.getSessionModel(SecUserSessionObject.class); |
||||
if (userInfoModel == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
|
||||
Map<String,Object> param = new HashMap<>(); |
||||
if (userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode())) { |
||||
param.put("merchantStoreId", userInfoModel.getAccount().getObjectId()); |
||||
|
||||
} else if (userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type3.getCode())) { |
||||
// 查询油站工作人员
|
||||
BsGasStaff gasStaff = gasStaffService.getStaffDetailById(userInfoModel.getAccount().getObjectId()); |
||||
if (gasStaff == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
param.put("merchantStoreId", gasStaff.getMerId()); |
||||
} |
||||
param.put("name", name); |
||||
param.put("principalName", principalName); |
||||
param.put("principalPhone", principalPhone); |
||||
|
||||
PageHelper.startPage(pageNum, pageSize); |
||||
return ResponseMsgUtil.success(new PageInfo<>(gasClassGroupService.getGroupList(param))); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("HighGasClassGroupController --> getClassGroupList() error!", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,246 @@ |
||||
package com.bweb.controller; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.github.pagehelper.PageHelper; |
||||
import com.github.pagehelper.PageInfo; |
||||
import com.hfkj.common.exception.ErrorCode; |
||||
import com.hfkj.common.exception.ErrorHelp; |
||||
import com.hfkj.common.exception.SysCode; |
||||
import com.hfkj.common.security.UserCenter; |
||||
import com.hfkj.common.utils.ResponseMsgUtil; |
||||
import com.hfkj.config.SpPrinterConfig; |
||||
import com.hfkj.config.SpPrinterTemplate; |
||||
import com.hfkj.entity.BsDevice; |
||||
import com.hfkj.entity.BsGasClassGroupTask; |
||||
import com.hfkj.entity.BsGasStaff; |
||||
import com.hfkj.model.GasClassGroupTaskDataCount; |
||||
import com.hfkj.model.ResponseData; |
||||
import com.hfkj.model.SecUserSessionObject; |
||||
import com.hfkj.service.BsDeviceService; |
||||
import com.hfkj.service.gas.BsGasClassGroupTaskService; |
||||
import com.hfkj.service.gas.BsGasStaffService; |
||||
import com.hfkj.sysenum.DeviceTypeEnum; |
||||
import com.hfkj.sysenum.SecUserObjectTypeEnum; |
||||
import com.hfkj.sysenum.gas.GasClassGroupTaskStatus; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.stereotype.Controller; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.math.BigDecimal; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 加油站班组任务 |
||||
* @author hurui |
||||
*/ |
||||
@Controller |
||||
@RequestMapping(value = "/gasClassGroupTask") |
||||
@Api(value = "加油站班组任务") |
||||
public class BsGasClassGroupTaskController { |
||||
|
||||
private static Logger log = LoggerFactory.getLogger(BsGasClassGroupTaskController.class); |
||||
|
||||
@Resource |
||||
private BsGasClassGroupTaskService gasClassGroupTaskService; |
||||
@Resource |
||||
private BsDeviceService deviceService; |
||||
@Resource |
||||
private BsGasStaffService gasStaffService; |
||||
/* @Resource |
||||
private MqttProviderConfig mqttProviderConfig;*/ |
||||
@Resource |
||||
private UserCenter userCenter; |
||||
|
||||
@RequestMapping(value = "/startGroupTask", method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "开启班组任务") |
||||
public ResponseData startGroupTask(@RequestBody JSONObject body) { |
||||
try { |
||||
if (body == null || body.getLong("gasId") == null || body.getLong("gasClassGroupId") == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
|
||||
gasClassGroupTaskService.startGroupTask(body.getLong("gasId"), body.getLong("gasClassGroupId")); |
||||
|
||||
return ResponseMsgUtil.success("操作成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("HighGasClassGroupTaskController --> startGroupTask() error!", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value = "/endGroupTask", method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "结束班组任务") |
||||
public ResponseData endGroupTask(@RequestBody JSONObject body) { |
||||
try { |
||||
if (body == null || body.getLong("gasId") == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
|
||||
gasClassGroupTaskService.endGroupTask(body.getLong("gasId")); |
||||
|
||||
return ResponseMsgUtil.success("操作成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("HighGasClassGroupTaskController --> endGroupTask() error!", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value = "/swapGroupTask", method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "交换班组任务") |
||||
public ResponseData swapGroupTask(@RequestBody JSONObject body) { |
||||
try { |
||||
if (body == null || body.getLong("gasId") == null || body.getLong("gasClassGroupId") == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
|
||||
gasClassGroupTaskService.swapGroupTask(body.getLong("gasId"), body.getLong("gasClassGroupId")); |
||||
|
||||
return ResponseMsgUtil.success("操作成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("HighGasClassGroupTaskController --> swapGroupTask() error!", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value = "/getCurrentClassGroupTask", method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询当前班次") |
||||
public ResponseData getCurrentClassGroupTask(@RequestParam(name = "gasId", required = true) Long gasId) { |
||||
try { |
||||
GasClassGroupTaskDataCount dataCount; |
||||
|
||||
Map<String,Object> param = new HashMap<>(); |
||||
param.put("merchantStoreId", gasId); |
||||
param.put("status", GasClassGroupTaskStatus.status1.getStatus()); |
||||
List<BsGasClassGroupTask> list = gasClassGroupTaskService.getGroupTaskList(param); |
||||
if (list.size() > 0) { |
||||
dataCount = gasClassGroupTaskService.countGroupTaskData(gasId, |
||||
list.get(0).getClassNum(), |
||||
list.get(0).getId(), |
||||
list.get(0).getStatus(), |
||||
list.get(0).getStartTime(), |
||||
null |
||||
); |
||||
return ResponseMsgUtil.success(dataCount); |
||||
} |
||||
dataCount = new GasClassGroupTaskDataCount(); |
||||
dataCount.setStatus(0); |
||||
|
||||
dataCount.setRefuelPrice(new BigDecimal("0")); |
||||
dataCount.setRefuelNum(0); |
||||
dataCount.setRefuelLiters(new BigDecimal("0")); |
||||
|
||||
dataCount.setRefundPrice(new BigDecimal("0")); |
||||
dataCount.setRefundNum(0); |
||||
dataCount.setRefundLiters(new BigDecimal("0")); |
||||
return ResponseMsgUtil.success(dataCount); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("HighGasClassGroupTaskController --> getCurrentClassGroupTask() error!", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value = "/getClassGroupTaskById", method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询班组任务记录") |
||||
public ResponseData getClassGroupTaskById(@RequestParam(name = "gasClassGroupTaskId", required = true) Long gasClassGroupTaskId) { |
||||
try { |
||||
|
||||
return ResponseMsgUtil.success(gasClassGroupTaskService.getDetailById(gasClassGroupTaskId)); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("HighGasClassGroupTaskController --> getClassGroupTaskById() error!", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value = "/getClassGroupTaskList", method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询班组任务记录") |
||||
public ResponseData getClassGroupTaskList(@RequestParam(name = "gasClassGroupId", required = false) Long gasClassGroupId, |
||||
@RequestParam(name = "merchantStoreId", required = false) Long merchantStoreId, |
||||
@RequestParam(name = "status", required = false) Integer status, |
||||
@RequestParam(name = "pageNum", required = true) Integer pageNum, |
||||
@RequestParam(name = "pageSize", required = true) Integer pageSize) { |
||||
try { |
||||
Map<String,Object> param = new HashMap<>(); |
||||
|
||||
SecUserSessionObject userInfoModel = userCenter.getSessionModel(SecUserSessionObject.class); |
||||
if (userInfoModel == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); |
||||
} |
||||
|
||||
if (userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode())) { |
||||
param.put("merchantStoreId", userInfoModel.getAccount().getObjectId()); |
||||
} else if (userInfoModel.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type3.getCode())) { |
||||
// 查询油站工作人员
|
||||
BsGasStaff gasStaff = gasStaffService.getStaffDetailById(userInfoModel.getAccount().getObjectId()); |
||||
if (gasStaff == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||
} |
||||
param.put("merchantStoreId", gasStaff.getMerId()); |
||||
} else { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.ROLE_NOT_PERMISSIONS, ""); |
||||
} |
||||
param.put("gasClassGroupId", gasClassGroupId); |
||||
param.put("status", status); |
||||
|
||||
PageHelper.startPage(pageNum, pageSize); |
||||
return ResponseMsgUtil.success(new PageInfo<>(gasClassGroupTaskService.getGroupTaskList(param))); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("HighGasClassGroupTaskController --> getClassGroupTaskList() error!", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
@RequestMapping(value = "/print", method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "打印小票") |
||||
public ResponseData print(@RequestParam(name = "gasClassGroupTaskId", required = true) Long gasClassGroupTaskId) { |
||||
try { |
||||
BsGasClassGroupTask groupTask = gasClassGroupTaskService.getDetailById(gasClassGroupTaskId); |
||||
if (groupTask == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到班次"); |
||||
} |
||||
GasClassGroupTaskDataCount dataCount = JSONObject.parseObject(groupTask.getDataCount(), GasClassGroupTaskDataCount.class); |
||||
|
||||
// 查询加油站打印机
|
||||
List<BsDevice> deviceList = deviceService.getDeviceByMer(groupTask.getMerId()); |
||||
for (BsDevice device : deviceList) { |
||||
if (device.getType().equals(DeviceTypeEnum.type1.getType())) { |
||||
new Thread(() -> { |
||||
try { |
||||
// 推送打印机
|
||||
SpPrinterConfig spPrinterConfig = new SpPrinterConfig(); |
||||
spPrinterConfig.print(device.getDeviceSn(), SpPrinterTemplate.classGroupCountTemp(dataCount, true), 1); |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
} |
||||
}).start(); |
||||
} |
||||
} |
||||
|
||||
return ResponseMsgUtil.success("操作成功"); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("HighGasClassGroupTaskController --> getClassGroupTaskById() error!", e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,125 @@ |
||||
package com.hfkj.dao; |
||||
|
||||
import com.hfkj.entity.BsGasClassGroup; |
||||
import com.hfkj.entity.BsGasClassGroupExample; |
||||
import java.util.List; |
||||
import org.apache.ibatis.annotations.Delete; |
||||
import org.apache.ibatis.annotations.DeleteProvider; |
||||
import org.apache.ibatis.annotations.Insert; |
||||
import org.apache.ibatis.annotations.InsertProvider; |
||||
import org.apache.ibatis.annotations.Options; |
||||
import org.apache.ibatis.annotations.Param; |
||||
import org.apache.ibatis.annotations.Result; |
||||
import org.apache.ibatis.annotations.Results; |
||||
import org.apache.ibatis.annotations.Select; |
||||
import org.apache.ibatis.annotations.SelectProvider; |
||||
import org.apache.ibatis.annotations.Update; |
||||
import org.apache.ibatis.annotations.UpdateProvider; |
||||
import org.apache.ibatis.type.JdbcType; |
||||
import org.springframework.stereotype.Repository; |
||||
|
||||
/** |
||||
* |
||||
* 代码由工具生成,请勿修改!!! |
||||
* 如果需要扩展请在其父类进行扩展 |
||||
* |
||||
**/ |
||||
@Repository |
||||
public interface BsGasClassGroupMapper extends BsGasClassGroupMapperExt { |
||||
@SelectProvider(type=BsGasClassGroupSqlProvider.class, method="countByExample") |
||||
long countByExample(BsGasClassGroupExample example); |
||||
|
||||
@DeleteProvider(type=BsGasClassGroupSqlProvider.class, method="deleteByExample") |
||||
int deleteByExample(BsGasClassGroupExample example); |
||||
|
||||
@Delete({ |
||||
"delete from bs_gas_class_group", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
int deleteByPrimaryKey(Long id); |
||||
|
||||
@Insert({ |
||||
"insert into bs_gas_class_group (mer_id, mer_name, ", |
||||
"`name`, principal_name, ", |
||||
"principal_phone, `status`, ", |
||||
"create_time, update_time, ", |
||||
"ext_1, ext_2, ext_3)", |
||||
"values (#{merId,jdbcType=BIGINT}, #{merName,jdbcType=VARCHAR}, ", |
||||
"#{name,jdbcType=VARCHAR}, #{principalName,jdbcType=VARCHAR}, ", |
||||
"#{principalPhone,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ", |
||||
"#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ", |
||||
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" |
||||
}) |
||||
@Options(useGeneratedKeys=true,keyProperty="id") |
||||
int insert(BsGasClassGroup record); |
||||
|
||||
@InsertProvider(type=BsGasClassGroupSqlProvider.class, method="insertSelective") |
||||
@Options(useGeneratedKeys=true,keyProperty="id") |
||||
int insertSelective(BsGasClassGroup record); |
||||
|
||||
@SelectProvider(type=BsGasClassGroupSqlProvider.class, method="selectByExample") |
||||
@Results({ |
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), |
||||
@Result(column="mer_id", property="merId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="mer_name", property="merName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="name", property="name", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="principal_name", property="principalName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="principal_phone", property="principalPhone", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) |
||||
}) |
||||
List<BsGasClassGroup> selectByExample(BsGasClassGroupExample example); |
||||
|
||||
@Select({ |
||||
"select", |
||||
"id, mer_id, mer_name, `name`, principal_name, principal_phone, `status`, create_time, ", |
||||
"update_time, ext_1, ext_2, ext_3", |
||||
"from bs_gas_class_group", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
@Results({ |
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), |
||||
@Result(column="mer_id", property="merId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="mer_name", property="merName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="name", property="name", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="principal_name", property="principalName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="principal_phone", property="principalPhone", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) |
||||
}) |
||||
BsGasClassGroup selectByPrimaryKey(Long id); |
||||
|
||||
@UpdateProvider(type=BsGasClassGroupSqlProvider.class, method="updateByExampleSelective") |
||||
int updateByExampleSelective(@Param("record") BsGasClassGroup record, @Param("example") BsGasClassGroupExample example); |
||||
|
||||
@UpdateProvider(type=BsGasClassGroupSqlProvider.class, method="updateByExample") |
||||
int updateByExample(@Param("record") BsGasClassGroup record, @Param("example") BsGasClassGroupExample example); |
||||
|
||||
@UpdateProvider(type=BsGasClassGroupSqlProvider.class, method="updateByPrimaryKeySelective") |
||||
int updateByPrimaryKeySelective(BsGasClassGroup record); |
||||
|
||||
@Update({ |
||||
"update bs_gas_class_group", |
||||
"set mer_id = #{merId,jdbcType=BIGINT},", |
||||
"mer_name = #{merName,jdbcType=VARCHAR},", |
||||
"`name` = #{name,jdbcType=VARCHAR},", |
||||
"principal_name = #{principalName,jdbcType=VARCHAR},", |
||||
"principal_phone = #{principalPhone,jdbcType=VARCHAR},", |
||||
"`status` = #{status,jdbcType=INTEGER},", |
||||
"create_time = #{createTime,jdbcType=TIMESTAMP},", |
||||
"update_time = #{updateTime,jdbcType=TIMESTAMP},", |
||||
"ext_1 = #{ext1,jdbcType=VARCHAR},", |
||||
"ext_2 = #{ext2,jdbcType=VARCHAR},", |
||||
"ext_3 = #{ext3,jdbcType=VARCHAR}", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
int updateByPrimaryKey(BsGasClassGroup record); |
||||
} |
@ -0,0 +1,7 @@ |
||||
package com.hfkj.dao; |
||||
|
||||
/** |
||||
* mapper扩展类 |
||||
*/ |
||||
public interface BsGasClassGroupMapperExt { |
||||
} |
@ -0,0 +1,332 @@ |
||||
package com.hfkj.dao; |
||||
|
||||
import com.hfkj.entity.BsGasClassGroup; |
||||
import com.hfkj.entity.BsGasClassGroupExample.Criteria; |
||||
import com.hfkj.entity.BsGasClassGroupExample.Criterion; |
||||
import com.hfkj.entity.BsGasClassGroupExample; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import org.apache.ibatis.jdbc.SQL; |
||||
|
||||
public class BsGasClassGroupSqlProvider { |
||||
|
||||
public String countByExample(BsGasClassGroupExample example) { |
||||
SQL sql = new SQL(); |
||||
sql.SELECT("count(*)").FROM("bs_gas_class_group"); |
||||
applyWhere(sql, example, false); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String deleteByExample(BsGasClassGroupExample example) { |
||||
SQL sql = new SQL(); |
||||
sql.DELETE_FROM("bs_gas_class_group"); |
||||
applyWhere(sql, example, false); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String insertSelective(BsGasClassGroup record) { |
||||
SQL sql = new SQL(); |
||||
sql.INSERT_INTO("bs_gas_class_group"); |
||||
|
||||
if (record.getMerId() != null) { |
||||
sql.VALUES("mer_id", "#{merId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getMerName() != null) { |
||||
sql.VALUES("mer_name", "#{merName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getName() != null) { |
||||
sql.VALUES("`name`", "#{name,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getPrincipalName() != null) { |
||||
sql.VALUES("principal_name", "#{principalName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getPrincipalPhone() != null) { |
||||
sql.VALUES("principal_phone", "#{principalPhone,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getStatus() != null) { |
||||
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getUpdateTime() != null) { |
||||
sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getExt1() != null) { |
||||
sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt2() != null) { |
||||
sql.VALUES("ext_2", "#{ext2,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt3() != null) { |
||||
sql.VALUES("ext_3", "#{ext3,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String selectByExample(BsGasClassGroupExample example) { |
||||
SQL sql = new SQL(); |
||||
if (example != null && example.isDistinct()) { |
||||
sql.SELECT_DISTINCT("id"); |
||||
} else { |
||||
sql.SELECT("id"); |
||||
} |
||||
sql.SELECT("mer_id"); |
||||
sql.SELECT("mer_name"); |
||||
sql.SELECT("`name`"); |
||||
sql.SELECT("principal_name"); |
||||
sql.SELECT("principal_phone"); |
||||
sql.SELECT("`status`"); |
||||
sql.SELECT("create_time"); |
||||
sql.SELECT("update_time"); |
||||
sql.SELECT("ext_1"); |
||||
sql.SELECT("ext_2"); |
||||
sql.SELECT("ext_3"); |
||||
sql.FROM("bs_gas_class_group"); |
||||
applyWhere(sql, example, false); |
||||
|
||||
if (example != null && example.getOrderByClause() != null) { |
||||
sql.ORDER_BY(example.getOrderByClause()); |
||||
} |
||||
|
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String updateByExampleSelective(Map<String, Object> parameter) { |
||||
BsGasClassGroup record = (BsGasClassGroup) parameter.get("record"); |
||||
BsGasClassGroupExample example = (BsGasClassGroupExample) parameter.get("example"); |
||||
|
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("bs_gas_class_group"); |
||||
|
||||
if (record.getId() != null) { |
||||
sql.SET("id = #{record.id,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getMerId() != null) { |
||||
sql.SET("mer_id = #{record.merId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getMerName() != null) { |
||||
sql.SET("mer_name = #{record.merName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getName() != null) { |
||||
sql.SET("`name` = #{record.name,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getPrincipalName() != null) { |
||||
sql.SET("principal_name = #{record.principalName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getPrincipalPhone() != null) { |
||||
sql.SET("principal_phone = #{record.principalPhone,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getStatus() != null) { |
||||
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getUpdateTime() != null) { |
||||
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getExt1() != null) { |
||||
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt2() != null) { |
||||
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt3() != null) { |
||||
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
applyWhere(sql, example, true); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String updateByExample(Map<String, Object> parameter) { |
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("bs_gas_class_group"); |
||||
|
||||
sql.SET("id = #{record.id,jdbcType=BIGINT}"); |
||||
sql.SET("mer_id = #{record.merId,jdbcType=BIGINT}"); |
||||
sql.SET("mer_name = #{record.merName,jdbcType=VARCHAR}"); |
||||
sql.SET("`name` = #{record.name,jdbcType=VARCHAR}"); |
||||
sql.SET("principal_name = #{record.principalName,jdbcType=VARCHAR}"); |
||||
sql.SET("principal_phone = #{record.principalPhone,jdbcType=VARCHAR}"); |
||||
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); |
||||
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); |
||||
|
||||
BsGasClassGroupExample example = (BsGasClassGroupExample) parameter.get("example"); |
||||
applyWhere(sql, example, true); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String updateByPrimaryKeySelective(BsGasClassGroup record) { |
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("bs_gas_class_group"); |
||||
|
||||
if (record.getMerId() != null) { |
||||
sql.SET("mer_id = #{merId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getMerName() != null) { |
||||
sql.SET("mer_name = #{merName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getName() != null) { |
||||
sql.SET("`name` = #{name,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getPrincipalName() != null) { |
||||
sql.SET("principal_name = #{principalName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getPrincipalPhone() != null) { |
||||
sql.SET("principal_phone = #{principalPhone,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getStatus() != null) { |
||||
sql.SET("`status` = #{status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getUpdateTime() != null) { |
||||
sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getExt1() != null) { |
||||
sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt2() != null) { |
||||
sql.SET("ext_2 = #{ext2,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt3() != null) { |
||||
sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
sql.WHERE("id = #{id,jdbcType=BIGINT}"); |
||||
|
||||
return sql.toString(); |
||||
} |
||||
|
||||
protected void applyWhere(SQL sql, BsGasClassGroupExample example, boolean includeExamplePhrase) { |
||||
if (example == null) { |
||||
return; |
||||
} |
||||
|
||||
String parmPhrase1; |
||||
String parmPhrase1_th; |
||||
String parmPhrase2; |
||||
String parmPhrase2_th; |
||||
String parmPhrase3; |
||||
String parmPhrase3_th; |
||||
if (includeExamplePhrase) { |
||||
parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}"; |
||||
parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; |
||||
parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}"; |
||||
parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; |
||||
parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}"; |
||||
parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; |
||||
} else { |
||||
parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}"; |
||||
parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; |
||||
parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}"; |
||||
parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; |
||||
parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}"; |
||||
parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; |
||||
} |
||||
|
||||
StringBuilder sb = new StringBuilder(); |
||||
List<Criteria> oredCriteria = example.getOredCriteria(); |
||||
boolean firstCriteria = true; |
||||
for (int i = 0; i < oredCriteria.size(); i++) { |
||||
Criteria criteria = oredCriteria.get(i); |
||||
if (criteria.isValid()) { |
||||
if (firstCriteria) { |
||||
firstCriteria = false; |
||||
} else { |
||||
sb.append(" or "); |
||||
} |
||||
|
||||
sb.append('('); |
||||
List<Criterion> criterions = criteria.getAllCriteria(); |
||||
boolean firstCriterion = true; |
||||
for (int j = 0; j < criterions.size(); j++) { |
||||
Criterion criterion = criterions.get(j); |
||||
if (firstCriterion) { |
||||
firstCriterion = false; |
||||
} else { |
||||
sb.append(" and "); |
||||
} |
||||
|
||||
if (criterion.isNoValue()) { |
||||
sb.append(criterion.getCondition()); |
||||
} else if (criterion.isSingleValue()) { |
||||
if (criterion.getTypeHandler() == null) { |
||||
sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j)); |
||||
} else { |
||||
sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler())); |
||||
} |
||||
} else if (criterion.isBetweenValue()) { |
||||
if (criterion.getTypeHandler() == null) { |
||||
sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j)); |
||||
} else { |
||||
sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler())); |
||||
} |
||||
} else if (criterion.isListValue()) { |
||||
sb.append(criterion.getCondition()); |
||||
sb.append(" ("); |
||||
List<?> listItems = (List<?>) criterion.getValue(); |
||||
boolean comma = false; |
||||
for (int k = 0; k < listItems.size(); k++) { |
||||
if (comma) { |
||||
sb.append(", "); |
||||
} else { |
||||
comma = true; |
||||
} |
||||
if (criterion.getTypeHandler() == null) { |
||||
sb.append(String.format(parmPhrase3, i, j, k)); |
||||
} else { |
||||
sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler())); |
||||
} |
||||
} |
||||
sb.append(')'); |
||||
} |
||||
} |
||||
sb.append(')'); |
||||
} |
||||
} |
||||
|
||||
if (sb.length() > 0) { |
||||
sql.WHERE(sb.toString()); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,136 @@ |
||||
package com.hfkj.dao; |
||||
|
||||
import com.hfkj.entity.BsGasClassGroupTask; |
||||
import com.hfkj.entity.BsGasClassGroupTaskExample; |
||||
import java.util.List; |
||||
import org.apache.ibatis.annotations.Delete; |
||||
import org.apache.ibatis.annotations.DeleteProvider; |
||||
import org.apache.ibatis.annotations.Insert; |
||||
import org.apache.ibatis.annotations.InsertProvider; |
||||
import org.apache.ibatis.annotations.Options; |
||||
import org.apache.ibatis.annotations.Param; |
||||
import org.apache.ibatis.annotations.Result; |
||||
import org.apache.ibatis.annotations.Results; |
||||
import org.apache.ibatis.annotations.Select; |
||||
import org.apache.ibatis.annotations.SelectProvider; |
||||
import org.apache.ibatis.annotations.Update; |
||||
import org.apache.ibatis.annotations.UpdateProvider; |
||||
import org.apache.ibatis.type.JdbcType; |
||||
import org.springframework.stereotype.Repository; |
||||
|
||||
/** |
||||
* |
||||
* 代码由工具生成,请勿修改!!! |
||||
* 如果需要扩展请在其父类进行扩展 |
||||
* |
||||
**/ |
||||
@Repository |
||||
public interface BsGasClassGroupTaskMapper extends BsGasClassGroupTaskMapperExt { |
||||
@SelectProvider(type=BsGasClassGroupTaskSqlProvider.class, method="countByExample") |
||||
long countByExample(BsGasClassGroupTaskExample example); |
||||
|
||||
@DeleteProvider(type=BsGasClassGroupTaskSqlProvider.class, method="deleteByExample") |
||||
int deleteByExample(BsGasClassGroupTaskExample example); |
||||
|
||||
@Delete({ |
||||
"delete from bs_gas_class_group_task", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
int deleteByPrimaryKey(Long id); |
||||
|
||||
@Insert({ |
||||
"insert into bs_gas_class_group_task (gas_class_group_id, gas_class_group_name, ", |
||||
"mer_id, mer_name, class_num, ", |
||||
"start_time, end_time, ", |
||||
"data_count, `status`, ", |
||||
"create_time, update_time, ", |
||||
"ext_1, ext_2, ext_3)", |
||||
"values (#{gasClassGroupId,jdbcType=BIGINT}, #{gasClassGroupName,jdbcType=VARCHAR}, ", |
||||
"#{merId,jdbcType=BIGINT}, #{merName,jdbcType=VARCHAR}, #{classNum,jdbcType=INTEGER}, ", |
||||
"#{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, ", |
||||
"#{dataCount,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ", |
||||
"#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ", |
||||
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" |
||||
}) |
||||
@Options(useGeneratedKeys=true,keyProperty="id") |
||||
int insert(BsGasClassGroupTask record); |
||||
|
||||
@InsertProvider(type=BsGasClassGroupTaskSqlProvider.class, method="insertSelective") |
||||
@Options(useGeneratedKeys=true,keyProperty="id") |
||||
int insertSelective(BsGasClassGroupTask record); |
||||
|
||||
@SelectProvider(type=BsGasClassGroupTaskSqlProvider.class, method="selectByExample") |
||||
@Results({ |
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), |
||||
@Result(column="gas_class_group_id", property="gasClassGroupId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="gas_class_group_name", property="gasClassGroupName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="mer_id", property="merId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="mer_name", property="merName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="class_num", property="classNum", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="start_time", property="startTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="end_time", property="endTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="data_count", property="dataCount", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) |
||||
}) |
||||
List<BsGasClassGroupTask> selectByExample(BsGasClassGroupTaskExample example); |
||||
|
||||
@Select({ |
||||
"select", |
||||
"id, gas_class_group_id, gas_class_group_name, mer_id, mer_name, class_num, start_time, ", |
||||
"end_time, data_count, `status`, create_time, update_time, ext_1, ext_2, ext_3", |
||||
"from bs_gas_class_group_task", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
@Results({ |
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), |
||||
@Result(column="gas_class_group_id", property="gasClassGroupId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="gas_class_group_name", property="gasClassGroupName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="mer_id", property="merId", jdbcType=JdbcType.BIGINT), |
||||
@Result(column="mer_name", property="merName", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="class_num", property="classNum", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="start_time", property="startTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="end_time", property="endTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="data_count", property="dataCount", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), |
||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), |
||||
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), |
||||
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) |
||||
}) |
||||
BsGasClassGroupTask selectByPrimaryKey(Long id); |
||||
|
||||
@UpdateProvider(type=BsGasClassGroupTaskSqlProvider.class, method="updateByExampleSelective") |
||||
int updateByExampleSelective(@Param("record") BsGasClassGroupTask record, @Param("example") BsGasClassGroupTaskExample example); |
||||
|
||||
@UpdateProvider(type=BsGasClassGroupTaskSqlProvider.class, method="updateByExample") |
||||
int updateByExample(@Param("record") BsGasClassGroupTask record, @Param("example") BsGasClassGroupTaskExample example); |
||||
|
||||
@UpdateProvider(type=BsGasClassGroupTaskSqlProvider.class, method="updateByPrimaryKeySelective") |
||||
int updateByPrimaryKeySelective(BsGasClassGroupTask record); |
||||
|
||||
@Update({ |
||||
"update bs_gas_class_group_task", |
||||
"set gas_class_group_id = #{gasClassGroupId,jdbcType=BIGINT},", |
||||
"gas_class_group_name = #{gasClassGroupName,jdbcType=VARCHAR},", |
||||
"mer_id = #{merId,jdbcType=BIGINT},", |
||||
"mer_name = #{merName,jdbcType=VARCHAR},", |
||||
"class_num = #{classNum,jdbcType=INTEGER},", |
||||
"start_time = #{startTime,jdbcType=TIMESTAMP},", |
||||
"end_time = #{endTime,jdbcType=TIMESTAMP},", |
||||
"data_count = #{dataCount,jdbcType=VARCHAR},", |
||||
"`status` = #{status,jdbcType=INTEGER},", |
||||
"create_time = #{createTime,jdbcType=TIMESTAMP},", |
||||
"update_time = #{updateTime,jdbcType=TIMESTAMP},", |
||||
"ext_1 = #{ext1,jdbcType=VARCHAR},", |
||||
"ext_2 = #{ext2,jdbcType=VARCHAR},", |
||||
"ext_3 = #{ext3,jdbcType=VARCHAR}", |
||||
"where id = #{id,jdbcType=BIGINT}" |
||||
}) |
||||
int updateByPrimaryKey(BsGasClassGroupTask record); |
||||
} |
@ -0,0 +1,59 @@ |
||||
package com.hfkj.dao; |
||||
|
||||
import org.apache.ibatis.annotations.Param; |
||||
import org.apache.ibatis.annotations.Select; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* mapper扩展类 |
||||
*/ |
||||
public interface BsGasClassGroupTaskMapperExt { |
||||
|
||||
|
||||
@Select("<script>" + |
||||
" select " + |
||||
" case when SUM(a.gas_refuel_price) is not null then SUM(a.gas_refuel_price) else 0 end refuelPrice," + |
||||
" COUNT(1) refuelNum," + |
||||
" case when SUM(a.gas_oil_liters) is not null then SUM(a.gas_oil_liters) else 0 end refuelLiters" + |
||||
" from bs_gas_order a" + |
||||
" where a.gas_class_group_task_id = #{gasClassGroupTaskId} " + |
||||
" and a.status in (2)" + |
||||
"</script>") |
||||
Map<String, Object> countRefuelData(@Param("gasClassGroupTaskId") Long gasClassGroupTaskId); |
||||
|
||||
@Select("<script>" + |
||||
" select" + |
||||
" case when SUM(a.gas_refuel_price) is not null then SUM(a.gas_refuel_price) else 0 end refundPrice," + |
||||
" COUNT(1) refundNum," + |
||||
" case when SUM(a.gas_oil_liters) is not null then SUM(a.gas_oil_liters) else 0 end refundLiters" + |
||||
" from bs_gas_order a" + |
||||
" where a.gas_class_group_task_id = #{gasClassGroupTaskId}" + |
||||
" and a.status in (4)" + |
||||
"</script>") |
||||
Map<String, Object> countRefundData(@Param("gasClassGroupTaskId") Long gasClassGroupTaskId); |
||||
|
||||
@Select("<script>" + |
||||
" SELECT" + |
||||
" a.oil_no oilNo," + |
||||
" case when b.refuelPrice is not null then b.refuelPrice else 0 end refuelPrice," + |
||||
" case when b.refuelNum is not null then b.refuelNum else 0 end refuelNum," + |
||||
" case when b.refuelLiters is not null then b.refuelLiters else 0 end refuelLiters" + |
||||
" FROM" + |
||||
" bs_gas_oil_price a " + |
||||
" LEFT JOIN (select gas_oil_no," + |
||||
" case when SUM(a.gas_refuel_price) is not null then SUM(a.gas_refuel_price) else 0 end refuelPrice," + |
||||
" COUNT(1) refuelNum," + |
||||
" case when SUM(a.gas_oil_liters) is not null then SUM(a.gas_oil_liters) else 0 end refuelLiters" + |
||||
" from bs_gas_order a" + |
||||
" where a.gas_class_group_task_id = #{gasClassGroupTaskId} and a.status in (4)" + |
||||
" GROUP BY a.gas_oil_no) b on b.gas_oil_no = a.oil_no" + |
||||
" WHERE a.merchant_store_id = #{gasId} and <![CDATA[ `status` <> 0 ]]> " + |
||||
"</script>") |
||||
List<Map<String, Object>> countOilData(@Param("gasId") Long gasId, @Param("gasClassGroupTaskId") Long gasClassGroupTaskId); |
||||
|
||||
@Select("select count(1) from bs_gas_class_group_task where merchant_store_id = #{gasId} and `status` <> 0") |
||||
int getLatestClassNum(@Param("gasId") Long gasId); |
||||
|
||||
} |
@ -0,0 +1,374 @@ |
||||
package com.hfkj.dao; |
||||
|
||||
import com.hfkj.entity.BsGasClassGroupTask; |
||||
import com.hfkj.entity.BsGasClassGroupTaskExample.Criteria; |
||||
import com.hfkj.entity.BsGasClassGroupTaskExample.Criterion; |
||||
import com.hfkj.entity.BsGasClassGroupTaskExample; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import org.apache.ibatis.jdbc.SQL; |
||||
|
||||
public class BsGasClassGroupTaskSqlProvider { |
||||
|
||||
public String countByExample(BsGasClassGroupTaskExample example) { |
||||
SQL sql = new SQL(); |
||||
sql.SELECT("count(*)").FROM("bs_gas_class_group_task"); |
||||
applyWhere(sql, example, false); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String deleteByExample(BsGasClassGroupTaskExample example) { |
||||
SQL sql = new SQL(); |
||||
sql.DELETE_FROM("bs_gas_class_group_task"); |
||||
applyWhere(sql, example, false); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String insertSelective(BsGasClassGroupTask record) { |
||||
SQL sql = new SQL(); |
||||
sql.INSERT_INTO("bs_gas_class_group_task"); |
||||
|
||||
if (record.getGasClassGroupId() != null) { |
||||
sql.VALUES("gas_class_group_id", "#{gasClassGroupId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getGasClassGroupName() != null) { |
||||
sql.VALUES("gas_class_group_name", "#{gasClassGroupName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getMerId() != null) { |
||||
sql.VALUES("mer_id", "#{merId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getMerName() != null) { |
||||
sql.VALUES("mer_name", "#{merName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getClassNum() != null) { |
||||
sql.VALUES("class_num", "#{classNum,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getStartTime() != null) { |
||||
sql.VALUES("start_time", "#{startTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getEndTime() != null) { |
||||
sql.VALUES("end_time", "#{endTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getDataCount() != null) { |
||||
sql.VALUES("data_count", "#{dataCount,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getStatus() != null) { |
||||
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getUpdateTime() != null) { |
||||
sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getExt1() != null) { |
||||
sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt2() != null) { |
||||
sql.VALUES("ext_2", "#{ext2,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt3() != null) { |
||||
sql.VALUES("ext_3", "#{ext3,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String selectByExample(BsGasClassGroupTaskExample example) { |
||||
SQL sql = new SQL(); |
||||
if (example != null && example.isDistinct()) { |
||||
sql.SELECT_DISTINCT("id"); |
||||
} else { |
||||
sql.SELECT("id"); |
||||
} |
||||
sql.SELECT("gas_class_group_id"); |
||||
sql.SELECT("gas_class_group_name"); |
||||
sql.SELECT("mer_id"); |
||||
sql.SELECT("mer_name"); |
||||
sql.SELECT("class_num"); |
||||
sql.SELECT("start_time"); |
||||
sql.SELECT("end_time"); |
||||
sql.SELECT("data_count"); |
||||
sql.SELECT("`status`"); |
||||
sql.SELECT("create_time"); |
||||
sql.SELECT("update_time"); |
||||
sql.SELECT("ext_1"); |
||||
sql.SELECT("ext_2"); |
||||
sql.SELECT("ext_3"); |
||||
sql.FROM("bs_gas_class_group_task"); |
||||
applyWhere(sql, example, false); |
||||
|
||||
if (example != null && example.getOrderByClause() != null) { |
||||
sql.ORDER_BY(example.getOrderByClause()); |
||||
} |
||||
|
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String updateByExampleSelective(Map<String, Object> parameter) { |
||||
BsGasClassGroupTask record = (BsGasClassGroupTask) parameter.get("record"); |
||||
BsGasClassGroupTaskExample example = (BsGasClassGroupTaskExample) parameter.get("example"); |
||||
|
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("bs_gas_class_group_task"); |
||||
|
||||
if (record.getId() != null) { |
||||
sql.SET("id = #{record.id,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getGasClassGroupId() != null) { |
||||
sql.SET("gas_class_group_id = #{record.gasClassGroupId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getGasClassGroupName() != null) { |
||||
sql.SET("gas_class_group_name = #{record.gasClassGroupName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getMerId() != null) { |
||||
sql.SET("mer_id = #{record.merId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getMerName() != null) { |
||||
sql.SET("mer_name = #{record.merName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getClassNum() != null) { |
||||
sql.SET("class_num = #{record.classNum,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getStartTime() != null) { |
||||
sql.SET("start_time = #{record.startTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getEndTime() != null) { |
||||
sql.SET("end_time = #{record.endTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getDataCount() != null) { |
||||
sql.SET("data_count = #{record.dataCount,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getStatus() != null) { |
||||
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getUpdateTime() != null) { |
||||
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getExt1() != null) { |
||||
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt2() != null) { |
||||
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt3() != null) { |
||||
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
applyWhere(sql, example, true); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String updateByExample(Map<String, Object> parameter) { |
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("bs_gas_class_group_task"); |
||||
|
||||
sql.SET("id = #{record.id,jdbcType=BIGINT}"); |
||||
sql.SET("gas_class_group_id = #{record.gasClassGroupId,jdbcType=BIGINT}"); |
||||
sql.SET("gas_class_group_name = #{record.gasClassGroupName,jdbcType=VARCHAR}"); |
||||
sql.SET("mer_id = #{record.merId,jdbcType=BIGINT}"); |
||||
sql.SET("mer_name = #{record.merName,jdbcType=VARCHAR}"); |
||||
sql.SET("class_num = #{record.classNum,jdbcType=INTEGER}"); |
||||
sql.SET("start_time = #{record.startTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("end_time = #{record.endTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("data_count = #{record.dataCount,jdbcType=VARCHAR}"); |
||||
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); |
||||
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); |
||||
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); |
||||
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); |
||||
|
||||
BsGasClassGroupTaskExample example = (BsGasClassGroupTaskExample) parameter.get("example"); |
||||
applyWhere(sql, example, true); |
||||
return sql.toString(); |
||||
} |
||||
|
||||
public String updateByPrimaryKeySelective(BsGasClassGroupTask record) { |
||||
SQL sql = new SQL(); |
||||
sql.UPDATE("bs_gas_class_group_task"); |
||||
|
||||
if (record.getGasClassGroupId() != null) { |
||||
sql.SET("gas_class_group_id = #{gasClassGroupId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getGasClassGroupName() != null) { |
||||
sql.SET("gas_class_group_name = #{gasClassGroupName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getMerId() != null) { |
||||
sql.SET("mer_id = #{merId,jdbcType=BIGINT}"); |
||||
} |
||||
|
||||
if (record.getMerName() != null) { |
||||
sql.SET("mer_name = #{merName,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getClassNum() != null) { |
||||
sql.SET("class_num = #{classNum,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getStartTime() != null) { |
||||
sql.SET("start_time = #{startTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getEndTime() != null) { |
||||
sql.SET("end_time = #{endTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getDataCount() != null) { |
||||
sql.SET("data_count = #{dataCount,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getStatus() != null) { |
||||
sql.SET("`status` = #{status,jdbcType=INTEGER}"); |
||||
} |
||||
|
||||
if (record.getCreateTime() != null) { |
||||
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getUpdateTime() != null) { |
||||
sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}"); |
||||
} |
||||
|
||||
if (record.getExt1() != null) { |
||||
sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt2() != null) { |
||||
sql.SET("ext_2 = #{ext2,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
if (record.getExt3() != null) { |
||||
sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}"); |
||||
} |
||||
|
||||
sql.WHERE("id = #{id,jdbcType=BIGINT}"); |
||||
|
||||
return sql.toString(); |
||||
} |
||||
|
||||
protected void applyWhere(SQL sql, BsGasClassGroupTaskExample example, boolean includeExamplePhrase) { |
||||
if (example == null) { |
||||
return; |
||||
} |
||||
|
||||
String parmPhrase1; |
||||
String parmPhrase1_th; |
||||
String parmPhrase2; |
||||
String parmPhrase2_th; |
||||
String parmPhrase3; |
||||
String parmPhrase3_th; |
||||
if (includeExamplePhrase) { |
||||
parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}"; |
||||
parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; |
||||
parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}"; |
||||
parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; |
||||
parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}"; |
||||
parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; |
||||
} else { |
||||
parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}"; |
||||
parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; |
||||
parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}"; |
||||
parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; |
||||
parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}"; |
||||
parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; |
||||
} |
||||
|
||||
StringBuilder sb = new StringBuilder(); |
||||
List<Criteria> oredCriteria = example.getOredCriteria(); |
||||
boolean firstCriteria = true; |
||||
for (int i = 0; i < oredCriteria.size(); i++) { |
||||
Criteria criteria = oredCriteria.get(i); |
||||
if (criteria.isValid()) { |
||||
if (firstCriteria) { |
||||
firstCriteria = false; |
||||
} else { |
||||
sb.append(" or "); |
||||
} |
||||
|
||||
sb.append('('); |
||||
List<Criterion> criterions = criteria.getAllCriteria(); |
||||
boolean firstCriterion = true; |
||||
for (int j = 0; j < criterions.size(); j++) { |
||||
Criterion criterion = criterions.get(j); |
||||
if (firstCriterion) { |
||||
firstCriterion = false; |
||||
} else { |
||||
sb.append(" and "); |
||||
} |
||||
|
||||
if (criterion.isNoValue()) { |
||||
sb.append(criterion.getCondition()); |
||||
} else if (criterion.isSingleValue()) { |
||||
if (criterion.getTypeHandler() == null) { |
||||
sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j)); |
||||
} else { |
||||
sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler())); |
||||
} |
||||
} else if (criterion.isBetweenValue()) { |
||||
if (criterion.getTypeHandler() == null) { |
||||
sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j)); |
||||
} else { |
||||
sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler())); |
||||
} |
||||
} else if (criterion.isListValue()) { |
||||
sb.append(criterion.getCondition()); |
||||
sb.append(" ("); |
||||
List<?> listItems = (List<?>) criterion.getValue(); |
||||
boolean comma = false; |
||||
for (int k = 0; k < listItems.size(); k++) { |
||||
if (comma) { |
||||
sb.append(", "); |
||||
} else { |
||||
comma = true; |
||||
} |
||||
if (criterion.getTypeHandler() == null) { |
||||
sb.append(String.format(parmPhrase3, i, j, k)); |
||||
} else { |
||||
sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler())); |
||||
} |
||||
} |
||||
sb.append(')'); |
||||
} |
||||
} |
||||
sb.append(')'); |
||||
} |
||||
} |
||||
|
||||
if (sb.length() > 0) { |
||||
sql.WHERE(sb.toString()); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,232 @@ |
||||
package com.hfkj.entity; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* bs_gas_class_group |
||||
* @author |
||||
*/ |
||||
/** |
||||
* |
||||
* 代码由工具生成 |
||||
* |
||||
**/ |
||||
public class BsGasClassGroup implements Serializable { |
||||
/** |
||||
* 主键 |
||||
*/ |
||||
private Long id; |
||||
|
||||
/** |
||||
* 加油站id |
||||
*/ |
||||
private Long merId; |
||||
|
||||
/** |
||||
* 加油站名称 |
||||
*/ |
||||
private String merName; |
||||
|
||||
/** |
||||
* 班组名称 |
||||
*/ |
||||
private String name; |
||||
|
||||
/** |
||||
* 负责人名称 |
||||
*/ |
||||
private String principalName; |
||||
|
||||
/** |
||||
* 负责人电话 |
||||
*/ |
||||
private String principalPhone; |
||||
|
||||
/** |
||||
* 状态 0:删除 1:正常 |
||||
*/ |
||||
private Integer status; |
||||
|
||||
/** |
||||
* 创建时间 |
||||
*/ |
||||
private Date createTime; |
||||
|
||||
/** |
||||
* 修改时间 |
||||
*/ |
||||
private Date updateTime; |
||||
|
||||
private String ext1; |
||||
|
||||
private String ext2; |
||||
|
||||
private String ext3; |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
public Long getId() { |
||||
return id; |
||||
} |
||||
|
||||
public void setId(Long id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public Long getMerId() { |
||||
return merId; |
||||
} |
||||
|
||||
public void setMerId(Long merId) { |
||||
this.merId = merId; |
||||
} |
||||
|
||||
public String getMerName() { |
||||
return merName; |
||||
} |
||||
|
||||
public void setMerName(String merName) { |
||||
this.merName = merName; |
||||
} |
||||
|
||||
public String getName() { |
||||
return name; |
||||
} |
||||
|
||||
public void setName(String name) { |
||||
this.name = name; |
||||
} |
||||
|
||||
public String getPrincipalName() { |
||||
return principalName; |
||||
} |
||||
|
||||
public void setPrincipalName(String principalName) { |
||||
this.principalName = principalName; |
||||
} |
||||
|
||||
public String getPrincipalPhone() { |
||||
return principalPhone; |
||||
} |
||||
|
||||
public void setPrincipalPhone(String principalPhone) { |
||||
this.principalPhone = principalPhone; |
||||
} |
||||
|
||||
public Integer getStatus() { |
||||
return status; |
||||
} |
||||
|
||||
public void setStatus(Integer status) { |
||||
this.status = status; |
||||
} |
||||
|
||||
public Date getCreateTime() { |
||||
return createTime; |
||||
} |
||||
|
||||
public void setCreateTime(Date createTime) { |
||||
this.createTime = createTime; |
||||
} |
||||
|
||||
public Date getUpdateTime() { |
||||
return updateTime; |
||||
} |
||||
|
||||
public void setUpdateTime(Date updateTime) { |
||||
this.updateTime = updateTime; |
||||
} |
||||
|
||||
public String getExt1() { |
||||
return ext1; |
||||
} |
||||
|
||||
public void setExt1(String ext1) { |
||||
this.ext1 = ext1; |
||||
} |
||||
|
||||
public String getExt2() { |
||||
return ext2; |
||||
} |
||||
|
||||
public void setExt2(String ext2) { |
||||
this.ext2 = ext2; |
||||
} |
||||
|
||||
public String getExt3() { |
||||
return ext3; |
||||
} |
||||
|
||||
public void setExt3(String ext3) { |
||||
this.ext3 = ext3; |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object that) { |
||||
if (this == that) { |
||||
return true; |
||||
} |
||||
if (that == null) { |
||||
return false; |
||||
} |
||||
if (getClass() != that.getClass()) { |
||||
return false; |
||||
} |
||||
BsGasClassGroup other = (BsGasClassGroup) that; |
||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) |
||||
&& (this.getMerId() == null ? other.getMerId() == null : this.getMerId().equals(other.getMerId())) |
||||
&& (this.getMerName() == null ? other.getMerName() == null : this.getMerName().equals(other.getMerName())) |
||||
&& (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName())) |
||||
&& (this.getPrincipalName() == null ? other.getPrincipalName() == null : this.getPrincipalName().equals(other.getPrincipalName())) |
||||
&& (this.getPrincipalPhone() == null ? other.getPrincipalPhone() == null : this.getPrincipalPhone().equals(other.getPrincipalPhone())) |
||||
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) |
||||
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) |
||||
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) |
||||
&& (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1())) |
||||
&& (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2())) |
||||
&& (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3())); |
||||
} |
||||
|
||||
@Override |
||||
public int hashCode() { |
||||
final int prime = 31; |
||||
int result = 1; |
||||
result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); |
||||
result = prime * result + ((getMerId() == null) ? 0 : getMerId().hashCode()); |
||||
result = prime * result + ((getMerName() == null) ? 0 : getMerName().hashCode()); |
||||
result = prime * result + ((getName() == null) ? 0 : getName().hashCode()); |
||||
result = prime * result + ((getPrincipalName() == null) ? 0 : getPrincipalName().hashCode()); |
||||
result = prime * result + ((getPrincipalPhone() == null) ? 0 : getPrincipalPhone().hashCode()); |
||||
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); |
||||
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); |
||||
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); |
||||
result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode()); |
||||
result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode()); |
||||
result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode()); |
||||
return result; |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
StringBuilder sb = new StringBuilder(); |
||||
sb.append(getClass().getSimpleName()); |
||||
sb.append(" ["); |
||||
sb.append("Hash = ").append(hashCode()); |
||||
sb.append(", id=").append(id); |
||||
sb.append(", merId=").append(merId); |
||||
sb.append(", merName=").append(merName); |
||||
sb.append(", name=").append(name); |
||||
sb.append(", principalName=").append(principalName); |
||||
sb.append(", principalPhone=").append(principalPhone); |
||||
sb.append(", status=").append(status); |
||||
sb.append(", createTime=").append(createTime); |
||||
sb.append(", updateTime=").append(updateTime); |
||||
sb.append(", ext1=").append(ext1); |
||||
sb.append(", ext2=").append(ext2); |
||||
sb.append(", ext3=").append(ext3); |
||||
sb.append(", serialVersionUID=").append(serialVersionUID); |
||||
sb.append("]"); |
||||
return sb.toString(); |
||||
} |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,280 @@ |
||||
package com.hfkj.entity; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* bs_gas_class_group_task |
||||
* @author |
||||
*/ |
||||
/** |
||||
* |
||||
* 代码由工具生成 |
||||
* |
||||
**/ |
||||
public class BsGasClassGroupTask implements Serializable { |
||||
/** |
||||
* 主键 |
||||
*/ |
||||
private Long id; |
||||
|
||||
/** |
||||
* 班组id |
||||
*/ |
||||
private Long gasClassGroupId; |
||||
|
||||
/** |
||||
* 班组名称 |
||||
*/ |
||||
private String gasClassGroupName; |
||||
|
||||
/** |
||||
* 加油站id |
||||
*/ |
||||
private Long merId; |
||||
|
||||
/** |
||||
* 加油站名称 |
||||
*/ |
||||
private String merName; |
||||
|
||||
/** |
||||
* 班次 |
||||
*/ |
||||
private Integer classNum; |
||||
|
||||
/** |
||||
* 开始时间 |
||||
*/ |
||||
private Date startTime; |
||||
|
||||
/** |
||||
* 结束时间 |
||||
*/ |
||||
private Date endTime; |
||||
|
||||
/** |
||||
* 数据统计 |
||||
*/ |
||||
private String dataCount; |
||||
|
||||
/** |
||||
* 状态 0:删除 1:进行中 2:已结束 |
||||
*/ |
||||
private Integer status; |
||||
|
||||
/** |
||||
* 创建时间 |
||||
*/ |
||||
private Date createTime; |
||||
|
||||
/** |
||||
* 修改时间 |
||||
*/ |
||||
private Date updateTime; |
||||
|
||||
private String ext1; |
||||
|
||||
private String ext2; |
||||
|
||||
private String ext3; |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
public Long getId() { |
||||
return id; |
||||
} |
||||
|
||||
public void setId(Long id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public Long getGasClassGroupId() { |
||||
return gasClassGroupId; |
||||
} |
||||
|
||||
public void setGasClassGroupId(Long gasClassGroupId) { |
||||
this.gasClassGroupId = gasClassGroupId; |
||||
} |
||||
|
||||
public String getGasClassGroupName() { |
||||
return gasClassGroupName; |
||||
} |
||||
|
||||
public void setGasClassGroupName(String gasClassGroupName) { |
||||
this.gasClassGroupName = gasClassGroupName; |
||||
} |
||||
|
||||
public Long getMerId() { |
||||
return merId; |
||||
} |
||||
|
||||
public void setMerId(Long merId) { |
||||
this.merId = merId; |
||||
} |
||||
|
||||
public String getMerName() { |
||||
return merName; |
||||
} |
||||
|
||||
public void setMerName(String merName) { |
||||
this.merName = merName; |
||||
} |
||||
|
||||
public Integer getClassNum() { |
||||
return classNum; |
||||
} |
||||
|
||||
public void setClassNum(Integer classNum) { |
||||
this.classNum = classNum; |
||||
} |
||||
|
||||
public Date getStartTime() { |
||||
return startTime; |
||||
} |
||||
|
||||
public void setStartTime(Date startTime) { |
||||
this.startTime = startTime; |
||||
} |
||||
|
||||
public Date getEndTime() { |
||||
return endTime; |
||||
} |
||||
|
||||
public void setEndTime(Date endTime) { |
||||
this.endTime = endTime; |
||||
} |
||||
|
||||
public String getDataCount() { |
||||
return dataCount; |
||||
} |
||||
|
||||
public void setDataCount(String dataCount) { |
||||
this.dataCount = dataCount; |
||||
} |
||||
|
||||
public Integer getStatus() { |
||||
return status; |
||||
} |
||||
|
||||
public void setStatus(Integer status) { |
||||
this.status = status; |
||||
} |
||||
|
||||
public Date getCreateTime() { |
||||
return createTime; |
||||
} |
||||
|
||||
public void setCreateTime(Date createTime) { |
||||
this.createTime = createTime; |
||||
} |
||||
|
||||
public Date getUpdateTime() { |
||||
return updateTime; |
||||
} |
||||
|
||||
public void setUpdateTime(Date updateTime) { |
||||
this.updateTime = updateTime; |
||||
} |
||||
|
||||
public String getExt1() { |
||||
return ext1; |
||||
} |
||||
|
||||
public void setExt1(String ext1) { |
||||
this.ext1 = ext1; |
||||
} |
||||
|
||||
public String getExt2() { |
||||
return ext2; |
||||
} |
||||
|
||||
public void setExt2(String ext2) { |
||||
this.ext2 = ext2; |
||||
} |
||||
|
||||
public String getExt3() { |
||||
return ext3; |
||||
} |
||||
|
||||
public void setExt3(String ext3) { |
||||
this.ext3 = ext3; |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object that) { |
||||
if (this == that) { |
||||
return true; |
||||
} |
||||
if (that == null) { |
||||
return false; |
||||
} |
||||
if (getClass() != that.getClass()) { |
||||
return false; |
||||
} |
||||
BsGasClassGroupTask other = (BsGasClassGroupTask) that; |
||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) |
||||
&& (this.getGasClassGroupId() == null ? other.getGasClassGroupId() == null : this.getGasClassGroupId().equals(other.getGasClassGroupId())) |
||||
&& (this.getGasClassGroupName() == null ? other.getGasClassGroupName() == null : this.getGasClassGroupName().equals(other.getGasClassGroupName())) |
||||
&& (this.getMerId() == null ? other.getMerId() == null : this.getMerId().equals(other.getMerId())) |
||||
&& (this.getMerName() == null ? other.getMerName() == null : this.getMerName().equals(other.getMerName())) |
||||
&& (this.getClassNum() == null ? other.getClassNum() == null : this.getClassNum().equals(other.getClassNum())) |
||||
&& (this.getStartTime() == null ? other.getStartTime() == null : this.getStartTime().equals(other.getStartTime())) |
||||
&& (this.getEndTime() == null ? other.getEndTime() == null : this.getEndTime().equals(other.getEndTime())) |
||||
&& (this.getDataCount() == null ? other.getDataCount() == null : this.getDataCount().equals(other.getDataCount())) |
||||
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) |
||||
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) |
||||
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) |
||||
&& (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1())) |
||||
&& (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2())) |
||||
&& (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3())); |
||||
} |
||||
|
||||
@Override |
||||
public int hashCode() { |
||||
final int prime = 31; |
||||
int result = 1; |
||||
result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); |
||||
result = prime * result + ((getGasClassGroupId() == null) ? 0 : getGasClassGroupId().hashCode()); |
||||
result = prime * result + ((getGasClassGroupName() == null) ? 0 : getGasClassGroupName().hashCode()); |
||||
result = prime * result + ((getMerId() == null) ? 0 : getMerId().hashCode()); |
||||
result = prime * result + ((getMerName() == null) ? 0 : getMerName().hashCode()); |
||||
result = prime * result + ((getClassNum() == null) ? 0 : getClassNum().hashCode()); |
||||
result = prime * result + ((getStartTime() == null) ? 0 : getStartTime().hashCode()); |
||||
result = prime * result + ((getEndTime() == null) ? 0 : getEndTime().hashCode()); |
||||
result = prime * result + ((getDataCount() == null) ? 0 : getDataCount().hashCode()); |
||||
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); |
||||
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); |
||||
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); |
||||
result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode()); |
||||
result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode()); |
||||
result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode()); |
||||
return result; |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
StringBuilder sb = new StringBuilder(); |
||||
sb.append(getClass().getSimpleName()); |
||||
sb.append(" ["); |
||||
sb.append("Hash = ").append(hashCode()); |
||||
sb.append(", id=").append(id); |
||||
sb.append(", gasClassGroupId=").append(gasClassGroupId); |
||||
sb.append(", gasClassGroupName=").append(gasClassGroupName); |
||||
sb.append(", merId=").append(merId); |
||||
sb.append(", merName=").append(merName); |
||||
sb.append(", classNum=").append(classNum); |
||||
sb.append(", startTime=").append(startTime); |
||||
sb.append(", endTime=").append(endTime); |
||||
sb.append(", dataCount=").append(dataCount); |
||||
sb.append(", status=").append(status); |
||||
sb.append(", createTime=").append(createTime); |
||||
sb.append(", updateTime=").append(updateTime); |
||||
sb.append(", ext1=").append(ext1); |
||||
sb.append(", ext2=").append(ext2); |
||||
sb.append(", ext3=").append(ext3); |
||||
sb.append(", serialVersionUID=").append(serialVersionUID); |
||||
sb.append("]"); |
||||
return sb.toString(); |
||||
} |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,155 @@ |
||||
package com.hfkj.model; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 加油站 班组任务数据统计模型 |
||||
* @author hurui |
||||
*/ |
||||
public class GasClassGroupTaskDataCount { |
||||
|
||||
/** |
||||
* 班次 |
||||
*/ |
||||
private Integer classNum; |
||||
|
||||
/** |
||||
* 开始时间 |
||||
*/ |
||||
private Date startTime; |
||||
|
||||
/** |
||||
* 结束时间 |
||||
*/ |
||||
private Date endTime; |
||||
|
||||
/** |
||||
* 班次状态 |
||||
*/ |
||||
private Integer status; |
||||
|
||||
/** |
||||
* 加油总金额 |
||||
*/ |
||||
private BigDecimal refuelPrice; |
||||
|
||||
/** |
||||
* 加油总笔数 |
||||
*/ |
||||
private Integer refuelNum; |
||||
|
||||
/** |
||||
* 加油总升数 |
||||
*/ |
||||
private BigDecimal refuelLiters; |
||||
|
||||
/** |
||||
* 退款总金额 |
||||
*/ |
||||
private BigDecimal refundPrice; |
||||
|
||||
/** |
||||
* 退款总笔数 |
||||
*/ |
||||
private Integer refundNum; |
||||
|
||||
/** |
||||
* 退款总升数 |
||||
*/ |
||||
private BigDecimal refundLiters; |
||||
|
||||
/** |
||||
* 班组油品数据统计 |
||||
*/ |
||||
List<GasClassGroupTaskOilCount> groupTaskOilCountList; |
||||
|
||||
public Integer getStatus() { |
||||
return status; |
||||
} |
||||
|
||||
public void setStatus(Integer status) { |
||||
this.status = status; |
||||
} |
||||
|
||||
public Integer getClassNum() { |
||||
return classNum; |
||||
} |
||||
|
||||
public void setClassNum(Integer classNum) { |
||||
this.classNum = classNum; |
||||
} |
||||
|
||||
public Date getStartTime() { |
||||
return startTime; |
||||
} |
||||
|
||||
public void setStartTime(Date startTime) { |
||||
this.startTime = startTime; |
||||
} |
||||
|
||||
public Date getEndTime() { |
||||
return endTime; |
||||
} |
||||
|
||||
public void setEndTime(Date endTime) { |
||||
this.endTime = endTime; |
||||
} |
||||
|
||||
public BigDecimal getRefuelPrice() { |
||||
return refuelPrice; |
||||
} |
||||
|
||||
public void setRefuelPrice(BigDecimal refuelPrice) { |
||||
this.refuelPrice = refuelPrice; |
||||
} |
||||
|
||||
public Integer getRefuelNum() { |
||||
return refuelNum; |
||||
} |
||||
|
||||
public void setRefuelNum(Integer refuelNum) { |
||||
this.refuelNum = refuelNum; |
||||
} |
||||
|
||||
public BigDecimal getRefuelLiters() { |
||||
return refuelLiters; |
||||
} |
||||
|
||||
public void setRefuelLiters(BigDecimal refuelLiters) { |
||||
this.refuelLiters = refuelLiters; |
||||
} |
||||
|
||||
public BigDecimal getRefundPrice() { |
||||
return refundPrice; |
||||
} |
||||
|
||||
public void setRefundPrice(BigDecimal refundPrice) { |
||||
this.refundPrice = refundPrice; |
||||
} |
||||
|
||||
public Integer getRefundNum() { |
||||
return refundNum; |
||||
} |
||||
|
||||
public void setRefundNum(Integer refundNum) { |
||||
this.refundNum = refundNum; |
||||
} |
||||
|
||||
public BigDecimal getRefundLiters() { |
||||
return refundLiters; |
||||
} |
||||
|
||||
public void setRefundLiters(BigDecimal refundLiters) { |
||||
this.refundLiters = refundLiters; |
||||
} |
||||
|
||||
public List<GasClassGroupTaskOilCount> getGroupTaskOilCountList() { |
||||
return groupTaskOilCountList; |
||||
} |
||||
|
||||
public void setGroupTaskOilCountList(List<GasClassGroupTaskOilCount> groupTaskOilCountList) { |
||||
this.groupTaskOilCountList = groupTaskOilCountList; |
||||
} |
||||
} |
@ -0,0 +1,62 @@ |
||||
package com.hfkj.model; |
||||
|
||||
import java.math.BigDecimal; |
||||
|
||||
/** |
||||
* 加油站 班组任务,加油统计 |
||||
* @author hurui |
||||
*/ |
||||
public class GasClassGroupTaskOilCount { |
||||
|
||||
/** |
||||
* 油号 |
||||
*/ |
||||
private Integer oilNo; |
||||
|
||||
/** |
||||
* 加油总金额 |
||||
*/ |
||||
private BigDecimal refuelPrice; |
||||
|
||||
/** |
||||
* 加油总数量 |
||||
*/ |
||||
private Integer refuelNum; |
||||
|
||||
/** |
||||
* 加油总升数 |
||||
*/ |
||||
private BigDecimal refuelLiters; |
||||
|
||||
public Integer getOilNo() { |
||||
return oilNo; |
||||
} |
||||
|
||||
public void setOilNo(Integer oilNo) { |
||||
this.oilNo = oilNo; |
||||
} |
||||
|
||||
public BigDecimal getRefuelPrice() { |
||||
return refuelPrice; |
||||
} |
||||
|
||||
public void setRefuelPrice(BigDecimal refuelPrice) { |
||||
this.refuelPrice = refuelPrice; |
||||
} |
||||
|
||||
public Integer getRefuelNum() { |
||||
return refuelNum; |
||||
} |
||||
|
||||
public void setRefuelNum(Integer refuelNum) { |
||||
this.refuelNum = refuelNum; |
||||
} |
||||
|
||||
public BigDecimal getRefuelLiters() { |
||||
return refuelLiters; |
||||
} |
||||
|
||||
public void setRefuelLiters(BigDecimal refuelLiters) { |
||||
this.refuelLiters = refuelLiters; |
||||
} |
||||
} |
@ -0,0 +1,40 @@ |
||||
package com.hfkj.service.gas; |
||||
|
||||
import com.hfkj.entity.BsGasClassGroup; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 加油站班组服务 |
||||
* @author hurui |
||||
*/ |
||||
public interface BsGasClassGroupService { |
||||
|
||||
/** |
||||
* 编辑班组 |
||||
* @param gasClassGroup |
||||
*/ |
||||
void editGroup(BsGasClassGroup gasClassGroup); |
||||
|
||||
/** |
||||
* 删除班组 |
||||
* @param groupId |
||||
*/ |
||||
void delGroup(Long groupId); |
||||
|
||||
/** |
||||
* 根据id查询详情 |
||||
* @param groupId |
||||
* @return |
||||
*/ |
||||
BsGasClassGroup getDetailById(Long groupId); |
||||
|
||||
/** |
||||
* 查询班组列表 |
||||
* @param param |
||||
* @return |
||||
*/ |
||||
List<BsGasClassGroup> getGroupList(Map<String, Object> param); |
||||
|
||||
} |
@ -0,0 +1,70 @@ |
||||
package com.hfkj.service.gas; |
||||
|
||||
import com.hfkj.entity.BsGasClassGroupTask; |
||||
import com.hfkj.model.GasClassGroupTaskDataCount; |
||||
|
||||
import java.util.Date; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 加油站班组任务 |
||||
* @author hurui |
||||
*/ |
||||
public interface BsGasClassGroupTaskService { |
||||
|
||||
/** |
||||
* 开始班组 |
||||
* @param gasId 油站id |
||||
* @param gasClassGroupId 班组id |
||||
*/ |
||||
void startGroupTask(Long gasId, Long gasClassGroupId); |
||||
|
||||
/** |
||||
* 结束班组任务 |
||||
* @param gasId 油站id |
||||
*/ |
||||
void endGroupTask(Long gasId); |
||||
|
||||
/** |
||||
* 交接班组任务 |
||||
* @param gasId 油站id |
||||
* @param gasClassGroupId 班组id |
||||
*/ |
||||
void swapGroupTask(Long gasId, Long gasClassGroupId); |
||||
|
||||
/** |
||||
* 统计班组任务数据 |
||||
* @param groupTaskId |
||||
* @return |
||||
*/ |
||||
GasClassGroupTaskDataCount countGroupTaskData(Long gasId, Integer classNum, Long groupTaskId, Integer status, Date startTime, Date endTime); |
||||
|
||||
/** |
||||
* 编辑班组任务 |
||||
* @param gasClassGroupTask |
||||
*/ |
||||
void editGroupTask(BsGasClassGroupTask gasClassGroupTask); |
||||
|
||||
/** |
||||
* 根据id查询详情 |
||||
* @param groupTaskId |
||||
* @return |
||||
*/ |
||||
BsGasClassGroupTask getDetailById(Long groupTaskId); |
||||
|
||||
/** |
||||
* 查询班组任务列表 |
||||
* @param param |
||||
* @return |
||||
*/ |
||||
List<BsGasClassGroupTask> getGroupTaskList(Map<String, Object> param); |
||||
|
||||
/** |
||||
* 跟油站 获取当前班组任务 |
||||
* @param merId |
||||
* @return |
||||
*/ |
||||
BsGasClassGroupTask getCurrentTaskByMerId(Long merId); |
||||
|
||||
} |
@ -0,0 +1,81 @@ |
||||
package com.hfkj.service.gas.impl; |
||||
|
||||
import com.hfkj.common.exception.ErrorCode; |
||||
import com.hfkj.common.exception.ErrorHelp; |
||||
import com.hfkj.common.exception.SysCode; |
||||
import com.hfkj.dao.BsGasClassGroupMapper; |
||||
import com.hfkj.entity.BsGasClassGroup; |
||||
import com.hfkj.entity.BsGasClassGroupExample; |
||||
import com.hfkj.service.gas.BsGasClassGroupService; |
||||
import org.apache.commons.collections4.MapUtils; |
||||
import org.apache.commons.lang3.StringUtils; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
@Service("gasClassGroupService") |
||||
public class BsGasClassGroupServiceImpl implements BsGasClassGroupService { |
||||
|
||||
@Resource |
||||
private BsGasClassGroupMapper gasClassGroupMapper; |
||||
|
||||
@Override |
||||
public void editGroup(BsGasClassGroup gasClassGroup) { |
||||
if (gasClassGroup.getId() == null) { |
||||
gasClassGroup.setStatus(1); |
||||
gasClassGroup.setCreateTime(new Date()); |
||||
gasClassGroup.setUpdateTime(new Date()); |
||||
gasClassGroupMapper.insert(gasClassGroup); |
||||
} else { |
||||
gasClassGroup.setUpdateTime(new Date()); |
||||
gasClassGroupMapper.updateByPrimaryKey(gasClassGroup); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void delGroup(Long groupId) { |
||||
BsGasClassGroup classGroup = getDetailById(groupId); |
||||
if (classGroup == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到班组"); |
||||
} |
||||
classGroup.setStatus(0); |
||||
editGroup(classGroup); |
||||
} |
||||
|
||||
@Override |
||||
public BsGasClassGroup getDetailById(Long groupId) { |
||||
return gasClassGroupMapper.selectByPrimaryKey(groupId); |
||||
} |
||||
|
||||
@Override |
||||
public List<BsGasClassGroup> getGroupList(Map<String, Object> param) { |
||||
BsGasClassGroupExample example = new BsGasClassGroupExample(); |
||||
BsGasClassGroupExample.Criteria criteria = example.createCriteria().andStatusNotEqualTo(0); |
||||
|
||||
if (MapUtils.getLong(param, "merId") != null) { |
||||
criteria.andMerIdEqualTo(MapUtils.getLong(param, "merId")); |
||||
} |
||||
|
||||
if (StringUtils.isNotBlank(MapUtils.getString(param, "merName"))) { |
||||
criteria.andMerNameLike("%" + MapUtils.getString(param, "merName") + "%"); |
||||
} |
||||
|
||||
if (StringUtils.isNotBlank(MapUtils.getString(param, "name"))) { |
||||
criteria.andNameLike("%" + MapUtils.getString(param, "name") + "%"); |
||||
} |
||||
|
||||
if (StringUtils.isNotBlank(MapUtils.getString(param, "principalName"))) { |
||||
criteria.andPrincipalNameLike("%" + MapUtils.getString(param, "principalName") + "%"); |
||||
} |
||||
|
||||
if (StringUtils.isNotBlank(MapUtils.getString(param, "principalPhone"))) { |
||||
criteria.andPrincipalPhoneLike("%" + MapUtils.getString(param, "principalPhone") + "%"); |
||||
} |
||||
|
||||
example.setOrderByClause("create_time desc"); |
||||
return gasClassGroupMapper.selectByExample(example); |
||||
} |
||||
} |
@ -0,0 +1,223 @@ |
||||
package com.hfkj.service.gas.impl; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.hfkj.common.exception.ErrorCode; |
||||
import com.hfkj.common.exception.ErrorHelp; |
||||
import com.hfkj.common.exception.SysCode; |
||||
import com.hfkj.config.SpPrinterConfig; |
||||
import com.hfkj.config.SpPrinterTemplate; |
||||
import com.hfkj.dao.BsGasClassGroupTaskMapper; |
||||
import com.hfkj.entity.*; |
||||
import com.hfkj.model.GasClassGroupTaskDataCount; |
||||
import com.hfkj.model.GasClassGroupTaskOilCount; |
||||
import com.hfkj.service.BsDeviceService; |
||||
import com.hfkj.service.BsMerchantService; |
||||
import com.hfkj.service.gas.BsGasClassGroupService; |
||||
import com.hfkj.service.gas.BsGasClassGroupTaskService; |
||||
import com.hfkj.sysenum.DeviceTypeEnum; |
||||
import com.hfkj.sysenum.gas.GasClassGroupTaskStatus; |
||||
import org.apache.commons.collections4.MapUtils; |
||||
import org.apache.commons.lang3.StringUtils; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.transaction.annotation.Propagation; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.math.BigDecimal; |
||||
import java.util.*; |
||||
|
||||
@Service("gasClassGroupTask") |
||||
public class BsGasClassGroupTaskServiceImpl implements BsGasClassGroupTaskService { |
||||
|
||||
@Resource |
||||
private BsGasClassGroupTaskMapper gasClassGroupTaskMapper; |
||||
|
||||
@Resource |
||||
private BsGasClassGroupService gasClassGroupService; |
||||
|
||||
@Resource |
||||
private BsMerchantService merchantService; |
||||
|
||||
@Resource |
||||
private BsDeviceService deviceService; |
||||
|
||||
/* @Resource |
||||
private MqttProviderConfig mqttProviderConfig;*/ |
||||
|
||||
@Override |
||||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) |
||||
public void startGroupTask(Long gasId, Long gasClassGroupId) { |
||||
// 查询加油站
|
||||
BsMerchant merchant = merchantService.getMerchant(gasId); |
||||
if (merchant == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到加油站信息"); |
||||
} |
||||
|
||||
// 查询进行中的任务
|
||||
Map<String, Object> param = new HashMap<>(); |
||||
param.put("merchantStoreId", merchant.getId()); |
||||
param.put("status", GasClassGroupTaskStatus.status1.getStatus()); |
||||
List<BsGasClassGroupTask> list = getGroupTaskList(param); |
||||
if (!list.isEmpty()) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已有班组正在进行中,请结束班组或交换班组"); |
||||
} |
||||
// 查询班组信息
|
||||
BsGasClassGroup group = gasClassGroupService.getDetailById(gasClassGroupId); |
||||
if (group == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到班组信息"); |
||||
} |
||||
|
||||
BsGasClassGroupTask groupTask = new BsGasClassGroupTask(); |
||||
groupTask.setGasClassGroupId(group.getId()); |
||||
groupTask.setGasClassGroupName(group.getName()); |
||||
groupTask.setMerId(merchant.getId()); |
||||
groupTask.setMerName(merchant.getMerName()); |
||||
groupTask.setStartTime(new Date()); |
||||
groupTask.setClassNum(gasClassGroupTaskMapper.getLatestClassNum(merchant.getId()) + 1); |
||||
editGroupTask(groupTask); |
||||
} |
||||
|
||||
@Override |
||||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) |
||||
public void endGroupTask(Long gasId) { |
||||
// 查询进行中的任务
|
||||
Map<String, Object> param = new HashMap<>(); |
||||
param.put("merchantStoreId", gasId); |
||||
param.put("status", GasClassGroupTaskStatus.status1.getStatus()); |
||||
List<BsGasClassGroupTask> list = getGroupTaskList(param); |
||||
if (!list.isEmpty()) { |
||||
BsGasClassGroupTask groupTask = list.get(0); |
||||
groupTask.setEndTime(new Date()); |
||||
groupTask.setStatus(GasClassGroupTaskStatus.status2.getStatus()); |
||||
// 统计
|
||||
GasClassGroupTaskDataCount dataCount = countGroupTaskData(gasId, groupTask.getClassNum(), groupTask.getId(), groupTask.getStatus(), groupTask.getStartTime(), groupTask.getEndTime()); |
||||
groupTask.setDataCount(JSONObject.toJSONString(dataCount)); |
||||
editGroupTask(groupTask); |
||||
|
||||
// 查询加油站打印机
|
||||
List<BsDevice> deviceList = deviceService.getDeviceByMer(gasId); |
||||
for (BsDevice device : deviceList) { |
||||
if (device.getType().equals(DeviceTypeEnum.type1.getType())) { |
||||
new Thread(() -> { |
||||
try { |
||||
// 推送打印机
|
||||
SpPrinterConfig spPrinterConfig = new SpPrinterConfig(); |
||||
spPrinterConfig.print(device.getDeviceSn(), SpPrinterTemplate.classGroupCountTemp(dataCount, false), 1); |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
} |
||||
}).start(); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) |
||||
public void swapGroupTask(Long gasId, Long gasClassGroupId) { |
||||
// 任务结束
|
||||
endGroupTask(gasId); |
||||
|
||||
// 开启新的任务
|
||||
startGroupTask(gasId, gasClassGroupId); |
||||
} |
||||
|
||||
@Override |
||||
public GasClassGroupTaskDataCount countGroupTaskData(Long gasId, Integer classNum, Long groupTaskId, Integer status, Date startTime, Date endTime) { |
||||
GasClassGroupTaskDataCount dataCount = new GasClassGroupTaskDataCount(); |
||||
dataCount.setClassNum(classNum); |
||||
dataCount.setStatus(status); |
||||
dataCount.setStartTime(startTime); |
||||
dataCount.setEndTime(endTime); |
||||
|
||||
// 加油汇总
|
||||
Map<String, Object> refuelData = gasClassGroupTaskMapper.countRefuelData(groupTaskId); |
||||
dataCount.setRefuelPrice(new BigDecimal(MapUtils.getString(refuelData, "refuelPrice"))); |
||||
dataCount.setRefuelNum(MapUtils.getInteger(refuelData, "refuelNum")); |
||||
dataCount.setRefuelLiters(new BigDecimal(MapUtils.getString(refuelData, "refuelLiters"))); |
||||
|
||||
// 退款汇总
|
||||
Map<String, Object> refundData = gasClassGroupTaskMapper.countRefundData(groupTaskId); |
||||
dataCount.setRefundPrice(new BigDecimal(MapUtils.getString(refundData, "refundPrice"))); |
||||
dataCount.setRefundNum(MapUtils.getInteger(refundData, "refundNum")); |
||||
dataCount.setRefundLiters(new BigDecimal(MapUtils.getString(refundData, "refundLiters"))); |
||||
|
||||
|
||||
// 油品汇总
|
||||
List<Map<String, Object>> oilDataList = gasClassGroupTaskMapper.countOilData(gasId, groupTaskId); |
||||
|
||||
List<GasClassGroupTaskOilCount> oilCountList = new ArrayList<>(); |
||||
for (Map<String, Object> oilData : oilDataList) { |
||||
GasClassGroupTaskOilCount oilCount = new GasClassGroupTaskOilCount(); |
||||
oilCount.setOilNo(MapUtils.getInteger(oilData, "oilNo")); |
||||
oilCount.setRefuelPrice(new BigDecimal(MapUtils.getString(oilData, "refuelPrice"))); |
||||
oilCount.setRefuelNum(MapUtils.getInteger(oilData, "refuelNum")); |
||||
oilCount.setRefuelLiters(new BigDecimal(MapUtils.getString(oilData, "refuelLiters"))); |
||||
oilCountList.add(oilCount); |
||||
} |
||||
dataCount.setGroupTaskOilCountList(oilCountList); |
||||
|
||||
return dataCount; |
||||
} |
||||
|
||||
@Override |
||||
public void editGroupTask(BsGasClassGroupTask gasClassGroupTask) { |
||||
if (gasClassGroupTask.getId() == null) { |
||||
gasClassGroupTask.setStatus(GasClassGroupTaskStatus.status1.getStatus()); |
||||
gasClassGroupTask.setCreateTime(new Date()); |
||||
gasClassGroupTask.setUpdateTime(new Date()); |
||||
gasClassGroupTaskMapper.insert(gasClassGroupTask); |
||||
} else { |
||||
gasClassGroupTask.setUpdateTime(new Date()); |
||||
gasClassGroupTaskMapper.updateByPrimaryKey(gasClassGroupTask); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public BsGasClassGroupTask getDetailById(Long groupTaskId) { |
||||
return gasClassGroupTaskMapper.selectByPrimaryKey(groupTaskId); |
||||
} |
||||
|
||||
@Override |
||||
public List<BsGasClassGroupTask> getGroupTaskList(Map<String, Object> param) { |
||||
BsGasClassGroupTaskExample example = new BsGasClassGroupTaskExample(); |
||||
BsGasClassGroupTaskExample.Criteria criteria = example.createCriteria() |
||||
.andStatusNotEqualTo(GasClassGroupTaskStatus.status0.getStatus()); |
||||
|
||||
if (MapUtils.getLong(param, "gasClassGroupId") != null) { |
||||
criteria.andGasClassGroupIdEqualTo(MapUtils.getLong(param, "gasClassGroupId")); |
||||
} |
||||
|
||||
if (StringUtils.isNotBlank(MapUtils.getString(param, "gasClassGroupName"))) { |
||||
criteria.andGasClassGroupNameLike("%" + MapUtils.getString(param, "gasClassGroupName") + "%"); |
||||
} |
||||
|
||||
if (MapUtils.getLong(param, "merId") != null) { |
||||
criteria.andMerIdEqualTo(MapUtils.getLong(param, "merId")); |
||||
} |
||||
|
||||
if (StringUtils.isNotBlank(MapUtils.getString(param, "gasClassGroupName"))) { |
||||
criteria.andGasClassGroupNameLike("%" + MapUtils.getString(param, "gasClassGroupName") + "%"); |
||||
} |
||||
|
||||
if (MapUtils.getInteger(param, "status") != null) { |
||||
criteria.andStatusEqualTo(MapUtils.getInteger(param, "status")); |
||||
} |
||||
|
||||
example.setOrderByClause("create_time desc"); |
||||
return gasClassGroupTaskMapper.selectByExample(example); |
||||
} |
||||
|
||||
@Override |
||||
public BsGasClassGroupTask getCurrentTaskByMerId(Long merId) { |
||||
BsGasClassGroupTaskExample example = new BsGasClassGroupTaskExample(); |
||||
example.createCriteria() |
||||
.andMerIdEqualTo(merId) |
||||
.andStatusEqualTo(GasClassGroupTaskStatus.status1.getStatus()); |
||||
List<BsGasClassGroupTask> list = gasClassGroupTaskMapper.selectByExample(example); |
||||
if (!list.isEmpty()) { |
||||
return list.get(0); |
||||
} |
||||
return null; |
||||
} |
||||
} |
@ -0,0 +1,36 @@ |
||||
package com.hfkj.sysenum.gas; |
||||
|
||||
/** |
||||
* 加油站员工状态 |
||||
* @author hurui |
||||
*/ |
||||
public enum GasClassGroupTaskStatus { |
||||
status0(0 , "删除"), |
||||
status1(1 , "进行中"), |
||||
status2(2 , "已结束"), |
||||
; |
||||
|
||||
private Integer status; |
||||
private String name; |
||||
|
||||
GasClassGroupTaskStatus(int status , String name) { |
||||
this.status = status; |
||||
this.name = name; |
||||
} |
||||
|
||||
public Integer getStatus() { |
||||
return status; |
||||
} |
||||
|
||||
public void setStatus(Integer status) { |
||||
this.status = status; |
||||
} |
||||
|
||||
public String getName() { |
||||
return name; |
||||
} |
||||
|
||||
public void setName(String name) { |
||||
this.name = name; |
||||
} |
||||
} |
Loading…
Reference in new issue