增加 商品类目

master
hst 2021-08-27 15:05:24 +08:00
parent 5aa681f8aa
commit 6d93089ec0
10 changed files with 453 additions and 147 deletions

View File

@ -3,6 +3,8 @@ package com.jeecg.demo.dao;
import java.util.List;
import java.util.Map;
import com.zzjee.ba.entity.BaGoodsCategoryEntity;
import com.zzjee.ba.vo.BaGoodsCategoryVoo;
import org.jeecgframework.minidao.annotation.Arguments;
import org.jeecgframework.minidao.annotation.MiniDao;
import org.jeecgframework.minidao.annotation.ResultType;
@ -32,11 +34,21 @@ public interface JeecgMinidaoDao {
@Sql("select ID,NAME,PID from t_s_region order by name_en")
List<Map<String, String>> getAllRegions();
@Sql("select ID,category_name as categoryName,PID from ba_goods_category where pid is null")
List<BaGoodsCategoryVoo> getAllBaGoodsCategorys();
@Arguments("pid")
@Sql("select ID,category_name as categoryName,PID from ba_goods_category where pid=:pid")
List<BaGoodsCategoryVoo> getAllBaGoodsCategorys(String pid);
@Arguments({"jeecgDemo", "page", "rows"})
@ResultType(JeecgDemoEntity.class)
public List<JeecgDemoEntity> getAllEntities(JeecgDemoEntity jeecgDemo, int page, int rows);
@Arguments({"baGoodsCategory", "page", "rows"})
@ResultType(BaGoodsCategoryEntity.class)
public List<BaGoodsCategoryEntity> getAllEntities(BaGoodsCategoryEntity baGoodsCategory, int page, int rows);
@Sql("SELECT count(*) FROM jeecg_demo")
Integer getCount();

View File

@ -1,4 +1,5 @@
package com.zzjee.ba.controller;
import com.jeecg.demo.dao.JeecgMinidaoDao;
import com.zzjee.ba.entity.BaGoodsCategoryEntity;
import com.zzjee.ba.service.BaGoodsCategoryServiceI;
import java.util.ArrayList;
@ -7,11 +8,11 @@ import java.text.SimpleDateFormat;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.zzjee.ba.vo.BaGoodsCategoryVo;
import com.zzjee.ba.vo.BaGoodsCategoryVoo;
import org.apache.log4j.Logger;
import org.jeecgframework.core.common.service.CommonService;
import org.jeecgframework.core.common.model.json.ComboTree;
import org.jeecgframework.tag.vo.easyui.ComboTreeModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
@ -72,7 +73,7 @@ import org.springframework.web.util.UriComponentsBuilder;
* @Title: Controller
* @Description:
* @author onlineGenerator
* @date 2021-08-20 10:29:34
* @date 2021-08-25 17:16:36
* @version V1.0
*
*/
@ -91,8 +92,7 @@ public class BaGoodsCategoryController extends BaseController {
@Autowired
private Validator validator;
@Autowired
private CommonService commonService;
private JeecgMinidaoDao jeecgMinidaoDao;
/**
@ -105,18 +105,131 @@ public class BaGoodsCategoryController extends BaseController {
return new ModelAndView("com/zzjee/ba/baGoodsCategoryList");
}
/**
* DEMO
*/
@RequestMapping(params = "getComboTreeData")
@ResponseBody
public List<ComboTree> getComboTreeData(HttpServletRequest request, ComboTree comboTree) {
System.out.println("======================getComboTreeData comboTree:==================="+comboTree);
List<BaGoodsCategoryVoo> balist=new ArrayList<BaGoodsCategoryVoo>();
balist = jeecgMinidaoDao.getAllBaGoodsCategorys();
/*for (int i = 0; i < demoList.size(); i++) {
BaGoodsCategoryVoo cat = new BaGoodsCategoryVoo();
String id=String.valueOf(demoList.get(i).get("id"));
String categoryName=String.valueOf(demoList.get(i).get("categoryName"));
// System.out.println(id+" "+categoryName);
cat.setId(id);
cat.setCategoryName(categoryName);
if (demoList.get(i).get("pid")!=null) {
String pid=String.valueOf(demoList.get(i).get("pid"));
cat.setPid(pid);
}
System.out.println(cat.toString());
balist.add(cat);
}*/
for (int i = 0; i <balist.size(); i++) {
String id = balist.get(i).getId();
List<BaGoodsCategoryVoo> allBaGoodsCategorys = jeecgMinidaoDao.getAllBaGoodsCategorys(id);
for (int j = 0; j <allBaGoodsCategorys.size() ; j++) {
String id1 = allBaGoodsCategorys.get(j).getId();
List<BaGoodsCategoryVoo> allBaGoodsCategorys1 = jeecgMinidaoDao.getAllBaGoodsCategorys(id1);
for (int k = 0; k <allBaGoodsCategorys.size() ; k++) {
String id2 = allBaGoodsCategorys.get(j).getId();
List<BaGoodsCategoryVoo> allBaGoodsCategorys2 = jeecgMinidaoDao.getAllBaGoodsCategorys(id2);
allBaGoodsCategorys.get(k).setBaGoodsCategory(allBaGoodsCategorys2);
}
allBaGoodsCategorys.get(j).setBaGoodsCategory(allBaGoodsCategorys1);
}
balist.get(i).setBaGoodsCategory(allBaGoodsCategorys);
}
//
// List<ComboTree> comboTrees = new ArrayList<ComboTree>();
ComboTreeModel comboTreeModel = new ComboTreeModel("id", "categoryName", "baGoodsCategory");
System.out.println("======================getComboTreeData demoList:==================="+balist.size());
List<ComboTree> comboTrees = systemService.ComboTree(balist, comboTreeModel, null, true);
return comboTrees;
}
/**
* ztree
*
* @param response
* @param request
* @return
*/
/*@RequestMapping(params = "getTreeData", method = {RequestMethod.GET, RequestMethod.POST})
@ResponseBody
public AjaxJson getTreeData(BaGoodsCategoryEntity baGoodsCategory1, HttpServletResponse response, HttpServletRequest request) {
AjaxJson j = new AjaxJson();
try {
// List<TSDepart> depatrList = new ArrayList<TSDepart>();
StringBuffer hql = new StringBuffer(" from BaGoodsCategoryEntity t");
//hql.append(" and (parent.id is null or parent.id='')");
List<BaGoodsCategoryEntity> catList = this.systemService.findHql(hql.toString());
List<Map<String, Object>> dataList = new ArrayList<Map<String, Object>>();
Map<String, Object> map = null;
for (BaGoodsCategoryEntity baGoodsCategory : catList) {
String sqls = null;
Object[] paramss = null;
map = new HashMap<String, Object>();
map.put("id", baGoodsCategory.getId());
map.put("name", baGoodsCategory.getCategoryName());
if (baGoodsCategory.getPid() != 0) {
map.put("pId", baGoodsCategory.getPid());
map.put("open", false);
} else {
map.put("pId", "1");
map.put("open", false);
}
sqls = "select count(1) from ba_goods_category t where t.pid = ?";
paramss = new Object[]{baGoodsCategory.getId()};
long counts = this.systemService.getCountForJdbcParam(sqls, paramss);
if (counts > 0) {
dataList.add(map);
} else {
TSDepart de = this.systemService.get(TSDepart.class, baGoodsCategory.getId());
if (de != null) {
map.put("id", de.getId());
map.put("name", de.getDepartname());
if (baGoodsCategory.getPid() != 0) {
map.put("pId", baGoodsCategory.getPid());
map.put("open", false);
} else {
map.put("pId", "1");
map.put("open", false);
}
dataList.add(map);
} else {
map.put("open", false);
dataList.add(map);
}
}
}
j.setObj(dataList);
} catch (Exception e) {
e.printStackTrace();
}
return j;
}*/
/**
* easyui AJAX
*
* @param request
* @param response
* @param dataGrid
* @param user
// * @param user
*/
@RequestMapping(params = "datagrid")
public void datagrid(BaGoodsCategoryEntity baGoodsCategory,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(BaGoodsCategoryEntity.class, dataGrid);
if(baGoodsCategory.getId()==null){
cq.isNull("pid");
}else{
cq.eq("pid", baGoodsCategory.getId());
baGoodsCategory.setId(null);
}
//查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, baGoodsCategory, request.getParameterMap());
try{
@ -134,7 +247,7 @@ public class BaGoodsCategoryController extends BaseController {
}
cq.add();
this.baGoodsCategoryService.getDataGridReturn(cq, true);
TagUtil.datagrid(response, dataGrid);
TagUtil.treegrid(response, dataGrid);
}
/**
@ -193,7 +306,7 @@ public class BaGoodsCategoryController extends BaseController {
/**
*
*
* @param ids
// * @param ids
* @return
*/
@RequestMapping(params = "doAdd")
@ -203,6 +316,9 @@ public class BaGoodsCategoryController extends BaseController {
AjaxJson j = new AjaxJson();
message = "商品类目添加成功";
try{
if(baGoodsCategory.getPid()==null){
baGoodsCategory.setPid(null);
}
baGoodsCategoryService.save(baGoodsCategory);
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
}catch(Exception e){
@ -217,7 +333,7 @@ public class BaGoodsCategoryController extends BaseController {
/**
*
*
* @param ids
// * @param ids
* @return
*/
@RequestMapping(params = "doUpdate")
@ -229,6 +345,9 @@ public class BaGoodsCategoryController extends BaseController {
BaGoodsCategoryEntity t = baGoodsCategoryService.get(BaGoodsCategoryEntity.class, baGoodsCategory.getId());
try {
MyBeanUtils.copyBeanNotNull2Bean(baGoodsCategory, t);
if(t.getPid()==null){
t.setPid(null);
}
baGoodsCategoryService.saveOrUpdate(t);
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
} catch (Exception e) {
@ -383,7 +502,7 @@ public class BaGoodsCategoryController extends BaseController {
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
//按照Restful风格约定创建指向新任务的url, 也可以直接返回id或对象.
int id = baGoodsCategory.getId();
Integer id = baGoodsCategory.getId();
URI uri = uriBuilder.path("/rest/baGoodsCategoryController/" + id).build().toUri();
HttpHeaders headers = new HttpHeaders();
headers.setLocation(uri);
@ -416,62 +535,4 @@ public class BaGoodsCategoryController extends BaseController {
public void delete(@PathVariable("id") String id) {
baGoodsCategoryService.deleteEntityById(BaGoodsCategoryEntity.class, id);
}
@RequestMapping(params = "getGoodsTreeList")
@ResponseBody
public AjaxJson getGoodsTreeList(){
List<BaGoodsCategoryVo> treeList = new ArrayList<>();
List<BaGoodsCategoryEntity> dataList = systemService.findHql("from BaGoodsCategoryEntity order by id");
for (BaGoodsCategoryEntity baGoodsCategoryEntity : dataList) {
BaGoodsCategoryVo baGoodsCategoryVo = new BaGoodsCategoryVo();
baGoodsCategoryVo.setLabel(baGoodsCategoryEntity.getCategoryName());
baGoodsCategoryVo.setValue(baGoodsCategoryEntity.getId());
baGoodsCategoryVo.setPid(baGoodsCategoryEntity.getPid());
if (baGoodsCategoryVo.getPid() == null){
System.out.println();
}
if (baGoodsCategoryVo.getPid() == 0) {
treeList.add(baGoodsCategoryVo);
}else {
BaGoodsCategoryVo parent = findParent(treeList,baGoodsCategoryVo.getPid());
if(parent!=null){
if(parent.getChildren()==null){
parent.setChildren(new ArrayList<>());
}
parent.getChildren().add(baGoodsCategoryVo);
} else {
treeList.add(baGoodsCategoryVo);
}
}
}
AjaxJson ajaxJson = new AjaxJson();
ajaxJson.setSuccess(true);
ajaxJson.setMsg("查询成功");
ajaxJson.setObj(treeList);
return ajaxJson;
}
private BaGoodsCategoryVo findParent(List<BaGoodsCategoryVo> treeList, Integer pid) {
BaGoodsCategoryVo find = null;
for(BaGoodsCategoryVo baGoodsCategoryVo:treeList){
if(baGoodsCategoryVo.getValue().equals(pid)){
find = baGoodsCategoryVo;
break;
} else if(baGoodsCategoryVo.getChildren()!=null) {
find = findParent(baGoodsCategoryVo.getChildren(),pid);
if(find!=null){
break;
}
}
}
return find;
}
}

View File

@ -1,28 +1,27 @@
package com.zzjee.ba.entity;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.lang.String;
import java.lang.Double;
import java.lang.Integer;
import java.math.BigDecimal;
import javax.persistence.*;
import javax.xml.soap.Text;
import java.sql.Blob;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.List;
import com.zzjee.ba.vo.BaGoodsCategoryVoo;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.SequenceGenerator;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecgframework.web.system.pojo.base.TSDepart;
/**
* @Title: Entity
* @Description:
* @author onlineGenerator
* @date 2021-08-20 10:29:34
* @date 2021-08-25 17:16:36
* @version V1.0
*
*/
@ -31,46 +30,54 @@ import org.jeecgframework.poi.excel.annotation.Excel;
@SuppressWarnings("serial")
public class BaGoodsCategoryEntity implements java.io.Serializable {
/**id*/
@Excel(name="类目id")
private Integer id;
private java.lang.Integer id;
/**创建人名称*/
private String createName;
private java.lang.String createName;
/**创建人登录名称*/
private String createBy;
private java.lang.String createBy;
/**创建日期*/
private Date createTime;
private java.util.Date createTime;
/**更新人名称*/
private String updateName;
private java.lang.String updateName;
/**更新人登录名称*/
private String updateBy;
private java.lang.String updateBy;
/**更新日期*/
private Date updateTime;
private java.util.Date updateTime;
/**所属部门*/
private String sysOrgCode;
private java.lang.String sysOrgCode;
/**类目编码*/
@Excel(name="类目编码")
private String categoryCode;
private java.lang.String categoryCode;
/**类目名称*/
@Excel(name="类目名称")
private String categoryName;
private java.lang.String categoryName;
/**类目级别*/
@Excel(name="类目级别")
private Integer categoryLevel;
private java.lang.Integer categoryLevel;
/**父级目录*/
@Excel(name="父级目录")
private Integer pid;
private java.lang.Integer pid;
/**是否为顶级目录*/
@Excel(name="是否为顶级目录")
private String topNode;
private java.lang.String topNode;
private List<BaGoodsCategoryEntity> baGoodsCategory;
public List<BaGoodsCategoryEntity> getBaGoodsCategory() {
return baGoodsCategory;
}
public void setBaGoodsCategory(List<BaGoodsCategoryEntity> baGoodsCategory) {
this.baGoodsCategory = baGoodsCategory;
}
/**
*: java.lang.Integer
*@return: java.lang.Integer id
*/
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name ="ID",nullable=false,length=10)
public Integer getId(){
@Column(name ="ID",length=10)
public java.lang.Integer getId(){
return this.id;
}
@ -78,7 +85,7 @@ public class BaGoodsCategoryEntity implements java.io.Serializable {
*: java.lang.Integer
*@param: java.lang.Integer id
*/
public void setId(Integer id){
public void setId(java.lang.Integer id){
this.id = id;
}
/**
@ -86,7 +93,7 @@ public class BaGoodsCategoryEntity implements java.io.Serializable {
*@return: java.lang.String
*/
@Column(name ="CREATE_NAME",nullable=true,length=50)
public String getCreateName(){
public java.lang.String getCreateName(){
return this.createName;
}
@ -94,7 +101,7 @@ public class BaGoodsCategoryEntity implements java.io.Serializable {
*: java.lang.String
*@param: java.lang.String
*/
public void setCreateName(String createName){
public void setCreateName(java.lang.String createName){
this.createName = createName;
}
/**
@ -102,7 +109,7 @@ public class BaGoodsCategoryEntity implements java.io.Serializable {
*@return: java.lang.String
*/
@Column(name ="CREATE_BY",nullable=true,length=50)
public String getCreateBy(){
public java.lang.String getCreateBy(){
return this.createBy;
}
@ -110,7 +117,7 @@ public class BaGoodsCategoryEntity implements java.io.Serializable {
*: java.lang.String
*@param: java.lang.String
*/
public void setCreateBy(String createBy){
public void setCreateBy(java.lang.String createBy){
this.createBy = createBy;
}
/**
@ -118,7 +125,7 @@ public class BaGoodsCategoryEntity implements java.io.Serializable {
*@return: java.util.Date
*/
@Column(name ="CREATE_TIME",nullable=true)
public Date getCreateTime(){
public java.util.Date getCreateTime(){
return this.createTime;
}
@ -126,7 +133,7 @@ public class BaGoodsCategoryEntity implements java.io.Serializable {
*: java.util.Date
*@param: java.util.Date
*/
public void setCreateTime(Date createTime){
public void setCreateTime(java.util.Date createTime){
this.createTime = createTime;
}
/**
@ -134,7 +141,7 @@ public class BaGoodsCategoryEntity implements java.io.Serializable {
*@return: java.lang.String
*/
@Column(name ="UPDATE_NAME",nullable=true,length=50)
public String getUpdateName(){
public java.lang.String getUpdateName(){
return this.updateName;
}
@ -142,7 +149,7 @@ public class BaGoodsCategoryEntity implements java.io.Serializable {
*: java.lang.String
*@param: java.lang.String
*/
public void setUpdateName(String updateName){
public void setUpdateName(java.lang.String updateName){
this.updateName = updateName;
}
/**
@ -150,7 +157,7 @@ public class BaGoodsCategoryEntity implements java.io.Serializable {
*@return: java.lang.String
*/
@Column(name ="UPDATE_BY",nullable=true,length=50)
public String getUpdateBy(){
public java.lang.String getUpdateBy(){
return this.updateBy;
}
@ -158,7 +165,7 @@ public class BaGoodsCategoryEntity implements java.io.Serializable {
*: java.lang.String
*@param: java.lang.String
*/
public void setUpdateBy(String updateBy){
public void setUpdateBy(java.lang.String updateBy){
this.updateBy = updateBy;
}
/**
@ -166,7 +173,7 @@ public class BaGoodsCategoryEntity implements java.io.Serializable {
*@return: java.util.Date
*/
@Column(name ="UPDATE_TIME",nullable=true)
public Date getUpdateTime(){
public java.util.Date getUpdateTime(){
return this.updateTime;
}
@ -174,7 +181,7 @@ public class BaGoodsCategoryEntity implements java.io.Serializable {
*: java.util.Date
*@param: java.util.Date
*/
public void setUpdateTime(Date updateTime){
public void setUpdateTime(java.util.Date updateTime){
this.updateTime = updateTime;
}
/**
@ -182,7 +189,7 @@ public class BaGoodsCategoryEntity implements java.io.Serializable {
*@return: java.lang.String
*/
@Column(name ="SYS_ORG_CODE",nullable=true,length=50)
public String getSysOrgCode(){
public java.lang.String getSysOrgCode(){
return this.sysOrgCode;
}
@ -190,7 +197,7 @@ public class BaGoodsCategoryEntity implements java.io.Serializable {
*: java.lang.String
*@param: java.lang.String
*/
public void setSysOrgCode(String sysOrgCode){
public void setSysOrgCode(java.lang.String sysOrgCode){
this.sysOrgCode = sysOrgCode;
}
/**
@ -198,7 +205,7 @@ public class BaGoodsCategoryEntity implements java.io.Serializable {
*@return: java.lang.String
*/
@Column(name ="CATEGORY_CODE",nullable=true,length=50)
public String getCategoryCode(){
public java.lang.String getCategoryCode(){
return this.categoryCode;
}
@ -206,7 +213,7 @@ public class BaGoodsCategoryEntity implements java.io.Serializable {
*: java.lang.String
*@param: java.lang.String
*/
public void setCategoryCode(String categoryCode){
public void setCategoryCode(java.lang.String categoryCode){
this.categoryCode = categoryCode;
}
/**
@ -214,7 +221,7 @@ public class BaGoodsCategoryEntity implements java.io.Serializable {
*@return: java.lang.String
*/
@Column(name ="CATEGORY_NAME",nullable=true,length=50)
public String getCategoryName(){
public java.lang.String getCategoryName(){
return this.categoryName;
}
@ -222,7 +229,7 @@ public class BaGoodsCategoryEntity implements java.io.Serializable {
*: java.lang.String
*@param: java.lang.String
*/
public void setCategoryName(String categoryName){
public void setCategoryName(java.lang.String categoryName){
this.categoryName = categoryName;
}
/**
@ -230,7 +237,7 @@ public class BaGoodsCategoryEntity implements java.io.Serializable {
*@return: java.lang.Integer
*/
@Column(name ="CATEGORY_LEVEL",nullable=true,length=10)
public Integer getCategoryLevel(){
public java.lang.Integer getCategoryLevel(){
return this.categoryLevel;
}
@ -238,7 +245,7 @@ public class BaGoodsCategoryEntity implements java.io.Serializable {
*: java.lang.Integer
*@param: java.lang.Integer
*/
public void setCategoryLevel(Integer categoryLevel){
public void setCategoryLevel(java.lang.Integer categoryLevel){
this.categoryLevel = categoryLevel;
}
/**
@ -246,7 +253,7 @@ public class BaGoodsCategoryEntity implements java.io.Serializable {
*@return: java.lang.Integer
*/
@Column(name ="PID",nullable=true,length=10)
public Integer getPid(){
public java.lang.Integer getPid(){
return this.pid;
}
@ -254,7 +261,7 @@ public class BaGoodsCategoryEntity implements java.io.Serializable {
*: java.lang.Integer
*@param: java.lang.Integer
*/
public void setPid(Integer pid){
public void setPid(java.lang.Integer pid){
this.pid = pid;
}
/**
@ -262,7 +269,7 @@ public class BaGoodsCategoryEntity implements java.io.Serializable {
*@return: java.lang.String
*/
@Column(name ="TOP_NODE",nullable=true,length=10)
public String getTopNode(){
public java.lang.String getTopNode(){
return this.topNode;
}
@ -270,7 +277,7 @@ public class BaGoodsCategoryEntity implements java.io.Serializable {
*: java.lang.String
*@param: java.lang.String
*/
public void setTopNode(String topNode){
public void setTopNode(java.lang.String topNode){
this.topNode = topNode;
}
}

View File

@ -0,0 +1,51 @@
package com.zzjee.ba.vo;
import java.util.List;
/**
* @Package com.zzjee.ba.vo
* @date 2021/8/20 11:38
* @description
*/
public class BaGoodsCategoryVoo {
private String categoryName;
private String id;
private String pid;
private List<BaGoodsCategoryVoo> baGoodsCategory;
public String getCategoryName() {
return categoryName;
}
public void setCategoryName(String categoryName) {
this.categoryName = categoryName;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getPid() {
return pid;
}
public void setPid(String pid) {
this.pid = pid;
}
public List<BaGoodsCategoryVoo> getBaGoodsCategory() {
return baGoodsCategory;
}
public void setBaGoodsCategory(List<BaGoodsCategoryVoo> baGoodsCategory) {
this.baGoodsCategory = baGoodsCategory;
}
}

View File

@ -342,8 +342,7 @@ public class MdGoodsController extends BaseController {
@RequestMapping(params = "goAdd")
public ModelAndView goAdd(MdGoodsEntity mdGoods, HttpServletRequest req) {
if (StringUtil.isNotEmpty(mdGoods.getId())) {
mdGoods = mdGoodsService.getEntity(MdGoodsEntity.class,
mdGoods.getId());
mdGoods = mdGoodsService.getEntity(MdGoodsEntity.class,mdGoods.getId());
req.setAttribute("mdGoodsPage", mdGoods);
}
return new ModelAndView("com/zzjee/md/mdGoods-add");

View File

@ -5,6 +5,54 @@
<head>
<title>商品类目</title>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<style type="text/css">
.combo_self{height: 22px !important;width: 150px !important;}
.layout-header .btn {
margin:0;
float: none !important;
}
.btn-default {
height: 35px;
line-height: 35px;
font-size:14px;
}
</style>
<script type="text/javascript">
$(function(){
$(".combo").removeClass("combo").addClass("combo combo_self");
$(".combo").each(function(){
$(this).parent().css("line-height","0px");
});
});
/**树形列表数据转换**/
function convertTreeData(rows, textField) {
for(var i = 0; i < rows.length; i++) {
var row = rows[i];
row.text = row[textField];
if(row.children) {
row.state = "open";
convertTreeData(row.children, textField);
}
}
}
/**树形列表加入子元素**/
function joinTreeChildren(arr1, arr2) {
for(var i = 0; i < arr1.length; i++) {
var row1 = arr1[i];
for(var j = 0; j < arr2.length; j++) {
if(row1.id == arr2[j].id) {
var children = arr2[j].children;
if(children) {
row1.children = children;
}
}
}
}
}
</script>
<script type="text/javascript">
//编写自定义JS代码
</script>
@ -72,10 +120,34 @@
</label>
</td>
<td class="value">
<input id="pid" name="pid" type="text" style="width: 150px" class="inputxt"
<input id="pid" name="pid" type="text" style="width: 150px" class="inputxt easyui-combotree"
ignore="ignore"
/>
data-options="panelHeight:'220',
url: 'baGoodsCategoryController.do?datagrid&field=id,categoryName',
loadFilter: function(data) {
var rows = data.rows || data;
var win = frameElement.api.opener;
var listRows = win.getDataGrid().treegrid('getData');
joinTreeChildren(rows, listRows);
convertTreeData(rows, 'categoryName');
return rows;
},
onLoadSuccess: function() {
var win = frameElement.api.opener;
var currRow = win.getDataGrid().treegrid('getSelected');
if(!'${baGoodsCategoryPage.id}') {
//增加时,选择当前父菜单
if(currRow) {
$('#pid').combotree('setValue', currRow.id);
}
}else {
//编辑时,选择当前父菜单
if(currRow) {
$('#pid').combotree('setValue', currRow.pid);
}
}
}">
<span class="Validform_checktip"></span>
<label class="Validform_label" style="display: none;">父级目录</label>
</td>

View File

@ -5,6 +5,54 @@
<head>
<title>商品类目</title>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<style type="text/css">
.combo_self{height: 22px !important;width: 150px !important;}
.layout-header .btn {
margin:0;
float: none !important;
}
.btn-default {
height: 35px;
line-height: 35px;
font-size:14px;
}
</style>
<script type="text/javascript">
$(function(){
$(".combo").removeClass("combo").addClass("combo combo_self");
$(".combo").each(function(){
$(this).parent().css("line-height","0px");
});
});
/**树形列表数据转换**/
function convertTreeData(rows, textField) {
for(var i = 0; i < rows.length; i++) {
var row = rows[i];
row.text = row[textField];
if(row.children) {
row.state = "open";
convertTreeData(row.children, textField);
}
}
}
/**树形列表加入子元素**/
function joinTreeChildren(arr1, arr2) {
for(var i = 0; i < arr1.length; i++) {
var row1 = arr1[i];
for(var j = 0; j < arr2.length; j++) {
if(row1.id == arr2[j].id) {
var children = arr2[j].children;
if(children) {
row1.children = children;
}
}
}
}
}
</script>
<script type="text/javascript">
//编写自定义JS代码
</script>
@ -69,9 +117,37 @@
</label>
</td>
<td class="value">
<input id="pid" name="pid" type="text" style="width: 150px" class="inputxt"
<input id="pid" name="pid" type="text" style="width: 150px" class="inputxt easyui-combotree"
value='${baGoodsCategoryPage.pid}'
ignore="ignore"
value='${baGoodsCategoryPage.pid}'>
data-options="
panelHeight:'220',
url: 'baGoodsCategoryController.do?datagrid&field=id,categoryName',
loadFilter: function(data) {
var rows = data.rows || data;
var win = frameElement.api.opener;
var listRows = win.getDataGrid().treegrid('getData');
joinTreeChildren(rows, listRows);
convertTreeData(rows, 'categoryName');
return rows;
},
onLoadSuccess: function() {
var win = frameElement.api.opener;
var currRow = win.getDataGrid().treegrid('getSelected');
if(!'${baGoodsCategoryPage.id}') {
//增加时,选择当前父菜单
if(currRow) {
$('#pid').combotree('setValue', currRow.id);
}
}else {
//编辑时,选择当前父菜单
if(currRow) {
$('#pid').combotree('setValue', currRow.pid);
}
}
}
"
>
<span class="Validform_checktip"></span>
<label class="Validform_label" style="display: none;">父级目录</label>
</td>

View File

@ -3,9 +3,9 @@
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<div class="easyui-layout" fit="true">
<div region="center" style="padding:0px;border:0px">
<t:datagrid name="baGoodsCategoryList" checkbox="true" pagination="true" fitColumns="false" title="商品类目" actionUrl="baGoodsCategoryController.do?datagrid" idField="id" fit="true" queryMode="group">
<t:datagrid name="baGoodsCategoryList" checkbox="true" pagination="false" treegrid="true" treeField="categoryName" fitColumns="false" title="商品类目" actionUrl="baGoodsCategoryController.do?datagrid" idField="id" fit="true" queryMode="group">
<t:dgCol title="id" field="id" hidden="true" queryMode="group" width="120"></t:dgCol>
<t:dgCol title="创建人名称" field="createName" queryMode="group" width="120"></t:dgCol>
<t:dgCol title="创建人名称" field="createName" hidden="true" queryMode="group" width="120"></t:dgCol>
<t:dgCol title="创建人登录名称" field="createBy" hidden="true" queryMode="group" width="120"></t:dgCol>
<t:dgCol title="创建日期" field="createTime" formatter="yyyy-MM-dd" query="true" queryMode="group" width="120"></t:dgCol>
<t:dgCol title="更新人名称" field="updateName" hidden="true" queryMode="group" width="120"></t:dgCol>
@ -13,9 +13,9 @@
<t:dgCol title="更新日期" field="updateTime" formatter="yyyy-MM-dd" hidden="true" queryMode="group" width="120"></t:dgCol>
<t:dgCol title="所属部门" field="sysOrgCode" hidden="true" queryMode="group" width="120"></t:dgCol>
<t:dgCol title="类目编码" field="categoryCode" query="true" queryMode="single" width="120"></t:dgCol>
<t:dgCol title="类目名称" field="categoryName" query="true" queryMode="single" width="120"></t:dgCol>
<t:dgCol title="类目级别" field="categoryLevel" queryMode="group" width="120"></t:dgCol>
<t:dgCol title="父级目录" field="pid" queryMode="group" width="120"></t:dgCol>
<t:dgCol title="类目名称" field="categoryName" query="true" queryMode="single" width="220"></t:dgCol>
<t:dgCol title="类目级别" field="categoryLevel" query="true" queryMode="single" width="120"></t:dgCol>
<t:dgCol title="父级目录" field="pid" hidden="true" queryMode="group" width="120"></t:dgCol>
<t:dgCol title="是否为顶级目录" field="topNode" hidden="true" queryMode="group" dictionary="yes_no" width="120"></t:dgCol>
<t:dgCol title="操作" field="opt" width="100"></t:dgCol>
<t:dgDelOpt title="删除" url="baGoodsCategoryController.do?doDel&id={id}" urlclass="ace_button" urlfont="fa-trash-o"/>
@ -32,6 +32,15 @@
<script src = "webpage/com/zzjee/ba/baGoodsCategoryList.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#baGoodsCategoryList").treegrid({
onExpand : function(row){
var children = $("#baGoodsCategoryList").treegrid('getChildren',row.id);
if(children.length<=0){
row.leaf=true;
$("#baGoodsCategoryList").treegrid('refresh', row.id);
}
}
});
});
@ -51,4 +60,12 @@ function ExportXlsByT() {
JeecgExcelExport("baGoodsCategoryController.do?exportXlsByT","baGoodsCategoryList");
}
/**
* 获取表格对象
* @return 表格对象
*/
function getDataGrid(){
var datagrid = $('#'+gridname);
return datagrid;
}
</script>

View File

@ -1,5 +1,6 @@
<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,autocomplete"></t:base>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
@ -86,6 +87,7 @@ function counttiji(){
<span class="Validform_checktip" style="float:left;height:0px;"></span>
<label class="Validform_label" style="display: none">产品属性</label>
</div>
<div class="col-xs-3 text-center">
<b style="color:red">价格</b>
</div>
@ -152,7 +154,16 @@ function counttiji(){
<label class="Validform_label" style="display: none">商品品牌</label>
</div>
</div>
<div class="row show-grid">
<div class="col-xs-3 text-center">
<b style="color:red">商品类目</b>
</div>
<div class="col-xs-3">
<t:comboTree name="categoryCode" id="categoryCode" url="baGoodsCategoryController.do?getComboTreeData" width="400" multiple="false"></t:comboTree>
<span class="Validform_checktip" style="float:left;height:0px;"></span>
<label class="Validform_label" style="display: none">商品类目</label>
</div>
</div>
<div class="row show-grid">
@ -185,7 +196,6 @@ function counttiji(){
<div class="row show-grid">
<div class="col-xs-3 text-center">
<b >日文名称</b>
</div>

View File

@ -29,6 +29,7 @@
<t:dgCol title="商品规格" field="shpGuiGe" queryMode="group" width="80"></t:dgCol>
<t:dgCol title="商品颜色" field="shpYanSe" hidden="true" queryMode="group" width="120"></t:dgCol>
<t:dgCol title="产品属性" field="chpShuXing" query="true" queryMode="single" dictionary="ba_goods_type,goods_type_code,goods_type_name" width="120"></t:dgCol>
<t:dgCol title="商品类目" field="categoryCode" query="true" queryMode="single" width="90"></t:dgCol>
<t:dgCol title="存放温层" field="cfWenCeng" queryMode="single" dictionary="ba_deg_type,deg_type_code,deg_type_name" width="80"></t:dgCol>
<t:dgCol title="拆零控制" field="chlKongZhi" queryMode="group" dictionary="sf_yn" width="60"></t:dgCol>
<t:dgCol title="码盘单层数量" field="mpDanCeng" style="text-align:right" queryMode="group" width="60"></t:dgCol>