Java full-stack development---Java ERP system development: commercial ERP (6) perfect product function

1. Improve the list and search

1. Display of product type

Idea: Establish a many-to-one association in the commodity entity, and associate the commodity type (Goodstype)
Insert picture description here

(1) Modify the mapping file of the entity class (improve the product type)

Insert picture description here

(2) Configure the corresponding entity class (Goods)

Insert picture description here

(3) Modify the content in GoodsDao

Insert picture description here

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

Insert picture description here

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

Product type displayed successfully
Insert picture description here

2. Realization of product search function

(1) Search the way to install the product type, set the drop-down menu

Insert picture description here

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

Insert picture description here

3. Modify the product

(1) Set the product drop-down menu

Insert picture description here

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

Insert picture description here

(2) Set the corresponding value when modifying the page

Insert picture description here
Insert picture description here

<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>

Insert picture description here

4. Set some values ​​that cannot be empty

Insert picture description here

<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>

Insert picture description here

5. Set up query products based on the purchase price as the interval

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

Insert picture description here

(2) Modify GoodsDao

Insert picture description here

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()));
	}
}

Achieve effect

Insert picture description here

Guess you like

Origin blog.csdn.net/qq_44757034/article/details/109315504