基于javaweb的SSM+Maven药店信息管理系统(java+ssm+jsp+layui+maven+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

400023082402

410023082402

420023082402

430023082402

440023082402

基于javaweb的SSM+Maven药店信息管理系统(java+ssm+jsp+layui+maven+mysql)

一、项目简述 环境配置:

Jdk1.8 + Tomcat8.5 + mysql + Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)

项目技术:

JSP +Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等  

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
				currentUser);
}

public String getAccess() {
return access;
}

public void setAccess(String access) {
this.access = access;
}

public String getUrl() {
return url;
}

public void setUrl(String url) {
this.url = url;
}

public String getMethod() {
return method;
}

public void setMethod(String method) {
this.method = (method != null) ? method.toUpperCase() : null;
}

/*------------- Private helper methods -----------------*/

@SuppressWarnings({ "unchecked", "rawtypes" })
private SecurityExpressionHandler<FilterInvocation> getExpressionHandler()
throws IOException {
// ApplicationContext appContext = SecurityWebApplicationContextUtils.findRequiredWebApplicationContext(getServletContext());
ServletContext sc = getServletContext();
String attrName = FrameworkServlet.SERVLET_CONTEXT_PREFIX + "dispatcherServlet";
ApplicationContext appContext = (ApplicationContext) sc.getAttribute(attrName);
Map<String, SecurityExpressionHandler> handlers = appContext
.getBeansOfType(SecurityExpressionHandler.class);

for (SecurityExpressionHandler h : handlers.values()) {
if (FilterInvocation.class.equals(GenericTypeResolver.resolveTypeArgument(
h.getClass(), SecurityExpressionHandler.class))) {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
	}
else if (StringUtils.hasText(getUrl())) {
isAuthorized = authorizeUsingUrlCheck();

}
else {
isAuthorized = false;

}

return isAuthorized;
}

/**
* Make an authorization decision based on a Spring EL expression. See the
* "Expression-Based Access Control" chapter in Spring Security for details on what
* expressions can be used.
*
* @return the result of the authorization decision
* @throws IOException
*/
public boolean authorizeUsingAccessExpression() throws IOException {
if (SecurityContextHolder.getContext().getAuthentication() == null) {
return false;
}

SecurityExpressionHandler<FilterInvocation> handler = getExpressionHandler();

Expression accessExpression;
try {
accessExpression = handler.getExpressionParser().parseExpression(getAccess());

}
catch (ParseException e) {
IOException ioException = new IOException();
ioException.initCause(e);
throw ioException;
}

return ExpressionUtils.evaluateAsBoolean(accessExpression,
createExpressionEvaluationContext(handler));
}

/**
* Allows the {@code EvaluationContext} to be customized for variable lookup etc.
*/
protected EvaluationContext createExpressionEvaluationContext(
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
					"No visible WebInvocationPrivilegeEvaluator instance could be found in the application "
+ "context. There must be at least one in order to support the use of URL access checks in 'authorize' tags.");
}

return (WebInvocationPrivilegeEvaluator) wipes.values().toArray()[0];
}
}



/**
* Spring Security配置类
* @E-mail suzeping10@126.com
*/
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)/* 启用全局方法权限控制,prePostEnabled = true 表示开启一些注解的使用 */
@EnableWebSecurity/* 启用web环境下权限控制功能 */
public class WebApplicationSecurityConfig extends WebSecurityConfigurerAdapter {
// 修改DelegatingFilterProxy的源码
// 使SpringMVC[dispatcherServlet]把WebApplicationSecurityConfig扫描到IOC容器
// 才可以针对浏览器请求进行权限控制
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
 * 器械前端控制器
* @E-mail suzeping10@126.com
*/
@Slf4j
@RestController
@RequestMapping("/instrument")
public class DrugInstrumentController {

@Autowired
private DrugInstrumentService instrumentService;

/**
* 分页获取器械
* @param instrumentName
* @param pageNum
* @param pageSize
* @return
*/
@PostMapping("/get/page.json")
public ResultEntity<PageInfo<DrugInstrument>> getPageInfo(
@RequestParam(value = "instrumentName",defaultValue = "") String instrumentName,
@RequestParam(value = "pageNum",defaultValue = "1") String pageNum,
@RequestParam(value = "pageSize",defaultValue = "5") String pageSize
){
return instrumentService.getPageInfo(instrumentName, pageNum, pageSize);
}

/**
* 新增器械(并返回新增后总数量)
* @param instrument
* @return
*/
@PostMapping("/save.json")
public ResultEntity<Integer> saveInstrument(DrugInstrument instrument){
return instrumentService.saveInstrument(instrument);
}

/**
* 修改器械
* @param instrument
* @return
*/
@PostMapping("/edit.json")
public ResultEntity<String> editInstrument(DrugInstrument instrument){
return instrumentService.editInstrument(instrument);
}

/**
* 删除器械
* @param instrumentId
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41


/**
* 异常处理器
* @E-mail suzeping10@126.com
*/
@ControllerAdvice
public class DrugExceptionResolver {

/**
* 修改时用户名重复异常处理
* @param exception
* @param request
* @param response
* @return
* @throws IOException
*/
@ExceptionHandler(AccountEditDuplicateKeyException.class)
public ModelAndView resolveAccountEditDuplicateKeyException(AccountEditDuplicateKeyException exception, HttpServletRequest request, HttpServletResponse response)
throws IOException {
String viewName = "system-error";
return commonResolve(viewName, exception, request, response);
}

/**
* 新增时用户名重复异常处理
* @param exception
* @param request
* @param response
* @return
* @throws IOException
*/
@ExceptionHandler(AccountAddDuplicateKeyException.class)
public ModelAndView resolveAccountAddDuplicateKeyException(AccountAddDuplicateKeyException exception, HttpServletRequest request, HttpServletResponse response)
throws IOException {
String viewName = "admin-add";
return commonResolve(viewName, exception, request, response);
}

/**
* 未登录就访问被保护资源异常处理
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
	 * @param pageNum
* @param pageSize
* @return
*/
@PostMapping("/get/page.json")
public ResultEntity<PageInfo<DrugSellPage>> getPageInfo(
@RequestParam(value = "sellName",defaultValue = "") String sellName,
@RequestParam(value = "otherName",defaultValue = "") String otherName,
@RequestParam(value = "pageNum",defaultValue = "1") String pageNum,
@RequestParam(value = "pageSize",defaultValue = "5") String pageSize
){
return sellService.getPageInfo(sellName, otherName, pageNum, pageSize);
}

/**
* 售出记录(返回新增后记录总数量、药品或器械剩余数量及产品名称)
* @param sell
* @return
*/
@PostMapping("/save.json")
public ResultEntity<Map<String,Object>> saveSell(DrugSell sell){
return sellService.saveSell(sell);
}

/**
* 删除记录
* @param sellId
* @return
*/
@PostMapping("/del.json")
public ResultEntity<String> removeSell(@RequestParam("sellId") String sellId){
return sellService.removeSell(sellId);
}
}


/**
* 药品前端控制器
* @E-mail suzeping10@126.com


项目链接:
https://javayms.github.io?id=431422292105200fo
https://javayms.pages.dev?id=431422292105200fo