forked from gitee/vben-java
增加流程分类与模板
This commit is contained in:
@@ -21,6 +21,16 @@ import java.util.List;
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public abstract class BaseCateService<T extends BaseCateEntity> {
|
||||
|
||||
public List<Ztree> findTreeList(String table,String name) {
|
||||
Sqler sqler = new Sqler(table);
|
||||
sqler.addSelect("t.pid");
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addOrder("t.ornum");
|
||||
List<Ztree> list = jdbcDao.findTreeList(sqler);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public PageData findPageData(Sqler sqler) {
|
||||
sqler.selectCUinfo().addSelect("t.label");
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.zsvg.vboot.wf;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.api.RestResult;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("wf")
|
||||
public class WfTestApi {
|
||||
|
||||
@GetMapping("test")
|
||||
public RestResult get() {
|
||||
return RestResult.ok("这里可以放扩展模块");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.zsvg.vboot.wf.tem.cate;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.entity.BaseCateEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class WfTemCate extends BaseCateEntity {
|
||||
|
||||
@ManyToOne(fetch= FetchType.EAGER)
|
||||
@JoinColumn(name = "pid")
|
||||
private WfTemCate parent;//父类别
|
||||
|
||||
private String notes;//备注
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.zsvg.vboot.wf.tem.cate;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.api.RestResult;
|
||||
import com.zsvg.vboot.common.mvc.dao.Sqler;
|
||||
import com.zsvg.vboot.common.mvc.pojo.Ztree;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("wf/tem/cate")
|
||||
public class WfTemCateApi {
|
||||
|
||||
private String table = "wf_tem_cate";
|
||||
|
||||
@GetMapping
|
||||
public RestResult get(String name) {
|
||||
Sqler sqler = new Sqler(table);
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addSelect("t.notes,t.ornum");
|
||||
return RestResult.ok(service.findPageData(sqler));
|
||||
}
|
||||
|
||||
@GetMapping("one/{id}")
|
||||
public RestResult getOne(@PathVariable String id) {
|
||||
WfTemCate cate = service.findOne(id);
|
||||
return RestResult.ok(cate);
|
||||
}
|
||||
|
||||
@GetMapping("tree")
|
||||
public RestResult getTree(String name) {
|
||||
List<Ztree> list = service.findTreeList(table,name);
|
||||
return RestResult.ok(list);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public RestResult post(@RequestBody WfTemCate main) {
|
||||
return RestResult.ok(service.insert(main));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public RestResult put(@RequestBody WfTemCate main) {
|
||||
return RestResult.ok(service.update(main));
|
||||
}
|
||||
|
||||
@DeleteMapping("{ids}")
|
||||
public RestResult delete(@PathVariable String[] ids) {
|
||||
return RestResult.ok(service.delete(ids));
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private WfTemCateService service;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.zsvg.vboot.wf.tem.cate;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface WfTemCateRepo extends JpaRepository<WfTemCate,String> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.zsvg.vboot.wf.tem.cate;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.service.BaseCateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@Service
|
||||
public class WfTemCateService extends BaseCateService<WfTemCate> {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//----------bean注入------------
|
||||
@Autowired
|
||||
private WfTemCateRepo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
super.setRepo(repo);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.zsvg.vboot.wf.tem.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 WfTemMain extends BaseMainEntity {
|
||||
|
||||
private String notes;
|
||||
|
||||
@Column(length = 32)
|
||||
private String code;//编码
|
||||
|
||||
private Integer ornum;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.zsvg.vboot.wf.tem.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("wf/tem/main")
|
||||
public class WfTemMainApi {
|
||||
|
||||
private String table = "wf_tem_main";
|
||||
|
||||
@GetMapping
|
||||
public RestResult get(String name) {
|
||||
Sqler sqler = new Sqler(table);
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addSelect("t.notes,t.ornum,t.code");
|
||||
return RestResult.ok(service.findPageData(sqler));
|
||||
}
|
||||
|
||||
@GetMapping("one/{id}")
|
||||
public RestResult getOne(@PathVariable String id) {
|
||||
WfTemMain main = service.findOne(id);
|
||||
return RestResult.ok(main);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public RestResult post(@RequestBody WfTemMain main) {
|
||||
return RestResult.ok(service.insert(main));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public RestResult put(@RequestBody WfTemMain main) {
|
||||
return RestResult.ok(service.update(main));
|
||||
}
|
||||
|
||||
@DeleteMapping("{ids}")
|
||||
public RestResult delete(@PathVariable String[] ids) {
|
||||
return RestResult.ok(service.delete(ids));
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private WfTemMainService service;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.zsvg.vboot.wf.tem.main;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
|
||||
public interface WfTemMainRepo extends JpaRepository<WfTemMain,String> {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.zsvg.vboot.wf.tem.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 WfTemMainService extends BaseMainService<WfTemMain> {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//----------bean注入------------
|
||||
@Autowired
|
||||
private WfTemMainRepo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
super.setRepo(repo);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user