Commit 6e7df45c1ab3350943d26099a1dc1461ac4a490d
1 parent
6439af72
Exists in
master
remove some unuseful code
Showing
2 changed files
with
6 additions
and
35 deletions
Show diff stats
build.gradle
src/main/resources/template/bazhuayun/RepositoryTemplate.ftl
| ... | ... | @@ -6,50 +6,21 @@ import java.util.Base64; |
| 6 | 6 | import java.util.List; |
| 7 | 7 | import java.util.Map; |
| 8 | 8 | |
| 9 | -import org.msgpack.MessagePack; | |
| 10 | 9 | import org.springframework.stereotype.Repository; |
| 11 | 10 | |
| 12 | 11 | import ${basePackage}.bean.entity.${entityClassSimpleName}; |
| 13 | -import ${basePackage}.bean.vo.${voClassSimpleName}; | |
| 14 | -import com.taover.repository.CustomJdbcTemplate; | |
| 15 | -import com.taover.util.UtilHttpRequestMap; | |
| 16 | -import com.taover.util.UtilObject; | |
| 12 | +import com.taover.repository.CustomJdbcTemplateWrapperTenant; | |
| 13 | +import com.taover.repository.jdbctemplate.JdbcTemplateWrapperTenant; | |
| 17 | 14 | |
| 18 | 15 | @Repository |
| 19 | -public class ${repositoryClassSimpleName} extends CustomJdbcTemplate<${entityClassSimpleName}, Long>{ | |
| 16 | +public class ${repositoryClassSimpleName} extends CustomJdbcTemplateWrapperTenant<${entityClassSimpleName}, Long>{ | |
| 20 | 17 | |
| 21 | 18 | public ${repositoryClassSimpleName}() throws Exception { |
| 22 | 19 | super(); |
| 23 | 20 | } |
| 24 | 21 | |
| 25 | - public String getSsidById(Long id) throws Exception{ | |
| 26 | - MessagePack pack = new MessagePack(); | |
| 27 | - return Base64.getEncoder().encodeToString(pack.write(new Long[]{id, id, id})); | |
| 22 | + public ${repositoryClassSimpleName}(JdbcTemplateWrapperTenant jdbcTemplate) throws Exception { | |
| 23 | + super(jdbcTemplate); | |
| 28 | 24 | } |
| 29 | 25 | |
| 30 | - public Integer getIdBySsid(String ssid) throws Exception{ | |
| 31 | - MessagePack pack = new MessagePack(); | |
| 32 | - return pack.read(Base64.getDecoder().decode(ssid), Long[].class)[0]; | |
| 33 | - } | |
| 34 | - | |
| 35 | - public Map<String, Object> getVoPage(List<Object[]> condition, Integer page, Integer size) throws Exception{ | |
| 36 | - Map<String, Object> entityData = this.findPageByCondition(condition, page, size); | |
| 37 | - List<${entityClassSimpleName}> entityList = (List<${entityClassSimpleName}>) entityData.get("rows"); | |
| 38 | - List<${voClassSimpleName}> voList = new ArrayList<${voClassSimpleName}>(); | |
| 39 | - for(int i=0; i<entityList.size(); ++i){ | |
| 40 | - voList.add(this.getVoByEntity(entityList.get(i))); | |
| 41 | - } | |
| 42 | - entityData.put("rows", voList); | |
| 43 | - return entityData; | |
| 44 | - } | |
| 45 | - | |
| 46 | - public ${voClassSimpleName} getVoByEntity(${entityClassSimpleName} entity) throws Exception{ | |
| 47 | - ${voClassSimpleName} voObj = null; | |
| 48 | - try { | |
| 49 | - voObj = UtilObject.fieldCopy(entity, ${voClassSimpleName}.class, true, null); | |
| 50 | - } catch (Exception e) { | |
| 51 | - throw new Exception("对象转换失败"); | |
| 52 | - } | |
| 53 | - return voObj; | |
| 54 | - } | |
| 55 | 26 | } | ... | ... |