|
@@ -1,44 +1,45 @@
|
|
|
package cn.vbdsm.manage.dao;
|
|
package cn.vbdsm.manage.dao;
|
|
|
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
|
|
+import cn.vbdsm.model.ApplySite;
|
|
|
|
|
+import org.springframework.stereotype.Repository;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
import javax.core.common.jdbc.BaseDaoSupport;
|
|
import javax.core.common.jdbc.BaseDaoSupport;
|
|
|
import javax.core.common.jdbc.QueryRule;
|
|
import javax.core.common.jdbc.QueryRule;
|
|
|
import javax.sql.DataSource;
|
|
import javax.sql.DataSource;
|
|
|
-
|
|
|
|
|
-import org.springframework.stereotype.Repository;
|
|
|
|
|
-
|
|
|
|
|
-import cn.vbdsm.model.ApplySite;
|
|
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
|
|
|
@Repository
|
|
@Repository
|
|
|
public class ApplySiteDao extends BaseDaoSupport<ApplySite, Long> {
|
|
public class ApplySiteDao extends BaseDaoSupport<ApplySite, Long> {
|
|
|
|
|
|
|
|
- @Resource(name="dynamicDataSource")
|
|
|
|
|
- public void setDataSource(DataSource dataSource){
|
|
|
|
|
- super.setDataSourceReadOnly(dataSource);
|
|
|
|
|
- super.setDataSourceWrite(dataSource);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @Override
|
|
|
|
|
- protected String getPKColumn() { return "id"; }
|
|
|
|
|
-
|
|
|
|
|
- public List<ApplySite> selectBySiteId(Integer siteId) {
|
|
|
|
|
- QueryRule queryRule = QueryRule.getInstance();
|
|
|
|
|
- queryRule.andEqual("siteId", siteId);
|
|
|
|
|
- return super.find(queryRule);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public List<ApplySite> selectList(Integer siteId, List<Long> roleIds) {
|
|
|
|
|
- QueryRule queryRule = QueryRule.getInstance();
|
|
|
|
|
- queryRule.andEqual("siteId", siteId);
|
|
|
|
|
- queryRule.andIn("roleId", roleIds);
|
|
|
|
|
- return super.find(queryRule);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public int deleteByAppId(Long appId) {
|
|
|
|
|
- String sql="delete from t_apply_site where applyId = ?";
|
|
|
|
|
- return super.update(sql, appId);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ @Resource(name = "dynamicDataSource")
|
|
|
|
|
+ public void setDataSource(DataSource dataSource) {
|
|
|
|
|
+ super.setDataSourceReadOnly(dataSource);
|
|
|
|
|
+ super.setDataSourceWrite(dataSource);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ protected String getPKColumn() {
|
|
|
|
|
+ return "id";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public List<ApplySite> selectBySiteId(Integer siteId) {
|
|
|
|
|
+ QueryRule queryRule = QueryRule.getInstance();
|
|
|
|
|
+ queryRule.andEqual("siteId", siteId);
|
|
|
|
|
+ return super.find(queryRule);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public List<ApplySite> selectList(Integer siteId, List<Long> roleIds) {
|
|
|
|
|
+ QueryRule queryRule = QueryRule.getInstance();
|
|
|
|
|
+ queryRule.andEqual("siteId", siteId);
|
|
|
|
|
+ queryRule.andIn("roleId", roleIds);
|
|
|
|
|
+ return super.find(queryRule);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public int deleteByAppId(Long appId) {
|
|
|
|
|
+ //内置的root的应用不能被删除
|
|
|
|
|
+ String sql = "delete from t_apply_site where applyId = ? and roleId != 1";
|
|
|
|
|
+ return super.update(sql, appId);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
}
|
|
}
|