提交 829b952e authored 作者: huyufan's avatar huyufan

资金管理相关代码

上级 8f49fe24
package com.clx.performance.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
import java.util.Optional;
@Getter
@AllArgsConstructor
@SuppressWarnings("all")
public enum OwnerAccountTypeEnum {
;
@Getter
@AllArgsConstructor
public enum Status {
MARGIN_ACCOUNT(1, "保证金账户"),
PREPAID_FREIGHT_ACCOUNT(2, "预付运费账户")
;
private final Integer code;
private final String msg;
}
}
package com.clx.performance.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
@SuppressWarnings("all")
public enum RunningWaterTypeEnum {
;
@Getter
@AllArgsConstructor
public enum Status {
TOP_UP(10, "充值"),
FROZEN(20, "冻结"),
THAW(30, "解冻"),
TAKE_OUT(40, "扣除"),
CASE_OUT_FROZEN(50, "提现冻结"),
CASE_OUT_SUCCESS(60, "提现成功"),
CASE_OUT_FAIL(70, "提现失败")
;
private final Integer code;
private final String msg;
}
}
......@@ -11,7 +11,7 @@ import lombok.Setter;
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class PageMoneyManagementListParam extends PageParam {
public class PageOwnerAccountListParam extends PageParam {
@ApiModelProperty(value = "货主编码")
private String ownerCode;
......@@ -19,5 +19,6 @@ public class PageMoneyManagementListParam extends PageParam {
@ApiModelProperty(value = "联系电话")
private Integer mobile;
@ApiModelProperty(value = "账户类型 1:保证金 2:预付运费")
private Integer accountType;
}
......@@ -12,7 +12,7 @@ import java.math.BigDecimal;
@Getter
@Setter
@NoArgsConstructor
public class MoneyManagementVO {
public class OwnerAccountRunningWaterRecordVO {
@ApiModelProperty("订单编号")
private String orderNo;
......
package com.clx.settlement.vo.pc;
import com.msl.common.convertor.type.MoneyOutConvert;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.apache.poi.hpsf.Decimal;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Getter
@Setter
@NoArgsConstructor
public class OwnerAccountVO {
private Integer id;
/**
* 货主编码
*/
private String accountNo;
/**
* 货主名称
*/
private String accountName;
/**
* 联系电话
*/
private Integer mobile;
/**
* 账户类型;1:保证金 2:预付运费
*/
private Integer accountType;
/**
* 账户余额
*/
private Decimal accountBalance;
/**
* 可用余额
*/
private Decimal usableBalance;
/**
* 冻结金额
*/
private Decimal frozenBalance;
/**
* 创建人
*/
private String createBy;
/**
* 创建时间
*/
private LocalDateTime createTime;
}
\ No newline at end of file
package com.clx.settlement.vo.pc;
import com.msl.common.base.PageParam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
/**
* @Author huyufan
* @create 2023-09-19 13:33
*/
@Getter
@Setter
@NoArgsConstructor
@ToString
public class PageOwnerMarginAccountParam extends PageParam {
@ApiModelProperty(value="流水编号",example = "201457878")
private String runningWaterNo;
@ApiModelProperty(value="流水类型",example = "12222222222")
private String runningWaterType;
@ApiModelProperty(value="操作开始时间",example = "2020-01-01 10:10:10")
private String beginTime;
@ApiModelProperty(value = "操作结束时间",example = "2020-01-01 10:10:10")
private String endTime;
}
package com.clx.settlement.vo.pc;
import com.msl.common.base.PageParam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
/**
* @Author huyufan
* @create 2023-09-19 13:33
*/
@Getter
@Setter
@NoArgsConstructor
@ToString
public class PageOwnerPrepaidFreightAccountParam extends PageParam {
@ApiModelProperty(value="订单编号",example = "201457878")
private String orderNo;
@ApiModelProperty(value="运单编号",example = "201457878")
private String orderChildNo;
@ApiModelProperty(value="流水类型",example = "12222222222")
private String runningWaterType;
@ApiModelProperty(value="操作开始时间",example = "2020-01-01 10:10:10")
private String beginTime;
@ApiModelProperty(value = "操作结束时间",example = "2020-01-01 10:10:10")
private String endTime;
}
package com.clx.performance.controller.pc;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.clx.performance.vo.pc.OrderGoodsVO;
import com.clx.settlement.params.PageMoneyManagementListParam;
import com.clx.settlement.vo.pc.MoneyManagementVO;
import com.clx.performance.service.OwnerAccountService;
import com.clx.settlement.params.PageOwnerAccountListParam;
import com.clx.settlement.vo.pc.OwnerAccountRunningWaterRecordVO;
import com.clx.settlement.vo.pc.OwnerAccountVO;
import com.clx.settlement.vo.pc.PageOwnerMarginAccountParam;
import com.clx.settlement.vo.pc.PageOwnerPrepaidFreightAccountParam;
import com.msl.common.base.PageData;
import com.msl.common.convertor.aspect.UnitCovert;
import com.msl.common.result.Result;
......@@ -19,18 +22,38 @@ import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController
@RequestMapping("/pc/moneyManagement")
@RequestMapping("/pc/ownerAccount")
@Validated
@AllArgsConstructor
@Api(tags = "PC-资金管理")
public class MoneyManagementController {
public class OwnerAccountController {
private final OwnerAccountService ownerAccountService;
@ApiOperation(value = "查看资金管理列表", notes = "<br>By:胡宇帆")
@PostMapping("/moneyManagementList")
@PostMapping("/pageList")
@UnitCovert(param = false)
public Result<PageData<OwnerAccountVO>> pageList(@RequestBody PageOwnerAccountListParam param) {
IPage<OwnerAccountVO> page = ownerAccountService.pageList(param);
return Result.page(page.getRecords(), page.getTotal(), page.getPages());
}
@ApiOperation(value = "保证金账户详情流水列表", notes = "<br>By:胡宇帆")
@PostMapping("/margin_account_page_list")
@UnitCovert(param = false)
public Result<PageData<OwnerAccountRunningWaterRecordVO>> marginAccountPageList(@RequestBody PageOwnerMarginAccountParam param) {
IPage<OwnerAccountRunningWaterRecordVO> page = ownerAccountService.marginAccountPageList(param);
return Result.page(page.getRecords(), page.getTotal(), page.getPages());
}
@ApiOperation(value = "预付金账户详情流水列表", notes = "<br>By:胡宇帆")
@PostMapping("/prepaidFreight_account_page_list")
@UnitCovert(param = false)
public Result<PageData<MoneyManagementVO>> moneyManagementList(@RequestBody PageMoneyManagementListParam param) {
// IPage<OrderGoodsVO> page = orderGoodsService.pageOrderGoodsList(param);
// return Result.page(page.getRecords(), page.getTotal(), page.getPages());
return null;
public Result<PageData<OwnerAccountRunningWaterRecordVO>> prepaidFreightAccountPageList(@RequestBody PageOwnerPrepaidFreightAccountParam param) {
IPage<OwnerAccountRunningWaterRecordVO> page = ownerAccountService.prepaidFreightAccountPageList(param);
return Result.page(page.getRecords(), page.getTotal(), page.getPages());
}
}
package com.clx.performance.dao;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.clx.performance.mapper.OwnerAccountMapper;
import com.clx.performance.model.OwnerAccount;
import com.clx.settlement.params.PageOwnerAccountListParam;
import com.clx.settlement.vo.pc.OwnerAccountRunningWaterRecordVO;
import com.clx.settlement.vo.pc.OwnerAccountVO;
import com.clx.settlement.vo.pc.PageOwnerMarginAccountParam;
import com.msl.common.dao.BaseDao;
public interface OwnerAccountDao extends BaseDao<OwnerAccountMapper, OwnerAccount, Integer> {
IPage<OwnerAccountVO> pageList(PageOwnerAccountListParam param);
}
package com.clx.performance.dao;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.clx.performance.mapper.OwnerRunningWaterRecordMapper;
import com.clx.performance.model.OwnerRunningWaterRecord;
import com.clx.settlement.vo.pc.OwnerAccountRunningWaterRecordVO;
import com.clx.settlement.vo.pc.PageOwnerMarginAccountParam;
import com.clx.settlement.vo.pc.PageOwnerPrepaidFreightAccountParam;
import com.msl.common.dao.BaseDao;
public interface OwnerRunningWaterRecordDao extends BaseDao<OwnerRunningWaterRecordMapper, OwnerRunningWaterRecord, Integer> {
IPage<OwnerAccountRunningWaterRecordVO> marginAccountPageList(PageOwnerMarginAccountParam param);
IPage<OwnerAccountRunningWaterRecordVO> prepaidFreightAccountPageList(PageOwnerPrepaidFreightAccountParam param);
}
package com.clx.performance.dao.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.clx.performance.dao.OwnerAccountDao;
import com.clx.performance.mapper.OwnerAccountMapper;
import com.clx.performance.model.OwnerAccount;
import com.clx.settlement.params.PageOwnerAccountListParam;
import com.clx.settlement.vo.pc.OwnerAccountRunningWaterRecordVO;
import com.clx.settlement.vo.pc.OwnerAccountVO;
import com.clx.settlement.vo.pc.PageOwnerMarginAccountParam;
import com.msl.common.dao.impl.BaseDaoImpl;
import org.springframework.stereotype.Repository;
@Repository
public class OwnerAccountDaoImpl extends BaseDaoImpl<OwnerAccountMapper, OwnerAccount, Integer> implements OwnerAccountDao {
@Override
public IPage<OwnerAccountVO> pageList(PageOwnerAccountListParam param) {
Page<OwnerAccountVO> page = Page.of(param.getPage(), param.getPageSize());
return baseMapper.pageList(page, param);
}
}
package com.clx.performance.dao.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.clx.performance.dao.OwnerRunningWaterRecordDao;
import com.clx.performance.mapper.OwnerRunningWaterRecordMapper;
import com.clx.performance.model.OwnerRunningWaterRecord;
import com.clx.settlement.vo.pc.OwnerAccountRunningWaterRecordVO;
import com.clx.settlement.vo.pc.PageOwnerMarginAccountParam;
import com.clx.settlement.vo.pc.PageOwnerPrepaidFreightAccountParam;
import com.msl.common.dao.impl.BaseDaoImpl;
import org.springframework.stereotype.Repository;
@Repository
public class OwnerRunningWaterRecordDaoImpl extends BaseDaoImpl<OwnerRunningWaterRecordMapper, OwnerRunningWaterRecord, Integer> implements OwnerRunningWaterRecordDao {
@Override
public IPage<OwnerAccountRunningWaterRecordVO> marginAccountPageList(PageOwnerMarginAccountParam param) {
Page<OwnerAccountRunningWaterRecordVO> page = Page.of(param.getPage(), param.getPageSize());
return baseMapper.marginAccountPageList(page, param);
}
@Override
public IPage<OwnerAccountRunningWaterRecordVO> prepaidFreightAccountPageList(PageOwnerPrepaidFreightAccountParam param) {
Page<OwnerAccountRunningWaterRecordVO> page = Page.of(param.getPage(), param.getPageSize());
return baseMapper.prepaidFreightAccountPageList(page, param);
}
}
package com.clx.performance.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.clx.performance.model.OwnerAccount;
import com.clx.performance.sqlProvider.OwnerAccountSqlProvider;
import com.clx.settlement.params.PageOwnerAccountListParam;
import com.clx.settlement.vo.pc.OwnerAccountVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.SelectProvider;
/**
* 货主账户
......@@ -10,4 +16,6 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface OwnerAccountMapper extends BaseMapper<OwnerAccount> {
@SelectProvider(type = OwnerAccountSqlProvider.class, method = "pageList")
IPage<OwnerAccountVO> pageList(Page<OwnerAccountVO> page, PageOwnerAccountListParam param);
}
\ No newline at end of file
package com.clx.performance.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.clx.performance.model.OwnerRunningWaterRecord;
import com.clx.performance.sqlProvider.OwnerRunningWaterRecordSqlProvider;
import com.clx.settlement.vo.pc.OwnerAccountRunningWaterRecordVO;
import com.clx.settlement.vo.pc.PageOwnerMarginAccountParam;
import com.clx.settlement.vo.pc.PageOwnerPrepaidFreightAccountParam;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.SelectProvider;
/**
* 货主流水记录
......@@ -10,4 +17,9 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface OwnerRunningWaterRecordMapper extends BaseMapper<OwnerRunningWaterRecord> {
@SelectProvider(type = OwnerRunningWaterRecordSqlProvider.class, method = "marginAccountPageList")
IPage<OwnerAccountRunningWaterRecordVO> marginAccountPageList(Page<OwnerAccountRunningWaterRecordVO> page, PageOwnerMarginAccountParam param);
@SelectProvider(type = OwnerRunningWaterRecordSqlProvider.class, method = "prepaidFreightAccountPageList")
IPage<OwnerAccountRunningWaterRecordVO> prepaidFreightAccountPageList(Page<OwnerAccountRunningWaterRecordVO> page, PageOwnerPrepaidFreightAccountParam param);
}
\ No newline at end of file
package com.clx.performance.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.msl.common.config.KeyColumn;
......@@ -8,6 +9,7 @@ import com.msl.common.model.HasKey;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.apache.poi.hpsf.Decimal;
import java.time.LocalDateTime;
......@@ -20,8 +22,8 @@ import java.time.LocalDateTime;
*/
@Getter
@Setter
@NoArgsConstructor
@TableName(autoResultMap = true)
@Accessors(chain = true)
@TableName("owner_account")
public class OwnerAccount implements HasKey<Integer> {
/**
* id
......@@ -31,38 +33,47 @@ public class OwnerAccount implements HasKey<Integer> {
/**
* 货主编码
*/
private String accountCode;
@TableField("account_no")
private String accountNo;
/**
* 货主名称
*/
@TableField("account_name")
private String accountName;
/**
* 联系电话
*/
@TableField("mobile")
private Integer mobile;
/**
* 账户类型;1:保证金 2:预付运费
*/
@TableField("account_type")
private Integer accountType;
/**
* 账户余额
*/
@TableField("account_balance")
private Decimal accountBalance;
/**
* 可用余额
*/
@TableField("usable_balance")
private Decimal usableBalance;
/**
* 冻结金额
*/
@TableField("frozen_balance")
private Decimal frozenBalance;
/**
* 创建人
*/
@TableField("create_by")
private String createBy;
/**
* 创建时间
*/
@TableField("create_time")
private LocalDateTime createTime;
@KeyColumn("id")
......
package com.clx.performance.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.msl.common.config.KeyColumn;
import com.msl.common.model.HasKey;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
......@@ -16,52 +20,63 @@ import java.time.LocalDateTime;
*/
@Getter
@Setter
@NoArgsConstructor
@TableName(autoResultMap = true)
@Accessors(chain = true)
@TableName("owner_bind_card_record")
public class OwnerBindCardRecord implements HasKey<Integer> {
/**
* id
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 货主编码
*/
private String ownerCode;
@TableField("owner_no")
private String ownerNo;
/**
* 货主名称
*/
@TableField("owner_name")
private String ownerName;
/**
* 货主类型;1:企业 2:个人
*/
@TableField("owner_type")
private Integer ownerType;
/**
* 货主银行
*/
@TableField("owner_bank")
private String ownerBank;
/**
* 银行卡号
*/
@TableField("bank_card_number")
private String bankCardNumber;
/**
* 开户行
*/
@TableField("open_account_bank")
private String openAccountBank;
/**
* 户名
*/
@TableField("account_bank_name")
private String accountBankName;
/**
* 操作人
*/
@TableField("create_by")
private String createBy;
/**
* 操作项目
*/
@TableField("create_item")
private String createItem;
/**
* 创建时间
*/
@TableField("create_time")
private LocalDateTime createTime;
@KeyColumn("id")
......
package com.clx.performance.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.msl.common.config.KeyColumn;
......@@ -8,6 +9,7 @@ import com.msl.common.model.HasKey;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.apache.poi.hpsf.Decimal;
import java.time.LocalDateTime;
......@@ -19,8 +21,8 @@ import java.time.LocalDateTime;
*/
@Getter
@Setter
@NoArgsConstructor
@TableName(autoResultMap = true)
@Accessors(chain = true)
@TableName("Owner_running_water_record")
public class OwnerRunningWaterRecord implements HasKey<Integer> {
/**
* id
......@@ -30,62 +32,77 @@ public class OwnerRunningWaterRecord implements HasKey<Integer> {
/**
* 货主编码
*/
private String ownerCode;
@TableField("owner_no")
private String ownerNo;
/**
* 货主名称
*/
@TableField("owner_name")
private String ownerName;
/**
* 联系电话
*/
@TableField("mobile")
private Integer mobile;
/**
* 账户类型
*/
@TableField("account_type")
private Integer accountType;
/**
* 流水类型
*/
@TableField("running_water_type")
private Integer runningWaterType;
/**
* 订单ID
*/
@TableField("order_id")
private Integer orderId;
/**
* 订单编号
*/
@TableField("order_no")
private String orderNo;
/**
* 运单ID
*/
@TableField("order_child_id")
private Integer orderChildId;
/**
* 运单编号
*/
@TableField("order_child_no")
private String orderChildNo;
/**
* 变动金额
*/
@TableField("alteration_balance")
private Double alterationBalance;
/**
* 冻结金额
*/
@TableField("frozen_balance")
private Decimal frozenBalance;
/**
* 可用余额
*/
@TableField("usable_balance")
private Decimal usableBalance;
/**
* 账户余额
*/
@TableField("account_balance")
private Decimal accountBalance;
/**
* 操作人
*/
@TableField("create_by")
private String createBy;
/**
* 操作时间
*/
@TableField("create_time")
private LocalDateTime createTime;
@KeyColumn("id")
......
package com.clx.performance.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.clx.settlement.params.PageOwnerAccountListParam;
import com.clx.settlement.vo.pc.OwnerAccountRunningWaterRecordVO;
import com.clx.settlement.vo.pc.OwnerAccountVO;
import com.clx.settlement.vo.pc.PageOwnerMarginAccountParam;
import com.clx.settlement.vo.pc.PageOwnerPrepaidFreightAccountParam;
public interface OwnerAccountService {
IPage<OwnerAccountVO> pageList(PageOwnerAccountListParam param);
IPage<OwnerAccountRunningWaterRecordVO> marginAccountPageList(PageOwnerMarginAccountParam param);
IPage<OwnerAccountRunningWaterRecordVO> prepaidFreightAccountPageList(PageOwnerPrepaidFreightAccountParam param);
}
package com.clx.performance.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.clx.performance.dao.OwnerAccountDao;
import com.clx.performance.dao.OwnerRunningWaterRecordDao;
import com.clx.performance.service.OwnerAccountService;
import com.clx.settlement.params.PageOwnerAccountListParam;
import com.clx.settlement.vo.pc.OwnerAccountRunningWaterRecordVO;
import com.clx.settlement.vo.pc.OwnerAccountVO;
import com.clx.settlement.vo.pc.PageOwnerMarginAccountParam;
import com.clx.settlement.vo.pc.PageOwnerPrepaidFreightAccountParam;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Slf4j
@Service
@AllArgsConstructor
public class OwnerAccountServiceImpl implements OwnerAccountService {
private final OwnerAccountDao ownerAccountDao;
private final OwnerRunningWaterRecordDao ownerRunningWaterRecordDao;
@Override
public IPage<OwnerAccountVO> pageList(PageOwnerAccountListParam param) {
return ownerAccountDao.pageList(param);
}
@Override
public IPage<OwnerAccountRunningWaterRecordVO> marginAccountPageList(PageOwnerMarginAccountParam param) {
return ownerRunningWaterRecordDao.marginAccountPageList(param);
}
@Override
public IPage<OwnerAccountRunningWaterRecordVO> prepaidFreightAccountPageList(PageOwnerPrepaidFreightAccountParam param) {
return ownerRunningWaterRecordDao.prepaidFreightAccountPageList(param);
}
}
package com.clx.performance.sqlProvider;
import cn.hutool.core.util.ObjectUtil;
import com.clx.settlement.params.PageOwnerAccountListParam;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.jdbc.SQL;
public class OwnerAccountSqlProvider {
public String pageList(@Param("param") PageOwnerAccountListParam param) {
String sql = new SQL() {{
SELECT("a.id, a.owner_code," +
" a.owner_name, a.mobile, a.account_type, " +
" a.account_balance,a.usable_balance, a.frozen_balance,a.create_by,a.create_time");
FROM("owner_account a");
if (StringUtils.isNotBlank(param.getOwnerCode())) {
WHERE("a.owner_code = #{param.ownerCode}");
}
if (ObjectUtil.isNotNull(param.getMobile())) {
WHERE("a.mobile = #{param.mobile}");
}
if (ObjectUtil.isNotNull(param.getAccountType())) {
WHERE("a.accountType = #{param.accountType}");
}
ORDER_BY("a.create_time desc");
}}.toString();
return sql;
}
}
package com.clx.performance.sqlProvider;
import cn.hutool.core.util.ObjectUtil;
import com.clx.performance.enums.OwnerAccountTypeEnum;
import com.clx.settlement.vo.pc.PageOwnerMarginAccountParam;
import com.clx.settlement.vo.pc.PageOwnerPrepaidFreightAccountParam;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.jdbc.SQL;
public class OwnerRunningWaterRecordSqlProvider {
public String marginAccountPageList(@Param("param") PageOwnerMarginAccountParam param) {
String sql = new SQL() {{
SELECT("a.id, a.owner_code," +
" a.owner_name, a.mobile, a.account_type, a.running_water_type,a.order_id,a.order_no,a.order_child_id,a.order_child_no,a.alteration_balance," +
" a.account_balance,a.usable_balance, a.frozen_balance,a.create_by,a.create_time");
FROM("owner_running_water_record a");
WHERE("a.account_type =" + OwnerAccountTypeEnum.Status.MARGIN_ACCOUNT.getCode());
if (StringUtils.isNotBlank(param.getBeginTime()) && StringUtils.isNotBlank(param.getEndTime())) {
WHERE("a.create_time >= #{param.beginTime} and a.create_time <= #{param.endTime}");
}
if (ObjectUtil.isNotNull(param.getRunningWaterType())) {
WHERE("a.running_water_type = #{param.runningWaterType}");
}
if (ObjectUtil.isNotNull(param.getRunningWaterNo())) {
WHERE("a.running_water_no = #{param.runningWaterNo}");
}
ORDER_BY("a.create_time desc");
}}.toString();
return sql;
}
public String prepaidFreightAccountPageList(@Param("param") PageOwnerPrepaidFreightAccountParam param) {
String sql = new SQL() {{
SELECT("a.id, a.owner_code," +
" a.owner_name, a.mobile, a.account_type, a.running_water_type,a.order_id,a.order_no,a.order_child_id,a.order_child_no,a.alteration_balance," +
" a.account_balance,a.usable_balance, a.frozen_balance,a.create_by,a.create_time");
FROM("owner_running_water_record a");
WHERE("a.account_type =" + OwnerAccountTypeEnum.Status.PREPAID_FREIGHT_ACCOUNT.getCode());
if (StringUtils.isNotBlank(param.getBeginTime()) && StringUtils.isNotBlank(param.getEndTime())) {
WHERE("a.create_time >= #{param.beginTime} and a.create_time <= #{param.endTime}");
}
if (ObjectUtil.isNotNull(param.getRunningWaterType())) {
WHERE("a.running_water_type = #{param.runningWaterType}");
}
if (StringUtils.isNotBlank(param.getOrderNo())) {
WHERE("a.order_no = #{param.orderNo}");
}
if (StringUtils.isNotBlank(param.getOrderChildNo())) {
WHERE("a.order_child_no = #{param.orderChildNo}");
}
ORDER_BY("a.create_time desc");
}}.toString();
return sql;
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论