增加根据id查询明细的接口
This commit is contained in:
@@ -32,6 +32,20 @@ public class ResourceController {
|
|||||||
return JsonUtils.ok();
|
return JsonUtils.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping(value = "/{apiName}/info")
|
||||||
|
public String getList(@PathVariable("apiName") String apiName,
|
||||||
|
@RequestParam("id") Long id,
|
||||||
|
HttpServletRequest request) throws Exception {
|
||||||
|
Object obj = configResourceManager.selectOne(apiName, id);
|
||||||
|
Map<String, Object> objectMap = new HashMap<String, Object>();
|
||||||
|
if(obj != null) {
|
||||||
|
objectMap.put("info", obj);
|
||||||
|
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
||||||
|
} else {
|
||||||
|
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping(value = "/{apiName}/list")
|
@GetMapping(value = "/{apiName}/list")
|
||||||
public String getList(@PathVariable("apiName") String apiName,
|
public String getList(@PathVariable("apiName") String apiName,
|
||||||
@RequestParam(value = Constants.PAGE_SIZE, required = false) Integer pageSize,
|
@RequestParam(value = Constants.PAGE_SIZE, required = false) Integer pageSize,
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ public class CommonQueryManager {
|
|||||||
* @param apiName 接口名称
|
* @param apiName 接口名称
|
||||||
* @param id ID
|
* @param id ID
|
||||||
*/
|
*/
|
||||||
public Object selectOne(String apiName, String id) throws Exception{
|
public Object selectOne(String apiName, Long id) throws Exception {
|
||||||
if (StringUtil.isNotEmpty(apiName) && StringUtil.isNotEmpty(id)) {
|
if (StringUtil.isNotEmpty(apiName) && id!=null) {
|
||||||
return container.getCommonQuery(apiName).selectOne(id);
|
return container.getCommonQuery(apiName).selectOne(id);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public interface ICommonQuery {
|
public interface ICommonQuery {
|
||||||
/**
|
/**
|
||||||
* 查询:解析JSON,查询资源。
|
* 根据id查询明细。
|
||||||
*
|
*
|
||||||
* @param condition 资源id
|
* @param id 资源id
|
||||||
* @return 资源
|
* @return 资源
|
||||||
*/
|
*/
|
||||||
Object selectOne(String condition) throws Exception;
|
Object selectOne(Long id) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义查询
|
* 自定义查询
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ public class AccountComponent implements ICommonQuery {
|
|||||||
private AccountService accountService;
|
private AccountService accountService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object selectOne(String condition) {
|
public Object selectOne(Long id) throws Exception {
|
||||||
return null;
|
return accountService.getAccount(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public class AccountService {
|
|||||||
@Resource
|
@Resource
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
|
|
||||||
public Account getAccount(long id) {
|
public Account getAccount(long id) throws Exception{
|
||||||
return accountMapper.selectByPrimaryKey(id);
|
return accountMapper.selectByPrimaryKey(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ public class AccountHeadComponent implements ICommonQuery {
|
|||||||
private AccountHeadService accountHeadService;
|
private AccountHeadService accountHeadService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object selectOne(String condition) throws Exception {
|
public Object selectOne(Long id) throws Exception {
|
||||||
return null;
|
return accountHeadService.getAccountHead(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ public class AccountItemComponent implements ICommonQuery {
|
|||||||
private AccountItemService accountItemService;
|
private AccountItemService accountItemService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object selectOne(String condition)throws Exception {
|
public Object selectOne(Long id) throws Exception {
|
||||||
return null;
|
return accountItemService.getAccountItem(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ public class AppComponent implements ICommonQuery {
|
|||||||
private AppService appService;
|
private AppService appService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object selectOne(String condition)throws Exception {
|
public Object selectOne(Long id) throws Exception {
|
||||||
return null;
|
return appService.getApp(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ public class DepotComponent implements ICommonQuery {
|
|||||||
private DepotService depotService;
|
private DepotService depotService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object selectOne(String condition)throws Exception {
|
public Object selectOne(Long id) throws Exception {
|
||||||
return null;
|
return depotService.getDepot(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ public class DepotHeadComponent implements ICommonQuery {
|
|||||||
private DepotHeadService depotHeadService;
|
private DepotHeadService depotHeadService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object selectOne(String condition)throws Exception {
|
public Object selectOne(Long id) throws Exception {
|
||||||
return null;
|
return depotHeadService.getDepotHead(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ public class DepotItemComponent implements ICommonQuery {
|
|||||||
private DepotItemService depotItemService;
|
private DepotItemService depotItemService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object selectOne(String condition)throws Exception {
|
public Object selectOne(Long id) throws Exception {
|
||||||
return null;
|
return depotItemService.getDepotItem(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ public class FunctionsComponent implements ICommonQuery {
|
|||||||
private FunctionsService functionsService;
|
private FunctionsService functionsService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object selectOne(String condition)throws Exception {
|
public Object selectOne(Long id) throws Exception {
|
||||||
return null;
|
return functionsService.getFunctions(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ public class InOutItemComponent implements ICommonQuery {
|
|||||||
private InOutItemService inOutItemService;
|
private InOutItemService inOutItemService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object selectOne(String condition)throws Exception {
|
public Object selectOne(Long id) throws Exception {
|
||||||
return null;
|
return inOutItemService.getInOutItem(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ public class LogComponent implements ICommonQuery {
|
|||||||
private LogService logService;
|
private LogService logService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object selectOne(String condition)throws Exception {
|
public Object selectOne(Long id) throws Exception {
|
||||||
return null;
|
return logService.getLog(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ public class MaterialComponent implements ICommonQuery {
|
|||||||
private MaterialService materialService;
|
private MaterialService materialService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object selectOne(String condition)throws Exception {
|
public Object selectOne(Long id) throws Exception {
|
||||||
return null;
|
return materialService.getMaterial(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ public class MaterialCategoryComponent implements ICommonQuery {
|
|||||||
private MaterialCategoryService materialCategoryService;
|
private MaterialCategoryService materialCategoryService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object selectOne(String condition)throws Exception {
|
public Object selectOne(Long id) throws Exception {
|
||||||
return null;
|
return materialCategoryService.getMaterialCategory(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ public class MaterialPropertyComponent implements ICommonQuery {
|
|||||||
private MaterialPropertyService materialPropertyService;
|
private MaterialPropertyService materialPropertyService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object selectOne(String condition)throws Exception {
|
public Object selectOne(Long id) throws Exception {
|
||||||
return null;
|
return materialPropertyService.getMaterialProperty(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -21,9 +21,10 @@ import java.util.Map;
|
|||||||
public class OrgaUserRelComponent implements ICommonQuery {
|
public class OrgaUserRelComponent implements ICommonQuery {
|
||||||
@Resource
|
@Resource
|
||||||
private OrgaUserRelService orgaUserRelService;
|
private OrgaUserRelService orgaUserRelService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object selectOne(String condition)throws Exception {
|
public Object selectOne(Long id) throws Exception {
|
||||||
return null;
|
return orgaUserRelService.getOrgaUserRel(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -41,6 +41,11 @@ public class OrgaUserRelService {
|
|||||||
private UserService userService;
|
private UserService userService;
|
||||||
@Resource
|
@Resource
|
||||||
private LogService logService;
|
private LogService logService;
|
||||||
|
|
||||||
|
public OrgaUserRel getOrgaUserRel(long id) throws Exception{
|
||||||
|
return orgaUserRelMapper.selectByPrimaryKey(id);
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int insertOrgaUserRel(String beanJson, HttpServletRequest request) throws Exception{
|
public int insertOrgaUserRel(String beanJson, HttpServletRequest request) throws Exception{
|
||||||
OrgaUserRel orgaUserRel = JSONObject.parseObject(beanJson, OrgaUserRel.class);
|
OrgaUserRel orgaUserRel = JSONObject.parseObject(beanJson, OrgaUserRel.class);
|
||||||
|
|||||||
@@ -22,9 +22,10 @@ import java.util.Map;
|
|||||||
public class OrganizationComponent implements ICommonQuery {
|
public class OrganizationComponent implements ICommonQuery {
|
||||||
@Resource
|
@Resource
|
||||||
private OrganizationService organizationService;
|
private OrganizationService organizationService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object selectOne(String condition)throws Exception {
|
public Object selectOne(Long id) throws Exception {
|
||||||
return null;
|
return organizationService.getOrganization(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -44,6 +44,11 @@ public class OrganizationService {
|
|||||||
private UserService userService;
|
private UserService userService;
|
||||||
@Resource
|
@Resource
|
||||||
private LogService logService;
|
private LogService logService;
|
||||||
|
|
||||||
|
public Organization getOrganization(long id) throws Exception {
|
||||||
|
return organizationMapper.selectByPrimaryKey(id);
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
public int insertOrganization(String beanJson, HttpServletRequest request)throws Exception {
|
public int insertOrganization(String beanJson, HttpServletRequest request)throws Exception {
|
||||||
Organization organization = JSONObject.parseObject(beanJson, Organization.class);
|
Organization organization = JSONObject.parseObject(beanJson, Organization.class);
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ public class PersonComponent implements ICommonQuery {
|
|||||||
private PersonService personService;
|
private PersonService personService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object selectOne(String condition)throws Exception {
|
public Object selectOne(Long id) throws Exception {
|
||||||
return null;
|
return personService.getPerson(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ public class RoleComponent implements ICommonQuery {
|
|||||||
private RoleService roleService;
|
private RoleService roleService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object selectOne(String condition)throws Exception {
|
public Object selectOne(Long id) throws Exception {
|
||||||
return null;
|
return roleService.getRole(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ public class SerialNumberComponent implements ICommonQuery {
|
|||||||
private SerialNumberService serialNumberService;
|
private SerialNumberService serialNumberService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object selectOne(String condition)throws Exception {
|
public Object selectOne(Long id) throws Exception {
|
||||||
return null;
|
return serialNumberService.getSerialNumber(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ public class SupplierComponent implements ICommonQuery {
|
|||||||
private SupplierService supplierService;
|
private SupplierService supplierService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object selectOne(String condition)throws Exception {
|
public Object selectOne(Long id) throws Exception {
|
||||||
return null;
|
return supplierService.getSupplier(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ public class SystemConfigComponent implements ICommonQuery {
|
|||||||
private SystemConfigService systemConfigService;
|
private SystemConfigService systemConfigService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object selectOne(String condition)throws Exception {
|
public Object selectOne(Long id) throws Exception {
|
||||||
return null;
|
return systemConfigService.getSystemConfig(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ public class UnitComponent implements ICommonQuery {
|
|||||||
private UnitService unitService;
|
private UnitService unitService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object selectOne(String condition)throws Exception {
|
public Object selectOne(Long id) throws Exception {
|
||||||
return null;
|
return unitService.getUnit(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ public class UserComponent implements ICommonQuery {
|
|||||||
private UserService userService;
|
private UserService userService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object selectOne(String condition)throws Exception {
|
public Object selectOne(Long id) throws Exception {
|
||||||
return null;
|
return userService.getUser(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ public class UserBusinessComponent implements ICommonQuery {
|
|||||||
private UserBusinessService userBusinessService;
|
private UserBusinessService userBusinessService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object selectOne(String condition)throws Exception {
|
public Object selectOne(Long id) throws Exception {
|
||||||
return null;
|
return userBusinessService.getUserBusiness(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user