MCPcopy Create free account
hub / github.com/diyhi/bbs / HelpRepositoryImpl

Class HelpRepositoryImpl

src/main/java/cms/repository/help/impl/HelpRepositoryImpl.java:21–197  ·  view source on GitHub ↗

帮助管理接口实现类

Source from the content-addressed store, hash-verified

19 *
20 */
21@Repository
22@Transactional
23public class HelpRepositoryImpl extends DaoSupport<Help> implements HelpRepository {
24 @Resource HelpTypeRepository helpTypeRepository;
25 /**
26 * 根据Id查询帮助
27 * @param helpId 帮助Id
28 * @return
29 */
30 @Transactional(readOnly=true, propagation=Propagation.NOT_SUPPORTED)
31 public Help findById(Long helpId){
32 Query query = em.createQuery("select o from Help o where o.id=?1")
33 .setParameter(1, helpId);
34 List<Help> list = query.getResultList();
35 for(Help p : list){
36 return p;
37 }
38 return null;
39 }
40 /**
41 * 根据Id集合查询帮助
42 * @param helpIdList 帮助Id集合
43 * @return
44 */
45 @Transactional(readOnly=true, propagation=Propagation.NOT_SUPPORTED)
46 public List<Help> findByIdList(List<Long> helpIdList){
47 Query query = em.createQuery("select o from Help o where o.id in(:helpIdList)")
48 .setParameter("helpIdList", helpIdList);
49 return query.getResultList();
50 }
51 /**
52 * 根据分类Id查询帮助
53 * @param helpTypeId 帮助分类Id
54 * @return
55 */
56 @Transactional(readOnly=true, propagation=Propagation.NOT_SUPPORTED)
57 public List<Help> findByTypeId(Long helpTypeId){
58 Query query = em.createQuery("select o from Help o where o.helpTypeId=?1 and o.visible=?2")
59 .setParameter(1, helpTypeId)
60 .setParameter(2, true);
61 return query.getResultList();
62 }
63
64
65 /**
66 * 保存帮助
67 * @param help 帮助
68 */
69 public Integer saveHelp(Help help){
70
71
72 //增加帮助数量
73 int i = helpTypeRepository.addHelpQuantity(help.getHelpTypeId());
74 this.save(help);
75 return i;
76 }
77 /**
78 * 修改帮助

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…