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)
(1) Modify the mapping file of the entity class (improve the product type)
(2) Configure the corresponding entity class (Goods)
(3) Modify the content in GoodsDao
// 根据商品类型查询
// 当商品类型不为空并且商品的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
{
field:'goodstype',title:'商品类型',width:100, formatter:function(value){
return value.name;
}},
Product type displayed successfully
2. Realization of product search function
(1) Search the way to install the product type, set the drop-down menu
商品类型:<input name="t1.goodstype.uuid" class="easyui-combobox" data-options="
url:'goodstype_list', valueField:'uuid',textField:'name'
" >
3. Modify the product
(1) Set the product drop-down menu
<td>商品类型</td><td><input name="t.goodstype.uuid" class="easyui-combobox" data-options="
url:'goodstype_list', valueField:'uuid',textField:'name'
" > </td>
(2) Set the corresponding value when modifying the page
<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. Set some values that cannot be empty
<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. Set up query products based on the purchase price as the interval
(1) Modify goods.html
进货价格:<input name="t1.inprice" > 到 <input name="t2.inprice" >
(2) Modify 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()));
}
}
Achieve effect