Java全栈开发---Java ERP系统开发:商业ERP(六)商品功能的完善

一、完善列表和搜索

1、商品类型的显示

思路:在商品实体建立多对一的关联,关联商品类型(Goodstype)
在这里插入图片描述

(1)修改实体类的映射文件(完善商品类型)

在这里插入图片描述

(2)配置对应的实体类(Goods)

在这里插入图片描述

(3)修改GoodsDao当中的内容

在这里插入图片描述

// 根据商品类型查询
// 当商品类型不为空并且商品的id不为空的时候,添加查询的条件(根据商品的类型来查询)
if (null != goods1.getGoodstype() && goods1.getGoodstype().getUuid() != null) {
    
    
	dc.add(Restrictions.eq("goodstype", goods1.getGoodstype()));
}
(4)修改goods.html页面当中的内容

在这里插入图片描述

{
    
    field:'goodstype',title:'商品类型',width:100, formatter:function(value){
    
    
	  	return value.name;
}},

商品类型显示成功
在这里插入图片描述

2、商品搜索功能的实现

(1)安装商品类型的方式搜索,设置下拉菜单

在这里插入图片描述

商品类型:<input name="t1.goodstype.uuid" class="easyui-combobox" data-options="
		url:'goodstype_list', valueField:'uuid',textField:'name'
	" >

在这里插入图片描述

3、修改商品

(1)设置商品下拉菜单

在这里插入图片描述

<td>商品类型</td><td><input name="t.goodstype.uuid" class="easyui-combobox" data-options="
		url:'goodstype_list', valueField:'uuid',textField:'name'
	" > </td>

在这里插入图片描述

(2)修改页面的时候设置对应的数值

在这里插入图片描述
在这里插入图片描述

<tr>
	 <td>进货价格</td><td><input name="t.inprice" class="easyui-numberbox" data-options="min:0,precision:2,prefix:''¥" > </td>
</tr> 
<tr>
	 <td>销售价格</td><td><input name="t.outprice"  class="easyui-numberbox" data-options="min:0,precision:2,prefix:''¥" > </td>
</tr>

在这里插入图片描述

4、设置一些值不能为空

在这里插入图片描述

<tr>
<td>名称</td>
<td><input name="t.name" class="easyui-validatebox" data-options="required:true,missingMessage:'名称不能为空!'">
</td>
</tr>
<tr>
<td>商品类型</td>
<td><input name="t.goodstype.uuid" class="easyui-combobox"  data-options="url:'goodstype_list', valueField:'uuid',textField:'name' ,required:'true'" >
</td>
</tr>

在这里插入图片描述

5、设置以进货价格为区间的查询商品

(1)修改goods.html
进货价格:<input name="t1.inprice" ><input name="t2.inprice" >

在这里插入图片描述

(2)修改GoodsDao

在这里插入图片描述

if (null != goods1.getInprice()) {
    
    
		dc.add(Restrictions.ge("inprice", goods1.getInprice()));
	}
}
if (goods2 != null) {
    
    
	if (null != goods2.getInprice()) {
    
    
		dc.add(Restrictions.le("inprice", goods2.getInprice()));
	}
}

实现效果

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_44757034/article/details/109315504