给商品相关的模块优化接口

This commit is contained in:
jishenghua
2025-02-23 14:49:34 +08:00
parent db090f8dd5
commit 8e3a971a04
30 changed files with 413 additions and 714 deletions

View File

@@ -11,18 +11,12 @@ public class TableDataInfo implements Serializable
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 总记录数 */
private long total;
/** 消息状态码 */ /** 消息状态码 */
private int code; private int code;
/** 消息状态码 */ /** 消息状态码 */
private Object data; private Object data;
/** 消息内容 */
private String msg;
/** /**
* 表格数据对象 * 表格数据对象
*/ */
@@ -30,16 +24,6 @@ public class TableDataInfo implements Serializable
{ {
} }
public long getTotal()
{
return total;
}
public void setTotal(long total)
{
this.total = total;
}
public int getCode() public int getCode()
{ {
return code; return code;
@@ -57,14 +41,4 @@ public class TableDataInfo implements Serializable
public void setData(Object data) { public void setData(Object data) {
this.data = data; this.data = data;
} }
public String getMsg()
{
return msg;
}
public void setMsg(String msg)
{
this.msg = msg;
}
} }

View File

@@ -2,22 +2,27 @@ package com.jsh.erp.controller;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.base.BaseController;
import com.jsh.erp.base.TableDataInfo;
import com.jsh.erp.datasource.entities.MaterialAttribute; import com.jsh.erp.datasource.entities.MaterialAttribute;
import com.jsh.erp.datasource.entities.Person;
import com.jsh.erp.service.materialAttribute.MaterialAttributeService; import com.jsh.erp.service.materialAttribute.MaterialAttributeService;
import com.jsh.erp.utils.BaseResponseInfo; import com.jsh.erp.utils.Constants;
import com.jsh.erp.utils.ErpInfo;
import com.jsh.erp.utils.StringUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
import static com.jsh.erp.utils.ResponseJsonUtil.returnStr;
/** /**
* @author ji sheng hua jshERP * @author ji sheng hua jshERP
@@ -25,12 +30,81 @@ import java.util.List;
@RestController @RestController
@RequestMapping(value = "/materialAttribute") @RequestMapping(value = "/materialAttribute")
@Api(tags = {"商品属性"}) @Api(tags = {"商品属性"})
public class MaterialAttributeController { public class MaterialAttributeController extends BaseController {
private Logger logger = LoggerFactory.getLogger(MaterialAttributeController.class); private Logger logger = LoggerFactory.getLogger(MaterialAttributeController.class);
@Resource @Resource
private MaterialAttributeService materialAttributeService; private MaterialAttributeService materialAttributeService;
@GetMapping(value = "/info")
@ApiOperation(value = "根据id获取信息")
public String getList(@RequestParam("id") Long id,
HttpServletRequest request) throws Exception {
MaterialAttribute materialAttribute = materialAttributeService.getMaterialAttribute(id);
Map<String, Object> objectMap = new HashMap<>();
if(materialAttribute != null) {
objectMap.put("info", materialAttribute);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@GetMapping(value = "/list")
@ApiOperation(value = "获取信息列表")
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request)throws Exception {
String attributeName = StringUtil.getInfo(search, "attributeName");
List<MaterialAttribute> list = materialAttributeService.select(attributeName);
return getDataTable(list);
}
@PostMapping(value = "/add")
@ApiOperation(value = "新增")
public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = materialAttributeService.insertMaterialAttribute(obj, request);
return returnStr(objectMap, insert);
}
@PutMapping(value = "/update")
@ApiOperation(value = "修改")
public String updateResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = materialAttributeService.updateMaterialAttribute(obj, request);
return returnStr(objectMap, update);
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除")
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = materialAttributeService.deleteMaterialAttribute(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除")
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = materialAttributeService.batchDeleteMaterialAttribute(ids, request);
return returnStr(objectMap, delete);
}
@GetMapping(value = "/checkIsNameExist")
@ApiOperation(value = "检查名称是否存在")
public String checkIsNameExist(@RequestParam Long id, @RequestParam(value ="name", required = false) String name,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int exist = materialAttributeService.checkIsNameExist(id, name);
if(exist > 0) {
objectMap.put("status", true);
} else {
objectMap.put("status", false);
}
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
/** /**
* 获取商品属性的名称列表 * 获取商品属性的名称列表
* @param request * @param request

View File

@@ -3,14 +3,15 @@ package com.jsh.erp.controller;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.BusinessConstants; import com.jsh.erp.base.BaseController;
import com.jsh.erp.constants.ExceptionConstants; import com.jsh.erp.base.TableDataInfo;
import com.jsh.erp.datasource.entities.MaterialCategory; import com.jsh.erp.datasource.entities.MaterialCategory;
import com.jsh.erp.datasource.entities.SerialNumberEx;
import com.jsh.erp.datasource.vo.TreeNode; import com.jsh.erp.datasource.vo.TreeNode;
import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.service.materialCategory.MaterialCategoryService; import com.jsh.erp.service.materialCategory.MaterialCategoryService;
import com.jsh.erp.utils.BaseResponseInfo; import com.jsh.erp.utils.BaseResponseInfo;
import com.jsh.erp.utils.Constants;
import com.jsh.erp.utils.ErpInfo;
import com.jsh.erp.utils.StringUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger; import org.slf4j.Logger;
@@ -19,7 +20,12 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
import static com.jsh.erp.utils.ResponseJsonUtil.returnStr;
/** /**
* @author ji—sheng—hua jshERP * @author ji—sheng—hua jshERP
@@ -27,12 +33,82 @@ import java.util.List;
@RestController @RestController
@RequestMapping(value = "/materialCategory") @RequestMapping(value = "/materialCategory")
@Api(tags = {"商品类别"}) @Api(tags = {"商品类别"})
public class MaterialCategoryController { public class MaterialCategoryController extends BaseController {
private Logger logger = LoggerFactory.getLogger(MaterialCategoryController.class); private Logger logger = LoggerFactory.getLogger(MaterialCategoryController.class);
@Resource @Resource
private MaterialCategoryService materialCategoryService; private MaterialCategoryService materialCategoryService;
@GetMapping(value = "/info")
@ApiOperation(value = "根据id获取信息")
public String getList(@RequestParam("id") Long id,
HttpServletRequest request) throws Exception {
MaterialCategory materialCategory = materialCategoryService.getMaterialCategory(id);
Map<String, Object> objectMap = new HashMap<>();
if(materialCategory != null) {
objectMap.put("info", materialCategory);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@GetMapping(value = "/list")
@ApiOperation(value = "获取信息列表")
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request)throws Exception {
String name = StringUtil.getInfo(search, "name");
Integer parentId = StringUtil.parseInteger(StringUtil.getInfo(search, "parentId"));
List<MaterialCategory> list = materialCategoryService.select(name, parentId);
return getDataTable(list);
}
@PostMapping(value = "/add")
@ApiOperation(value = "新增")
public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = materialCategoryService.insertMaterialCategory(obj, request);
return returnStr(objectMap, insert);
}
@PutMapping(value = "/update")
@ApiOperation(value = "修改")
public String updateResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = materialCategoryService.updateMaterialCategory(obj, request);
return returnStr(objectMap, update);
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除")
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = materialCategoryService.deleteMaterialCategory(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除")
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = materialCategoryService.batchDeleteMaterialCategory(ids, request);
return returnStr(objectMap, delete);
}
@GetMapping(value = "/checkIsNameExist")
@ApiOperation(value = "检查名称是否存在")
public String checkIsNameExist(@RequestParam Long id, @RequestParam(value ="name", required = false) String name,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int exist = materialCategoryService.checkIsNameExist(id, name);
if(exist > 0) {
objectMap.put("status", true);
} else {
objectMap.put("status", false);
}
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
/** /**
* 获取全部商品类别 * 获取全部商品类别
* @param parentId * @param parentId

View File

@@ -2,6 +2,9 @@ package com.jsh.erp.controller;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.base.BaseController;
import com.jsh.erp.base.TableDataInfo;
import com.jsh.erp.datasource.entities.Material;
import com.jsh.erp.datasource.entities.MaterialExtend; import com.jsh.erp.datasource.entities.MaterialExtend;
import com.jsh.erp.datasource.entities.MaterialVo4Unit; import com.jsh.erp.datasource.entities.MaterialVo4Unit;
import com.jsh.erp.datasource.entities.Unit; import com.jsh.erp.datasource.entities.Unit;
@@ -12,10 +15,7 @@ import com.jsh.erp.service.role.RoleService;
import com.jsh.erp.service.systemConfig.SystemConfigService; import com.jsh.erp.service.systemConfig.SystemConfigService;
import com.jsh.erp.service.unit.UnitService; import com.jsh.erp.service.unit.UnitService;
import com.jsh.erp.service.user.UserService; import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.BaseResponseInfo; import com.jsh.erp.utils.*;
import com.jsh.erp.utils.ErpInfo;
import com.jsh.erp.utils.PinYinUtil;
import com.jsh.erp.utils.StringUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger; import org.slf4j.Logger;
@@ -34,6 +34,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import static com.jsh.erp.utils.ResponseJsonUtil.returnJson; import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
import static com.jsh.erp.utils.ResponseJsonUtil.returnStr;
/** /**
* @author ji|sheng|hua jshERP * @author ji|sheng|hua jshERP
@@ -41,7 +42,7 @@ import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
@RestController @RestController
@RequestMapping(value = "/material") @RequestMapping(value = "/material")
@Api(tags = {"商品管理"}) @Api(tags = {"商品管理"})
public class MaterialController { public class MaterialController extends BaseController {
private Logger logger = LoggerFactory.getLogger(MaterialController.class); private Logger logger = LoggerFactory.getLogger(MaterialController.class);
@Resource @Resource
@@ -68,6 +69,91 @@ public class MaterialController {
@Value(value="${file.uploadType}") @Value(value="${file.uploadType}")
private Long fileUploadType; private Long fileUploadType;
@GetMapping(value = "/info")
@ApiOperation(value = "根据id获取信息")
public String getList(@RequestParam("id") Long id,
HttpServletRequest request) throws Exception {
Material material = materialService.getMaterial(id);
Map<String, Object> objectMap = new HashMap<>();
if(material != null) {
objectMap.put("info", material);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@GetMapping(value = "/list")
@ApiOperation(value = "获取信息列表")
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request)throws Exception {
String categoryId = StringUtil.getInfo(search, "categoryId");
String materialParam = StringUtil.getInfo(search, "materialParam");
String standard = StringUtil.getInfo(search, "standard");
String model = StringUtil.getInfo(search, "model");
String color = StringUtil.getInfo(search, "color");
String brand = StringUtil.getInfo(search, "brand");
String mfrs = StringUtil.getInfo(search, "mfrs");
String materialOther = StringUtil.getInfo(search, "materialOther");
String weight = StringUtil.getInfo(search, "weight");
String expiryNum = StringUtil.getInfo(search, "expiryNum");
String enableSerialNumber = StringUtil.getInfo(search, "enableSerialNumber");
String enableBatchNumber = StringUtil.getInfo(search, "enableBatchNumber");
String position = StringUtil.getInfo(search, "position");
String enabled = StringUtil.getInfo(search, "enabled");
String remark = StringUtil.getInfo(search, "remark");
String mpList = StringUtil.getInfo(search, "mpList");
List<MaterialVo4Unit> list = materialService.select(materialParam, standard, model, color, brand, mfrs, materialOther, weight, expiryNum,
enableSerialNumber, enableBatchNumber, position, enabled, remark, categoryId, mpList);
return getDataTable(list);
}
@PostMapping(value = "/add")
@ApiOperation(value = "新增")
public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = materialService.insertMaterial(obj, request);
return returnStr(objectMap, insert);
}
@PutMapping(value = "/update")
@ApiOperation(value = "修改")
public String updateResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = materialService.updateMaterial(obj, request);
return returnStr(objectMap, update);
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除")
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = materialService.deleteMaterial(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除")
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = materialService.batchDeleteMaterial(ids, request);
return returnStr(objectMap, delete);
}
@GetMapping(value = "/checkIsNameExist")
@ApiOperation(value = "检查名称是否存在")
public String checkIsNameExist(@RequestParam Long id, @RequestParam(value ="name", required = false) String name,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int exist = materialService.checkIsNameExist(id, name);
if(exist > 0) {
objectMap.put("status", true);
} else {
objectMap.put("status", false);
}
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
/** /**
* 检查商品是否存在 * 检查商品是否存在
* @param id * @param id

View File

@@ -6,6 +6,7 @@ import com.jsh.erp.datasource.entities.MaterialExtend;
import com.jsh.erp.datasource.vo.MaterialExtendVo4List; import com.jsh.erp.datasource.vo.MaterialExtendVo4List;
import com.jsh.erp.service.materialExtend.MaterialExtendService; import com.jsh.erp.service.materialExtend.MaterialExtendService;
import com.jsh.erp.utils.BaseResponseInfo; import com.jsh.erp.utils.BaseResponseInfo;
import com.jsh.erp.utils.ErpInfo;
import com.jsh.erp.utils.StringUtil; import com.jsh.erp.utils.StringUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@@ -20,6 +21,9 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
import static com.jsh.erp.utils.ResponseJsonUtil.returnStr;
/** /**
* @author jijiaqing * @author jijiaqing
*/ */
@@ -31,12 +35,57 @@ public class MaterialExtendController {
@Resource @Resource
private MaterialExtendService materialExtendService; private MaterialExtendService materialExtendService;
@GetMapping(value = "/info")
@ApiOperation(value = "根据id获取信息")
public String getList(@RequestParam("id") Long id,
HttpServletRequest request) throws Exception {
MaterialExtend materialExtend = materialExtendService.getMaterialExtend(id);
Map<String, Object> objectMap = new HashMap<>();
if(materialExtend != null) {
objectMap.put("info", materialExtend);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@PostMapping(value = "/add")
@ApiOperation(value = "新增")
public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = materialExtendService.insertMaterialExtend(obj, request);
return returnStr(objectMap, insert);
}
@PutMapping(value = "/update")
@ApiOperation(value = "修改")
public String updateResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = materialExtendService.updateMaterialExtend(obj, request);
return returnStr(objectMap, update);
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除")
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = materialExtendService.deleteMaterialExtend(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除")
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = materialExtendService.batchDeleteMaterialExtendByIds(ids, request);
return returnStr(objectMap, delete);
}
@GetMapping(value = "/getDetailList") @GetMapping(value = "/getDetailList")
@ApiOperation(value = "价格信息列表") @ApiOperation(value = "价格信息列表")
public BaseResponseInfo getDetailList(@RequestParam("materialId") Long materialId, public BaseResponseInfo getDetailList(@RequestParam("materialId") Long materialId,
HttpServletRequest request)throws Exception { HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo(); BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
try { try {
List<MaterialExtendVo4List> dataList = new ArrayList<MaterialExtendVo4List>(); List<MaterialExtendVo4List> dataList = new ArrayList<MaterialExtendVo4List>();
if(materialId!=0) { if(materialId!=0) {

View File

@@ -1,19 +1,27 @@
package com.jsh.erp.controller; package com.jsh.erp.controller;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.base.BaseController;
import com.jsh.erp.base.TableDataInfo;
import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.datasource.entities.MaterialProperty; import com.jsh.erp.datasource.entities.MaterialProperty;
import com.jsh.erp.service.materialProperty.MaterialPropertyService; import com.jsh.erp.service.materialProperty.MaterialPropertyService;
import com.jsh.erp.utils.BaseResponseInfo; import com.jsh.erp.utils.*;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
import static com.jsh.erp.utils.ResponseJsonUtil.returnStr;
/** /**
* Description * Description
@@ -24,13 +32,82 @@ import java.util.List;
@RestController @RestController
@RequestMapping(value = "/materialProperty") @RequestMapping(value = "/materialProperty")
@Api(tags = {"商品扩展字段"}) @Api(tags = {"商品扩展字段"})
public class MaterialPropertyController { public class MaterialPropertyController extends BaseController {
private Logger logger = LoggerFactory.getLogger(MaterialPropertyController.class); private Logger logger = LoggerFactory.getLogger(MaterialPropertyController.class);
@Resource @Resource
private MaterialPropertyService materialPropertyService; private MaterialPropertyService materialPropertyService;
@GetMapping(value = "/info")
@ApiOperation(value = "根据id获取信息")
public String getList(@RequestParam("id") Long id,
HttpServletRequest request) throws Exception {
MaterialProperty materialProperty = materialPropertyService.getMaterialProperty(id);
Map<String, Object> objectMap = new HashMap<>();
if(materialProperty != null) {
objectMap.put("info", materialProperty);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@GetMapping(value = "/list")
@ApiOperation(value = "获取信息列表")
public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
HttpServletRequest request)throws Exception {
String name = StringUtil.getInfo(search, "name");
List<?> list = materialPropertyService.select(name);
return getDataTable(list);
}
@PostMapping(value = "/add")
@ApiOperation(value = "新增")
public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = materialPropertyService.insertMaterialProperty(obj, request);
return returnStr(objectMap, insert);
}
@PutMapping(value = "/update")
@ApiOperation(value = "修改")
public String updateResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = materialPropertyService.updateMaterialProperty(obj, request);
return returnStr(objectMap, update);
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除")
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = materialPropertyService.deleteMaterialProperty(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除")
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = materialPropertyService.batchDeleteMaterialProperty(ids, request);
return returnStr(objectMap, delete);
}
@GetMapping(value = "/checkIsNameExist")
@ApiOperation(value = "检查名称是否存在")
public String checkIsNameExist(@RequestParam Long id, @RequestParam(value ="name", required = false) String name,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int exist = materialPropertyService.checkIsNameExist(id, name);
if(exist > 0) {
objectMap.put("status", true);
} else {
objectMap.put("status", false);
}
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
@GetMapping(value = "/getAllList") @GetMapping(value = "/getAllList")
@ApiOperation(value = "查询全部商品扩展字段信息") @ApiOperation(value = "查询全部商品扩展字段信息")
public BaseResponseInfo getAllList(HttpServletRequest request) throws Exception{ public BaseResponseInfo getAllList(HttpServletRequest request) throws Exception{

View File

@@ -57,7 +57,11 @@ public class MsgController extends BaseController {
HttpServletRequest request)throws Exception { HttpServletRequest request)throws Exception {
String name = StringUtil.getInfo(search, "name"); String name = StringUtil.getInfo(search, "name");
List<MsgEx> list = msgService.select(name); List<MsgEx> list = msgService.select(name);
if(list!=null && list.size()>0) {
return getDataTable(list); return getDataTable(list);
} else {
return null;
}
} }
@PostMapping(value = "/add") @PostMapping(value = "/add")

View File

@@ -8,12 +8,7 @@ import java.util.List;
public interface MaterialAttributeMapperEx { public interface MaterialAttributeMapperEx {
List<MaterialAttribute> selectByConditionMaterialAttribute( List<MaterialAttribute> selectByConditionMaterialAttribute(
@Param("attributeName") String attributeName, @Param("attributeName") String attributeName);
@Param("offset") Integer offset,
@Param("rows") Integer rows);
Long countsByMaterialAttribute(
@Param("attributeField") String attributeField);
int batchDeleteMaterialAttributeByIds( int batchDeleteMaterialAttributeByIds(
@Param("ids") String ids[]); @Param("ids") String ids[]);

View File

@@ -16,12 +16,6 @@ import java.util.Map;
*/ */
public interface MaterialCategoryMapperEx { public interface MaterialCategoryMapperEx {
List<MaterialCategory> selectByConditionMaterialCategory( List<MaterialCategory> selectByConditionMaterialCategory(
@Param("name") String name,
@Param("parentId") Integer parentId,
@Param("offset") Integer offset,
@Param("rows") Integer rows);
Long countsByMaterialCategory(
@Param("name") String name, @Param("name") String name,
@Param("parentId") Integer parentId); @Param("parentId") Integer parentId);

View File

@@ -18,26 +18,6 @@ import java.util.Map;
public interface MaterialMapperEx { public interface MaterialMapperEx {
List<MaterialVo4Unit> selectByConditionMaterial( List<MaterialVo4Unit> selectByConditionMaterial(
@Param("materialParam") String materialParam,
@Param("standard") String standard,
@Param("model") String model,
@Param("color") String color,
@Param("brand") String brand,
@Param("mfrs") String mfrs,
@Param("materialOther") String materialOther,
@Param("weight") String weight,
@Param("expiryNum") String expiryNum,
@Param("enableSerialNumber") String enableSerialNumber,
@Param("enableBatchNumber") String enableBatchNumber,
@Param("position") String position,
@Param("enabled") String enabled,
@Param("remark") String remark,
@Param("idList") List<Long> idList,
@Param("mpList") String mpList,
@Param("offset") Integer offset,
@Param("rows") Integer rows);
Long countsByMaterial(
@Param("materialParam") String materialParam, @Param("materialParam") String materialParam,
@Param("standard") String standard, @Param("standard") String standard,
@Param("model") String model, @Param("model") String model,

View File

@@ -10,11 +10,7 @@ import java.util.List;
public interface MaterialPropertyMapperEx { public interface MaterialPropertyMapperEx {
List<MaterialProperty> selectByConditionMaterialProperty( List<MaterialProperty> selectByConditionMaterialProperty(
@Param("name") String name, @Param("name") String name);
@Param("offset") Integer offset,
@Param("rows") Integer rows);
Long countsByMaterialProperty(@Param("name") String name);
int batchDeleteMaterialPropertyByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]); int batchDeleteMaterialPropertyByIds(@Param("updateTime") Date updateTime, @Param("updater") Long updater, @Param("ids") String ids[]);
} }

View File

@@ -1,102 +0,0 @@
package com.jsh.erp.service.material;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.service.ICommonQuery;
import com.jsh.erp.utils.Constants;
import com.jsh.erp.utils.QueryUtils;
import com.jsh.erp.utils.StringUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
@Service(value = "material_component")
@MaterialResource
public class MaterialComponent implements ICommonQuery {
@Resource
private MaterialService materialService;
@Override
public Object selectOne(Long id) throws Exception {
return materialService.getMaterial(id);
}
@Override
public List<?> select(Map<String, String> map)throws Exception {
return getMaterialList(map);
}
private List<?> getMaterialList(Map<String, String> map) throws Exception{
String search = map.get(Constants.SEARCH);
String categoryId = StringUtil.getInfo(search, "categoryId");
String materialParam = StringUtil.getInfo(search, "materialParam");
String standard = StringUtil.getInfo(search, "standard");
String model = StringUtil.getInfo(search, "model");
String color = StringUtil.getInfo(search, "color");
String brand = StringUtil.getInfo(search, "brand");
String mfrs = StringUtil.getInfo(search, "mfrs");
String materialOther = StringUtil.getInfo(search, "materialOther");
String weight = StringUtil.getInfo(search, "weight");
String expiryNum = StringUtil.getInfo(search, "expiryNum");
String enableSerialNumber = StringUtil.getInfo(search, "enableSerialNumber");
String enableBatchNumber = StringUtil.getInfo(search, "enableBatchNumber");
String position = StringUtil.getInfo(search, "position");
String enabled = StringUtil.getInfo(search, "enabled");
String remark = StringUtil.getInfo(search, "remark");
String mpList = StringUtil.getInfo(search, "mpList");
return materialService.select(materialParam, standard, model, color, brand, mfrs, materialOther, weight, expiryNum,
enableSerialNumber, enableBatchNumber, position, enabled, remark, categoryId, mpList, QueryUtils.offset(map), QueryUtils.rows(map));
}
@Override
public Long counts(Map<String, String> map)throws Exception {
String search = map.get(Constants.SEARCH);
String categoryId = StringUtil.getInfo(search, "categoryId");
String materialParam = StringUtil.getInfo(search, "materialParam");
String standard = StringUtil.getInfo(search, "standard");
String model = StringUtil.getInfo(search, "model");
String color = StringUtil.getInfo(search, "color");
String brand = StringUtil.getInfo(search, "brand");
String mfrs = StringUtil.getInfo(search, "mfrs");
String materialOther = StringUtil.getInfo(search, "materialOther");
String weight = StringUtil.getInfo(search, "weight");
String expiryNum = StringUtil.getInfo(search, "expiryNum");
String enableSerialNumber = StringUtil.getInfo(search, "enableSerialNumber");
String enableBatchNumber = StringUtil.getInfo(search, "enableBatchNumber");
String position = StringUtil.getInfo(search, "position");
String enabled = StringUtil.getInfo(search, "enabled");
String remark = StringUtil.getInfo(search, "remark");
String mpList = StringUtil.getInfo(search, "mpList");
return materialService.countMaterial(materialParam, standard, model, color, brand, mfrs, materialOther, weight, expiryNum,
enableSerialNumber, enableBatchNumber, position, enabled, remark, categoryId, mpList);
}
@Override
public int insert(JSONObject obj, HttpServletRequest request) throws Exception{
return materialService.insertMaterial(obj, request);
}
@Override
public int update(JSONObject obj, HttpServletRequest request)throws Exception {
return materialService.updateMaterial(obj, request);
}
@Override
public int delete(Long id, HttpServletRequest request)throws Exception {
return materialService.deleteMaterial(id, request);
}
@Override
public int deleteBatch(String ids, HttpServletRequest request)throws Exception {
return materialService.batchDeleteMaterial(ids, request);
}
@Override
public int checkIsNameExist(Long id, String name)throws Exception {
return materialService.checkIsNameExist(id, name);
}
}

View File

@@ -1,15 +0,0 @@
package com.jsh.erp.service.material;
import com.jsh.erp.service.ResourceInfo;
import java.lang.annotation.*;
/**
* @author jishenghua qq752718920 2018-10-7 15:26:27
*/
@ResourceInfo(value = "material")
@Inherited
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface MaterialResource {
}

View File

@@ -18,10 +18,7 @@ import com.jsh.erp.service.materialExtend.MaterialExtendService;
import com.jsh.erp.service.systemConfig.SystemConfigService; import com.jsh.erp.service.systemConfig.SystemConfigService;
import com.jsh.erp.service.unit.UnitService; import com.jsh.erp.service.unit.UnitService;
import com.jsh.erp.service.user.UserService; import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.BaseResponseInfo; import com.jsh.erp.utils.*;
import com.jsh.erp.utils.ExcelUtils;
import com.jsh.erp.utils.PinYinUtil;
import com.jsh.erp.utils.StringUtil;
import jxl.Sheet; import jxl.Sheet;
import jxl.Workbook; import jxl.Workbook;
import org.slf4j.Logger; import org.slf4j.Logger;
@@ -122,7 +119,7 @@ public class MaterialService {
public List<MaterialVo4Unit> select(String materialParam, String standard, String model, String color, String brand, String mfrs, public List<MaterialVo4Unit> select(String materialParam, String standard, String model, String color, String brand, String mfrs,
String materialOther, String weight, String expiryNum, String enableSerialNumber, String materialOther, String weight, String expiryNum, String enableSerialNumber,
String enableBatchNumber, String position, String enabled, String remark, String categoryId, String enableBatchNumber, String position, String enabled, String remark, String categoryId,
String mpList, int offset, int rows) String mpList)
throws Exception{ throws Exception{
String[] mpArr = new String[]{}; String[] mpArr = new String[]{};
if(StringUtil.isNotEmpty(mpList)){ if(StringUtil.isNotEmpty(mpList)){
@@ -135,8 +132,9 @@ public class MaterialService {
if(StringUtil.isNotEmpty(categoryId)){ if(StringUtil.isNotEmpty(categoryId)){
idList = getListByParentId(Long.parseLong(categoryId)); idList = getListByParentId(Long.parseLong(categoryId));
} }
PageUtils.startPage();
list= materialMapperEx.selectByConditionMaterial(materialParam, standard, model, color, brand, mfrs, materialOther, weight, expiryNum, list= materialMapperEx.selectByConditionMaterial(materialParam, standard, model, color, brand, mfrs, materialOther, weight, expiryNum,
enableSerialNumber, enableBatchNumber, position, enabled, remark, idList, mpList, offset, rows); enableSerialNumber, enableBatchNumber, position, enabled, remark, idList, mpList);
if (null != list && list.size()>0) { if (null != list && list.size()>0) {
Map<Long,BigDecimal> initialStockMap = getInitialStockMapByMaterialList(list); Map<Long,BigDecimal> initialStockMap = getInitialStockMapByMaterialList(list);
Map<Long,BigDecimal> currentStockMap = getCurrentStockMapByMaterialList(list); Map<Long,BigDecimal> currentStockMap = getCurrentStockMapByMaterialList(list);
@@ -159,24 +157,6 @@ public class MaterialService {
return resList; return resList;
} }
public Long countMaterial(String materialParam, String standard, String model, String color, String brand, String mfrs,
String materialOther, String weight, String expiryNum, String enableSerialNumber,
String enableBatchNumber, String position, String enabled, String remark, String categoryId,
String mpList)throws Exception {
Long result =null;
try{
List<Long> idList = new ArrayList<>();
if(StringUtil.isNotEmpty(categoryId)){
idList = getListByParentId(Long.parseLong(categoryId));
}
result= materialMapperEx.countsByMaterial(materialParam, standard, model, color, brand, mfrs, materialOther, weight, expiryNum,
enableSerialNumber, enableBatchNumber, position, enabled, remark, idList, mpList);
}catch(Exception e){
JshException.readFail(logger, e);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int insertMaterial(JSONObject obj, HttpServletRequest request)throws Exception { public int insertMaterial(JSONObject obj, HttpServletRequest request)throws Exception {
Material m = JSONObject.parseObject(obj.toJSONString(), Material.class); Material m = JSONObject.parseObject(obj.toJSONString(), Material.class);

View File

@@ -1,70 +0,0 @@
package com.jsh.erp.service.materialAttribute;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.service.ICommonQuery;
import com.jsh.erp.utils.Constants;
import com.jsh.erp.utils.QueryUtils;
import com.jsh.erp.utils.StringUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
@Service(value = "materialAttribute_component")
@MaterialAttributeResource
public class MaterialAttributeComponent implements ICommonQuery {
@Resource
private MaterialAttributeService materialAttributeService;
@Override
public Object selectOne(Long id) throws Exception {
return materialAttributeService.getMaterialAttribute(id);
}
@Override
public List<?> select(Map<String, String> map)throws Exception {
return getMaterialList(map);
}
private List<?> getMaterialList(Map<String, String> map) throws Exception{
String search = map.get(Constants.SEARCH);
String attributeName = StringUtil.getInfo(search, "attributeName");
return materialAttributeService.select(attributeName, QueryUtils.offset(map), QueryUtils.rows(map));
}
@Override
public Long counts(Map<String, String> map)throws Exception {
String search = map.get(Constants.SEARCH);
String attributeField = StringUtil.getInfo(search, "attributeField");
return materialAttributeService.countMaterialAttribute(attributeField);
}
@Override
public int insert(JSONObject obj, HttpServletRequest request) throws Exception{
return materialAttributeService.insertMaterialAttribute(obj, request);
}
@Override
public int update(JSONObject obj, HttpServletRequest request)throws Exception {
return materialAttributeService.updateMaterialAttribute(obj, request);
}
@Override
public int delete(Long id, HttpServletRequest request)throws Exception {
return materialAttributeService.deleteMaterialAttribute(id, request);
}
@Override
public int deleteBatch(String ids, HttpServletRequest request)throws Exception {
return materialAttributeService.batchDeleteMaterialAttribute(ids, request);
}
@Override
public int checkIsNameExist(Long id, String name)throws Exception {
return materialAttributeService.checkIsNameExist(id, name);
}
}

View File

@@ -1,15 +0,0 @@
package com.jsh.erp.service.materialAttribute;
import com.jsh.erp.service.ResourceInfo;
import java.lang.annotation.*;
/**
* @author jishenghua qq752718920 2021-07-21 22:26:27
*/
@ResourceInfo(value = "materialAttribute")
@Inherited
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface MaterialAttributeResource {
}

View File

@@ -10,6 +10,7 @@ import com.jsh.erp.datasource.mappers.MaterialAttributeMapperEx;
import com.jsh.erp.exception.BusinessRunTimeException; import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException; import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.log.LogService;
import com.jsh.erp.utils.PageUtils;
import com.jsh.erp.utils.StringUtil; import com.jsh.erp.utils.StringUtil;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -19,9 +20,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
@Service @Service
public class MaterialAttributeService { public class MaterialAttributeService {
@@ -59,27 +58,17 @@ public class MaterialAttributeService {
return list; return list;
} }
public List<MaterialAttribute> select(String attributeName, int offset, int rows) public List<MaterialAttribute> select(String attributeName) throws Exception{
throws Exception{
List<MaterialAttribute> list = new ArrayList<>(); List<MaterialAttribute> list = new ArrayList<>();
try{ try{
list = materialAttributeMapperEx.selectByConditionMaterialAttribute(attributeName, offset, rows); PageUtils.startPage();
list = materialAttributeMapperEx.selectByConditionMaterialAttribute(attributeName);
}catch(Exception e){ }catch(Exception e){
JshException.readFail(logger, e); JshException.readFail(logger, e);
} }
return list; return list;
} }
public Long countMaterialAttribute(String attributeField)throws Exception {
Long result =null;
try{
result= 5L;
}catch(Exception e){
JshException.readFail(logger, e);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int insertMaterialAttribute(JSONObject obj, HttpServletRequest request)throws Exception { public int insertMaterialAttribute(JSONObject obj, HttpServletRequest request)throws Exception {
MaterialAttribute m = JSONObject.parseObject(obj.toJSONString(), MaterialAttribute.class); MaterialAttribute m = JSONObject.parseObject(obj.toJSONString(), MaterialAttribute.class);

View File

@@ -1,75 +0,0 @@
package com.jsh.erp.service.materialCategory;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.service.ICommonQuery;
import com.jsh.erp.service.materialProperty.MaterialPropertyResource;
import com.jsh.erp.service.materialProperty.MaterialPropertyService;
import com.jsh.erp.utils.Constants;
import com.jsh.erp.utils.QueryUtils;
import com.jsh.erp.utils.StringUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
@Service(value = "materialCategory_component")
@MaterialCategoryResource
public class MaterialCategoryComponent implements ICommonQuery {
@Resource
private MaterialCategoryService materialCategoryService;
@Override
public Object selectOne(Long id) throws Exception {
return materialCategoryService.getMaterialCategory(id);
}
@Override
public List<?> select(Map<String, String> map)throws Exception {
return getMaterialCategoryList(map);
}
private List<?> getMaterialCategoryList(Map<String, String> map) throws Exception{
String search = map.get(Constants.SEARCH);
String name = StringUtil.getInfo(search, "name");
Integer parentId = StringUtil.parseInteger(StringUtil.getInfo(search, "parentId"));
String order = QueryUtils.order(map);
return materialCategoryService.select(name, parentId, QueryUtils.offset(map), QueryUtils.rows(map));
}
@Override
public Long counts(Map<String, String> map)throws Exception {
String search = map.get(Constants.SEARCH);
String name = StringUtil.getInfo(search, "name");
Integer parentId = StringUtil.parseInteger(StringUtil.getInfo(search, "parentId"));
return materialCategoryService.countMaterialCategory(name, parentId);
}
@Override
public int insert(JSONObject obj, HttpServletRequest request)throws Exception {
return materialCategoryService.insertMaterialCategory(obj, request);
}
@Override
public int update(JSONObject obj, HttpServletRequest request)throws Exception {
return materialCategoryService.updateMaterialCategory(obj, request);
}
@Override
public int delete(Long id, HttpServletRequest request)throws Exception {
return materialCategoryService.deleteMaterialCategory(id, request);
}
@Override
public int deleteBatch(String ids, HttpServletRequest request)throws Exception {
return materialCategoryService.batchDeleteMaterialCategory(ids, request);
}
@Override
public int checkIsNameExist(Long id, String name)throws Exception {
return materialCategoryService.checkIsNameExist(id, name);
}
}

View File

@@ -1,15 +0,0 @@
package com.jsh.erp.service.materialCategory;
import com.jsh.erp.service.ResourceInfo;
import java.lang.annotation.*;
/**
* @author jishenghua qq752718920 2018-10-7 15:26:27
*/
@ResourceInfo(value = "materialCategory")
@Inherited
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface MaterialCategoryResource {
}

View File

@@ -1,10 +1,12 @@
package com.jsh.erp.service.materialCategory; package com.jsh.erp.service.materialCategory;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.jsh.erp.constants.BusinessConstants; import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.constants.ExceptionConstants; import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.*; import com.jsh.erp.datasource.entities.Material;
import com.jsh.erp.datasource.entities.MaterialCategory;
import com.jsh.erp.datasource.entities.MaterialCategoryExample;
import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.mappers.MaterialCategoryMapper; import com.jsh.erp.datasource.mappers.MaterialCategoryMapper;
import com.jsh.erp.datasource.mappers.MaterialCategoryMapperEx; import com.jsh.erp.datasource.mappers.MaterialCategoryMapperEx;
import com.jsh.erp.datasource.mappers.MaterialMapperEx; import com.jsh.erp.datasource.mappers.MaterialMapperEx;
@@ -13,6 +15,7 @@ import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException; import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService; import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.PageUtils;
import com.jsh.erp.utils.StringUtil; import com.jsh.erp.utils.StringUtil;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -105,26 +108,17 @@ public class MaterialCategoryService {
return res; return res;
} }
public List<MaterialCategory> select(String name, Integer parentId, int offset, int rows) throws Exception{ public List<MaterialCategory> select(String name, Integer parentId) throws Exception{
List<MaterialCategory> list=null; List<MaterialCategory> list=null;
try{ try{
list=materialCategoryMapperEx.selectByConditionMaterialCategory(name, parentId, offset, rows); PageUtils.startPage();
list=materialCategoryMapperEx.selectByConditionMaterialCategory(name, parentId);
}catch(Exception e){ }catch(Exception e){
JshException.readFail(logger, e); JshException.readFail(logger, e);
} }
return list; return list;
} }
public Long countMaterialCategory(String name, Integer parentId) throws Exception{
Long result=null;
try{
result=materialCategoryMapperEx.countsByMaterialCategory(name, parentId);
}catch(Exception e){
JshException.readFail(logger, e);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int insertMaterialCategory(JSONObject obj, HttpServletRequest request)throws Exception { public int insertMaterialCategory(JSONObject obj, HttpServletRequest request)throws Exception {
MaterialCategory materialCategory = JSONObject.parseObject(obj.toJSONString(), MaterialCategory.class); MaterialCategory materialCategory = JSONObject.parseObject(obj.toJSONString(), MaterialCategory.class);

View File

@@ -1,65 +0,0 @@
package com.jsh.erp.service.materialExtend;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.service.ICommonQuery;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
@Service(value = "material_extend")
@MaterialExtendResource
public class MaterialExtendComponent implements ICommonQuery {
@Resource
private MaterialExtendService materialExtendService;
@Override
public Object selectOne(Long id) throws Exception {
return materialExtendService.getMaterialExtend(id);
}
@Override
public List<?> select(Map<String, String> map)throws Exception {
return getMaterialList(map);
}
private List<?> getMaterialList(Map<String, String> map) throws Exception{
return null;
}
@Override
public Long counts(Map<String, String> map)throws Exception {
return 0L;
}
@Override
public int insert(JSONObject obj, HttpServletRequest request) throws Exception{
return materialExtendService.insertMaterialExtend(obj, request);
}
@Override
public int update(JSONObject obj, HttpServletRequest request)throws Exception {
return materialExtendService.updateMaterialExtend(obj, request);
}
@Override
public int delete(Long id, HttpServletRequest request)throws Exception {
return materialExtendService.deleteMaterialExtend(id, request);
}
@Override
public int deleteBatch(String ids, HttpServletRequest request)throws Exception {
return materialExtendService.batchDeleteMaterialExtendByIds(ids, request);
}
@Override
public int checkIsNameExist(Long id, String name)throws Exception {
return 0;
}
}

View File

@@ -1,15 +0,0 @@
package com.jsh.erp.service.materialExtend;
import com.jsh.erp.service.ResourceInfo;
import java.lang.annotation.*;
/**
* @author jishenghua qq752718920 2018-10-7 15:26:27
*/
@ResourceInfo(value = "materialExtend")
@Inherited
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface MaterialExtendResource {
}

View File

@@ -11,7 +11,6 @@ import com.jsh.erp.datasource.entities.User;
import com.jsh.erp.datasource.mappers.MaterialExtendMapper; import com.jsh.erp.datasource.mappers.MaterialExtendMapper;
import com.jsh.erp.datasource.mappers.MaterialExtendMapperEx; import com.jsh.erp.datasource.mappers.MaterialExtendMapperEx;
import com.jsh.erp.datasource.vo.MaterialExtendVo4List; import com.jsh.erp.datasource.vo.MaterialExtendVo4List;
import com.jsh.erp.exception.BusinessParamCheckingException;
import com.jsh.erp.exception.BusinessRunTimeException; import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException; import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.log.LogService;
@@ -41,8 +40,6 @@ public class MaterialExtendService {
@Resource @Resource
private MaterialExtendMapperEx materialExtendMapperEx; private MaterialExtendMapperEx materialExtendMapperEx;
@Resource @Resource
private LogService logService;
@Resource
private UserService userService; private UserService userService;
@Resource @Resource
private RedisService redisService; private RedisService redisService;

View File

@@ -1,71 +0,0 @@
package com.jsh.erp.service.materialProperty;
import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.service.ICommonQuery;
import com.jsh.erp.utils.Constants;
import com.jsh.erp.utils.QueryUtils;
import com.jsh.erp.utils.StringUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
@Service(value = "materialProperty_component")
@MaterialPropertyResource
public class MaterialPropertyComponent implements ICommonQuery {
@Resource
private MaterialPropertyService materialPropertyService;
@Override
public Object selectOne(Long id) throws Exception {
return materialPropertyService.getMaterialProperty(id);
}
@Override
public List<?> select(Map<String, String> map)throws Exception {
return getMaterialPropertyList(map);
}
private List<?> getMaterialPropertyList(Map<String, String> map)throws Exception {
String search = map.get(Constants.SEARCH);
String name = StringUtil.getInfo(search, "name");
String order = QueryUtils.order(map);
return materialPropertyService.select(name, QueryUtils.offset(map), QueryUtils.rows(map));
}
@Override
public Long counts(Map<String, String> map)throws Exception {
String search = map.get(Constants.SEARCH);
String name = StringUtil.getInfo(search, "name");
return materialPropertyService.countMaterialProperty(name);
}
@Override
public int insert(JSONObject obj, HttpServletRequest request)throws Exception {
return materialPropertyService.insertMaterialProperty(obj, request);
}
@Override
public int update(JSONObject obj, HttpServletRequest request)throws Exception {
return materialPropertyService.updateMaterialProperty(obj, request);
}
@Override
public int delete(Long id, HttpServletRequest request)throws Exception {
return materialPropertyService.deleteMaterialProperty(id, request);
}
@Override
public int deleteBatch(String ids, HttpServletRequest request)throws Exception {
return materialPropertyService.batchDeleteMaterialProperty(ids, request);
}
@Override
public int checkIsNameExist(Long id, String name)throws Exception {
return materialPropertyService.checkIsNameExist(id, name);
}
}

View File

@@ -1,15 +0,0 @@
package com.jsh.erp.service.materialProperty;
import com.jsh.erp.service.ResourceInfo;
import java.lang.annotation.*;
/**
* @author jishenghua qq752718920 2018-10-7 15:26:27
*/
@ResourceInfo(value = "materialProperty")
@Inherited
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface MaterialPropertyResource {
}

View File

@@ -12,6 +12,7 @@ import com.jsh.erp.exception.BusinessRunTimeException;
import com.jsh.erp.exception.JshException; import com.jsh.erp.exception.JshException;
import com.jsh.erp.service.log.LogService; import com.jsh.erp.service.log.LogService;
import com.jsh.erp.service.user.UserService; import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.PageUtils;
import com.jsh.erp.utils.StringUtil; import com.jsh.erp.utils.StringUtil;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -61,11 +62,12 @@ public class MaterialPropertyService {
return list; return list;
} }
public List<MaterialProperty> select(String name, int offset, int rows)throws Exception { public List<MaterialProperty> select(String name)throws Exception {
List<MaterialProperty> list=null; List<MaterialProperty> list=null;
try{ try{
if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) { if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) {
list = materialPropertyMapperEx.selectByConditionMaterialProperty(name, offset, rows); PageUtils.startPage();
list = materialPropertyMapperEx.selectByConditionMaterialProperty(name);
} }
}catch(Exception e){ }catch(Exception e){
JshException.readFail(logger, e); JshException.readFail(logger, e);
@@ -73,18 +75,6 @@ public class MaterialPropertyService {
return list; return list;
} }
public Long countMaterialProperty(String name)throws Exception {
Long result=null;
try{
if(BusinessConstants.DEFAULT_MANAGER.equals(userService.getCurrentUser().getLoginName())) {
result = materialPropertyMapperEx.countsByMaterialProperty(name);
}
}catch(Exception e){
JshException.readFail(logger, e);
}
return result;
}
@Transactional(value = "transactionManager", rollbackFor = Exception.class) @Transactional(value = "transactionManager", rollbackFor = Exception.class)
public int insertMaterialProperty(JSONObject obj, HttpServletRequest request)throws Exception { public int insertMaterialProperty(JSONObject obj, HttpServletRequest request)throws Exception {
MaterialProperty materialProperty = JSONObject.parseObject(obj.toJSONString(), MaterialProperty.class); MaterialProperty materialProperty = JSONObject.parseObject(obj.toJSONString(), MaterialProperty.class);

View File

@@ -2,8 +2,6 @@ package com.jsh.erp.service.serialNumber;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.service.ICommonQuery; import com.jsh.erp.service.ICommonQuery;
import com.jsh.erp.service.material.MaterialResource;
import com.jsh.erp.service.material.MaterialService;
import com.jsh.erp.utils.Constants; import com.jsh.erp.utils.Constants;
import com.jsh.erp.utils.QueryUtils; import com.jsh.erp.utils.QueryUtils;
import com.jsh.erp.utils.StringUtil; import com.jsh.erp.utils.StringUtil;

View File

@@ -16,16 +16,6 @@
</if> </if>
</select> </select>
<select id="countsByMaterialAttribute" resultType="java.lang.Long">
SELECT count(ma.id) from jsh_material_attribute ma
where 1=1
<if test="attributeName != null">
<bind name="bindAttributeName" value="'%'+attributeName+'%'"/>
and ma.attribute_name like #{bindAttributeName}
</if>
and ifnull(ma.delete_flag,'0') !='1'
</select>
<update id="batchDeleteMaterialAttributeByIds"> <update id="batchDeleteMaterialAttributeByIds">
update jsh_material_attribute update jsh_material_attribute
set delete_flag='1' set delete_flag='1'

View File

@@ -107,79 +107,6 @@
and ifnull(m.delete_flag,'0') !='1' and ifnull(m.delete_flag,'0') !='1'
group by m.id group by m.id
order by m.id desc order by m.id desc
<if test="offset != null and rows != null">
limit #{offset},#{rows}
</if>
</select>
<select id="countsByMaterial" resultType="java.lang.Long">
SELECT
COUNT(m.id)
FROM jsh_material m
left JOIN jsh_material_extend me on m.id = me.material_id and ifnull(me.delete_Flag,'0') !='1'
left JOIN jsh_unit u on m.unit_id = u.id and ifnull(u.delete_Flag,'0') !='1'
left JOIN jsh_material_category mc on m.category_id = mc.id and ifnull(mc.delete_Flag,'0') !='1'
WHERE 1=1
and me.default_flag=1
<if test="materialParam != null and materialParam !=''">
<bind name="bindKey" value="'%'+materialParam+'%'"/>
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey}
or m.model like #{bindKey} or m.color like #{bindKey} or m.brand like #{bindKey} or m.mfrs like #{bindKey})
</if>
<if test="standard != null and standard !=''">
<bind name="bindStandard" value="'%'+standard+'%'"/>
and m.standard like #{bindStandard}
</if>
<if test="model != null and model !=''">
<bind name="bindModel" value="'%'+model+'%'"/>
and m.model like #{bindModel}
</if>
<if test="color != null and color !=''">
<bind name="bindColor" value="'%'+color+'%'"/>
and m.color like #{bindColor}
</if>
<if test="brand != null and brand !=''">
<bind name="bindBrand" value="'%'+brand+'%'"/>
and m.brand like #{bindBrand}
</if>
<if test="mfrs != null and mfrs !=''">
<bind name="bindMfrs" value="'%'+mfrs+'%'"/>
and m.mfrs like #{bindMfrs}
</if>
<if test="materialOther != null and materialOther !=''">
<bind name="bindOther" value="'%'+materialOther+'%'"/>
and (m.other_field1 like #{bindOther} or m.other_field2 like #{bindOther} or m.other_field3 like #{bindOther})
</if>
<if test="weight != null and weight !=''">
and m.weight = #{weight}
</if>
<if test="expiryNum != null and expiryNum !=''">
and m.expiry_num = #{expiryNum}
</if>
<if test="enableSerialNumber != null and enableSerialNumber !=''">
and m.enable_serial_number = #{enableSerialNumber}
</if>
<if test="enableBatchNumber != null and enableBatchNumber !=''">
and m.enable_batch_number = #{enableBatchNumber}
</if>
<if test="position != null and position !=''">
<bind name="bindPosition" value="'%'+position+'%'"/>
and m.position like #{bindPosition}
</if>
<if test="enabled != null and enabled !=''">
and m.enabled = #{enabled}
</if>
<if test="remark != null and remark !=''">
<bind name="bindRemark" value="'%'+remark+'%'"/>
and m.remark like #{bindRemark}
</if>
<if test="idList.size()>0">
and m.category_id in
<foreach collection="idList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
and ifnull(m.delete_flag,'0') !='1'
</select> </select>
<insert id="insertSelectiveEx" parameterType="com.jsh.erp.datasource.entities.Material" useGeneratedKeys="true" keyProperty="id"> <insert id="insertSelectiveEx" parameterType="com.jsh.erp.datasource.entities.Material" useGeneratedKeys="true" keyProperty="id">

View File

@@ -10,21 +10,8 @@
and native_name like #{bindName} and native_name like #{bindName}
</if> </if>
and ifnull(delete_flag,'0') !='1' and ifnull(delete_flag,'0') !='1'
<if test="offset != null and rows != null">
limit #{offset},#{rows}
</if>
</select>
<select id="countsByMaterialProperty" resultType="java.lang.Long">
SELECT
COUNT(id)
FROM jsh_material_property
WHERE 1=1
<if test="name != null">
<bind name="bindName" value="'%'+name+'%'"/>
and native_name like #{bindName}
</if>
and ifnull(delete_flag,'0') !='1'
</select> </select>
<update id="batchDeleteMaterialPropertyByIds"> <update id="batchDeleteMaterialPropertyByIds">
update jsh_material_property update jsh_material_property
set delete_flag='1' set delete_flag='1'