ludc
2025-01-16 986aa62ed00bee39363bab41b4eeb8259d446efd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
package com.vci.server.portal.service;
 
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.List;
 
import com.vci.server.base.persistence.dao.BaseService;
import com.vci.server.portal.dao.impl.PLActionEntityDaoImpl;
import com.vci.server.portal.dao.impl.PLTypeActionEntityDaoImpl;
import com.vci.server.portal.entity.PLActionEntity;
import com.vci.server.portal.entity.PLTypeActionEntity;
 
public class PLTypeActionEntityService extends BaseService{
    private static PLTypeActionEntityService instance = null;
    private DateFormat dFormat = new SimpleDateFormat("yyyy-MM-dd");
    
    private PLTypeActionEntityService(){
        
    }
    
    public static PLTypeActionEntityService getInstance(){
        if(instance == null){
            instance = new PLTypeActionEntityService();
        }
        return instance;
    }
    /**
     * 新增action对象
     * @param obj
     * @throws Throwable 
     */
    public boolean savePLTypeActionEntity(PLTypeActionEntity obj) throws Throwable {
 
        try {
            PLTypeActionEntityDaoImpl daoImpl = new PLTypeActionEntityDaoImpl();
            daoImpl.saveOrUpdate(obj);
            return true;
        } catch(Throwable e){
            throw e;
        }
    }
    
    
    /**
     * 删除action对象
     * @param obj
     * @return
     * @throws Throwable 
     */
    public boolean deletePLActionEntity(PLTypeActionEntity obj) throws Throwable{
        try {
            PLTypeActionEntityDaoImpl daoImpl = new PLTypeActionEntityDaoImpl();
            daoImpl.delete(obj);
            return true;
        } catch(Throwable e){
            throw e;
        }
        
    }
    
    public List<PLTypeActionEntity> getAllTypeAction()  throws Throwable{
        try {
            PLTypeActionEntityDaoImpl daoImpl = new PLTypeActionEntityDaoImpl();
            //String sql = " from PLTypeActionEntity";
            return daoImpl.loadAll();
        } catch(Throwable e){
            throw e;
        }
        
    }
 
    /**
     * 根据Id删除指定的action对象 
     * @param id
     * @return
     * @throws Throwable 
     */
    public boolean deletePLTypeActionEntityByTypeAndAction(String type, String actionoId) throws Throwable{
        try {
            PLTypeActionEntityDaoImpl daoImpl = new PLTypeActionEntityDaoImpl();
            StringBuilder sql = new StringBuilder("select t.* from PLTYPEACTION t where t.typeName=? and t.actionoid=?");
            List<PLTypeActionEntity> loadAll = daoImpl.findEntites(sql.toString(), new Object[]{type, actionoId}, "", PLTypeActionEntity.class);
            if (loadAll != null && loadAll.size() > 0) {
                for(PLTypeActionEntity action: loadAll){
                    daoImpl.delete(action);
                }
            }
            return true;
        } catch(Throwable e){
            throw e;
        }
        
    }
 
    
    /**
     * 获取type下所有PLAction
     * @return
     * @throws Throwable 
     */
    public List<PLActionEntity> getAllPLActionEntityByType(String type) throws Throwable{
        try {
            PLActionEntityDaoImpl daoImpl = new PLActionEntityDaoImpl();
            StringBuilder sql = new StringBuilder("select p.* from PLAction p, PLTYPEACTION t where p.ploid=t.actionoId and t.typeName=? order by p.plCode");
            List<PLActionEntity> loadAll = daoImpl.findEntites(sql.toString(), new Object[]{type}, "", PLActionEntity.class);
            return loadAll;
        } catch(Throwable e){
            throw e;
        }
    }
 
}