mybatis项目模块搭建
jopen
9年前
mybatis使用步骤
1.PO.xml
2.po定义
3.dao定义
4.PO.xml对应sql语句,返回结果集合
5.mybatis.xml配置别名
6.bean.xml配置PO.xml路径,Dao对应bean实例化
/** * */ package com.ym.qab.commons.dao; import java.lang.reflect.ParameterizedType; import java.math.BigDecimal; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.StringUtils; import org.apache.ibatis.session.RowBounds; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.util.CollectionUtils; import com.ym.qab.commons.dto.Page; import com.ym.qab.commons.exception.PersistenceException; import com.ym.qab.commons.persistence.AbstractBaseDao; import com.ym.qab.commons.persistence.IBaseDAO; import com.ym.qab.commons.utils.FunIMsgFormat; /** * @author Hing<xingguang.ren@pactera.com> * @since 2014年4月19日 */ public abstract class BaseDao<T, ID> extends AbstractBaseDao implements IBaseDAO<T, ID> { private final Logger logger = LoggerFactory.getLogger(getClass().getName()); public static final String POSTFIX_SELECTBYID = ".selectById"; public static final String POSTFIX_SELECTALL = ".selectAll"; public static final String POSTFIX_SELECTBYPROPERTIES = ".selectByProperties"; public static final String POSTFIX_SELECTBYIDS = ".selectByIds"; public static final String POSTFIX_SELECTBYMAP = ".selectByMap"; public static final String POSTFIX_SELECTIDSLIKEBYMAP = ".selectIdsLikeByMap"; public static final String POSTFIX_PKSELECTMAP = ".pkSelectByMap"; public static final String POSTFIX_COUNT = ".count"; public static final String POSTFIX_COUNTLIKEBYMAP = ".countLikeByMap"; public static final String POSTFIX_INSERT = ".insert"; public static final String POSTFIX_DELETEBYID = ".deleteById"; public static final String POSTFIX_DELETEBYIDS = ".deleteByIds"; public static final String POSTFIX_DELETEBYIDSMAP = ".deleteByIdsMap"; public static final String POSTFIX_DELETEBYMAP = ".deleteByMap"; public static final String POSTFIX_UPDATE = ".update"; public static final String POSTFIX_UPDATEBYMAP = ".updateByMap"; public static final String POSTFIX_UPDATEBYIDSMAP = ".updateByIdsMap"; protected Class<T> clazz; protected String clazzName; public String getClazzName() { return clazzName; } public void setClazzName(String clazzName) { this.clazzName = clazzName; } protected T t; @SuppressWarnings("unchecked") public BaseDao() { clazz = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0]; clazzName = clazz.getName(); } /** * 获得方法名,可以作为mybatis的id,便于灵活定义id<br> * 方法名 == id * */ public String getPostifx() { StackTraceElement[] stacks = new Exception().getStackTrace(); String mn = stacks[1].getMethodName(); return "." + mn; } /** * 通过id得到实体对象 */ @Override public T selectById(ID id) { logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("开始调用{}的findById方法,传入的参数是{}。"), new Object[] { this.getClass().getName(), id }); if (id == null) return null; T t = getSqlSession().selectOne(clazzName + POSTFIX_SELECTBYID, id); logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("结束执行{}的findById方,执行的结果是{}。"), new Object[] { this.getClass().getName(), t }); return t; } @Override public List<T> selectAll() { logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("开始调用{}的findAll()方法。"), this.getClass() .getName()); List<T> list = getSqlSession().selectList(clazzName + POSTFIX_SELECTALL); logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("结束执行{}的findAll()方法,结果是{},size={}。"), new Object[] { this.getClass().getName(), list, list.size() }); return list; } @Override public T selectByProperties(String propertie, Object values) { return selectByProperties(new String[] { propertie }, values); } @Override public T selectByProperties(String[] properties, Object... values) { return findOneByStatementPostfix(".selectByProperties", properties, values, null, null); } @Override public <E> E selectByProperties(String statement, String[] properties, Object... values) { logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG .getFormat("开始调用{}的方法,传递的参数是statement={},properties={},propertyValues={}。"), new Object[] { this.getClass().getName(), statement, properties, values }); if (StringUtils.isEmpty(statement)) return null; Map<String, Object> map = buildMap(properties, values); E t = getSqlSession().selectOne(clazzName + statement, map); logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("结束执行{}的{}方法,结果是{}。"), new Object[] { this.getClass().getName(), statement, t }); return t; } /** * 根据ids获取实体列表 * * @param ids * @return */ @Override public List<T> selectByIds(List<ID> ids) { logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("开始调用{}的findByIds方法,传入的参数是{}。"), new Object[] { this.getClass().getName(), ids }); if (CollectionUtils.isEmpty(ids)) { throw new PersistenceException("传入参数为空!"); } List<T> list = getSqlSession().selectList(clazzName + POSTFIX_SELECTBYIDS, ids); logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("结束执行{}的findByIds方法,结果是{},size={}。"), new Object[] { this.getClass().getName(), list, list.size() }); return list; } /** * 根据条件查询结果 * * @param properties * 查询条件名 * @param propertyValues * 查询条件值 * @return */ public List<T> selectByMap(String[] properties, Object[] propertyValues, String orderBy, String order) throws PersistenceException { logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG .getFormat("开始调用{}的selectByMap方法,传入的参数是properties={},propertyValues={},orderBy={},order={}。"), new Object[] { this.getClass().getName(), properties, propertyValues, orderBy, order }); Map<String, Object> map = buildMapWithOrder(properties, propertyValues, orderBy, order); List<T> list = getSqlSession().selectList(clazzName + POSTFIX_SELECTBYMAP, map); logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("结束执行{}的selectByMap方法,结果是{},size={}。"), new Object[] { this.getClass().getName(), list, list.size() }); return list; } /** * 根据条件分页查询结果 * * @param properties * @param propertyValues * @param offset * 起始记录 * @param limit * 最大记录数 * @param orderBy * @param order * @return * @throws PersistenceException */ public List<T> selectByMap(String[] properties, Object[] propertyValues, int offset, int limit, String orderBy, String order) throws PersistenceException { logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG .getFormat("开始调用{}的selectByMap方法,传入的参数是properties={},propertyValues={},orderBy={},order={}。"), new Object[] { this.getClass().getName(), properties, propertyValues, orderBy, order }); Map<String, Object> map = buildMapWithOrder(properties, propertyValues, orderBy, order); RowBounds rowBound = new RowBounds(offset, limit); List<T> list = getSqlSession().selectList(clazzName + POSTFIX_SELECTBYMAP, map, rowBound); logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("结束执行{}的selectByMap方法,结果是{},size={}。"), new Object[] { this.getClass().getName(), list, list.size() }); return list; } /** like分页查询(不走列表缓存) */ public List<T> pageLikeByMap(String[] properties, Object[] propertyValues, String orderBy, String order, int pageSize, int pageNo) throws PersistenceException { logger .debug( FunIMsgFormat.MsgStyle.DEFAULT_LOG .getFormat("开始调用{}的pageLikeByMap方法,传入的参数是properties={},propertyValues={},orderBy={},order={},pageSize={},pageNo={}。"), new Object[] { this.getClass().getName(), properties, propertyValues, orderBy, order, pageSize, pageNo }); Map<String, Object> map = buildMapWithOrderAndPagination(properties, propertyValues, orderBy, order, pageSize, pageNo); List<ID> ids = getSqlSession().selectList(clazzName + POSTFIX_SELECTIDSLIKEBYMAP, map); List<T> list = selectByIds(ids); logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("结束执行{}的pageLikeByMap方法,结果是{},size={}。"), new Object[] { this.getClass().getName(), list, list.size() }); return list; } /** * 新增对象 */ @Override public T insert(T entity) throws PersistenceException { logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("开始调用{}的insert方法,传入的参数是entity={}。"), new Object[] { this.getClass().getName(), entity }); if (entity == null) throw new PersistenceException("保存的数据为空!"); try { getSqlSession().insert(clazzName + POSTFIX_INSERT, entity); } catch (Exception ex) { logger.debug(FunIMsgFormat.MsgStyle.ERROR_REPORT.getFormat("执行{}的insert方法出现异常,具体原因是:{}"), new Object[] { this.getClass().getName(), ex.getStackTrace() }); throw new PersistenceException("执行数据插入出错。", ex); } logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("结束执行{}的insert方法,结果是{}。"), new Object[] { this.getClass().getName(), entity }); return entity; } /** * 更新对象 */ @Override public T update(T entity) throws PersistenceException { logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("开始调用{}的update方法,传入的参数是entity={}。"), new Object[] { this.getClass().getName(), entity }); if (entity == null) throw new PersistenceException("更新的数据为空!"); try { getSqlSession().update(clazzName + POSTFIX_UPDATE, entity); } catch (Exception ex) { logger.debug(FunIMsgFormat.MsgStyle.ERROR_REPORT.getFormat("执行{}的update方法出现异常,具体原因是:{}"), new Object[] { this.getClass().getName(), ex.getStackTrace() }); throw new PersistenceException("执行数据更新出错。", ex); } logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("结束执行{}的update方法,结果是{}。"), new Object[] { this.getClass().getName(), entity }); return entity; } /** * 根据ID删除对象 */ @Override public void deleteById(ID id) throws PersistenceException { logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("开始调用{}的deleteById方法,传递的参数是id={}。"), new Object[] { this.getClass().getName(), id }); if (id == null) throw new PersistenceException("主键为空!"); try { getSqlSession().delete(clazzName + POSTFIX_DELETEBYID, id); } catch (Exception ex) { logger.debug(FunIMsgFormat.MsgStyle.ERROR_REPORT.getFormat("执行{}的deleteById方法出现异常,具体原因是:{}"), new Object[] { this.getClass().getName(), ex.getStackTrace() }); throw new PersistenceException("执行删除出错。", ex); } logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("结束执行{}的deleteById方法。"), this.getClass() .getName()); } /** * 根据ID删除对象 */ @Override public void deleteByIds(List<ID> ids) throws PersistenceException { logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("开始调用{}的deleteByIds方法,传递的参数是ids={}。"), new Object[] { this.getClass().getName(), ids }); if (CollectionUtils.isEmpty(ids)) throw new PersistenceException("主键为空!"); try { getSqlSession().delete(clazzName + POSTFIX_DELETEBYIDS, ids); } catch (Exception ex) { logger.debug(FunIMsgFormat.MsgStyle.ERROR_REPORT.getFormat("执行{}的deleteByIds方法出现异常,具体原因是:{}"), new Object[] { this.getClass().getName(), ex.getStackTrace() }); throw new PersistenceException("执行批量删除出错。", ex); } logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("结束执行{}的deleteByIds方法。"), this.getClass() .getName()); } @Override public Integer count(String propertyName, Object propertyValue) { return count(new String[] { propertyName }, new Object[] { propertyValue }); } @Override public Integer count(String[] propertyNames, Object... propertyValues) throws PersistenceException { logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG .getFormat("开始调用{}的count方法,传入的参数propertyNames={},propertyValues={}"), new Object[] { this.getClass().getName(), propertyNames, propertyValues }); Map<String, Object> map = buildMap(propertyNames, propertyValues); BigDecimal cout = (BigDecimal) getSqlSession().selectOne(clazzName + POSTFIX_COUNT, map); logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("结束执行{}的count方法,执行的结果是{}。"), new Object[] { this.getClass().getName(), cout }); if (cout != null && cout.compareTo(BigDecimal.ZERO) > 0) return cout.intValue(); return BigDecimal.ZERO.intValue(); } @Override public Integer countLikeByMap(String[] propertyNames, Object[] propertyValues) throws PersistenceException { logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG .getFormat("开始调用{}的countLikeByMap方法,传入的参数propertyNames={},propertyValues={}"), new Object[] { this.getClass().getName(), propertyNames, propertyValues }); Map<String, Object> map = buildMap(propertyNames, propertyValues); Integer cout = (Integer) getSqlSession().selectOne(clazzName + POSTFIX_COUNTLIKEBYMAP, map); logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("结束执行{}的countLikeByMap方法,执行的结果是{}。"), new Object[] { this.getClass().getName(), cout }); return cout; } /** 根据自定义SqlMap中的条件语句查询出记录数量 */ @Override public Integer countByStatementPostfix(String statementPostfix, String[] properties, Object[] propertyValues) throws PersistenceException { logger .debug( FunIMsgFormat.MsgStyle.DEFAULT_LOG .getFormat("开始调用{}的countByStatementPostfix方法,传入的参数statementPostfix={},propertyNames={},propertyValues={}"), new Object[] { this.getClass().getName(), statementPostfix, properties, propertyValues }); if (StringUtils.isEmpty(statementPostfix)) return 0; Map<String, Object> map = buildMap(properties, propertyValues); Integer cout = (Integer) getSqlSession().selectOne(clazzName + statementPostfix, map); logger.debug( FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("结束执行{}的countByStatementPostfix方法,执行的结果是{}。"), new Object[] { this.getClass().getName(), cout }); if (cout != null) { return cout.intValue(); } return 0; } /** * 直接从数据库查询出ids列表(包括符合条件的所有id) * * @param properties * 查询条件字段名 * @param propertyValues * 字段取值 * @return */ @Override public List<ID> findIdsByMap(String[] properties, Object[] propertyValues, String orderBy, String order) throws PersistenceException { logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG .getFormat("开始调用{}的findIdsByMap方法,传入的参数是properties={},propertyValues={},orderBy={},order={}。"), new Object[] { this.getClass().getName(), properties, propertyValues, orderBy, order }); Map<String, Object> map = buildMapWithOrder(properties, propertyValues, orderBy, order); List<ID> list = getSqlSession().selectList(clazzName + POSTFIX_PKSELECTMAP, map); logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("结束执行{}的findIdsByMap方法,结果是{},size={}。"), new Object[] { this.getClass().getName(), list, list.size() }); return list; } /** * 直接从数据库查询出ids列表(包括符合条件的所有id) * * @param <E> * * @param properties * 查询条件字段名 * @param propertyValues * 字段取值 * @return */ @Override public <E> List<E> findByStatementPostfix(String statement, String[] properties, Object[] propertyValues, int offset, int limit) throws PersistenceException { logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG .getFormat("开始调用{}的{}方法,传入的参数是properties={},propertyValues={}。"), new Object[] { this.getClass() .getName(), statement, properties, propertyValues }); Map<String, Object> map = buildMap(properties, propertyValues); RowBounds row = new RowBounds(offset, limit); List<E> list = getSqlSession().selectList(clazzName + statement, map, row); logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("结束执行{}的{}方法,结果是{},size={}。"), new Object[] { this.getClass().getName(), statement, list, list.size() }); return list; } /** * 根据条件查询结果 * * @param properties * 查询条件名 * @param propertyValues * 查询条件值 * @return */ @Override public List<T> findByMap(String[] properties, Object[] propertyValues, String orderBy, String order) throws PersistenceException { logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG .getFormat("开始调用{}的findByMap方法,传入的参数是properties={},propertyValues={},orderBy={},order={}。"), new Object[] { this.getClass().getName(), properties, propertyValues, orderBy, order }); Map<String, Object> map = buildMapWithOrder(properties, propertyValues, orderBy, order); List<T> list = getSqlSession().selectList(clazzName + POSTFIX_SELECTBYMAP, map); logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("结束执行{}的findByMap方法,结果是{},size={}。"), new Object[] { this.getClass().getName(), list, list.size() }); return list; } /** * 分页查询(未处理缓存) * * @param properties * 查询条件字段名 * @param propertyValues * 字段取值 * @return */ @Override public List<T> pageQueryByMap(String[] properties, Object[] propertyValues, String orderBy, String order, int pageSize, int pageNo) throws PersistenceException { logger .debug( FunIMsgFormat.MsgStyle.DEFAULT_LOG .getFormat("开始调用{}的pageQueryByMap方法,传入的参数是properties={},propertyValues={},orderBy={},order={},pageSize={},pageNo={}。"), new Object[] { this.getClass().getName(), properties, propertyValues, orderBy, order, pageSize, pageNo }); Map<String, Object> map = buildMapWithOrderAndPagination(properties, propertyValues, orderBy, order, pageSize, pageNo); List<T> list = getSqlSession().selectList(clazzName + POSTFIX_SELECTBYMAP, map); logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("结束执行{}的pageQueryByMap方法,结果是{},size={}。"), new Object[] { this.getClass().getName(), list, list.size() }); return list; } /** * 分页查询出id列表(处理缓存) * * @param properties * 查询条件字段名 * @param propertyValues * 字段取值 * @return */ @Override public List<ID> pageQueryIdsByMap(String[] properties, Object[] propertyValues, String orderBy, String order, int pageSize, int pageNo) throws PersistenceException { logger .debug( FunIMsgFormat.MsgStyle.DEFAULT_LOG .getFormat("开始调用{}的pageQueryIdsByMap方法,传入的参数是properties={},propertyValues={},orderBy={},order={},pageSize={},pageNo={}。"), new Object[] { this.getClass().getName(), properties, propertyValues, orderBy, order, pageSize, pageNo }); Map<String, Object> map = buildMapWithOrderAndPagination(properties, propertyValues, orderBy, order, pageSize, pageNo); List<ID> list = getSqlSession().selectList(clazzName + POSTFIX_PKSELECTMAP, map); logger.debug( FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("结束执行{}的pageQueryIdsByMap方法,结果是{},size={}。"), new Object[] { this.getClass().getName(), list, list.size() }); return list; } /** * 更新对象的部分属性 */ @Override public int update(ID id, String propertie, Object propertyValue) throws PersistenceException { return update(id, new String[] { propertie }, new Object[] { propertyValue }); } /** * 更新对象的部分属性 */ @Override public int update(ID id, String[] properties, Object[] propertyValues) throws PersistenceException { logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG .getFormat("开始调用{}的update方法,传入的参数是id={},properties={},propertyValues={}。"), new Object[] { this.getClass().getName(), id, properties, propertyValues }); if (id == null) throw new PersistenceException("主键为空!"); Map<String, Object> map = buildMap(properties, propertyValues); map.put("id", id); int count = 0; try { count = getSqlSession().update(clazzName + POSTFIX_UPDATEBYMAP, map); } catch (Exception ex) { logger.debug(FunIMsgFormat.MsgStyle.ERROR_REPORT.getFormat("执行{}的update方法出现异常,具体原因是:{}"), new Object[] { this.getClass().getName(), ex.getStackTrace() }); throw new PersistenceException("执行数据更新出错。", ex); } logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("结束执行{}的update方法,结果是{}。"), new Object[] { this.getClass().getName(), count }); return count; } /** * 根据ID列表更新对象的部分属性 */ @Override public int updateByIdsMap(List<ID> ids, String[] properties, Object[] propertyValues) throws PersistenceException { logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG .getFormat("开始调用{}的updateByIdsMap方法,传入的参数是ids={},properties={},propertyValues={}。"), new Object[] { this.getClass().getName(), ids, properties, propertyValues }); if (CollectionUtils.isEmpty(ids)) new PersistenceException("主键为空!"); Map<String, Object> map = buildMap(properties, propertyValues); map.put("ids", ids); int count = 0; try { count = getSqlSession().update(clazzName + POSTFIX_UPDATEBYIDSMAP, map); } catch (Exception ex) { logger.debug(FunIMsgFormat.MsgStyle.ERROR_REPORT.getFormat("执行{}的updateByIdsMap方法出现异常,具体原因是:{}"), new Object[] { this.getClass().getName(), ex.getStackTrace() }); throw new PersistenceException("执行批量数据更新出错。", ex); } logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("结束执行{}的updateByIdsMap方法,结果是{}。"), new Object[] { this.getClass().getName(), count }); return count; } /** 根据ID及条件删除对象 */ @Override public void deleteByIdsMap(List<ID> ids, String[] properties, Object[] propertyValues) throws PersistenceException { logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG .getFormat("开始调用{}的deleteByIdsMap方法,传递的参数是ids={},properties={},propertyValues={}。"), new Object[] { this.getClass().getName(), ids, properties, propertyValues }); if (CollectionUtils.isEmpty(ids)) throw new PersistenceException("主键为空!"); Map<String, Object> map = buildMap(properties, propertyValues); map.put("ids", ids); try { getSqlSession().delete(clazzName + POSTFIX_DELETEBYIDSMAP, map); } catch (Exception ex) { logger.debug(FunIMsgFormat.MsgStyle.ERROR_REPORT.getFormat("执行{}的deleteByIdsMap方法出现异常,具体原因是:{}"), new Object[] { this.getClass().getName(), ex.getStackTrace() }); throw new PersistenceException("执行批量删除出错。", ex); } logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("结束执行{}的deleteByIdsMap方法。"), this .getClass().getName()); } /** * 根据条件删除对象 */ @Override public int deleteByMap(String[] properties, Object[] propertyValues) throws PersistenceException { logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG .getFormat("开始调用{}的deleteByMap方法,传递的参数是properties={},propertyValues={}。"), new Object[] { this.getClass().getName(), properties, propertyValues }); Map<String, Object> map = buildMap(properties, propertyValues); int count = 0; try { count = getSqlSession().delete(clazzName + POSTFIX_DELETEBYMAP, map); } catch (Exception ex) { logger.debug(FunIMsgFormat.MsgStyle.ERROR_REPORT.getFormat("执行{}的deleteByMap方法出现异常,具体原因是:{}"), new Object[] { this.getClass().getName(), ex.getStackTrace() }); throw new PersistenceException("执行批量删除出错。", ex); } logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("结束执行{}的deleteByMap方法,执行的结果是{}。"), new Object[] { this.getClass().getName(), count }); return count; } /** * 根据自定义SqlMap中的条件语句查询出列表(注意:不处理缓存) */ @Override public List<T> findByStatementPostfix(String statementPostfix, String[] properties, Object[] propertyValues, String orderBy, String order) throws PersistenceException { logger .debug( FunIMsgFormat.MsgStyle.DEFAULT_LOG .getFormat("开始调用{}的findByStatementPostfix方法,传递的参数是statementPostfix={},properties={},propertyValues={},orderBy={},order={}。"), new Object[] { this.getClass().getName(), statementPostfix, properties, propertyValues, orderBy, order }); if (StringUtils.isEmpty(statementPostfix)) return null; Map<String, Object> map = buildMapWithOrder(properties, propertyValues, orderBy, order); List<T> list = getSqlSession().selectList(clazzName + statementPostfix, map); logger.debug( FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("结束执行{}的findByStatementPostfix方法,结果是{},size={}。"), new Object[] { this.getClass().getName(), list, list.size() }); return list; } /** * 根据自定义SqlMap中的条件语句查询出对象(注意:不处理缓存) */ @Override public T findOneByStatementPostfix(String statementPostfix, String[] properties, Object[] propertyValues, String orderBy, String order) throws PersistenceException { logger .debug( FunIMsgFormat.MsgStyle.DEFAULT_LOG .getFormat("开始调用{}的findOneByStatementPostfix方法,传递的参数是statementPostfix={},properties={},propertyValues={},orderBy={},order={}。"), new Object[] { this.getClass().getName(), statementPostfix, properties, propertyValues, orderBy, order }); if (StringUtils.isEmpty(statementPostfix)) return null; Map<String, Object> map = buildMapWithOrder(properties, propertyValues, orderBy, order); T t = getSqlSession().selectOne(clazzName + statementPostfix, map); logger.debug( FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("结束执行{}的findOneByStatementPostfix方法,结果是{}。"), new Object[] { this.getClass().getName(), t }); return t; } /** * 根据自定义SqlMap中的条件语句查询出列表(注意:不处理缓存) */ @Override public List<T> pageQueryByStatementPostfix(String statementPostfix, String[] properties, Object[] propertyValues, String orderBy, String order, int pageSize, int pageNo) throws PersistenceException { logger .debug( FunIMsgFormat.MsgStyle.DEFAULT_LOG .getFormat("开始调用{}的findByStatementPostfix方法,传递的参数是statementPostfix={},properties={},propertyValues={},orderBy={},order={},pageSize={},pageNo={}。"), new Object[] { this.getClass().getName(), statementPostfix, properties, propertyValues, orderBy, order, pageSize, pageNo }); if (StringUtils.isEmpty(statementPostfix)) return null; Map<String, Object> map = buildMapWithOrderAndPagination(properties, propertyValues, orderBy, order, pageSize, pageNo); List<ID> ids = getSqlSession().selectList(clazzName + statementPostfix, map); List<T> list = selectByIds(ids); logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG .getFormat("结束执行{}的pageQueryByStatementPostfix方法,结果是{},size={}。"), new Object[] { this.getClass().getName(), list, list.size() }); return list; } /** * 根据自定义SqlMap中的条件语句更新数据(注意:不处理缓存) */ @Override public int updateByStatementPostfix(String statementPostfix, String[] properties, Object[] propertyValues) throws PersistenceException { logger .debug( FunIMsgFormat.MsgStyle.DEFAULT_LOG .getFormat("开始调用{}的updateByStatementPostfix方法,传递的参数是statementPostfix={},properties={},propertyValues={}。"), new Object[] { this.getClass().getName(), statementPostfix, properties, propertyValues }); if (StringUtils.isEmpty(statementPostfix)) throw new PersistenceException("自定义SqlMap中的条件语句为空!"); Map<String, Object> map = buildMap(properties, propertyValues); int record = 0; try { record = getSqlSession().update(clazzName + statementPostfix, map); } catch (Exception ex) { logger .debug(FunIMsgFormat.MsgStyle.ERROR_REPORT .getFormat("执行{}的updateByStatementPostfix方法出现异常,具体原因是:{}"), new Object[] { this.getClass().getName(), ex.getStackTrace() }); throw new PersistenceException("执行数据更新时出错!", ex); } logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("结束执行{}的updateByStatementPostfix方法。"), this .getClass().getName()); return record; } /** * 根据自定义SqlMap中的条件语句删除数据(注意:不处理缓存) */ @Override public void deleteByStatementPostfix(String statementPostfix, String[] properties, Object[] propertyValues) throws PersistenceException { logger .debug( FunIMsgFormat.MsgStyle.DEFAULT_LOG .getFormat("开始调用{}的deleteByStatementPostfix方法,传递的参数是statementPostfix={},properties={},propertyValues={}。"), new Object[] { this.getClass().getName(), statementPostfix, properties, propertyValues }); if (StringUtils.isEmpty(statementPostfix)) throw new PersistenceException("自定义SqlMap中的条件语句为空!"); Map<String, Object> map = buildMap(properties, propertyValues); try { getSqlSession().delete(clazzName + statementPostfix, map); } catch (Exception ex) { logger .debug(FunIMsgFormat.MsgStyle.ERROR_REPORT .getFormat("执行{}的deleteByStatementPostfix方法出现异常,具体原因是:{}"), new Object[] { this.getClass().getName(), ex.getStackTrace() }); throw new PersistenceException("执行数据删除时出错!", ex); } logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("结束执行{}的deleteByStatementPostfix方法。"), this .getClass().getName()); } /** * 根据自定义SqlMap中的条件语句 插入数据(注意:不处理缓存) */ @Override public void insertByStatementPostfix(String statementPostfix, String[] properties, Object[] propertyValues) throws PersistenceException { logger .debug( FunIMsgFormat.MsgStyle.DEFAULT_LOG .getFormat("开始调用{}的insertByStatementPostfix方法,传递的参数是statementPostfix={},properties={},propertyValues={}。"), new Object[] { this.getClass().getName(), statementPostfix, properties, propertyValues }); if (StringUtils.isEmpty(statementPostfix)) throw new PersistenceException("自定义SqlMap中的条件语句为空!"); Map<String, Object> map = buildMap(properties, propertyValues); try { getSqlSession().insert(clazzName + statementPostfix, map); } catch (Exception ex) { logger .debug(FunIMsgFormat.MsgStyle.ERROR_REPORT .getFormat("执行{}的insertByStatementPostfix方法出现异常,具体原因是:{}"), new Object[] { this.getClass().getName(), ex.getStackTrace() }); throw new PersistenceException("执行数据插入时出错!", ex); } logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("结束执行{}的insertByStatementPostfix方法。"), this .getClass().getName()); } @Override public <E> List<E> listByPage(String statement, Page page) { logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG .getFormat("开始调用{}的findByStatementPostfix方法,传递的参数是statementPostfix={}。"), new Object[] { this.getClass().getName(), statement }); if (StringUtils.isEmpty(statement)) throw new PersistenceException("自定义SqlMap中的条件语句为空!"); if (!statement.endsWith("ByPage")) throw new PersistenceException("statement定义错误!分页查询必须以ByPage结尾"); List<E> list = getSqlSession().selectList(clazzName + statement, page); logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("结束执行{}的listByPage方法。"), this.getClass() .getName()); return list; } private Map<String, Object> buildMap(String[] propertyNames, Object[] propertyValues) throws PersistenceException { Map<String, Object> map = new HashMap<String, Object>(); if (ArrayUtils.isNotEmpty(propertyNames) && ArrayUtils.isNotEmpty(propertyValues)) { int prosKeyLen = propertyNames.length; int prosValueLen = propertyValues.length; if (prosKeyLen != prosValueLen) throw new PersistenceException("传递的参数不匹配!"); for (int i = 0; i < prosKeyLen; i++) { map.put(propertyNames[i], propertyValues[i]); } } return map; } private Map<String, Object> buildMapWithOrder(String[] propertyNames, Object[] propertyValues, String orderBy, String order) throws PersistenceException { Map<String, Object> map = buildMap(propertyNames, propertyValues); if (StringUtils.isNotEmpty(orderBy)) { map.put("orderBy", orderBy); map.put("order", order); } return map; } private Map<String, Object> buildMapWithOrderAndPagination(String[] propertyNames, Object[] propertyValues, String orderBy, String order, int pageSize, int pageNo) throws PersistenceException { Map<String, Object> map = buildMap(propertyNames, propertyValues); if (StringUtils.isNotEmpty(orderBy)) { map.put("orderBy", orderBy); map.put("order", order); } map.put("limit", true); map.put("start", (pageNo - 1) * pageSize);// limit 操作 map.put("end", pageSize); return map; } }
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <mapper namespace="com.ym.qab.ts.po.OrderListPO"> <resultMap id="BaseResultMap" type="OrderListPO"> <id column="ID" jdbcType="VARCHAR" property="id" /> <result column="TXN_DATE" jdbcType="TIMESTAMP" property="txnDate" /> <result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime" /> <result column="CHNL_ID" jdbcType="CHAR" property="chnlId" /> <result column="ORDER_NO" jdbcType="CHAR" property="orderNo" /> <result column="TXN_TYPE" jdbcType="CHAR" property="txnType" /> <result column="CUST_NO" jdbcType="CHAR" property="custNo" /> <result column="ACCT_NO" jdbcType="VARCHAR" property="acctNo" /> <result column="ACCT_TYPE" jdbcType="CHAR" property="acctType" /> <result column="CARDMER_CODE" jdbcType="CHAR" property="cardmerCode" /> <result column="MER_TIME" jdbcType="TIMESTAMP" property="merTime" /> <result column="MER_ORDER" jdbcType="VARCHAR" property="merOrder" /> <result column="PRODUCT_NAME" jdbcType="VARCHAR" property="productName" /> <result column="ACQMER_CODE" jdbcType="CHAR" property="acqmerCode" /> <result column="ACQMER_NAME" jdbcType="VARCHAR" property="acqmerName" /> <result column="ACQMER_TYPE" jdbcType="CHAR" property="acqmerType" /> <result column="REL_ACCT" jdbcType="VARCHAR" property="relAcct" /> <result column="REL_ACCT_TYPE" jdbcType="CHAR" property="relAcctType" /> <result column="REL_CARDMER_CODE" jdbcType="VARCHAR" property="relCardmerCode" /> <result column="ORDER_STAT" jdbcType="CHAR" property="orderStat" /> <result column="DEL_FLAG" jdbcType="CHAR" property="delFlag" /> <result column="END_TIME" jdbcType="TIMESTAMP" property="endTime" /> <result column="ORDER_DEL_TIME" jdbcType="TIMESTAMP" property="orderDelTime" /> <result column="NOTE_STAT" jdbcType="CHAR" property="noteStat" /> <result column="NOTE_TIME" jdbcType="TIMESTAMP" property="noteTime" /> <result column="TXN_AMT" jdbcType="DECIMAL" property="txnAmt" /> <result column="BEF_AMT" jdbcType="DECIMAL" property="befAmt" /> <result column="TXN_FEE" jdbcType="DECIMAL" property="txnFee" /> <result column="CCY" jdbcType="CHAR" property="ccy" /> <result column="ORI_ORDER_NO" jdbcType="CHAR" property="oriOrderNo" /> <result column="EJECT_AMT" jdbcType="DECIMAL" property="ejectAmt" /> <result column="CHK_FLAG" jdbcType="CHAR" property="chkFlag" /> <result column="CHK_BATCH_NO" jdbcType="CHAR" property="chkBatchNo" /> <result column="CHK_DATE" jdbcType="TIMESTAMP" property="chkDate" /> <result column="MER_STL_FLAG" jdbcType="CHAR" property="merStlFlag" /> <result column="MER_STL_BATCH_NO" jdbcType="CHAR" property="merStlBatchNo" /> <result column="MER_STL_DATE" jdbcType="TIMESTAMP" property="merStlDate" /> <result column="COP_STL_FLAG" jdbcType="CHAR" property="copStlFlag" /> <result column="COP_STL_BATCH_NO" jdbcType="CHAR" property="copStlBatchNo" /> <result column="COP_STL_DATE" jdbcType="TIMESTAMP" property="copStlDate" /> <result column="MEMO" jdbcType="VARCHAR" property="memo" /> <result column="ORDER_CLOSE_TIME" jdbcType="TIMESTAMP" property="orderCloseTime" /> <result column="POS_CODE" jdbcType="VARCHAR" property="posCode" /> <result column="STL_MER_FLAG" jdbcType="CHAR" property="stlMerFlag" /> <result column="ERR_STL_FLAG" jdbcType="CHAR" property="errStlFlag" /> <result column="DEAL_AMT" jdbcType="DECIMAL" property="dealAmt" /> <result column="MER_ERR_STL_BATCH_NO" jdbcType="CHAR" property="merErrStlBatchNo" /> <result column="COP_ERR_STL_BATCH_NO" jdbcType="CHAR" property="copErrStlBatchNo" /> <result column="COPMER_CODE" jdbcType="CHAR" property="copmerCode" /> <result column="CARDMER_TYPE" jdbcType="CHAR" property="cardmerType" /> <result column="COP_ERR_STL_FLAG" jdbcType="CHAR" property="copErrStlFlag" /> <result column="PAY_METHOD" jdbcType="CHAR" property="payMethod" /> <result column="OPER_NO" jdbcType="VARCHAR" property="operNo" /> </resultMap> <insert id="insert" parameterType="OrderListPO"> insert into T_ORDER_LIST (ID, TXN_DATE, CREATE_TIME, CHNL_ID, ORDER_NO, TXN_TYPE, CUST_NO, ACCT_NO, ACCT_TYPE, CARDMER_CODE, MER_TIME, MER_ORDER, PRODUCT_NAME, ACQMER_CODE, ACQMER_NAME, ACQMER_TYPE, REL_ACCT, REL_ACCT_TYPE, REL_CARDMER_CODE, ORDER_STAT, DEL_FLAG, END_TIME, ORDER_DEL_TIME, NOTE_STAT, NOTE_TIME, TXN_AMT, BEF_AMT, TXN_FEE, CCY, ORI_ORDER_NO, EJECT_AMT, CHK_FLAG, CHK_BATCH_NO, CHK_DATE, MER_STL_FLAG, MER_STL_BATCH_NO, MER_STL_DATE, COP_STL_FLAG, COP_STL_BATCH_NO, COP_STL_DATE, MEMO, ORDER_CLOSE_TIME, POS_CODE, STL_MER_FLAG, ERR_STL_FLAG, DEAL_AMT, MER_ERR_STL_BATCH_NO, COP_ERR_STL_BATCH_NO, COPMER_CODE, CARDMER_TYPE, COP_ERR_STL_FLAG,PAY_METHOD,OPER_NO) values (sys_guid(), #{txnDate,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}, #{chnlId,jdbcType=CHAR}, #{orderNo,jdbcType=CHAR}, #{txnType,jdbcType=CHAR}, #{custNo,jdbcType=CHAR}, #{acctNo,jdbcType=VARCHAR}, #{acctType,jdbcType=CHAR}, #{cardmerCode,jdbcType=CHAR}, #{merTime,jdbcType=TIMESTAMP}, #{merOrder,jdbcType=VARCHAR}, #{productName,jdbcType=VARCHAR}, #{acqmerCode,jdbcType=CHAR}, #{acqmerName,jdbcType=VARCHAR}, #{acqmerType,jdbcType=CHAR}, #{relAcct,jdbcType=VARCHAR}, #{relAcctType,jdbcType=CHAR}, #{relCardmerCode,jdbcType=VARCHAR}, #{orderStat,jdbcType=CHAR}, #{delFlag,jdbcType=CHAR}, #{endTime,jdbcType=TIMESTAMP}, #{orderDelTime,jdbcType=TIMESTAMP}, #{noteStat,jdbcType=CHAR}, #{noteTime,jdbcType=TIMESTAMP}, #{txnAmt,jdbcType=DECIMAL}, #{befAmt,jdbcType=DECIMAL}, #{txnFee,jdbcType=DECIMAL}, #{ccy,jdbcType=CHAR}, #{oriOrderNo,jdbcType=CHAR}, #{ejectAmt,jdbcType=DECIMAL}, #{chkFlag,jdbcType=CHAR}, #{chkBatchNo,jdbcType=CHAR}, #{chkDate,jdbcType=TIMESTAMP}, #{merStlFlag,jdbcType=CHAR}, #{merStlBatchNo,jdbcType=CHAR}, #{merStlDate,jdbcType=TIMESTAMP}, #{copStlFlag,jdbcType=CHAR}, #{copStlBatchNo,jdbcType=CHAR}, #{copStlDate,jdbcType=TIMESTAMP}, #{memo,jdbcType=VARCHAR}, #{orderCloseTime,jdbcType=TIMESTAMP}, #{posCode,jdbcType=VARCHAR}, #{stlMerFlag,jdbcType=CHAR}, #{errStlFlag,jdbcType=CHAR}, #{dealAmt,jdbcType=DECIMAL}, #{merErrStlBatchNo,jdbcType=CHAR}, #{copErrStlBatchNo,jdbcType=CHAR}, #{copmerCode,jdbcType=CHAR}, #{cardmerType,jdbcType=CHAR}, #{copErrStlFlag,jdbcType=CHAR},#{payMethod,jdbcType=CHAR}, #{operNo,jdbcType=VARCHAR}) </insert> <sql id="Query_Column_List"> ID, TXN_DATE, CREATE_TIME, CHNL_ID, ORDER_NO, TXN_TYPE, CUST_NO, ACCT_NO, ACCT_TYPE, CARDMER_CODE, MER_TIME, MER_ORDER, PRODUCT_NAME, ACQMER_CODE, ACQMER_NAME, ACQMER_TYPE, REL_ACCT, REL_ACCT_TYPE, REL_CARDMER_CODE, ORDER_STAT, DEL_FLAG, END_TIME, ORDER_DEL_TIME, NOTE_STAT, NOTE_TIME, TXN_AMT, BEF_AMT, TXN_FEE, CCY, ORI_ORDER_NO, EJECT_AMT, CHK_FLAG, CHK_BATCH_NO, CHK_DATE, MER_STL_FLAG, MER_STL_BATCH_NO, MER_STL_DATE, COP_STL_FLAG, COP_STL_BATCH_NO, COP_STL_DATE, MEMO, ORDER_CLOSE_TIME, POS_CODE, STL_MER_FLAG, ERR_STL_FLAG, DEAL_AMT, MER_ERR_STL_BATCH_NO, COP_ERR_STL_BATCH_NO, COPMER_CODE, CARDMER_TYPE, COP_ERR_STL_FLAG,PAY_METHOD,OPER_NO </sql> <sql id="Query_Order_List"> o.ID, o.TXN_DATE, o.CREATE_TIME, o.CHNL_ID, o.ORDER_NO, o.TXN_TYPE, o.CUST_NO, o.ACCT_NO, ACCT_TYPE, o.CARDMER_CODE, o.MER_TIME, o.MER_ORDER, o.PRODUCT_NAME, o.ACQMER_CODE, o.ACQMER_NAME, o.ACQMER_TYPE, o.REL_ACCT, o.REL_ACCT_TYPE, o.REL_CARDMER_CODE, o.ORDER_STAT, o.DEL_FLAG, END_TIME,ORDER_CLOSE_TIME, ORDER_DEL_TIME, o.NOTE_STAT, o.NOTE_TIME, o.TXN_AMT, o.BEF_AMT, o.TXN_FEE, o.CCY, o.ORI_ORDER_NO, o.EJECT_AMT, o.CHK_FLAG, o.CHK_BATCH_NO, o.CHK_DATE, o.MER_STL_FLAG, o.MER_STL_BATCH_NO, o.MER_STL_DATE, o.COP_STL_FLAG, o.COP_STL_BATCH_NO, o.COP_STL_DATE,o.POS_CODE </sql> <!-- 频繁交易、大额消费监控 --> <sql id="Query_Mon_Column_List"> ID, CUST_NO, ORDER_NO, CREATE_TIME, TXN_AMT, ACCT_NO, ACCT_TYPE, CARDMER_CODE, MER_ORDER, PRODUCT_NAME, ACQMER_CODE, ACQMER_NAME, MEMO </sql> <update id="updateByMap"> update t_order_list set order_stat=#{orderStat},end_time=#{endTime} where id=#{id} </update> <update id="updateOriOrderEjectAmt"> update T_ORDER_LIST SET EJECT_AMT = #{ejectAmt} where ORDER_NO = #{orderNo} </update> <update id="updateStatByOrderNo"> update t_order_list set order_stat=#{orderStat} <if test="endTime != null"> , end_time=#{endTime} </if> <if test="acctNo != null"> , acct_no=#{acctNo} </if> <if test="txnAmt != null"> , txn_amt=#{txnAmt} </if> <if test="cardmerCode != null and cardmerCode != ''"> , cardmer_code=#{cardmerCode} </if> where order_stat = #{preStat} and order_no=#{orderNo} </update> <update id="updateNoteStatByOrderNo"> update t_order_list set NOTE_STAT=#{noteStat} ,NOTE_TIME=#{noteTime} where order_stat = #{preStat} and order_no=#{orderNo} </update> <!-- 根据操作员账号查询订单信息,liu.xu于2014-11-13添加 --> <sql id="operNoQryCondition"> <where> <if test="operNo != null"> and oper_no in( select cust_no from t_es_login_info where user_flag='2' and cust_no=#{operNo} union select cust_no from t_es_login_info where mer_code =(select mer_code from t_es_login_info where user_flag='1' and cust_no=#{operNo}) ) </if> <if test="orderNo != null"> and order_no like #{orderNo} </if> and Del_FLAG=#{delFlag} and txn_type in('01','02','11') </where> </sql> <!-- 查询消费净额消费部分金额,liu.xu于2014-11-17添加 --> <sql id="qryNetAmtInCondition"> <where> <if test="operNo != null"> and oper_no in( select cust_no from t_es_login_info where user_flag='2' and cust_no=#{operNo} union select cust_no from t_es_login_info where mer_code =(select mer_code from t_es_login_info where user_flag='1' and cust_no=#{operNo}) ) </if> <if test="orderNo != null"> and order_no like #{orderNo} </if> and Del_FLAG=#{delFlag} and txn_type='01' and order_stat='1' </where> </sql> <!-- 查询消费净额退货部分金额,liu.xu于2014-11-17添加 --> <sql id="qryNetAmtOutCondition"> <where> <if test="operNo != null"> and oper_no in( select cust_no from t_es_login_info where user_flag='2' and cust_no=#{operNo} union select cust_no from t_es_login_info where mer_code =(select mer_code from t_es_login_info where user_flag='1' and cust_no=#{operNo}) ) </if> <if test="orderNo != null"> and order_no like #{orderNo} </if> and Del_FLAG=#{delFlag} and txn_type in ('02','11') and order_stat='1' </where> </sql> <!-- app订单查询,不显示退款 --> <sql id="pageQueryCondition"> <where> <if test="orderNoList != null"> order_no in <foreach collection="orderNoList" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> </if> <if test="acqmerCode != null"> and acqmer_Code = #{acqmerCode} </if> <if test="acqmerType != null"> and acqmer_type = #{acqmerType} </if> <if test="productName != null"> and product_name like #{productName} </if> <!-- 统计数量 2014-10-21添加退款项 j.zhou --> and TXN_TYPE in ('01','11','02') <!-- and txn_Type='01' --> and Del_FLAG=#{delFlag} and cust_no=#{custNo} and txn_date >= #{txnDate} </where> </sql> <!-- app订单查询,不显示退款 --> <!-- <select id="selectByMap" resultMap="BaseResultMap"> select <include refid="Query_Column_List" /> from T_ORDER_LIST <include refid="pageQueryCondition" /> order by order_no desc </select> --> <!-- 根据操作员账号查询订单信息,liu.xu于2014-11-13添加 --> <select id="selectByOperNo" resultMap="BaseResultMap"> select <include refid="Query_Column_List" /> from T_ORDER_LIST <include refid="operNoQryCondition" /> order by order_no desc </select> <!-- 添加退款订单 --> <sql id="Query_Column_List2"> t.ID, t.TXN_DATE, t.CREATE_TIME, t.CHNL_ID, t.ORDER_NO, t.TXN_TYPE, t.CUST_NO, t.ACCT_NO, t.ACCT_TYPE,t.CARDMER_CODE, t.MER_TIME, t.MER_ORDER, t.PRODUCT_NAME, t.ACQMER_CODE, t.ACQMER_NAME, t.ACQMER_TYPE,t.REL_ACCT, t.REL_ACCT_TYPE, t.REL_CARDMER_CODE, t.ORDER_STAT, t.DEL_FLAG,t.END_TIME, t.ORDER_DEL_TIME,t.NOTE_STAT, t.NOTE_TIME, t.TXN_AMT, t.BEF_AMT, t.TXN_FEE, t.CCY, (case when (t.txn_type='02' or t.txn_type='11') then p.mer_order else t.ori_order_no end) as ORI_ORDER_NO, t.EJECT_AMT,t.CHK_FLAG,t.CHK_BATCH_NO, t.CHK_DATE, t.MER_STL_FLAG, t.MER_STL_BATCH_NO, t.MER_STL_DATE, t.COP_STL_FLAG, t.COP_STL_BATCH_NO, t.COP_STL_DATE, t.MEMO, t.ORDER_CLOSE_TIME, t.POS_CODE, t.STL_MER_FLAG, t.ERR_STL_FLAG,t.DEAL_AMT, t.MER_ERR_STL_BATCH_NO, t.COP_ERR_STL_BATCH_NO, t.COPMER_CODE, t.CARDMER_TYPE, t.COP_ERR_STL_FLAG,t.PAY_METHOD </sql> <select id="selectByMap" resultMap="BaseResultMap"> select <include refid="Query_Column_List2" /> from t_order_list t, t_order_list p where t.ori_order_no=p.order_no(+) <if test="orderNoList != null"> and t.order_no in <foreach collection="orderNoList" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> </if> <if test="acqmerCode != null"> and t.acqmer_Code = #{acqmerCode} </if> <if test="acqmerType != null"> and t.acqmer_type = #{acqmerType} </if> <if test="productName != null"> and t.product_name like #{productName} </if> and t.TXN_TYPE in ('01','11','02') and t.Del_FLAG=#{delFlag} and t.cust_no=#{custNo} and t.txn_date >=#{txnDate} order by t.order_no desc </select> <select id="countRetSuccess" resultType="Integer"> select count(id) from t_order_list where txn_type in ('02','11') and order_stat='1' and ori_order_no=#{orderNo} </select> <select id="selectByMapTotalrecord" resultType="Integer"> select count(id) from T_ORDER_LIST <include refid="pageQueryCondition" /> </select> <!-- 根据操作员账号查询订单总数,liu.xu于2014-11-13添加 --> <select id="selectTotalrecordByOperNo" resultType="Integer"> select count(id) from T_ORDER_LIST <include refid="operNoQryCondition" /> </select> <!-- 根据操作员账号查询交易净额,liu.xu于2014-11-17添加 --> <select id="selectNetAmountByOperNo" resultType="BigDecimal"> select consumeAmt-returnAmt from (select decode(sum(txn_amt) ,null,0,sum(txn_amt)) as consumeAmt from t_order_list <include refid="qryNetAmtInCondition" />) , (select decode(sum(txn_amt) ,null,0,sum(txn_amt)) as returnAmt from t_order_list <include refid="qryNetAmtOutCondition" />) </select> <select id="findLastPayOrderList" resultMap="BaseResultMap"> select <include refid="Query_Column_List"/> from T_ORDER_LIST where CUST_NO = #{custNo} and CARDMER_CODE = #{cardmerCode} and ACCT_NO = #{acctNo} and TXN_TYPE = #{txnType} and ORDER_STAT = #{orderStat} and rownum = 1 order by TXN_DATE desc </select> <!--APP订单按月份统计 --> <!-- 2014-10-22 添加退款记录,并从支出中去除 --> <select id="sumTxnAmt" resultType="Map"> select sum(amt)*100 AMT,YYMM from( select sum((case when (txn_type='02' or txn_type='11') then 0-txn_amt else txn_amt end)) amt, to_char(txn_date,'yymm') yymm from T_ORDER_LIST where ORDER_STAT=#{orderStat} and Del_FLAG=#{delFlag} and txn_type in ('01','02','11') and CUST_NO = #{custNo} and TXN_DATE >= #{txnDateBegin} and txn_date <= #{txnDateEnd} group by txn_date )group by yymm order by yymm desc </select> <!-- <select id="sumTxnAmt" resultType="Map"> select sum(amt)*100 AMT,YYMM from( select sum(txn_amt) amt,to_char(txn_date,'yymm') yymm from T_ORDER_LIST where ORDER_STAT=#{orderStat} and Del_FLAG=#{delFlag} and txn_type=#{txnType} and CUST_NO = #{custNo} and TXN_DATE >= #{txnDateBegin} and txn_date <= #{txnDateEnd} group by txn_date )group by yymm order by yymm desc </select> --> <!--SZL 2014-12-25 添加用于辅助账户余额表 冻结金额处理--> <select id="frozenOrderInfo" resultType="Map"> SELECT o.order_no,o.txn_amt,o.acqmer_code,o.cardmer_code, c.cardmer_type FROM t_order_list o, t_cardmer_info c WHERE o.cardmer_code = c.cardmer_code AND o.order_no= #{orderNo} </select> <select id="getByMerOrder" resultMap="BaseResultMap"> select <include refid="Query_Column_List" /> from T_ORDER_LIST where mer_order=#{merOrder} and acqmer_Code=#{acqmerCode} </select> <update id="delOrder"> update T_ORDER_LIST set del_flag=#{delFlag}, ORDER_DEL_TIME = #{orderDelTime} where order_no in <foreach collection="orderNoList" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> and cust_no = #{custNo} </update> <select id="getRefundOrder" resultMap="BaseResultMap" parameterType="String"> select <include refid="Query_Column_List" /> from T_ORDER_LIST where ACQMER_CODE = #{acqmerCode} and ORI_ORDER_NO = #{oriOrderNo} and ORDER_STAT = '1' </select> <select id="getOriOrder" resultMap="BaseResultMap" parameterType="Object"> select <include refid="Query_Column_List" /> from T_ORDER_LIST where ACQMER_CODE = #{acqmerCode} and ORDER_STAT = #{stat} and TXN_TYPE = #{txnType} <if test="oriMerOrder !=null and oriMerOrder != ''"> and MER_ORDER = #{oriMerOrder} </if> <if test="oriTranDate !=null and oriTranDate != ''"> and TXN_DATE = #{oriTranDate} </if> <if test="oriOrderNo !=null and oriOrderNo != ''"> and ORDER_NO = #{oriOrderNo} </if> </select> <!-- 退款,退货操作查询是否有原订单非失败的退款退货订单 --> <select id="queryByProps" resultMap="BaseResultMap" parameterType="Object"> select <include refid="Query_Column_List" /> from T_ORDER_LIST <where> <if test="acqmerCode !=null and acqmerCode != ''"> and ACQMER_CODE = #{acqmerCode} </if> <if test="stat !=null and stat != ''"> and ORDER_STAT <> #{stat} </if> <if test="txnType !=null and txnType != ''"> and TXN_TYPE = #{txnType} </if> <!-- 退款成功的,无论是商户还是亚盟 zhoujian 20141211 --> <if test="txnType ==null or txnType == ''"> and (TXN_TYPE = '11' or TXN_TYPE='02') </if> <if test="oriMerOrder !=null and oriMerOrder != ''"> and MER_ORDER = #{oriMerOrder} </if> <if test="oriTranDate !=null and oriTranDate != ''"> and TXN_DATE = #{oriTranDate} </if> <if test="oriOrderNo !=null and oriOrderNo != ''"> and ORI_ORDER_NO = #{oriOrderNo} </if> </where> </select> <!-- 查询客户交易记录 memo==loginName --> <select id="queryOrderListByPage" parameterType="com.ym.qab.commons.dto.Page" resultMap="BaseResultMap"> select tc.CUST_NO,tc.TXN_DATE,tc.CHNL_ID,tc.ACQMER_NAME,tc.TXN_TYPE,tc.ACCT_TYPE,tc.ACCT_NO ,tc.ORDER_STAT,tc.TXN_AMT,tc.ORDER_NO,tc.ORI_ORDER_NO,tc.PAY_METHOD <choose> <when test="memo != null and memo != ''"> from T_CUST_INFO c, T_ORDER_LIST tc </when> <otherwise> from T_ORDER_LIST tc </otherwise> </choose> <where> <if test="memo !=null and memo != ''"> and tc.CUST_NO = c.CUST_NO and c.LOGIN_NAME = #{memo} </if> <if test="custNo !=null and custNo != ''"> and tc.CUST_NO = #{custNo} </if> <if test="txnDate !=null and txnDate != ''"> and tc.TXN_DATE = #{txnDate} </if> <if test="chnlId !=null and chnlId != ''"> and tc.CHNL_ID = #{chnlId} </if> <if test="txnType !=null and txnType != ''"> and tc.TXN_TYPE = #{txnType} </if> <if test="acctType !=null and acctType != ''"> and tc.ACCT_TYPE = #{acctType} </if> <if test="acctNo !=null and acctNo != ''"> and tc.ACCT_NO = #{acctNo} </if> <if test="orderStat !=null and orderStat != ''"> and tc.ORDER_STAT = #{orderStat} </if> <if test="cardmerCode !=null and cardmerCode != ''"> and tc.CARDMER_CODE = #{cardmerCode} </if> <if test="acqmerCode !=null and acqmerCode != ''"> and tc.ACQMER_CODE = #{acqmerCode} </if> <if test="merOrder !=null and merOrder != ''"> and tc.MER_ORDER = #{merOrder} </if> <if test="orderNo !=null and orderNo != ''"> and tc.ORDER_NO = #{orderNo} </if> <if test="startDate != null and startDate != ''" > <![CDATA[ and to_char(tc.TXN_DATE,'yyyy.mm.dd') >= #{startDate} ]]> </if> <if test="endDate != null and endDate != ''" > <![CDATA[ and to_char(tc.TXN_DATE,'yyyy.mm.dd') <= #{endDate} ]]> </if> <if test="payMethod !=null and payMethod != ''"> and tc.PAY_METHOD = #{payMethod} </if> </where> order by CREATE_TIME desc </select> <!-- 查询客户交易记录,进行大额、频繁交易监控 --> <select id="queryMonOrderList" parameterType="Map" resultMap="BaseResultMap"> select <include refid="Query_Mon_Column_List" /> from T_ORDER_LIST where create_time <= #{endTime} and create_time >= #{startTime} and ORDER_STAT = #{orderStat} order by create_time asc </select> <!-- 查询客户交易记录的条数,进行大额、频繁交易监控 --> <select id="queryMonOrderListCount" parameterType="Map" resultType="Long"> select count(ID) from T_ORDER_LIST where create_time <= #{endTime} and create_time >= #{startTime} and ORDER_STAT = #{orderStat} </select> <!-- 查询客户交易记录总数 --> <select id="queryOrderCount" parameterType="OrderListPO" resultType="Long"> select count(*) <choose> <when test="memo != null and memo != ''"> from T_CUST_INFO c, T_ORDER_LIST tc </when> <otherwise> from T_ORDER_LIST tc </otherwise> </choose> <where> <if test="memo !=null and memo != ''"> and tc.CUST_NO = c.CUST_NO and c.LOGIN_NAME = #{memo} </if> <if test="custNo !=null and custNo != ''"> and tc.CUST_NO = #{custNo} </if> <if test="txnDate !=null and txnDate != ''"> and tc.TXN_DATE = #{txnDate} </if> <if test="chnlId !=null and chnlId != ''"> and tc.CHNL_ID = #{chnlId} </if> <if test="txnType !=null and txnType != ''"> and tc.TXN_TYPE = #{txnType} </if> <if test="acctType !=null and acctType != ''"> and tc.ACCT_TYPE = #{acctType} </if> <if test="acctNo !=null and acctNo != ''"> and tc.ACCT_NO = #{acctNo} </if> <if test="orderStat !=null and orderStat != ''"> and tc.ORDER_STAT = #{orderStat} </if> <if test="cardmerCode !=null and cardmerCode != ''"> and tc.CARDMER_CODE = #{cardmerCode} </if> <if test="acqmerCode !=null and acqmerCode != ''"> and tc.ACQMER_CODE = #{acqmerCode} </if> <if test="merOrder !=null and merOrder != ''"> and tc.MER_ORDER = #{merOrder} </if> <if test="orderNo !=null and orderNo != ''"> and tc.ORDER_NO = #{orderNo} </if> </where> </select> <!-- 对账 order_stat=#{orderStat} and chk_Flag=#{chkFlag} and --> <select id="selectChkUnique" resultMap="BaseResultMap"> select id,txn_amt,order_no,order_stat,chk_Flag from T_ORDER_LIST where ACQMER_CODE=#{acqmerCode} and MER_ORDER=#{merOrder} </select> <update id="updateChkFlag"> update T_ORDER_LIST set chk_Flag=#{chkFlag} , chk_Batch_No=#{chkBatchNo},chk_date=trunc(sysdate) where id=#{id} </update> <!-- 对账,登记亚盟多的记录 --> <select id="countChkList" resultType="Integer"> select count(id) from T_ORDER_LIST where txn_type in('01','02','11') and order_stat=#{orderStat} and txn_Date =#{txnDate} and chk_Flag=#{chkFlag} and acqmer_Code=#{acqmerCode} </select> <!-- 对账,登记亚盟多的记录 --> <select id="findChkList" resultMap="BaseResultMap"> select <include refid="Query_Column_List" /> from T_ORDER_LIST where txn_type in('01','02','11') and order_stat=#{orderStat} and txn_Date =#{txnDate} and chk_Flag=#{chkFlag} and acqmer_Code=#{acqmerCode} </select> <!-- 根据订单号查询订单(可扩展) --> <select id="queryOrderByOrderNo" parameterType="OrderListPO" resultMap="BaseResultMap"> select <include refid="Query_Order_List" />, (select login_name from t_cust_info c where o.cust_no = c.cust_no) as memo from T_ORDER_LIST o <where> <if test="orderNo !=null and orderNo !=''"> and o.ORDER_NO = #{orderNo} </if> </where> </select> <update id="updateByOrderNo"> update t_order_list <set> <if test="orderStat != null and orderStat !=''"> order_stat=#{orderStat} </if> </set> where order_no=#{orderNo} </update> <update id="updateFail"> update T_ORDER_LIST set order_stat=#{orderStat} , chk_Flag=#{chkFlag},err_stl_flag=#{errStlFlag} where id=#{id} </update> <update id="updateFailWithCop"> update T_ORDER_LIST set order_stat=#{orderStat} , chk_Flag=#{chkFlag},err_stl_flag=#{errStlFlag},COP_ERR_STL_FLAG=#{copErrStlFlag} where id=#{id} </update> <update id="updateFailWithFlag"> update T_ORDER_LIST set order_stat=#{orderStat} ,chk_Flag=#{chkFlag},mer_stl_flag=#{merStlFlag},cop_stl_flag=#{copStlFlag}, err_stl_flag=#{errStlFlag},cop_err_stl_flag=#{copErrStlFlag} where id=#{id} </update> <!-- 合作伙伴结算 --> <update id="copmerUpdateOrder"> update t_order_list t set t.COP_STL_BATCH_NO=#{copStlBatchNo},t.COP_STL_DATE=#{copStlDate}, t.COP_STL_FLAG=#{copStlFlag} where t.order_no in ((select order_no from t_cust_acct_list where order_no in (select o.order_no from t_order_list o where o.COPMER_CODE=#{copmerCode} and o.txn_date<#{txnDate} and o.COP_STL_FLAG=#{oldCopStlFlag} and o.ORDER_STAT=#{orderStat}) and STL_FLAG=#{stlFlag} )) </update> <update id="copmerUpdateAmountDifferOrder"> update t_order_list t set t.COP_ERR_STL_BATCH_NO=#{copErrStlBatchNo}, t.COP_ERR_STL_FLAG=#{copErrStlFlag} where t.order_no in (select ori_order_no from t_cust_acct_list where ori_order_no in (select o.order_no from t_order_list o where o.COPMER_CODE=#{copmerCode} and o.txn_date<#{txnDate} and o.COP_ERR_STL_FLAG=#{oldcopErrStlFlag} and o.ORDER_STAT=#{orderStat}) and txn_type not in ('02','11') and STL_FLAG=#{stlFlag}) </update> <update id="copmerUpdateDealOrder"> update t_order_list t set t.COP_ERR_STL_BATCH_NO=#{copErrStlBatchNo}, t.COP_ERR_STL_FLAG=#{copErrStlFlag} where t.order_no in (select order_no from t_cust_acct_list where order_no in (select o.order_no from t_order_list o where o.COPMER_CODE=#{copmerCode} and o.txn_date<#{txnDate} and o.COP_ERR_STL_FLAG=#{oldcopErrStlFlag} and o.ORDER_STAT=#{orderStat} ) and STL_FLAG=#{stlFlag} ) </update> <!-- 特约商户结算-先对账后结算 对账标记:成功=1 或者 无需对账=4 SZL 2014-12-04 --> <select id="sumMerTxnAmt" resultType="Map"> select nvl(sum(o.txn_amt),0)+nvl(sum(o.DEAL_AMT),0) DTXNAMT from t_order_list o where o.acqmer_code=#{acqmerCode} and o.STL_MER_FLAG=#{stlMerFlag} and o.txn_date<#{txnDate} and o.CARDMER_TYPE=#{cardmerType} and o.mer_stl_flag=#{merStlFlag} and (o.CHK_FLAG='1' or o.CHK_FLAG='4') and o.ORDER_STAT=#{orderStat} and o.txn_type in <foreach item="item" index="index" collection="txnType" open="(" separator="," close=")"> #{item} </foreach> </select> <!-- 登记结算后修改订单明细状态。[订单状态成功=1; 对账成功=1 或者 无需对账=4; 未结算=0] 才参与修改 结算状态为 结算中=1 SZL --> <update id="merUpdateOrder"> update t_order_list t set t.MER_STL_BATCH_NO=#{merStlBatchNo},t.MER_STL_DATE=#{merStlDate}, t.MER_STL_FLAG='1' where t.order_no in (select order_no from t_order_list o where o.acqmer_code=#{acqmerCode} and o.txn_date<#{txnDate} and o.MER_STL_FLAG='0' and o.ORDER_STAT='1' and o.CARDMER_TYPE=#{cardmerType} and o.STL_MER_FLAG=#{stlMerFlag} and (o.CHK_FLAG='1' or o.CHK_FLAG='4')) </update> <!-- 修订 调账后订单是成功的,结算时没同步调涨标记为 调账成功已结算 SZL--> <!-- 操作 修改 成功状态、并结算中、并调帐标记不为null的记录为 调账成功已结算 SZL--> <update id="syncErrStlingState"> update t_order_list o set o.err_stl_flag='3' where o.order_stat = '1' and o.MER_STL_FLAG = '1' and o.err_stl_flag is not null </update> <update id="merUpdateAmountDifferOrder"> update t_order_list t set t.MER_ERR_STL_BATCH_NO=#{merStlBatchNo},t.ERR_STL_FLAG=#{newErrStlFlag} where t.order_no in (select order_no from t_order_list o where o.acqmer_code=#{acqmerCode} and o.txn_date<#{txnDate} and o.MER_STL_FLAG=#{oldMerStlFlag} and o.ORDER_STAT=#{orderStat} and o.CARDMER_TYPE=#{cardmerType} and o.STL_MER_FLAG=#{stlMerFlag} and o.CHK_FLAG=#{chkFlag} and o.ERR_STL_FLAG=#{oldErrStlFlag}) </update> <!-- 特约商户结算-先结算后对账 --> <select id="sumMerChkStlTxnAmt" resultType="Map"> select nvl(nvl(sum(o.txn_amt),0)+nvl(sum(o.DEAL_AMT),0),0) DTXNAMT from t_order_list o where o.acqmer_code=#{acqmerCode} and o.STL_MER_FLAG=#{stlMerFlag} and o.txn_date<#{txnDate} and o.CARDMER_TYPE=#{cardmerType} and o.mer_stl_flag=#{merStlFlag} and o.ORDER_STAT=#{orderStat} and o.txn_type in <foreach item="item" index="index" collection="txnType" open="(" separator="," close=")"> #{item} </foreach> </select> <select id="sumMerChkStlDealTxnAmt" resultType="Map"> select nvl(sum(o.txn_amt),0) DTXNAMT from t_order_list o where o.acqmer_code=#{acqmerCode} and o.STL_MER_FLAG=#{stlMerFlag} and o.txn_date<#{txnDate} and o.CARDMER_TYPE=#{cardmerType} and o.mer_stl_flag=#{merStlFlag} and o.ERR_STL_FLAG=#{errStlFlag} and o.txn_type in <foreach item="item" index="index" collection="txnType" open="(" separator="," close=")"> #{item} </foreach> and o.order_stat=#{orderStat} </select> <select id="sumMerAmountDifferTxnAmt" resultType="Map"> select nvl(sum(o.DEAL_AMT),0) DTXNAMT from t_order_list o where o.acqmer_code=#{acqmerCode} and o.STL_MER_FLAG=#{stlMerFlag} and o.txn_date<#{txnDate} and o.CARDMER_TYPE=#{cardmerType} and o.mer_stl_flag=#{merStlFlag} and o.ERR_STL_FLAG=#{errStlFlag} and o.txn_type in <foreach item="item" index="index" collection="txnType" open="(" separator="," close=")"> #{item} </foreach> and o.order_stat=#{orderStat} </select> <update id="merUpdatebefOrder"> update t_order_list t set t.MER_STL_BATCH_NO=#{merStlBatchNo},t.MER_STL_DATE=#{merStlDate}, t.MER_STL_FLAG=#{newMerStlFlag} where t.order_no in (select order_no from t_order_list o where o.acqmer_code=#{acqmerCode} and o.txn_date<#{txnDate} and o.mer_stl_flag=#{oldMerStlFlag} and o.ORDER_STAT=#{orderStat} and o.CARDMER_TYPE=#{cardmerType} and o.STL_MER_FLAG=#{stlMerFlag} ) </update> <update id="merNoChkUpdateAmountDifferOrder"> update t_order_list t set t.MER_ERR_STL_BATCH_NO=#{merStlBatchNo},t.ERR_STL_FLAG=#{newErrStlFlag} where t.order_no in (select order_no from t_order_list o where o.acqmer_code=#{acqmerCode} and o.txn_date<#{txnDate} and o.MER_STL_FLAG=#{oldMerStlFlag} and o.ORDER_STAT=#{orderStat} and o.CARDMER_TYPE=#{cardmerType} and o.STL_MER_FLAG=#{stlMerFlag} and o.ERR_STL_FLAG=#{oldErrStlFlag}) </update> <update id="merUpdateaftOrder"> update t_order_list t set t.MER_ERR_STL_BATCH_NO=#{merErrStlBatchNo}, t.ERR_STL_FLAG=#{errStlFlagaft} where t.order_no in (select order_no from t_order_list o where o.acqmer_code=#{acqmerCode} and o.txn_date<#{txnDate} and o.mer_stl_flag=#{merStlFlag} and o.CARDMER_TYPE=#{cardmerType} and o.STL_MER_FLAG=#{stlMerFlag} and o.ERR_STL_FLAG=#{errStlFlagbef} and o.ORDER_STAT=#{orderStat}) </update> <!-- 发卡机构结算-单用途卡-先对账 后结算--> <select id="sumCardSingleTxnAmt" resultType="Map"> select nvl(nvl(sum(o.txn_amt),0)+nvl(sum(o.DEAL_AMT),0),0) DTXNAMT from t_order_list o where o.acqmer_code=#{acqmerCode} and o.STL_MER_FLAG=#{stlMerFlag} and o.txn_date<#{txnDate} and o.CARDMER_TYPE=#{cardmerType} and o.mer_stl_flag=#{merStlFlag} and o.CHK_FLAG in ('1','4') and o.ORDER_STAT=#{orderStat} and o.txn_type in <foreach item="item" index="index" collection="txnType" open="(" separator="," close=")"> #{item} </foreach> and o.CARDMER_CODE=#{cardmerCode} </select> <update id="cardSingleUpdateOrder"> update t_order_list t set t.MER_STL_BATCH_NO=#{merStlBatchNo},t.MER_STL_DATE=#{merStlDate}, t.MER_STL_FLAG=#{newMerStlFlag} where t.order_no in (select order_no from t_order_list o where o.acqmer_code=#{acqmerCode} and o.txn_date<#{txnDate} and o.MER_STL_FLAG=#{oldMerStlFlag} and o.ORDER_STAT=#{orderStat} and o.CARDMER_TYPE=#{cardmerType} and o.STL_MER_FLAG=#{stlMerFlag} and o.CHK_FLAG in ('1','4') and o.CARDMER_CODE=#{cardmerCode}) </update> <update id="cardSingleUpdateAmountDifferOrder"> update t_order_list t set t.MER_ERR_STL_BATCH_NO=#{merStlBatchNo},t.ERR_STL_FLAG=#{newErrStlFlag} where t.order_no in (select order_no from t_order_list o where o.acqmer_code=#{acqmerCode} and o.txn_date<#{txnDate} and o.MER_STL_FLAG=#{oldMerStlFlag} and o.ORDER_STAT=#{orderStat} and o.CARDMER_TYPE=#{cardmerType} and o.STL_MER_FLAG=#{stlMerFlag} and o.CHK_FLAG in ('1','4') and o.ERR_STL_FLAG=#{oldErrStlFlag} and o.CARDMER_CODE=#{cardmerCode}) </update> <!-- 发卡机构结算-单用途卡-先结算后对账 --> <select id="sumCardSingleNoChkTxnAmt" resultType="Map"> select nvl(sum(o.txn_amt),0)+nvl(sum(o.DEAL_AMT),0) DTXNAMT from t_order_list o where o.acqmer_code=#{acqmerCode} and o.STL_MER_FLAG=#{stlMerFlag} and o.txn_date<#{txnDate} and o.CARDMER_TYPE=#{cardmerType} and o.mer_stl_flag=#{merStlFlag} and o.ORDER_STAT=#{orderStat} and o.txn_type in <foreach item="item" index="index" collection="txnType" open="(" separator="," close=")"> #{item} </foreach> and o.cardmer_code=#{cardmerCode} </select> <select id="sumCardSingleNoChkDealTxnAmt" resultType="Map"> select nvl(sum(o.txn_amt),0) DTXNAMT from t_order_list o where o.acqmer_code=#{acqmerCode} and o.STL_MER_FLAG=#{stlMerFlag} and o.txn_date<#{txnDate} and o.CARDMER_TYPE=#{cardmerType} and o.mer_stl_flag=#{merStlFlag} and o.ERR_STL_FLAG=#{errStlFlag} and o.txn_type in <foreach item="item" index="index" collection="txnType" open="(" separator="," close=")"> #{item} </foreach> and o.order_stat=#{orderStat} and o.cardmer_code=#{cardmerCode} </select> <select id="sumCardSingleNoChkAmountDifferTxnAmt" resultType="Map"> select nvl(sum(o.DEAL_AMT),0) DTXNAMT from t_order_list o where o.acqmer_code=#{acqmerCode} and o.STL_MER_FLAG=#{stlMerFlag} and o.txn_date<#{txnDate} and o.CARDMER_TYPE=#{cardmerType} and o.mer_stl_flag=#{merStlFlag} and o.ERR_STL_FLAG=#{errStlFlag} and o.txn_type in <foreach item="item" index="index" collection="txnType" open="(" separator="," close=")"> #{item} </foreach> and o.order_stat=#{orderStat} and o.cardmer_code=#{cardmerCode} </select> <update id="cardSingleNoChkUpdatebefOrder"> update t_order_list t set t.MER_STL_BATCH_NO=#{merStlBatchNo},t.MER_STL_DATE=#{merStlDate}, t.MER_STL_FLAG=#{newMerStlFlag} where t.order_no in (select order_no from t_order_list o where o.acqmer_code=#{acqmerCode} and o.txn_date<#{txnDate} and o.mer_stl_flag=#{oldMerStlFlag} and o.ORDER_STAT=#{orderStat} and o.CARDMER_TYPE=#{cardmerType} and o.STL_MER_FLAG=#{stlMerFlag} and o.cardmer_code=#{cardmerCode} ) </update> <update id="cardSingleNoChkUpdateAmountDifferOrder"> update t_order_list t set t.MER_ERR_STL_BATCH_NO=#{merStlBatchNo},t.ERR_STL_FLAG=#{newErrStlFlag} where t.order_no in (select order_no from t_order_list o where o.acqmer_code=#{acqmerCode} and o.txn_date<#{txnDate} and o.MER_STL_FLAG=#{oldMerStlFlag} and o.ORDER_STAT=#{orderStat} and o.CARDMER_TYPE=#{cardmerType} and o.STL_MER_FLAG=#{stlMerFlag} and o.ERR_STL_FLAG=#{oldErrStlFlag} and o.cardmer_code=#{cardmerCode}) </update> <update id="cardSingleNoChkUpdateaftOrder"> update t_order_list t set t.MER_ERR_STL_BATCH_NO=#{merErrStlBatchNo}, t.ERR_STL_FLAG=#{errStlFlagaft} where t.order_no in (select order_no from t_order_list o where o.acqmer_code=#{acqmerCode} and o.txn_date<#{txnDate} and o.mer_stl_flag=#{merStlFlag} and o.CARDMER_TYPE=#{cardmerType} and o.STL_MER_FLAG=#{stlMerFlag} and o.ERR_STL_FLAG=#{errStlFlagbef} and o.ORDER_STAT=#{orderStat} and o.cardmer_code=#{cardmerCode}) </update> <!-- 发卡机构结算-多用途卡-先对账后结算 --> <select id="sumCardChkStlTxnAmt" resultType="Map"> select nvl(sum(o.txn_amt),0) DTXNAMT from t_order_list o inner join t_cust_acct_list t on t.order_no=o.order_no and t.STL_FLAG=#{stlFlag} and t.CHK_FLAG=#{tchkFlag} and t.TXN_STAT=#{txnStat} and t.CARDMER_code=#{cardmerCode} and t.txn_date<#{txnDate} where o.MER_STL_FLAG=#{merStlFlag} and o.CHK_FLAG in ('1','4') and t.ORDER_STAT=#{orderStat} and o.txn_type in <foreach item="item" index="index" collection="txnType" open="(" separator="," close=")"> #{item} </foreach> and o.ACQMER_CODE=#{acqmerCode} </select> <update id="updateCardChkStlTxnAmt"> update t_order_list t set t.MER_STL_BATCH_NO=#{merStlBatchNo},t.MER_STL_DATE=#{merStlDate}, t.MER_STL_FLAG=#{merStlFlag} where t.cardmer_code=#{cardmerCode} and t.MER_STL_FLAG=#{oldMerStlFlag} and t.ORDER_STAT=#{orderStat} and t.ACQMER_CODE=#{acqmerCode} and t.ERR_STL_FLAG is null and t.CHK_FLAG in ('1','4') </update> <update id="updateCardChkDealStlTxnAmt"> update t_order_list t set t.MER_STL_BATCH_NO=#{merStlBatchNo},t.MER_STL_DATE=#{merStlDate}, t.MER_STL_FLAG=#{merStlFlag},t.ERR_STL_FLAG ='3',t.MER_ERR_STL_BATCH_NO=#{merStlBatchNo} where t.cardmer_code=#{cardmerCode} and t.MER_STL_FLAG=#{oldMerStlFlag} and t.ORDER_STAT=#{orderStat} and t.ACQMER_CODE=#{acqmerCode} and t.ERR_STL_FLAG ='1' and t.CHK_FLAG in ('1','4') </update> <!-- 发卡机构结算-多用途卡-先结算后对账 --> <select id="sumCardNoChkStlTxnAmt" resultType="Map"> select nvl(sum(o.txn_amt),0)+nvl(sum(o.DEAL_AMT),0) DTXNAMT from t_order_list o where o.acqmer_code=#{acqmerCode} and o.STL_MER_FLAG=#{stlMerFlag} and o.txn_date<#{txnDate} and o.CARDMER_TYPE=#{cardmerType} and o.mer_stl_flag=#{merStlFlag} and o.ORDER_STAT=#{orderStat} and o.txn_type in <foreach item="item" index="index" collection="txnType" open="(" separator="," close=")"> #{item} </foreach> and o.cardmer_code=#{cardmerCode} </select> <select id="sumCardNoChkDealStlTxnAmt" resultType="Map"> select nvl(sum(o.txn_amt),0) DTXNAMT from t_order_list o where o.acqmer_code=#{acqmerCode} and o.STL_MER_FLAG=#{stlMerFlag} and o.txn_date<#{txnDate} and o.CARDMER_TYPE=#{cardmerType} and o.mer_stl_flag=#{merStlFlag} and o.ERR_STL_FLAG=#{errStlFlag} and o.txn_type in <foreach item="item" index="index" collection="txnType" open="(" separator="," close=")"> #{item} </foreach> and o.CARDMER_code=#{cardmerCode} </select> <update id="updateCardNoChkStlTxn"> update t_order_list t set t.MER_STL_BATCH_NO=#{merStlBatchNo},t.MER_STL_DATE=#{merStlDate}, t.MER_STL_FLAG=#{merStlFlag} where t.cardmer_code=#{cardmerCode} and t.MER_STL_FLAG=#{oldMerStlFlag} and t.ORDER_STAT=#{orderStat} and t.ACQMER_CODE=#{acqmerCode} and t.ERR_STL_FLAG is null </update> <update id="updateCardNoChkDealStlTxn"> update t_order_list t set t.MER_ERR_STL_BATCH_NO=#{merErrStlBatchNo}, t.ERR_STL_FLAG=#{errStlFlagaft} where t.cardmer_code=#{cardmerCode} and t.MER_STL_FLAG=#{oldMerStlFlag} and t.ACQMER_CODE=#{acqmerCode} and t.ERR_STL_FLAG=#{errStlFlag} </update> <!-- 金额不符调账后更新订单调账金额 --> <update id="updateOriDealAmt"> update T_ORDER_LIST SET ERR_STL_FLAG=#{errStlFlag},COP_ERR_STL_FLAG=#{copErrStlFlag},DEAL_AMT = #{dealAmt} where ID = #{id} </update> <!-- 根据结算批次号更新商户结算标志 --> <update id="updateStlFlagByStlBatchNo"> update t_order_list <set> <if test="merStlFlag != null and merStlFlag !=''"> MER_STL_FLAG=#{merStlFlag}, </if> <if test="copStlFlag != null and copStlFlag !=''"> COP_STL_FLAG=#{copStlFlag}, </if> <if test="errStlFlag != null and errStlFlag !=''"> ERR_STL_FLAG=#{errStlFlag}, </if> <if test="copErrStlFlag != null and copErrStlFlag !=''"> COP_ERR_STL_FLAG=#{copErrStlFlag}, </if> </set> <where> <if test="merStlBatchNo != null and merStlBatchNo !=''"> and MER_STL_BATCH_NO=#{merStlBatchNo} </if> <if test="copStlBbatchNo != null and copStlBbatchNo !=''"> and COP_STL_BATCH_NO=#{copStlBbatchNo} </if> <if test="merErrStlBatchNo != null and merErrStlBatchNo !=''"> and MER_ERR_STL_BATCH_NO=#{merErrStlBatchNo} </if> <if test="copErrStlBatchNo != null and copErrStlBatchNo !=''"> and COP_ERR_STL_BATCH_NO=#{copErrStlBatchNo} </if> <if test="orderNo != null and orderNo !=''"> and ORDER_NO=#{orderNo} </if> </where> </update> <!-- 根据结算批次号更新商户结算标志 --> <update id="updateStlFlagByStlBatchNoFor11"> update T_ORDER_LIST SET ERR_STL_FLAG=#{errStlFlag} where MER_STL_BATCH_NO=#{merStlBatchNo} and txn_type='11' </update> <!-- 根据结算批次号更新商户结算标志 --> <select id="selectByStlBatchNo" parameterType="OrderListPO" resultMap="BaseResultMap"> select <include refid="Query_Column_List" /> from t_order_list <where> <if test="merStlBatchNo != null and merStlBatchNo !=''"> and MER_STL_BATCH_NO=#{merStlBatchNo} </if> <if test="copStlBbatchNo != null and copStlBbatchNo !=''"> and COP_STL_BATCH_NO=#{copStlBbatchNo} </if> <if test="merErrStlBatchNo != null and merErrStlBatchNo !=''"> and MER_ERR_STL_BATCH_NO=#{merErrStlBatchNo} </if> <if test="copErrStlBatchNo != null and copErrStlBatchNo !=''"> and COP_ERR_STL_BATCH_NO=#{copErrStlBatchNo} </if> </where> order by acqmer_code,order_no </select> <!-- 查询发卡机构结算是否需要参与结算的记录数--> <select id="countCardStlNum" resultType="Map"> select count(*) STLNUM from t_order_list t where (t.Mer_STL_FLAG in <foreach item="item" index="index" collection="stlFlag" open="(" separator="," close=")"> #{item} </foreach> or t.ERR_STL_FLAG in <foreach item="item" index="index" collection="errStlFlag" open="(" separator="," close=")"> #{item} </foreach>) and t.CARDMER_code=#{cardmerCode} </select> <!-- 查询商户是否需要参与结算的记录数--> <select id="countMerStlNum" resultType="Map"> select count(*) STLNUM from t_order_list t where (t.Mer_STL_FLAG in <foreach item="item" index="index" collection="merStlFlag" open="(" separator="," close=")"> #{item} </foreach> or t.ERR_STL_FLAG in <foreach item="item" index="index" collection="errStlFlag" open="(" separator="," close=")"> #{item} </foreach>) and t.ACQMER_CODE=#{acqmerCode} </select> <!-- 查询合作伙伴是否需要参与结算的记录数--> <select id="countCopStlNum" resultType="Map"> select count(*) STLNUM from t_order_list t where (t.COP_STL_FLAG in <foreach item="item" index="index" collection="copStlFlag" open="(" separator="," close=")"> #{item} </foreach> or t.COP_ERR_STL_FLAG in <foreach item="item" index="index" collection="copErrStlFlag" open="(" separator="," close=")"> #{item} </foreach>) and t.COPMER_CODE=#{copmerCode} </select> </mapper>
package com.ym.qab.ts.po; import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; public class OrderListPO implements Serializable { private static final long serialVersionUID = -8911518589443724L; private String id; private Date txnDate; private Date createTime; private String chnlId; private String orderNo; private String txnType; private String custNo; private String acctNo; private String acctType; private String cardmerCode; private Date merTime; private String merOrder; private String productName; private String acqmerCode; private String acqmerName; private String acqmerType; private String relAcct; private String relAcctType; private String relCardmerCode; private String orderStat; private String delFlag; private Date endTime; private Date orderDelTime; private String noteStat; private Date noteTime; private BigDecimal txnAmt; private BigDecimal befAmt; private BigDecimal txnFee; private String ccy; private String oriOrderNo; private BigDecimal ejectAmt; private String chkFlag; private String chkBatchNo; private Date chkDate; private String stlMerFlag; private String errStlFlag; private String copErrStlFlag; private BigDecimal dealAmt; private String merErrStlBatchNo; private String copErrStlBatchNo; private String copmerCode; private String cardmerType; private String merStlFlag; private String merStlBatchNo; private Date merStlDate; private String copStlFlag; private String copStlBatchNo; private Date copStlDate; private String memo; private Date orderCloseTime; private String posCode; private Date cardmerDate; private Date cardmerTime; private String cardmerSeq; private String operNo;// 操作员账号,liu.xu于2014.11.12添加 /** 支付方式:一维码支付、二维码支付 */ private String payMethod; public String getId() { return id; } public void setId(String id) { this.id = id; } public Date getTxnDate() { return txnDate; } public void setTxnDate(Date txnDate) { this.txnDate = txnDate; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public String getChnlId() { return chnlId; } public void setChnlId(String chnlId) { this.chnlId = chnlId == null ? null : chnlId.trim(); } public String getOrderNo() { return orderNo; } public void setOrderNo(String orderNo) { this.orderNo = orderNo == null ? null : orderNo.trim(); } public String getTxnType() { return txnType; } public void setTxnType(String txnType) { this.txnType = txnType == null ? null : txnType.trim(); } public String getCustNo() { return custNo; } public void setCustNo(String custNo) { this.custNo = custNo == null ? null : custNo.trim(); } public String getAcctNo() { return acctNo; } public void setAcctNo(String acctNo) { this.acctNo = acctNo == null ? null : acctNo.trim(); } public String getAcctType() { return acctType; } public void setAcctType(String acctType) { this.acctType = acctType == null ? null : acctType.trim(); } public String getCardmerCode() { return cardmerCode; } public void setCardmerCode(String cardmerCode) { this.cardmerCode = cardmerCode == null ? null : cardmerCode.trim(); } public Date getMerTime() { return merTime; } public void setMerTime(Date merTime) { this.merTime = merTime; } public String getMerOrder() { return merOrder; } public void setMerOrder(String merOrder) { this.merOrder = merOrder == null ? null : merOrder.trim(); } public String getProductName() { return productName; } public void setProductName(String productName) { this.productName = productName == null ? null : productName.trim(); } public String getAcqmerCode() { return acqmerCode; } public void setAcqmerCode(String acqmerCode) { this.acqmerCode = acqmerCode == null ? null : acqmerCode.trim(); } public String getAcqmerName() { return acqmerName; } public void setAcqmerName(String acqmerName) { this.acqmerName = acqmerName == null ? null : acqmerName.trim(); } public String getAcqmerType() { return acqmerType; } public void setAcqmerType(String acqmerType) { this.acqmerType = acqmerType == null ? null : acqmerType.trim(); } public String getPosCode() { return posCode; } public void setPosCode(String posCode) { this.posCode = posCode; } public String getRelAcct() { return relAcct; } public void setRelAcct(String relAcct) { this.relAcct = relAcct == null ? null : relAcct.trim(); } public String getRelAcctType() { return relAcctType; } public void setRelAcctType(String relAcctType) { this.relAcctType = relAcctType == null ? null : relAcctType.trim(); } public String getRelCardmerCode() { return relCardmerCode; } public void setRelCardmerCode(String relCardmerCode) { this.relCardmerCode = relCardmerCode; } public String getOrderStat() { return orderStat; } public void setOrderStat(String orderStat) { this.orderStat = orderStat; } public String getDelFlag() { return delFlag; } public void setDelFlag(String delFlag) { this.delFlag = delFlag == null ? null : delFlag.trim(); } public Date getEndTime() { return endTime; } public void setEndTime(Date endTime) { this.endTime = endTime; } public Date getOrderDelTime() { return orderDelTime; } public void setOrderDelTime(Date orderDelTime) { this.orderDelTime = orderDelTime; } public String getNoteStat() { return noteStat; } public void setNoteStat(String noteStat) { this.noteStat = noteStat == null ? null : noteStat.trim(); } public Date getNoteTime() { return noteTime; } public void setNoteTime(Date noteTime) { this.noteTime = noteTime; } public BigDecimal getTxnAmt() { return txnAmt; } public void setTxnAmt(BigDecimal txnAmt) { this.txnAmt = txnAmt; } public BigDecimal getBefAmt() { return befAmt; } public void setBefAmt(BigDecimal befAmt) { this.befAmt = befAmt; } public BigDecimal getTxnFee() { return txnFee; } public void setTxnFee(BigDecimal txnFee) { this.txnFee = txnFee; } public String getCcy() { return ccy; } public void setCcy(String ccy) { this.ccy = ccy == null ? null : ccy.trim(); } public String getOriOrderNo() { return oriOrderNo; } public void setOriOrderNo(String oriOrderNo) { this.oriOrderNo = oriOrderNo == null ? null : oriOrderNo.trim(); } public BigDecimal getEjectAmt() { return ejectAmt; } public void setEjectAmt(BigDecimal ejectAmt) { this.ejectAmt = ejectAmt; } public String getChkFlag() { return chkFlag; } public void setChkFlag(String chkFlag) { this.chkFlag = chkFlag == null ? null : chkFlag.trim(); } public String getChkBatchNo() { return chkBatchNo; } public void setChkBatchNo(String chkBatchNo) { this.chkBatchNo = chkBatchNo == null ? null : chkBatchNo.trim(); } public Date getChkDate() { return chkDate; } public void setChkDate(Date chkDate) { this.chkDate = chkDate; } public String getMerStlFlag() { return merStlFlag; } public void setMerStlFlag(String merStlFlag) { this.merStlFlag = merStlFlag == null ? null : merStlFlag.trim(); } public String getMerStlBatchNo() { return merStlBatchNo; } public void setMerStlBatchNo(String merStlBatchNo) { this.merStlBatchNo = merStlBatchNo == null ? null : merStlBatchNo.trim(); } public Date getMerStlDate() { return merStlDate; } public void setMerStlDate(Date merStlDate) { this.merStlDate = merStlDate; } public String getCopStlFlag() { return copStlFlag; } public void setCopStlFlag(String copStlFlag) { this.copStlFlag = copStlFlag == null ? null : copStlFlag.trim(); } public String getCopStlBatchNo() { return copStlBatchNo; } public void setCopStlBatchNo(String copStlBatchNo) { this.copStlBatchNo = copStlBatchNo == null ? null : copStlBatchNo.trim(); } public Date getCopStlDate() { return copStlDate; } public void setCopStlDate(Date copStlDate) { this.copStlDate = copStlDate; } public Date getOrderCloseTime() { return orderCloseTime; } public void setOrderCloseTime(Date orderCloseTime) { this.orderCloseTime = orderCloseTime; } public String getMemo() { return memo; } public void setMemo(String memo) { this.memo = memo == null ? null : memo.trim(); } public String getStlMerFlag() { return stlMerFlag; } public void setStlMerFlag(String stlMerFlag) { this.stlMerFlag = stlMerFlag; } public String getErrStlFlag() { return errStlFlag; } public void setErrStlFlag(String errStlFlag) { this.errStlFlag = errStlFlag; } public String getMerErrStlBatchNo() { return merErrStlBatchNo; } public void setMerErrStlBatchNo(String merErrStlBatchNo) { this.merErrStlBatchNo = merErrStlBatchNo; } public String getCopErrStlBatchNo() { return copErrStlBatchNo; } public void setCopErrStlBatchNo(String copErrStlBatchNo) { this.copErrStlBatchNo = copErrStlBatchNo; } public String getCopmerCode() { return copmerCode; } public void setCopmerCode(String copmerCode) { this.copmerCode = copmerCode; } public BigDecimal getDealAmt() { return dealAmt; } public void setDealAmt(BigDecimal dealAmt) { this.dealAmt = dealAmt; } public String getCardmerType() { return cardmerType; } public void setCardmerType(String cardmerType) { this.cardmerType = cardmerType; } public String getCopErrStlFlag() { return copErrStlFlag; } public void setCopErrStlFlag(String copErrStlFlag) { this.copErrStlFlag = copErrStlFlag; } public Date getCardmerDate() { return cardmerDate; } public void setCardmerDate(Date cardmerDate) { this.cardmerDate = cardmerDate; } public Date getCardmerTime() { return cardmerTime; } public void setCardmerTime(Date cardmerTime) { this.cardmerTime = cardmerTime; } public String getCardmerSeq() { return cardmerSeq; } public void setCardmerSeq(String cardmerSeq) { this.cardmerSeq = cardmerSeq; } public String getPayMethod() { return payMethod; } public void setPayMethod(String payMethod) { this.payMethod = payMethod; } public String getOperNo() { return operNo; } public void setOperNo(String operNo) { this.operNo = operNo; } }
package com.ym.qab.ts.dao.impl; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.StringUtils; import org.apache.ibatis.session.RowBounds; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.ym.qab.comm.QueryResult; import com.ym.qab.commons.consts.CommonConst; import com.ym.qab.commons.consts.OrderStatConsts; import com.ym.qab.commons.dao.BaseDao; import com.ym.qab.commons.exception.PersistenceException; import com.ym.qab.commons.utils.DateUtil; import com.ym.qab.commons.utils.FunIMsgFormat; import com.ym.qab.ts.dao.IOrderListDao; import com.ym.qab.ts.po.OrderListPO; /** * * @author WUDUFENG * @since 2014年4月24日 */ public class OrderListDaoImpl extends BaseDao<OrderListPO, String> implements IOrderListDao { private final Logger logger = LoggerFactory.getLogger(getClass().getName()); private static final String QUERY_ORDER_LIST = ".queryOrderListByPage"; private static final String QUERY_ORDER_COUNT = ".queryOrderCount"; private static final String QUERY_ORDER_BYORDERNOT = ".queryOrderByOrderNo"; private static final String UPDATE_ORDER_BYORDERNOT = ".updateByOrderNo"; private static final String QUERY_MON_ORDER_LIST = ".queryMonOrderList"; private static final String QUERY_MON_ORDER_COUNT = ".queryMonOrderListCount"; @Override public QueryResult<OrderListPO> search(Date ltTxnDate, String custNo, String acqmerType, String acqmerCode, String productName, int startIndex, int maxResult) { if (productName != null && !productName.trim().equals("")) { productName = "%" + productName + "%"; } String[] properties = { "custNo", "acqmerType", "acqmerCode", "productName", "txnDate", "delFlag" }; Object[] propertyValues = { custNo, acqmerType, acqmerCode, productName, ltTxnDate, CommonConst.ORDER_DEL_FLAG_N }; List<OrderListPO> orderList = selectByMap(properties, propertyValues, startIndex, maxResult, null, null); long totalRecord = countByStatementPostfix(".selectByMapTotalrecord", properties, propertyValues); QueryResult<OrderListPO> queryResult = new QueryResult<OrderListPO>(); queryResult.setResultList(orderList); queryResult.setTotalRecord(totalRecord); return queryResult; } @Override public List<OrderListPO> search(List<String> orderNoList, String custNo, Date date) { String[] properties = { "orderNoList", "custNo", "txnDate", "delFlag" }; Object[] propertyValues = { orderNoList, custNo, date, CommonConst.ORDER_DEL_FLAG_N }; List<OrderListPO> orderList = selectByMap(properties, propertyValues, null, null); return orderList; } @Override public OrderListPO get(String merOrder, String acqmerCode) { String[] properties = { "merOrder", "acqmerCode" }; Object[] propertyValues = { merOrder, acqmerCode }; return findOneByStatementPostfix(".getByMerOrder", properties, propertyValues, null, null); } @Override public int updateStat(String orderNo, String stat, String preStat, Date endTime) { return updateStat(orderNo, stat, preStat, null, null, endTime,null); } @Override public int updateStat(String orderNo, String stat, String preStat, String acctNo, BigDecimal txnAmt, Date endTime,String cardmerCode) { String[] properties = { "orderNo", "orderStat", "preStat", "endTime", "acctNo", "txnAmt","cardmerCode" }; Object[] propertyValues = { orderNo, stat, preStat, endTime, acctNo, txnAmt,cardmerCode }; int record = updateByStatementPostfix(".updateStatByOrderNo", properties, propertyValues); return record; } @Override public int updateChkFlag(String id, String chkFlag, String chkBatchNo) { String[] properties = { "id", "chkFlag", "chkBatchNo" }; Object[] propertyValues = { id, chkFlag, chkBatchNo }; int record = updateByStatementPostfix(".updateChkFlag", properties, propertyValues); return record; } /** * 根据客户号查询客户订单信息 * * @param custInfoPO * @return */ public List<OrderListPO> queryOrderList(OrderListPO orderListPO, int start, int limit) { logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG .getFormat("开始调queryOrderList方法,传入的参数是。" + orderListPO)); RowBounds rowBound = new RowBounds(start, limit); String clazzName = orderListPO.getClass().getName(); List<OrderListPO> orderListPOList = this.getSqlSession().selectList(clazzName + QUERY_ORDER_LIST, orderListPO, rowBound); logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("结束执行queryOrderList方法,执行的结果取到数据条数为:" + orderListPOList.size())); return orderListPOList; } /** * 查询客户交易记录,进行大额、频繁交易监控 * * @param parMap * @return */ public List<OrderListPO> queryMonOrderList(Map<String,Object> parMap, int start, int limit) { logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG .getFormat("开始调queryMonOrderList方法,传入的参数是:" + parMap)); RowBounds rowBound = new RowBounds(start, limit); String clazzName = this.getClazzName(); List<OrderListPO> orderMonListPOList = this.getSqlSession().selectList(clazzName + QUERY_MON_ORDER_LIST, parMap, rowBound); logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("结束执行queryMonOrderList方法,执行的结果取到数据条数为:" + orderMonListPOList.size())); return orderMonListPOList; } /** * 根据查询订单条数 * * @param parMap * @return */ public long queryMonOrderListCount(Map<String,Object> parMap) { logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("开始调queryMonOrderListCount方法,传入的参数是:" + parMap)); String clazzName = this.getClazzName(); Long orderListPOCount = this.getSqlSession().selectOne(clazzName + QUERY_MON_ORDER_COUNT, parMap); logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("结束执行queryMonOrderListCount方法,执行的结果取到数据条数为:" + orderListPOCount)); return orderListPOCount; } @Override public void syncErrStlingState() { this.getSqlSession().update(clazzName + ".syncErrStlingState"); } @Override public Map<String, Object> getFrozenOrderInfo(String orderNo) { assert orderNo != null : "订单号不能为空"; Map<String, Object> params = new HashMap<>(); params.put("orderNo", orderNo); Map<String, Map<String,Object>> orderInfoMap = getSqlSession().selectMap(clazzName + ".frozenOrderInfo",params, "ORDER_NO"); return orderInfoMap.get(orderNo); } /** * 根据客户号查询客户订单条数 * * @param custInfoPO * @return */ public long queryOrderCount(OrderListPO orderListPO) { logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("开始调queryOrderCount方法,传入的参数是。" + orderListPO)); String clazzName = orderListPO.getClass().getName(); Long orderListPOCount = this.getSqlSession().selectOne(clazzName + QUERY_ORDER_COUNT, orderListPO); logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("结束执行queryOrderCount方法,执行的结果取到数据条数为:" + orderListPOCount)); return orderListPOCount; } /** * 根据订单号查询客户订单信息(此方法可扩展) * * @param orderListPO * @return */ public OrderListPO queryOrderByOrderNo(OrderListPO orderListPO) { logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("开始调queryOrderByOrderNo方法,传入的参数是。" + orderListPO)); String clazzName = orderListPO.getClass().getName(); OrderListPO po = this.getSqlSession().selectOne(clazzName + QUERY_ORDER_BYORDERNOT, orderListPO); return po; } /** * 根据订单号更新客户订单信息(此方法可扩展) * * @param custInfoPO * @return */ public void updateOrderByOrderNo(OrderListPO orderListPO) { logger.debug(FunIMsgFormat.MsgStyle.DEFAULT_LOG.getFormat("开始调updateOrderByOrderNo方法,传入的参数是。" + orderListPO)); String clazzName = orderListPO.getClass().getName(); this.getSqlSession().update(clazzName + UPDATE_ORDER_BYORDERNOT, orderListPO); } @Override public List<BigDecimal> getSumTxnAmt(String custNo, Date begin, Date endDate) { Map<String, Object> parameter = new HashMap<String, Object>(); parameter.put("custNo", custNo); parameter.put("txnDateBegin", begin); parameter.put("txnDateEnd", endDate); parameter.put("delFlag", CommonConst.ORDER_DEL_FLAG_N); parameter.put("orderStat", OrderStatConsts.SUCESS); parameter.put("txnType", CommonConst.TXN_TYPE_PAY); Map<String, Map<String, Object>> map = getSqlSession().selectMap(clazzName + ".sumTxnAmt", parameter, "YYMM"); List<BigDecimal> list = new ArrayList<BigDecimal>(); if (map != null && map.size() > 0) { Date d = endDate; while (d.compareTo(begin) >= 0) { String yyMM = DateUtil.format(d, "yyMM"); Map<String, Object> o = map.get(yyMM); if (o != null) { list.add((BigDecimal) o.get("AMT")); } else { list.add(BigDecimal.ZERO); } d = DateUtil.add(d, Calendar.MONTH, -1); } } return list; } @Override public Map<String, Object> findMapByStatementPostfix(String statementPostfix, String[] properties, Object[] propertyValues) throws PersistenceException { logger .debug( FunIMsgFormat.MsgStyle.DEFAULT_LOG .getFormat("开始调用{}的findMapByStatementPostfix方法,传递的参数是statementPostfix={},properties={},propertyValues={},orderBy={},order={}。"), new Object[] { this.getClass().getName(), statementPostfix, properties, propertyValues }); if (StringUtils.isEmpty(statementPostfix)) return null; Map<String, Object> map = new HashMap<String, Object>(); if (ArrayUtils.isNotEmpty(properties) && ArrayUtils.isNotEmpty(propertyValues)) { int prosKeyLen = properties.length; int prosValueLen = propertyValues.length; if (prosKeyLen != prosValueLen) throw new PersistenceException("传递的参数不匹配!"); for (int i = 0; i < prosKeyLen; i++) { map.put(properties[i], propertyValues[i]); } } return getSqlSession().selectOne(clazzName + statementPostfix, map); } /** * 根据订单号更新状态(特约商户发送通知状态) * * @param orderNo * @param stat * @param preStat * @param endTime * @return */ @Override public int updateNoteStat(String orderNo,String preStat, String noteStat, Date noteTime) { String[] properties = { "orderNo","preStat", "noteStat", "noteTime"}; Object[] propertyValues = { orderNo,preStat, noteStat, noteTime}; int record = updateByStatementPostfix(".updateNoteStatByOrderNo", properties, propertyValues); return record; } /** * 根据操作员账号及订单号查询订单信息 * * @param operNo * 操作员账号 * @param orderNo * 订单号(模糊匹配) * @param startIndex * 分页开始索引 * @param maxResult * 每页条数 * @return * @author liu.xu * @since 2014-11-13 */ public QueryResult<OrderListPO> search(String operNo, String orderNo, int startIndex, int maxResult) { if (StringUtils.isNotBlank(orderNo)) { orderNo = "%" + orderNo + "%"; } String[] properties = { "operNo", "orderNo", "delFlag" }; Object[] propertyValues = { operNo, orderNo, CommonConst.ORDER_DEL_FLAG_N }; // 查询未删除的记录 List<OrderListPO> orderList = findByStatementPostfix(".selectByOperNo", properties, propertyValues, startIndex, maxResult); long totalRecord = countByStatementPostfix(".selectTotalrecordByOperNo", properties, propertyValues); QueryResult<OrderListPO> queryResult = new QueryResult<OrderListPO>(); queryResult.setResultList(orderList); queryResult.setTotalRecord(totalRecord); return queryResult; } /** * 查询交易净消费额(消费总额-退货总额) * * @param operNo * 操作员账号 * @param orderNo * 订单号(模糊匹配) * @return * @author liu.xu * @since 2014-11-17 */ public BigDecimal selectNetAmountByOperNo(String operNo, String orderNo) { if (StringUtils.isNotBlank(orderNo)) { orderNo = "%" + orderNo + "%"; } String[] properties = { "operNo", "orderNo", "delFlag" }; Object[] propertyValues = { operNo, orderNo, CommonConst.ORDER_DEL_FLAG_N }; // 查询未删除的记录 return this.<BigDecimal> selectByProperties(".selectNetAmountByOperNo", properties, propertyValues); } }
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> <configuration> <typeAliases> <!-- A --> <typeAlias alias="AcctBindChgPO" type="com.ym.qab.uc.po.AcctBindChgPO" /> <typeAlias alias="AcctFundsBalancePO" type="com.ym.qab.ts.po.AcctFundsBalancePO" /> <typeAlias alias="AssDetailPO" type="com.ym.qab.mer.po.AssDetailPO" /> <typeAlias alias="AreaCodePO" type="com.ym.qab.comm.po.AreaCodePO" /> <typeAlias alias="AddrBookPO" type="com.ym.qab.bmoa.po.AddrBookPO" /> <typeAlias alias="AppStorePO" type="com.ym.qab.uc.po.AppStorePO" /> <typeAlias alias="AcctTatisticsTotalPO" type="com.ym.qab.bmoa.po.AcctTatisticsTotalPO" /> <typeAlias alias="AdPlayPlanPO" type="com.ym.qab.ts.po.AdPlayPlanPO" /> <!-- B --> <typeAlias alias="BatchFileInfoPO" type="com.ym.qab.comm.po.BatchFileInfoPO" /> <typeAlias alias="BindPrepayCardPO" type="com.ym.qab.uc.po.BindPrepayCardPO" /> <typeAlias alias="BlackCustPO" type="com.ym.qab.uc.po.BlackCustPO" /> <typeAlias alias="BlackWhiteListPO" type="com.ym.qab.uc.po.BlackWhiteListPO" /> <typeAlias alias="BlackWhiteListChgPO" type="com.ym.qab.bmoa.po.BlackWhiteListChgPO" /> <typeAlias alias="BlackWhiteTatisticsTotalPO" type="com.ym.qab.bmoa.po.BlackWhiteTatisticsTotalPO" /> <!-- C --> <typeAlias alias="CardBusinessInfoPO" type="com.ym.qab.uc.po.CardBusinessInfoPO" /> <typeAlias alias="CardmerRangeRegionPO" type="com.ym.qab.mer.po.CardmerRangeRegionPO" /> <typeAlias alias="CardmerRangeMertypePO" type="com.ym.qab.mer.po.CardmerRangeMertypePO" /> <typeAlias alias="ChkInfoPO" type="com.ym.qab.bmfinance.po.ChkInfoPO" /> <typeAlias alias="ChkMerlistPO" type="com.ym.qab.bmfinance.po.ChkMerlistPO" /> <typeAlias alias="ChkRulePO" type="com.ym.qab.bmfinance.po.ChkRulePO" /> <typeAlias alias="CmAppMngPO" type="com.ym.qab.uc.po.CmAppMngPO" /> <typeAlias alias="CmCodePO" type="com.ym.qab.uc.po.CmCodePO" /> <typeAlias alias="CmCustKeyPO" type="com.ym.qab.uc.po.CmCustKeyPO" /> <typeAlias alias="CmSysInfoPO" type="com.ym.qab.comm.po.CmSysInfoPO" /> <typeAlias alias="CustAcctBookPO" type="com.ym.qab.uc.po.CustAcctBookPO" /> <typeAlias alias="CustAcctListPO" type="com.ym.qab.ts.po.CustAcctListPO" /> <typeAlias alias="CustInfoPO" type="com.ym.qab.uc.po.CustInfoPO" /> <typeAlias alias="CustLoginInfoPO" type="com.ym.qab.uc.po.CustLoginInfoPO" /> <typeAlias alias="CustLoginLogPO" type="com.ym.qab.uc.po.CustLoginLogPO" /> <typeAlias alias="CustPwdGetBookPO" type="com.ym.qab.uc.po.CustPwdGetBookPO" /> <typeAlias alias="CardDiscInfoPO" type="com.ym.qab.ts.po.CardDiscInfoPO" /> <typeAlias alias="CardMerInfoPO" type="com.ym.qab.mer.po.CardmerInfoPO" /> <typeAlias alias="CopmerInfoPO" type="com.ym.qab.mer.po.CopmerInfoPO" /> <typeAlias alias="CopmerRateInfoPO" type="com.ym.qab.mer.po.CopmerRateInfoPO" /> <typeAlias alias="CmEmailPO" type="com.ym.qab.comm.po.CmEmailPO" /> <typeAlias alias="CardMerRateInfoPO" type="com.ym.qab.mer.po.CardMerRateInfoPO" /> <typeAlias alias="CardmerKindConfPO" type="com.ym.qab.mer.po.CardmerKindConfPO" /> <typeAlias alias="CmParmPO" type="com.ym.qab.uc.po.CmParmPO" /> <typeAlias alias="CmVcTotPO" type="com.ym.qab.uc.po.CmVcTotPO" /> <typeAlias alias="CustFrzBookHisPO" type="com.ym.qab.bmoa.po.CustFrzBookHisPO" /> <typeAlias alias="CustAcctCtrlPO" type="com.ym.qab.uc.po.CustAcctCtrlPO" /> <typeAlias alias="CustLoginLogHisPO" type="com.ym.qab.bmoa.po.CustLoginLogHisPO" /> <typeAlias alias="CustAcctConfPO" type="com.ym.qab.uc.po.CustAcctConfPO" /> <typeAlias alias="CmTxnInfoPO" type="com.ym.qab.ts.po.CmTxnInfoPO" /> <typeAlias alias="CustFrzBookPO" type="com.ym.qab.bmoa.po.CustFrzBookPO" /> <typeAlias alias="CustSysLmtConfPO" type="com.ym.qab.ts.po.CustSysLmtConfPO" /> <typeAlias alias="CustLmtTotalPO" type="com.ym.qab.ts.po.CustLmtTotalPO" /> <typeAlias alias="CustTatisticsTotalPO" type="com.ym.qab.bmoa.po.CustTatisticsTotalPO" /> <typeAlias alias="CustTranListPO" type="com.ym.qab.uc.po.CustTranListPO" /> <typeAlias alias="CmLogoFilePO" type="com.ym.qab.bmpublic.po.CmLogoFilePO" /> <typeAlias alias="CardSelectMerPO" type="com.ym.qab.uc.po.CardSelectMerPO"/> <typeAlias alias="CardSelectKindPO" type="com.ym.qab.uc.po.CardSelectKindPO"/> <typeAlias alias="CardSelectAcctPO" type="com.ym.qab.uc.po.CardSelectAcctPO"/> <typeAlias alias="CouponListPO" type="com.ym.qab.ts.po.CouponListPO"/> <typeAlias alias="CustTransferListPO" type="com.ym.qab.ts.po.CustTransferListPO"/> <!-- D --> <typeAlias alias="DiscActInfoPO" type="com.ym.qab.ts.po.DiscActInfoPO" /> <!-- E --> <typeAlias alias="ESLoginPO" type="com.ym.qab.uc.po.ESLoginPO" /> <!-- 电子凭证 --> <typeAlias alias="ECouponPO" type="com.ym.qab.ts.po.ECouponPO"/> <!-- G --> <!-- I --> <typeAlias alias="InAcctBookPO" type="com.ym.qab.mer.po.InAcctBookPO" /> <typeAlias alias="InAcctListPO" type="com.ym.qab.mer.po.InAcctListPO" /> <!-- L --> <typeAlias alias="LoginTatisticsTotalPO" type="com.ym.qab.bmoa.po.LoginTatisticsTotalPO" /> <!-- M --> <typeAlias alias="MerInfoPO" type="com.ym.qab.mer.po.MerInfoPO" /> <typeAlias alias="MinNumberNoPwdPO" type="com.ym.qab.uc.po.MinNumberNoPwdPO" /> <typeAlias alias="MerAcctBookPO" type="com.ym.qab.mer.po.MerAcctBookPO" /> <typeAlias alias="MerAcctListPO" type="com.ym.qab.mer.po.MerAcctListPO" /> <typeAlias alias="MerRateInfoPO" type="com.ym.qab.mer.po.MerRateInfoPO" /> <typeAlias alias="MerStoreInfoPO" type="com.ym.qab.mer.po.MerStoreInfoPO" /> <typeAlias alias="MerTypePO" type="com.ym.qab.bmmer.po.MerTypePO" /> <typeAlias alias="MerAddrBookPO" type="com.ym.qab.mer.po.MerAddrBookPO" /> <typeAlias alias="MerKeyPO" type="com.ym.qab.mer.po.MerKeyPO" /> <typeAlias alias="MonBigatmLmtPO" type="com.ym.qab.bmmonitor.po.MonBigatmLmtPO" /> <typeAlias alias="MonBigatmPayPO" type="com.ym.qab.bmmonitor.po.MonBigatmPayPO" /> <typeAlias alias="MonBigatmAverPO" type="com.ym.qab.bmmonitor.po.MonBigatmAverPO" /> <typeAlias alias="MonFrequentListPO" type="com.ym.qab.bmmonitor.po.MonFrequentListPO" /> <typeAlias alias="MonFrequentConfPO" type="com.ym.qab.bmmonitor.po.MonFrequentConfPO" /> <typeAlias alias="MonFundsFrequentPO" type="com.ym.qab.bmmonitor.po.MonFundsFrequentPO" /> <typeAlias alias="MonFundsListPO" type="com.ym.qab.bmmonitor.po.MonFundsListPO" /> <typeAlias alias="MonPwdLockPO" type="com.ym.qab.bmmonitor.po.MonPwdLockPO" /> <typeAlias alias="MonRemoteLoginPO" type="com.ym.qab.bmmonitor.po.MonRemoteLoginPO" /> <typeAlias alias="MonBatchTimePO" type="com.ym.qab.bmmonitor.po.MonBatchTimePO" /> <typeAlias alias="MerGoodsPO" type="com.ym.qab.bmpublic.po.MerGoodsPO"/> <!-- O --> <typeAlias alias="OrderGoodsListPO" type="com.ym.qab.ts.po.OrderGoodsListPO" /> <typeAlias alias="OrderListPO" type="com.ym.qab.ts.po.OrderListPO" /> <typeAlias alias="OrderTatisticsTotalPO" type="com.ym.qab.bmoa.po.OrderTatisticsTotalPO" /> <!-- Q --> <typeAlias alias="QRFilePO" type="com.ym.qab.bmpublic.po.QRFilePO" /> <!-- R --> <typeAlias alias="RefundOrderListPO" type="com.ym.qab.bmfinance.po.RefundOrderListPO" /> <typeAlias alias="ReportPO" type="com.ym.qab.bmfinance.po.ReportPO" /> <!-- S --> <typeAlias alias="SafeQuePO" type="com.ym.qab.uc.po.SafeQuePO" /> <typeAlias type="com.ym.qab.comm.po.SmsMessagePO" alias="SmsMessagePO" /> <!-- V --> <typeAlias alias="ViewMonitorQueryListPO" type="com.ym.qab.bmmonitor.po.ViewMonitorQueryListPO" /> <!-- W --> <typeAlias type="com.ym.qab.bmmer.po.WorkflowAuditPO" alias="WorkflowAuditPO" /> <typeAlias type="com.ym.qab.bmmer.po.WorkflowInfoPO" alias="WorkflowInfoPO" /> <typeAlias type="com.ym.qab.bmpublic.po.WghtParmPO" alias="WghtParmPO" /> </typeAliases> <plugins> <plugin interceptor="com.ym.qab.commons.utils.PagePlugin"> <property name="dialect" value="oracle" /> <property name="pageSqlId" value=".*ByPage" /> </plugin> </plugins> </configuration>
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="configLocation" value="classpath:META-INF/com/unilife/mybatis-config.xml" /> <property name="mapperLocations" > <list> <value>classpath:META-INF/com/unilife/bmmdt/sqlmap/DeviceInfoPO.xml</value> <value>classpath:META-INF/com/unilife/bmmdt/sqlmap/MdtInfoPO.xml</value> <value>classpath:META-INF/com/unilife/bmmdt/sqlmap/MdtAlarmInfoPO.xml</value> <value>classpath:META-INF/com/unilife/bmmdt/sqlmap/MdtParameterPO.xml</value> <value>classpath:META-INF/com/unilife/finance/sqlmap/OrderAccountSettlePO.xml</value> <value>classpath:META-INF/com/unilife/finance/sqlmap/OrderAccountCashPO.xml</value> <value>classpath:META-INF/com/unilife/finance/sqlmap/OrderAccountCheckPO.xml</value> <value>classpath:META-INF/com/unilife/finance/sqlmap/OrderAccountInfoPO.xml</value> </list> </property> </bean> <bean id="baseDao" class="com.unilife.commons.dao.BaseDao" abstract="true"> <property name="sqlSessionFactory" ref="sqlSessionFactory" /> </bean> <bean id="sequenceGenerator" class="com.unilife.common.SequenceGeneratorImpl" parent="baseDao"> </bean> <bean id="deviceInfoDao" class="com.unilife.bmmdt.dao.impl.DeviceInfoDaoImpl" parent="baseDao"> </bean> <bean id="merInfoDao" class="com.unilife.bmmdt.dao.impl.MdtInfoDaoImpl" parent="baseDao"> </bean> <bean id="merAlarmInfoDao" class="com.unilife.bmmdt.dao.impl.MdtAlarmInfoDaoImpl" parent="baseDao"> </bean> <bean id="merParameterDao" class="com.unilife.bmmdt.dao.impl.MdtParameterDaoImpl" parent="baseDao"> </bean> <bean id="orderAccountSettleDao" class="com.unilife.finance.dao.impl.OrderAccountSettleDaoImpl" parent="baseDao"> </bean> <bean id="orderAccountCashDao" class="com.unilife.finance.dao.impl.OrderAccountCashDaoImpl" parent="baseDao"> </bean> <bean id="orderAccountCheckDao" class="com.unilife.finance.dao.impl.OrderAccountCheckDaoImpl" parent="baseDao"> </bean> <bean id="orderAccountInfoDao" class="com.unilife.finance.dao.impl.OrderAccountInfoDaoImpl" parent="baseDao"> </bean> </beans>
String[] properties = { "chkDate", "merFlag", "merCode"}; Object[] propertyValues = { chkEndDate, merFlag, merCode}; ChkInfoPO chkInfoPO = chkInfoDao.findOneByStatementPostfix(".selectByProperties", properties, propertyValues, null, null);