PickUpPointDaoImpl.java 7.02 KB
package com.diligrp.website.dao.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.diligrp.website.dao.PickUpPointDao;
import com.diligrp.website.domain.PickUpPointDomain;
import com.diligrp.website.util.dao.BaseQuery;
import com.diligrp.website.util.dao.impl.BaseDaoImpl;

/**
 * <B>Description</B> TODO <br />
 * <B>Copyright</B> Copyright (c) 2014 www.diligrp.com All rights reserved. <br />
 * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br />
 * <B>Company</B> 地利集团
 * @createTime 2014年8月13日 下午3:55:58
 * @author liujie
 */
@Repository
public class PickUpPointDaoImpl extends BaseDaoImpl<PickUpPointDomain>
        implements PickUpPointDao {

    private static final String PREFIX = PickUpPointDaoImpl.class
            .getCanonicalName();

    /*
     * (non-Javadoc)
     * @see
     * com.diligrp.website.dao.PickUpPointDao#getPickInfo(com.diligrp.website
     * .util.dao.BaseQuery)
     */
    @Override
    public List<PickUpPointDomain> getPickInfo(BaseQuery bq) throws Exception {
        return getSqlSessionTemplate().selectList(
                PREFIX + ".SELECT-PICK-UP-INFO", bq);
    }

    /*
     * (non-Javadoc)
     * @see
     * com.diligrp.website.dao.PickUpPointDao#getCountPickInfo(com.diligrp.website
     * .util.dao.BaseQuery)
     */
    @Override
    public Integer getCountPickInfo(BaseQuery bq) throws Exception {
        return getSqlSessionTemplate().selectOne(
                PREFIX + ".SELECT-COUNT-PICK-UP-INFO", bq);
    }

    /*
     * (non-Javadoc)
     * @see
     * com.diligrp.website.dao.PickUpPointDao#savePickUpInfo(com.diligrp.website
     * .domain.PickUpPointDomain)
     */
    @Override
    public Long savePickUpInfo(PickUpPointDomain pickUpPointDomain)
            throws Exception {
        getSqlSessionTemplate().insert(PREFIX + ".INSERT-PICKUP-INFO", pickUpPointDomain);
        return pickUpPointDomain.getId();
    }

    /*
     * (non-Javadoc)
     * @see
     * com.diligrp.website.dao.PickUpPointDao#modifyPickUpInfo(com.diligrp.website
     * .domain.PickUpPointDomain)
     */
    @Override
    public boolean modifyPickUpInfo(PickUpPointDomain pickUpPointDomain)
            throws Exception {
        return getSqlSessionTemplate().update(PREFIX + ".UPDATE-PICKUP-INFO",
                pickUpPointDomain) > 0 ? true : false;
    }

    /*
     * (non-Javadoc)
     * @see
     * com.diligrp.website.dao.PickUpPointDao#modifyPickUpInfoDeafult(com.diligrp
     * .website.domain.PickUpPointDomain)
     */
    @Override
    public boolean modifyPickUpInfoDeafult() throws Exception {
        return getSqlSessionTemplate().update(
                PREFIX + ".UPDATE-PICKUP-INFO-STATE-NOT-DEAFULT") > 0;
    }

    /*
     * (non-Javadoc)
     * @see
     * com.diligrp.website.dao.PickUpPointDao#getPickUpPointDomainInfo(java.
     * lang.Long)
     */
    @Override
    public PickUpPointDomain getPickUpPointDomainInfo(Long id) throws Exception {
        return getSqlSessionTemplate().selectOne(
                PREFIX + ".SELECT-ONE-PICK-UP-INFO", id);
    }

    /*
     * (non-Javadoc)
     * @see
     * com.diligrp.website.dao.PickUpPointDao#modifyStateByPickUpId(java.lang
     * .Long)
     */
    @Override
    public boolean modifyStateByPickUpId(Long id) throws Exception {
        return getSqlSessionTemplate().update(
                PREFIX + ".UPDATE-PICKUP-INFO-STATE", id) > 0;
    }

    /*
     * (non-Javadoc)
     * @see
     * com.diligrp.website.dao.PickUpPointDao#getRelationPickInfo(java.lang.
     * Long)
     */
    @Override
    public List<PickUpPointDomain> getRelationPickInfo(Long id) {
        return getSqlSessionTemplate().selectList(
                PREFIX + ".SELECT-RELATION-PICKINFO", id);
    }

    /*
     * (non-Javadoc)
     * @see com.diligrp.website.dao.PickUpPointDao#getNotMarketPickInfo()
     */
    @Override
    public List<PickUpPointDomain> getNotMarketPickInfo() {
        return getSqlSessionTemplate().selectList(
                PREFIX + ".SELECT-IS-MARKET-RELATION-PICKINFO");
    }

    /*
     * (non-Javadoc)
     * @see
     * com.diligrp.website.dao.PickUpPointDao#modifyRelationPoint(java.util.Map)
     */
    @Override
    public boolean modifyRelationPoint(Map<String, Long> map) {
        return getSqlSessionTemplate().update(
                PREFIX + ".UPDATE-RELATION-PICKINFO", map) > 0;
    }

    /*
     * (non-Javadoc)
     * @see
     * com.diligrp.website.dao.PickUpPointDao#modifyRelationPointParent(java
     * .lang.Long)
     */
    @Override
    public boolean modifyRelationPointParent(Long id) {
        return getSqlSessionTemplate().update(
                PREFIX + ".UPDATE-PICKUP-RELATION-INFO-STATE", id) > 0;
    }

    /*
     * (non-Javadoc)
     * @see com.diligrp.website.dao.PickUpPointDao#getIsMarketPickUpInfo()
     */
    @Override
    public List<PickUpPointDomain> getIsMarketPickUpInfo() {
        return getSqlSessionTemplate().selectList(
                PREFIX + ".SELECT-IS-MARKET-PICKINFO");
    }

    /* (non-Javadoc)
     * @see com.diligrp.website.dao.PickUpPointDao#getIsNotMarketPickUpInfo()
     */
    @Override
    public List<PickUpPointDomain> getIsNotMarketPickUpInfo() throws Exception {
        return getSqlSessionTemplate().selectList(
                PREFIX + ".SELECT-IS-NOT-MARKET-PICKINFO");
    }
    /* (non-Javadoc)
     * @see com.diligrp.website.dao.PickUpPointDao#getAllMarketPickUpInfo()
     */
    @Override
    public List<PickUpPointDomain> getAllMarketPickUpInfo() throws Exception {
        return getSqlSessionTemplate().selectList(
                PREFIX + ".SELECT-ALL-MARKET-PICKINFO");
    }

    /* (non-Javadoc)
     * @see com.diligrp.website.dao.PickUpPointDao#getCodeByPickUpInfo(java.lang.String)
     */
    @Override
    public PickUpPointDomain getCodeByPickUpInfo(String code) throws Exception {
        return  getSqlSessionTemplate().selectOne(
                PREFIX + ".SELECT-CODE-BY-PICKINFO",code);
    }

	@Override
	public PickUpPointDomain getDefaultPickUpInfo() throws Exception {
	    return  getSqlSessionTemplate().selectOne(
                PREFIX + ".SELECT-DEFALUT-PICK-UP-INFO");
	}

    @Override
    public List<PickUpPointDomain> getPickUpInfoByName(String pickName) {
        return  getSqlSessionTemplate().selectList(PREFIX + ".getPickUpInfoByName", pickName);
    }

    @Override
    public List<PickUpPointDomain> getRecommendPickUp() {
        return  getSqlSessionTemplate().selectList(PREFIX + ".getRecommendPickUp");
    }

    @Override
    public List<PickUpPointDomain> getPickUpListByCityId(Long cityId) {
        return  getSqlSessionTemplate().selectList(PREFIX + ".getPickUpListByCityId", cityId);
    }

    @Override
    public List<PickUpPointDomain> getPickUpInfoByCityName(String cityName) {
        return  getSqlSessionTemplate().selectList(PREFIX + ".getPickUpInfoByCityName", cityName);
    }

    @Override
    public List<PickUpPointDomain> getAllPickUpListByCityId(Long cityId) {
        return  getSqlSessionTemplate().selectList(PREFIX + ".getAllPickUpListByCityId", cityId);
    }

}