|
@@ -12,6 +12,8 @@ import com.youxianxin.project.system.accountGroup.domain.JnAccountGroup;
|
|
|
import com.youxianxin.project.system.accountGroup.service.IJnAccountGroupService;
|
|
|
import com.youxianxin.project.system.goods.domain.JnGoods;
|
|
|
import com.youxianxin.project.system.goods.service.IJnGoodsService;
|
|
|
+import com.youxianxin.project.system.goodsType.domain.JnGoodsType;
|
|
|
+import com.youxianxin.project.system.goodsType.service.IJnGoodsTypeService;
|
|
|
import com.youxianxin.project.system.user.domain.User;
|
|
|
import com.youxianxin.project.system.utils.ReturnCode;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -46,6 +48,8 @@ public class JnGroupController extends BaseController
|
|
|
@Autowired
|
|
|
private IJnGoodsService jnGoodsService;
|
|
|
@Autowired
|
|
|
+ private IJnGoodsTypeService jnGoodsTypeService;
|
|
|
+ @Autowired
|
|
|
private IJnAccountService jnAccountService;
|
|
|
@Autowired
|
|
|
private IJnAccountGroupService jnAccountGroupService;
|
|
@@ -103,12 +107,21 @@ public class JnGroupController extends BaseController
|
|
|
//供应商只能看到自己添加的菜品
|
|
|
String roleKey = sysUser.getRoles().get(0).getRoleKey();
|
|
|
JnGoods jnGoods = new JnGoods();
|
|
|
+ JnGoodsType goodsType = new JnGoodsType();
|
|
|
if ("supplier".equals(roleKey)){
|
|
|
jnGoods.setUserId(sysUser.getUserId());
|
|
|
+ goodsType.setHold1(sysUser.getUserId() + "");
|
|
|
}
|
|
|
- List<JnGoods> goodsList = jnGoodsService.selectJnGoodsList(jnGoods);
|
|
|
|
|
|
- map.put("goodsList",goodsList);
|
|
|
+ List<JnGoodsType> goodsTypeList = jnGoodsTypeService.selectJnGoodsTypeList(goodsType);
|
|
|
+ goodsTypeList.forEach(type -> {
|
|
|
+ jnGoods.setGoodsType(type.getTypeId());
|
|
|
+ List<JnGoods> goodsList = jnGoodsService.selectJnGoodsList(jnGoods);
|
|
|
+ type.setGoodsList(goodsList);
|
|
|
+ });
|
|
|
+
|
|
|
+ map.put("goodsTypeList", goodsTypeList);
|
|
|
+// map.put("goodsList",goodsList);
|
|
|
return prefix + "/add";
|
|
|
}
|
|
|
|
|
@@ -149,32 +162,42 @@ public class JnGroupController extends BaseController
|
|
|
//供应商只能看到自己添加的菜品
|
|
|
String roleKey = sysUser.getRoles().get(0).getRoleKey();
|
|
|
JnGoods jnGoods = new JnGoods();
|
|
|
+ JnGoodsType goodsType = new JnGoodsType();
|
|
|
if ("supplier".equals(roleKey)){
|
|
|
jnGoods.setUserId(sysUser.getUserId());
|
|
|
+ goodsType.setHold1(sysUser.getUserId() + "");
|
|
|
}
|
|
|
- List<JnGoods> goodsList = jnGoodsService.selectJnGoodsList(jnGoods);
|
|
|
JnGroup jnGroup = jnGroupService.selectJnGroupByGroupId(groupId);
|
|
|
- //根据分组中的菜品ids,标记选中的菜品
|
|
|
- if (StringUtils.isNotEmpty(jnGroup.getGoodsIds())){
|
|
|
- if (jnGroup.getGoodsIds().contains(",")){
|
|
|
- String[] split = jnGroup.getGoodsIds().split(",");
|
|
|
- for (String s:split){
|
|
|
+ List<JnGoodsType> goodsTypeList = jnGoodsTypeService.selectJnGoodsTypeList(goodsType);
|
|
|
+ goodsTypeList.forEach(type -> {
|
|
|
+ jnGoods.setGoodsType(type.getTypeId());
|
|
|
+ List<JnGoods> goodsList = jnGoodsService.selectJnGoodsList(jnGoods);
|
|
|
+ //根据分组中的菜品ids,标记选中的菜品
|
|
|
+ if (StringUtils.isNotEmpty(jnGroup.getGoodsIds())){
|
|
|
+ if (jnGroup.getGoodsIds().contains(",")){
|
|
|
+ String[] split = jnGroup.getGoodsIds().split(",");
|
|
|
+ for (String s:split){
|
|
|
+ for (JnGoods jg:goodsList){
|
|
|
+ if (s.equals(jg.getGoodsId().toString())){
|
|
|
+ jg.setFlag(true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else {
|
|
|
for (JnGoods jg:goodsList){
|
|
|
- if (s.equals(jg.getGoodsId().toString())){
|
|
|
+ if (jnGroup.getGoodsIds().equals(jg.getGoodsId().toString())){
|
|
|
jg.setFlag(true);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }else {
|
|
|
- for (JnGoods jg:goodsList){
|
|
|
- if (jnGroup.getGoodsIds().equals(jg.getGoodsId().toString())){
|
|
|
- jg.setFlag(true);
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
- }
|
|
|
+ type.setGoodsList(goodsList);
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- mmap.put("goodsList", goodsList);
|
|
|
+// mmap.put("goodsList", goodsList);
|
|
|
+ mmap.put("goodsTypeList", goodsTypeList);
|
|
|
mmap.put("jnGroup", jnGroup);
|
|
|
return prefix + "/edit";
|
|
|
}
|