2d7e16ccec1ae9d0ef96d534458704289fc679ab.svn-base
2.97 KB
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
/**
* Copyright © 2012-2014 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
*/
package com.thinkgem.jeesite.modules.reg.service.base;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.service.CrudService;
import com.thinkgem.jeesite.common.utils.StringUtils;
import com.thinkgem.jeesite.modules.reg.dao.base.RegBaseChxx11Dao;
import com.thinkgem.jeesite.modules.reg.dao.base.RegBaseZbinfo11Dao;
import com.thinkgem.jeesite.modules.reg.entity.base.RegBaseChxx11;
import com.thinkgem.jeesite.modules.reg.entity.base.RegBaseZbinfo11;
/**
* 测绘信息Service
* @author jiangdb
* @version 2015-11-23
*/
@Service
@Transactional(readOnly = true)
public class RegBaseChxx11Service extends CrudService<RegBaseChxx11Dao, RegBaseChxx11> {
@Autowired
private RegBaseZbinfo11Dao regBaseZbinfoDao;
public RegBaseChxx11 get(String id) {
//return super.get(id);
RegBaseChxx11 regBaseChxx = super.get(id);
regBaseChxx.setRegBaseZbinfoList(regBaseZbinfoDao.findList(new RegBaseZbinfo11(regBaseChxx)));
return regBaseChxx;
}
public List<RegBaseChxx11> findList(RegBaseChxx11 regBaseChxx) {
return super.findList(regBaseChxx);
}
public Page<RegBaseChxx11> findPage(Page<RegBaseChxx11> page, RegBaseChxx11 regBaseChxx) {
return super.findPage(page, regBaseChxx);
}
@Transactional(readOnly = false)
public void save(RegBaseChxx11 regBaseChxx) {
super.save(regBaseChxx);
for (RegBaseZbinfo11 regBaseZbinfo : regBaseChxx.getRegBaseZbinfoList()){
if (regBaseZbinfo.getId() == null){
continue;
}
System.out.println(RegBaseZbinfo11.DEL_FLAG_NORMAL);
if (RegBaseZbinfo11.DEL_FLAG_NORMAL.equals(regBaseZbinfo.getDelFlag())){
if (StringUtils.isBlank(regBaseZbinfo.getId())){
regBaseZbinfo.setMainId(regBaseChxx);
regBaseZbinfo.preInsert();
regBaseZbinfoDao.insert(regBaseZbinfo);
}else{
regBaseZbinfo.preUpdate();
regBaseZbinfoDao.update(regBaseZbinfo);
}
}else{
regBaseZbinfoDao.delete(regBaseZbinfo);
}
}
}
@Transactional(readOnly = false)
public void drsave(RegBaseChxx11 regBaseChxx) {
super.save(regBaseChxx);
for (RegBaseZbinfo11 regBaseZbinfo : regBaseChxx.getRegBaseZbinfoList()){
System.out.println(RegBaseZbinfo11.DEL_FLAG_NORMAL);
if (RegBaseZbinfo11.DEL_FLAG_NORMAL.equals(regBaseZbinfo.getDelFlag())){
if (StringUtils.isBlank(regBaseZbinfo.getId())){
regBaseZbinfo.setMainId(regBaseChxx);
regBaseZbinfo.preInsert();
regBaseZbinfoDao.insert(regBaseZbinfo);
}else{
regBaseZbinfo.preUpdate();
regBaseZbinfoDao.update(regBaseZbinfo);
}
}else{
regBaseZbinfoDao.delete(regBaseZbinfo);
}
}
}
@Transactional(readOnly = false)
public void delete(RegBaseChxx11 regBaseChxx) {
super.delete(regBaseChxx);
}
}