提交 7274b36f 编写于 作者: ibizdev's avatar ibizdev

generator before deploy...

generator before deploy registry.cn-shanghai.aliyuncs.com/ibizsys/samplesolution-demosys-api-demoapi:2022.11.07.001
上级 89d8bdc4
...@@ -12,4 +12,4 @@ ...@@ -12,4 +12,4 @@
**.iml **.iml
*.jar *.jar
*.log *.log
.DS_Store .DS_Store
\ No newline at end of file
...@@ -50,4 +50,4 @@ public class BootApplication extends WebMvcConfigurerAdapter { ...@@ -50,4 +50,4 @@ public class BootApplication extends WebMvcConfigurerAdapter {
super.addArgumentResolvers(argumentResolvers); super.addArgumentResolvers(argumentResolvers);
argumentResolvers.add(resolver); argumentResolvers.add(resolver);
} }
} }
\ No newline at end of file
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
</parent> </parent>
<artifactId>demo-core</artifactId> <artifactId>demo-core</artifactId>
<name>后台服务 Core</name> <name>Demo Core</name>
<description>后台服务 Core</description> <description>后台服务 Core,模板生成代码,再次发布会覆盖,建议不要直接修改,修改请在demo-boot项目中继承或覆盖重写</description>
<dependencies> <dependencies>
...@@ -20,6 +20,14 @@ ...@@ -20,6 +20,14 @@
<artifactId>ibizlab-boot-starter-data</artifactId> <artifactId>ibizlab-boot-starter-data</artifactId>
<version>2.4.0-SNAPSHOT</version> <version>2.4.0-SNAPSHOT</version>
</dependency> </dependency>
<!-- MySQL驱动包 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
</dependencies> </dependencies>
<properties> <properties>
...@@ -93,4 +101,4 @@ ...@@ -93,4 +101,4 @@
</profile> </profile>
</profiles> </profiles>
</project> </project>
\ No newline at end of file
...@@ -35,7 +35,6 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -35,7 +35,6 @@ import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import cn.ibizlab.core.sample.domain.IBIZAccount;
import cn.ibizlab.core.sample.domain.IBIZCustomer; import cn.ibizlab.core.sample.domain.IBIZCustomer;
@Getter @Getter
...@@ -109,22 +108,6 @@ public class IBIZCustomerMG extends EntityMP implements Serializable ...@@ -109,22 +108,6 @@ public class IBIZCustomerMG extends EntityMP implements Serializable
private String customerUid; private String customerUid;
/**
* 账户
*/
@JsonIgnore
@JSONField(serialize = false)
@TableField(exist = false)
@ApiModelProperty(value = "ibizaccount", notes = "")
private IBIZAccount ibizAccount;
/**
* 客户
*/
@JsonIgnore
@JSONField(serialize = false)
@TableField(exist = false)
@ApiModelProperty(value = "ibizcustomer", notes = "")
private IBIZCustomer ibizCustomer;
......
...@@ -77,7 +77,5 @@ public interface IBIZCustomerMGMapper extends BaseMapper<IBIZCustomerMG> { ...@@ -77,7 +77,5 @@ public interface IBIZCustomerMGMapper extends BaseMapper<IBIZCustomerMG> {
@Delete("${sql}") @Delete("${sql}")
boolean deleteBySQL(@Param("sql") String sql, @Param("et")Map param); boolean deleteBySQL(@Param("sql") String sql, @Param("et")Map param);
List<IBIZCustomerMG> selectBy(@Param("") Serializable );
List<IBIZCustomerMG> selectBy(@Param("") Serializable );
} }
\ No newline at end of file
package cn.ibizlab.core.sample.mapping;
import org.mapstruct.*;
import cn.ibizlab.core.sample.domain.IBIZCustomerMG;
import cn.ibizlab.core.sample.domain.IBIZCustomer;
import java.util.List;
@Mapper(componentModel = "spring", uses = {})
public interface IBIZCustomerMGInheritMapping {
@Mappings({
@Mapping(target ="focusNull",ignore = true),
@Mapping(source ="ibizCustomerId",target = "ibizCustomerId"),
@Mapping(source ="ibizCustomerName",target = "ibizCustomerName"),
})
IBIZCustomer toIbizCustomer(IBIZCustomerMG ibizCustomerMg);
@Mappings({
@Mapping(target ="focusNull",ignore = true),
@Mapping(source ="ibizCustomerId",target = "ibizCustomerId"),
@Mapping(source ="ibizCustomerName",target = "ibizCustomerName"),
})
IBIZCustomerMG toIbizCustomerMg(IBIZCustomer ibizCustomer);
List<IBIZCustomer> toIbizCustomer(List<IBIZCustomerMG> list);
List<IBIZCustomerMG> toIbizCustomerMg(List<IBIZCustomer> list);
}
...@@ -21,7 +21,6 @@ import cn.ibizlab.util.helper.CachedBeanCopier; ...@@ -21,7 +21,6 @@ import cn.ibizlab.util.helper.CachedBeanCopier;
import cn.ibizlab.util.security.SpringContextHolder; import cn.ibizlab.util.security.SpringContextHolder;
import cn.ibizlab.core.sample.domain.IBIZCustomerMG; import cn.ibizlab.core.sample.domain.IBIZCustomerMG;
import cn.ibizlab.core.sample.filter.IBIZCustomerMGSearchContext; import cn.ibizlab.core.sample.filter.IBIZCustomerMGSearchContext;
import cn.ibizlab.core.sample.domain.IBIZAccount;
import cn.ibizlab.core.sample.domain.IBIZCustomer; import cn.ibizlab.core.sample.domain.IBIZCustomer;
public interface IBIZCustomerMGService extends IService<IBIZCustomerMG> { public interface IBIZCustomerMGService extends IService<IBIZCustomerMG> {
...@@ -85,24 +84,4 @@ public interface IBIZCustomerMGService extends IService<IBIZCustomerMG> { ...@@ -85,24 +84,4 @@ public interface IBIZCustomerMGService extends IService<IBIZCustomerMG> {
Page<IBIZCustomerMG> searchDefault(IBIZCustomerMGSearchContext context); Page<IBIZCustomerMG> searchDefault(IBIZCustomerMGSearchContext context);
List<IBIZCustomerMG> listDefault(IBIZCustomerMGSearchContext context); List<IBIZCustomerMG> listDefault(IBIZCustomerMGSearchContext context);
List<IBIZCustomerMG> selectBy( );
boolean removeBy( );
boolean resetBy( );
boolean saveByIbizAccount(cn.ibizlab.core.sample.domain.IBIZAccount ibizAccount,List<IBIZCustomerMG> list);
default boolean saveBy( ,List<IBIZCustomerMG> list) {
cn.ibizlab.core.sample.domain.IBIZAccount et = new cn.ibizlab.core.sample.domain.IBIZAccount();
et.setIbizAccountId();
return getSelf().saveByIbizAccount(et,list);
}
List<IBIZCustomerMG> selectBy( );
boolean removeBy( );
boolean resetBy( );
boolean saveByIbizCustomer(cn.ibizlab.core.sample.domain.IBIZCustomer ibizCustomer,List<IBIZCustomerMG> list);
default boolean saveBy( ,List<IBIZCustomerMG> list) {
cn.ibizlab.core.sample.domain.IBIZCustomer et = new cn.ibizlab.core.sample.domain.IBIZCustomer();
et.setIbizCustomerId();
return getSelf().saveByIbizCustomer(et,list);
}
} }
\ No newline at end of file
...@@ -40,8 +40,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; ...@@ -40,8 +40,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
import cn.ibizlab.core.sample.domain.IBIZAccount;
import cn.ibizlab.core.sample.service.IBIZAccountService;
import cn.ibizlab.core.sample.domain.IBIZCustomer; import cn.ibizlab.core.sample.domain.IBIZCustomer;
import cn.ibizlab.core.sample.service.IBIZCustomerService; import cn.ibizlab.core.sample.service.IBIZCustomerService;
...@@ -55,12 +53,11 @@ public class IBIZCustomerMGServiceBase extends ServiceImpl<IBIZCustomerMGMapper, ...@@ -55,12 +53,11 @@ public class IBIZCustomerMGServiceBase extends ServiceImpl<IBIZCustomerMGMapper,
@Autowired @Autowired
@Lazy @Lazy
protected IBIZAccountService ibizAccountService; protected IBIZCustomerService ibizCustomerService;
@Autowired @Autowired
@Lazy @Lazy
protected IBIZCustomerService ibizCustomerService; protected cn.ibizlab.core.sample.mapping.IBIZCustomerMGInheritMapping ibizCustomerMgInheritMapping;
protected int batchSize = 500; protected int batchSize = 500;
...@@ -75,27 +72,8 @@ public class IBIZCustomerMGServiceBase extends ServiceImpl<IBIZCustomerMGMapper, ...@@ -75,27 +72,8 @@ public class IBIZCustomerMGServiceBase extends ServiceImpl<IBIZCustomerMGMapper,
return this.baseMapper.selectEntities(entities); return this.baseMapper.selectEntities(entities);
} }
public void fillParentData(IBIZCustomerMG et) {
if(!ObjectUtils.isEmpty(et.get())) {
IBIZAccount ibizAccount = et.getIbizAccount();
if(!ObjectUtils.isEmpty(ibizAccount)) {
et.setBankAccountNum(ibizAccount.getBankAccountNum());
et.setBankName(ibizAccount.getBankName());
}
}
if(!ObjectUtils.isEmpty(et.get())) {
IBIZCustomer ibizCustomer = et.getIbizCustomer();
if(!ObjectUtils.isEmpty(ibizCustomer)) {
et.setIbizCustomerId(ibizCustomer.getIbizCustomerId());
et.setIbizCustomerName(ibizCustomer.getIbizCustomerName());
et.setAddress(ibizCustomer.getAddress());
et.setCustomerUid(ibizCustomer.getCustomerUid());
}
}
}
public IBIZCustomerMG getDraft(IBIZCustomerMG et) { public IBIZCustomerMG getDraft(IBIZCustomerMG et) {
fillParentData(et);
return et; return et;
} }
...@@ -106,6 +84,11 @@ public class IBIZCustomerMGServiceBase extends ServiceImpl<IBIZCustomerMGMapper, ...@@ -106,6 +84,11 @@ public class IBIZCustomerMGServiceBase extends ServiceImpl<IBIZCustomerMGMapper,
@Override @Override
@Transactional @Transactional
public boolean create(IBIZCustomerMG et) { public boolean create(IBIZCustomerMG et) {
if(ObjectUtils.isEmpty(et.getIbizCustomerId()))
et.setIbizCustomerId((String)et.getDefaultKey(true));
IBIZCustomer ibizCustomer = ibizCustomerMgInheritMapping.toIbizCustomer(et);
ibizCustomerService.create(ibizCustomer);
if(!this.retBool(this.baseMapper.insert(et))) if(!this.retBool(this.baseMapper.insert(et)))
return false; return false;
get(et); get(et);
...@@ -113,12 +96,17 @@ public class IBIZCustomerMGServiceBase extends ServiceImpl<IBIZCustomerMGMapper, ...@@ -113,12 +96,17 @@ public class IBIZCustomerMGServiceBase extends ServiceImpl<IBIZCustomerMGMapper,
} }
@Transactional @Transactional
public boolean createBatch(List<IBIZCustomerMG> list) { public boolean createBatch(List<IBIZCustomerMG> list) {
this.saveBatch(list, batchSize); for (IBIZCustomerMG et : list) {
getSelf().create(et);
}
return true; return true;
} }
@Transactional @Transactional
public boolean update(IBIZCustomerMG et) { public boolean update(IBIZCustomerMG et) {
IBIZCustomer ibizCustomer = ibizCustomerMgInheritMapping.toIbizCustomer(et);
ibizCustomerService.save(ibizCustomer);
UpdateWrapper qw=et.getUpdateWrapper(true); UpdateWrapper qw=et.getUpdateWrapper(true);
if(!update(et, qw)) { if(!update(et, qw)) {
return false; return false;
...@@ -172,6 +160,8 @@ public class IBIZCustomerMGServiceBase extends ServiceImpl<IBIZCustomerMGMapper, ...@@ -172,6 +160,8 @@ public class IBIZCustomerMGServiceBase extends ServiceImpl<IBIZCustomerMGMapper,
@Transactional @Transactional
public boolean remove(IBIZCustomerMG et) { public boolean remove(IBIZCustomerMG et) {
String key = et.getIbizCustomerId(); String key = et.getIbizCustomerId();
ibizCustomerService.remove(ibizCustomerMgInheritMapping.toIbizCustomer(et));
if(!remove(new QueryWrapper<IBIZCustomerMG>() if(!remove(new QueryWrapper<IBIZCustomerMG>()
)) { )) {
...@@ -182,7 +172,10 @@ public class IBIZCustomerMGServiceBase extends ServiceImpl<IBIZCustomerMGMapper, ...@@ -182,7 +172,10 @@ public class IBIZCustomerMGServiceBase extends ServiceImpl<IBIZCustomerMGMapper,
@Transactional @Transactional
public boolean removeByEntities(List<IBIZCustomerMG> entities) { public boolean removeByEntities(List<IBIZCustomerMG> entities) {
this.baseMapper.deleteEntities(entities); for (IBIZCustomerMG et : entities) {
if(!getSelf().remove(et))
return false;
}
return true; return true;
} }
...@@ -194,90 +187,6 @@ public class IBIZCustomerMGServiceBase extends ServiceImpl<IBIZCustomerMGMapper, ...@@ -194,90 +187,6 @@ public class IBIZCustomerMGServiceBase extends ServiceImpl<IBIZCustomerMGMapper,
return baseMapper.listDefault(context,context.getSelectCond()); return baseMapper.listDefault(context,context.getSelectCond());
} }
public List<IBIZCustomerMG> selectBy( ) {
return baseMapper.selectBy();
}
public boolean removeBy( ) {
return this.remove(new QueryWrapper<IBIZCustomerMG>().eq("",));
}
public boolean resetBy( ) {
return this.update(new UpdateWrapper<IBIZCustomerMG>().set("",null).eq("",));
}
public boolean saveByIbizAccount(IBIZAccount ibizAccount,List<IBIZCustomerMG> list) {
if(list==null)
return true;
Set<String> delIds=new HashSet<String>();
List<IBIZCustomerMG> _update=new ArrayList<IBIZCustomerMG>();
List<IBIZCustomerMG> _create=new ArrayList<IBIZCustomerMG>();
for(IBIZCustomerMG before:selectBy(ibizAccount.getIbizAccountId())){
delIds.add(before.getIbizCustomerId());
}
for(IBIZCustomerMG sub:list) {
sub.set(ibizAccount.getIbizAccountId());
sub.setIbizAccount(ibizAccount);
if(ObjectUtils.isEmpty(sub.getIbizCustomerId()))
sub.setIbizCustomerId((String)sub.getDefaultKey(true));
if(delIds.contains(sub.getIbizCustomerId())) {
delIds.remove(sub.getIbizCustomerId());
_update.add(sub);
}
else
_create.add(sub);
}
if(_update.size()>0 && (!getSelf().updateBatch(_update)))
return false;
if(_create.size()>0 && (!getSelf().createBatch(_create)))
return false;
if(delIds.size()>0 && (!getSelf().removeBatch(delIds)))
return false;
return true;
}
public List<IBIZCustomerMG> selectBy( ) {
return baseMapper.selectBy();
}
public boolean removeBy( ) {
return this.remove(new QueryWrapper<IBIZCustomerMG>().eq("",));
}
public boolean resetBy( ) {
return this.update(new UpdateWrapper<IBIZCustomerMG>().set("",null).eq("",));
}
public boolean saveByIbizCustomer(IBIZCustomer ibizCustomer,List<IBIZCustomerMG> list) {
if(list==null)
return true;
Set<String> delIds=new HashSet<String>();
List<IBIZCustomerMG> _update=new ArrayList<IBIZCustomerMG>();
List<IBIZCustomerMG> _create=new ArrayList<IBIZCustomerMG>();
for(IBIZCustomerMG before:selectBy(ibizCustomer.getIbizCustomerId())){
delIds.add(before.getIbizCustomerId());
}
for(IBIZCustomerMG sub:list) {
sub.set(ibizCustomer.getIbizCustomerId());
sub.setIbizCustomer(ibizCustomer);
if(ObjectUtils.isEmpty(sub.getIbizCustomerId()))
sub.setIbizCustomerId((String)sub.getDefaultKey(true));
if(delIds.contains(sub.getIbizCustomerId())) {
delIds.remove(sub.getIbizCustomerId());
_update.add(sub);
}
else
_create.add(sub);
}
if(_update.size()>0 && (!getSelf().updateBatch(_update)))
return false;
if(_create.size()>0 && (!getSelf().createBatch(_create)))
return false;
if(delIds.size()>0 && (!getSelf().removeBatch(delIds)))
return false;
return true;
}
} }
\ No newline at end of file
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
<!--通过mybatis将查询结果注入到entity中,通过配置autoMapping="true"由mybatis自动处理映射关系 --> <!--通过mybatis将查询结果注入到entity中,通过配置autoMapping="true"由mybatis自动处理映射关系 -->
<resultMap id="IBIZCustomerMGResultMap" type="cn.ibizlab.core.sample.domain.IBIZCustomerMG" autoMapping="true"> <resultMap id="IBIZCustomerMGResultMap" type="cn.ibizlab.core.sample.domain.IBIZCustomerMG" autoMapping="true">
<association property="ibizAccount" javaType="cn.ibizlab.core.sample.domain.IBIZAccount" column="" select="cn.ibizlab.core.sample.mapper.IBIZAccountMapper.selectById" fetchType="lazy"></association>
<association property="ibizCustomer" javaType="cn.ibizlab.core.sample.domain.IBIZCustomer" column="" select="cn.ibizlab.core.sample.mapper.IBIZCustomerMapper.selectById" fetchType="lazy"></association>
</resultMap> </resultMap>
<select id="selectById" resultMap="IBIZCustomerMGResultMap"> <select id="selectById" resultMap="IBIZCustomerMGResultMap">
...@@ -74,17 +72,5 @@ ...@@ -74,17 +72,5 @@
</select> </select>
<select id="selectBy" resultMap="IBIZCustomerMGResultMap">
<include refid="default" />
where
= #{ }
</select>
<select id="selectBy" resultMap="IBIZCustomerMGResultMap">
<include refid="default" />
where
= #{ }
</select>
</mapper> </mapper>
\ No newline at end of file
[ [
{
"name": "年度",
"code": "Years",
"group": "",
"memo": "",
}
]
\ No newline at end of file
{
"name":"年度",
"code":"Years",
"group":"",
"memo":"",
"enable":"",
}
]
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
<artifactId>demo</artifactId> <artifactId>demo</artifactId>
<groupId>cn.ibizlab</groupId> <groupId>cn.ibizlab</groupId>
<version>1.0.0.0</version> <version>1.0.0.0</version>
<name>后台服务</name> <name>Demo</name>
<description></description> <description>后台服务</description>
<packaging>pom</packaging> <packaging>pom</packaging>
<parent> <parent>
...@@ -105,7 +105,7 @@ ...@@ -105,7 +105,7 @@
<generateBackupPoms>false</generateBackupPoms> <generateBackupPoms>false</generateBackupPoms>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>cn.ibizlab</groupId> <groupId>cn.ibizlab</groupId>
<artifactId>ibizlab-generator-plugin</artifactId> <artifactId>ibizlab-generator-plugin</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
...@@ -137,4 +137,4 @@ ...@@ -137,4 +137,4 @@
</plugins> </plugins>
</build> </build>
</project> </project>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册