forked from gitee/vben-java
BI相关demo修改
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package com.zsvg.vboot.bi.field.main;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.entity.BaseMainEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class BiFieldMain extends BaseMainEntity {
|
||||
|
||||
@Column(length = 64)
|
||||
private String comet;
|
||||
|
||||
@Column(length = 64)
|
||||
private String notes;
|
||||
|
||||
@Column(length = 32)
|
||||
private String tableid;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.zsvg.vboot.bi.field.main;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.api.RestResult;
|
||||
import com.zsvg.vboot.common.mvc.dao.Sqler;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("bi/field/main")
|
||||
public class BiFieldMainApi {
|
||||
|
||||
private String table = "bi_field_main";
|
||||
|
||||
@GetMapping
|
||||
public RestResult get(String name) {
|
||||
Sqler sqler = new Sqler(table);
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addSelect("t.notes");
|
||||
return RestResult.ok(service.findPageData(sqler));
|
||||
}
|
||||
|
||||
@GetMapping("one/{id}")
|
||||
public RestResult getOne(@PathVariable String id) {
|
||||
BiFieldMain main = service.findOne(id);
|
||||
return RestResult.ok(main);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public RestResult post(@RequestBody BiFieldMain main) {
|
||||
return RestResult.ok(service.insert(main));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public RestResult put(@RequestBody BiFieldMain main) {
|
||||
return RestResult.ok(service.update(main));
|
||||
}
|
||||
|
||||
@DeleteMapping("{ids}")
|
||||
public RestResult delete(@PathVariable String[] ids) {
|
||||
return RestResult.ok(service.delete(ids));
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private BiFieldMainService service;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.zsvg.vboot.bi.field.main;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface BiFieldMainRepo extends JpaRepository<BiFieldMain,String> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.zsvg.vboot.bi.field.main;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.service.BaseMainService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@Service
|
||||
public class BiFieldMainService extends BaseMainService<BiFieldMain> {
|
||||
|
||||
//----------bean注入------------
|
||||
@Autowired
|
||||
private BiFieldMainRepo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
super.setRepo(repo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.zsvg.vboot.bi.table.main;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.entity.BaseMainEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class BiTableMain extends BaseMainEntity {
|
||||
|
||||
@Column(length = 64)
|
||||
private String comet;//注释
|
||||
|
||||
@Column(length = 64)
|
||||
private String notes;//备注
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.zsvg.vboot.bi.table.main;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.api.RestResult;
|
||||
import com.zsvg.vboot.common.mvc.dao.Sqler;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("bi/table/main")
|
||||
public class BiTableMainApi {
|
||||
|
||||
private String table = "bi_table_main";
|
||||
|
||||
@GetMapping
|
||||
public RestResult get(String name) {
|
||||
Sqler sqler = new Sqler(table);
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addSelect("t.comet,t.notes");
|
||||
return RestResult.ok(service.findPageData(sqler));
|
||||
}
|
||||
|
||||
@GetMapping("one/{id}")
|
||||
public RestResult getOne(@PathVariable String id) {
|
||||
BiTableMain main = service.findOne(id);
|
||||
return RestResult.ok(main);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public RestResult post(@RequestBody BiTableMain main) {
|
||||
return RestResult.ok(service.insert(main));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public RestResult put(@RequestBody BiTableMain main) {
|
||||
return RestResult.ok(service.update(main));
|
||||
}
|
||||
|
||||
@DeleteMapping("{ids}")
|
||||
public RestResult delete(@PathVariable String[] ids) {
|
||||
return RestResult.ok(service.delete(ids));
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private BiTableMainService service;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.zsvg.vboot.bi.table.main;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface BiTableMainRepo extends JpaRepository<BiTableMain,String> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.zsvg.vboot.bi.table.main;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.service.BaseMainService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@Service
|
||||
public class BiTableMainService extends BaseMainService<BiTableMain> {
|
||||
|
||||
//----------bean注入------------
|
||||
@Autowired
|
||||
private BiTableMainRepo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
super.setRepo(repo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user