Browse Source

修复无法删除的BUG

10.0
LAPTOP-SB56SG4Q\86185 2 years ago
parent
commit
9a2379f33e
  1. 4
      build.gradle
  2. 10
      src/main/java/com/tptj/demo/hg/db/access/provider/DemoDbController.java
  3. 1
      src/main/java/com/tptj/demo/hg/db/access/provider/DemoEntity.java
  4. 1
      src/main/java/com/tptj/demo/hg/db/access/provider/LinkEntity.java

4
build.gradle

@ -9,7 +9,7 @@ ext {
* 1.jar需要打包到zip中,lib根目录下
* 2.jar仅仅是编译时需要lib下子目录下即可
*/
libPath = "$projectDir/../webroot/WEB-INF/lib"
libPath = "$projectDir/../../webroot/WEB-INF/lib"
/**
* class进行加密保护
@ -21,7 +21,7 @@ ext {
pluginName = pluginInfo.id
pluginVersion = pluginInfo.version
outputPath = "$projectDir/../webroot/WEB-INF/plugins/plugin-" + pluginName + "-1.0/classes"
outputPath = "$projectDir/../../webroot/WEB-INF/plugins/plugin-" + pluginName + "-1.0/classes"
}
group = 'com.fr.plugin'

10
src/main/java/com/tptj/demo/hg/db/access/provider/DemoDbController.java

@ -66,13 +66,15 @@ public class DemoDbController extends AbstractDBAccessProvider {
*/
public static DataBean delete( final String id ){
try{
DemoEntity entity = accessor.runQueryAction((context)->
context.getDAO(DemoDao.class).getById(id)
);
if( null == entity ){
return null;
}
return accessor.runDMLAction(new DBAction<DataBean>() {
@Override
public DataBean run(DAOContext context) throws Exception {
DemoEntity entity = context.getDAO(DemoDao.class).getById(id);
if( null == entity ){
return null;
}
context.getDAO(DemoDao.class).remove( id );
List<LinkEntity> list = context.getDAO(LinkDao.class).removeByKey(entity.getKey());
return toDataBean(entity,list);

1
src/main/java/com/tptj/demo/hg/db/access/provider/DemoEntity.java

@ -14,7 +14,6 @@ import com.fr.third.javax.persistence.Table;
**/
@Entity
@Table(name = "plugin_demo")
@TableAssociation(associated = true)
public class DemoEntity extends BaseEntity {
public static final String COLUMN_KEY = "key";

1
src/main/java/com/tptj/demo/hg/db/access/provider/LinkEntity.java

@ -13,7 +13,6 @@ import com.fr.third.javax.persistence.Table;
**/
@Entity
@Table(name = "plugin_demo_link")
@TableAssociation(associated = true)
public class LinkEntity extends BaseEntity {
public static final String COLUMN_KEY = "key";

Loading…
Cancel
Save