commit | author | age
|
a18bfa
|
1 |
package com.changhong.epc.admin.service.master.impl; |
Z |
2 |
|
|
3 |
import com.changhong.epc.admin.mapper.centen.master.MasterElementMapper; |
|
4 |
import com.changhong.epc.admin.mapper.centen.master.MasterValueMapper; |
|
5 |
import com.changhong.epc.bean.tenant.master.MasterAlias; |
|
6 |
import com.changhong.epc.bean.tenant.master.MasterEleValue; |
|
7 |
import com.changhong.epc.bean.tenant.master.MasterElement; |
|
8 |
import com.changhong.epc.bean.tenant.master.extend.MasterElementExtend; |
|
9 |
import com.changhong.epc.config.service.MasterElementService; |
|
10 |
import org.springframework.stereotype.Service; |
|
11 |
|
|
12 |
import javax.annotation.Resource; |
|
13 |
import java.util.List; |
|
14 |
import java.util.Objects; |
|
15 |
|
|
16 |
@Service |
|
17 |
public class MasterElementServiceImpl extends MasterElementService { |
|
18 |
|
|
19 |
@Resource |
|
20 |
private MasterElementMapper masterElementMapper; |
|
21 |
|
|
22 |
@Resource |
|
23 |
private MasterValueMapper masterValueMapper; |
|
24 |
|
|
25 |
@Override |
|
26 |
public List<MasterElementExtend> selectByCode(String defineCode) { |
|
27 |
return masterElementMapper.selectByCode(defineCode); |
|
28 |
} |
|
29 |
|
|
30 |
@Override |
|
31 |
public String getValFunc(MasterEleValue value) { |
|
32 |
return Objects.toString(masterValueMapper.getVal(value),""); |
|
33 |
} |
|
34 |
|
|
35 |
@Override |
|
36 |
public List<MasterElement> elementInfos(MasterElement masterList) { |
|
37 |
return masterElementMapper.elementInfos(masterList.getDefineCode()); |
|
38 |
} |
|
39 |
|
|
40 |
@Override |
|
41 |
public int updateAlias(MasterAlias alias) { |
|
42 |
String defCode = alias.getDefineCode(); |
|
43 |
int count = -1; |
|
44 |
//清空原有alias |
|
45 |
masterElementMapper.updateAlias(defCode, null, ""); |
|
46 |
//修改新得元素code |
|
47 |
if(!"".equals( alias.getCode()) && alias.getCode()!=null){ |
|
48 |
count += masterElementMapper.updateAlias(defCode, alias.getCode(), "code"); |
|
49 |
} |
|
50 |
//修改新的得value |
|
51 |
if(!"".equals( alias.getName()) && alias.getName()!=null) { |
|
52 |
count += masterElementMapper.updateAlias(defCode, alias.getName(), "value"); |
|
53 |
} |
|
54 |
return count; |
|
55 |
} |
|
56 |
|
|
57 |
public MasterElement geteleCode(String code){ |
|
58 |
|
|
59 |
MasterElement masterElement=new MasterElement(); |
|
60 |
masterElement.setName(masterElementMapper.geteleCode(code,"value")); |
|
61 |
masterElement.setCode(masterElementMapper.geteleCode(code,"code")); |
|
62 |
return masterElement; |
|
63 |
} |
|
64 |
} |