001// ______________________________________________________
002// Generated by sql2java - https://github.com/10km/sql2java-2-6-7 (custom branch) 
003// modified by guyadong from
004// sql2java original version https://sourceforge.net/projects/sql2java/ 
005// JDBC driver used at code generation time: com.mysql.jdbc.Driver
006// template: manager.interface.java.vm
007// ______________________________________________________
008package net.gdface.facelog.db;
009import net.gdface.facelog.db.exception.ObjectRetrievalException;
010import net.gdface.facelog.db.exception.RuntimeDaoException;
011
012/**
013 * Interface to handle database calls (save, load, count, etc...) for the fl_permit table.<br>
014 * Remarks: 通行权限关联表
015 * @author guyadong
016 */
017public interface IPermitManager extends TableManager<PermitBean>
018{  
019    //////////////////////////////////////
020    // PRIMARY KEY METHODS
021    //////////////////////////////////////
022
023    //1
024    /**
025     * Loads a {@link PermitBean} from the fl_permit using primary key fields.
026     *
027     * @param deviceGroupId Integer - PK# 1
028     * @param personGroupId Integer - PK# 2
029     * @return a unique PermitBean or {@code null} if not found
030     * @throws RuntimeDaoException
031     */
032    public PermitBean loadByPrimaryKey(Integer deviceGroupId,Integer personGroupId)throws RuntimeDaoException;
033
034    //1.1
035    /**
036     * Loads a {@link PermitBean} from the fl_permit using primary key fields.
037     *
038     * @param deviceGroupId Integer - PK# 1
039     * @param personGroupId Integer - PK# 2
040     * @return a unique PermitBean
041     * @throws ObjectRetrievalException if not found
042     * @throws RuntimeDaoException
043     */
044    public PermitBean loadByPrimaryKeyChecked(Integer deviceGroupId,Integer personGroupId) throws RuntimeDaoException,ObjectRetrievalException;
045    
046    //1.4
047    /**
048     * Returns true if this fl_permit contains row with primary key fields.
049     * @param deviceGroupId Integer - PK# 1
050     * @param personGroupId Integer - PK# 2
051     * @return
052     * @throws RuntimeDaoException
053     */
054    public boolean existsPrimaryKey(Integer deviceGroupId,Integer personGroupId)throws RuntimeDaoException;
055    //2
056    /**
057     * Delete row according to its primary keys.<br>
058     * all keys must not be null
059     *
060     * @param deviceGroupId Integer - PK# 1
061     * @param personGroupId Integer - PK# 2
062     * @return the number of deleted rows
063     * @throws RuntimeDaoException
064     */
065    public int deleteByPrimaryKey(Integer deviceGroupId,Integer personGroupId)throws RuntimeDaoException;
066    //2.4
067    /**
068     * Delete beans.<br>
069     *
070     * @param beans PermitBean collection wille be deleted
071     * @return the number of deleted rows
072     * @throws RuntimeDaoException
073     */
074    public int delete(PermitBean... beans)throws RuntimeDaoException;
075    //2.5
076    /**
077     * Delete beans.<br>
078     *
079     * @param beans PermitBean collection wille be deleted
080     * @return the number of deleted rows
081     * @throws RuntimeDaoException
082     */
083    public int delete(java.util.Collection<PermitBean> beans)throws RuntimeDaoException;
084 
085    //3.5 SYNC SAVE 
086    /**
087     * Save the PermitBean bean and referenced beans and imported beans into the database.
088     *
089     * @param bean the {@link PermitBean} bean to be saved
090     * @param refDevicegroupByDeviceGroupId the {@link DeviceGroupBean} bean referenced by {@link PermitBean} 
091     * @param refPersongroupByPersonGroupId the {@link PersonGroupBean} bean referenced by {@link PermitBean} 
092         * @return the inserted or updated {@link PermitBean} bean
093     * @throws RuntimeDaoException
094     */
095    public PermitBean save(PermitBean bean
096        , DeviceGroupBean refDevicegroupByDeviceGroupId , PersonGroupBean refPersongroupByPersonGroupId 
097        )throws RuntimeDaoException;
098    //3.6 SYNC SAVE AS TRANSACTION
099    /**
100     * Transaction version for sync save<br>
101     * see also {@link #save(PermitBean , DeviceGroupBean , PersonGroupBean )}
102     * @param bean the {@link PermitBean} bean to be saved
103     * @param refDevicegroupByDeviceGroupId the {@link DeviceGroupBean} bean referenced by {@link PermitBean} 
104     * @param refPersongroupByPersonGroupId the {@link PersonGroupBean} bean referenced by {@link PermitBean} 
105         * @return the inserted or updated {@link PermitBean} bean
106     * @throws RuntimeDaoException
107     */
108    public PermitBean saveAsTransaction(final PermitBean bean
109        ,final DeviceGroupBean refDevicegroupByDeviceGroupId ,final PersonGroupBean refPersongroupByPersonGroupId 
110        )throws RuntimeDaoException;
111      //////////////////////////////////////
112    // GET/SET FOREIGN KEY BEAN METHOD
113    //////////////////////////////////////
114    //5.1 GET REFERENCED VALUE
115    /**
116     * Retrieves the {@link DeviceGroupBean} object referenced by {@link PermitBean#getDeviceGroupId}() field.<br>
117     * FK_NAME : fl_permit_ibfk_1
118     * @param bean the {@link PermitBean}
119     * @return the associated {@link DeviceGroupBean} bean or {@code null} if {@code bean} is {@code null}
120     * @throws RuntimeDaoException
121     */
122    public DeviceGroupBean getReferencedByDeviceGroupId(PermitBean bean)throws RuntimeDaoException;
123
124    //5.2 SET REFERENCED 
125    /**
126     * Associates the {@link PermitBean} object to the {@link DeviceGroupBean} object by {@link PermitBean#getDeviceGroupId}() field.
127     *
128     * @param bean the {@link PermitBean} object to use
129     * @param beanToSet the {@link DeviceGroupBean} object to associate to the {@link PermitBean}
130     * @return always beanToSet saved
131     * @throws RuntimeDaoException
132     */
133    public DeviceGroupBean setReferencedByDeviceGroupId(PermitBean bean, DeviceGroupBean beanToSet)throws RuntimeDaoException;
134    //5.1 GET REFERENCED VALUE
135    /**
136     * Retrieves the {@link PersonGroupBean} object referenced by {@link PermitBean#getPersonGroupId}() field.<br>
137     * FK_NAME : fl_permit_ibfk_2
138     * @param bean the {@link PermitBean}
139     * @return the associated {@link PersonGroupBean} bean or {@code null} if {@code bean} is {@code null}
140     * @throws RuntimeDaoException
141     */
142    public PersonGroupBean getReferencedByPersonGroupId(PermitBean bean)throws RuntimeDaoException;
143
144    //5.2 SET REFERENCED 
145    /**
146     * Associates the {@link PermitBean} object to the {@link PersonGroupBean} object by {@link PermitBean#getPersonGroupId}() field.
147     *
148     * @param bean the {@link PermitBean} object to use
149     * @param beanToSet the {@link PersonGroupBean} object to associate to the {@link PermitBean}
150     * @return always beanToSet saved
151     * @throws RuntimeDaoException
152     */
153    public PersonGroupBean setReferencedByPersonGroupId(PermitBean bean, PersonGroupBean beanToSet)throws RuntimeDaoException;
154
155
156}