SSM配置文件

本文详细介绍了SSM框架的配置文件,包括applicationContext-dao、service、transaction的配置,SpringMVC的设置,数据库连接(db.properties),日志(log4j.properties)配置,web应用上下文(web.xml),MyBatis的SqlMapConfig及Mapper相关配置。
摘要由CSDN通过智能技术生成

applicationContext-dao.xml

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
        http://www.springframework.org/schema/beans/spring-beans-3.2.xsd 
        http://www.springframework.org/schema/mvc 
        http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd 
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context-3.2.xsd 
        http://www.springframework.org/schema/aop 
        http://www.springframework.org/schema/aop/spring-aop-3.2.xsd 
        http://www.springframework.org/schema/tx 
        http://www.springframework.org/schema/tx/spring-tx-3.2.xsd ">

	<context:property-placeholder location="classpath:db.properties"/>
	
	<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
		<property name="driverClassName" value="${jdbc.driver}"/>
		<property name="url" value="${jdbc.url}"/>
		<property name="username" value="${jdbc.username}"/>
		<property name="password" value="${jdbc.password}"/>
		<property name="maxActive" value="30"/>        
		<property name="maxIdle" value="5" />
	</bean>
	
	<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
		<property name="dataSource" ref="dataSource"/>
		<property name="configLocation" value="classpath:mybatis/sqlMapConfig.xml"/>
	</bean>
	
	<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
		<property name="basePackage" value="com.czj.mapper"/>
		<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
	</bean>
	
</beans>

applicationContext-service.xml

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
        http://www.springframework.org/schema/beans/spring-beans-3.2.xsd 
        http://www.springframework.org/schema/mvc 
        http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd 
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context-3.2.xsd 
        http://www.springframework.org/schema/aop 
        http://www.springframework.org/schema/aop/spring-aop-3.2.xsd 
        http://www.springframework.org/schema/tx 
        http://www.springframework.org/schema/tx/spring-tx-3.2.xsd ">
	
	<context:annotation-config/>
	<context:component-scan base-package="com.czj.service"/>
</beans>

applicationContext-transaction.xml

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
        http://www.springframework.org/schema/beans/spring-beans-3.2.xsd 
        http://www.springframework.org/schema/mvc 
        http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd 
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context-3.2.xsd 
        http://www.springframework.org/schema/aop 
        http://www.springframework.org/schema/aop/spring-aop-3.2.xsd 
        http://www.springframework.org/schema/tx 
        http://www.springframework.org/schema/tx/spring-tx-3.2.xsd ">

	<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
		<property name="dataSource" ref="dataSource"/>
	</bean>
	<tx:advice id="txAdvice" transaction-manager="transactionManager">
		<tx:attributes>
			<tx:method name="save*" propagation="REQUIRED"/>
			<tx:method name="delete*" propagation="REQUIRED"/>
			<tx:method name="insert*" propagation="REQUIRED"/>
			<tx:method name="update*" propagation="SUPPORTS" read-only="true"/>
			<tx:method name="find*" propagation="SUPPORTS" read-only="true"/>
			<tx:method name="query*" propagation="SUPPORTS" read-only="true"/>
			<tx:method name="get*" propagation="SUPPORTS" read-only="true"/>
			<tx:method name="select*" propagation="SUPPORTS" read-only="true"/>
		</tx:attributes>
	</tx:advice>
	
	<aop:config>
		<aop:advisor advice-ref="txAdvice" pointcut="execution(* com.czj.service.*.*(..))"/>
	</aop:config>
</beans>

springmvc

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:mvc="http://www.springframework.org/schema/mvc"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
		http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd">
	
	<mvc:annotation-driven/>
	<mvc:default-servlet-handler/>
	
	<context:component-scan base-package="com.czj.controller"/>
	
	<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<property name="prefix" value="/"/>
		<property name="suffix" value=".jsp"/>
	</bean>
	
	
 	<bean id="exceptionResolver" class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
		<property name="exceptionMappings">
			<props>
				<prop key="org.springframework.web.multipart.MaxUploadSizeExceededException">upload_error</prop>
				<prop key="com.czj.utils.UserException">user_error</prop>
			</props>
		</property>
	</bean> 
	
<!-- 	<bean id="exceptionResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
		<property name="exceptionMappings">
			<props>
				<prop key="org.springframework.web.multipart.MaxUploadSizeExceededException">upload_error</prop>
				<prop key="com.czj.utils.UserException">user_error</prop>
			</props>
		</property>
	</bean> -->
	
	<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
		<property name="maxUploadSize">
			<value>2097152</value>
		</property>
	</bean>

<!-- 	<mvc:annotation-driven validator="validator"/>
	<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
		<property name="providerClass" value="org.hibernate.validtor.HibernateValidator"/>
	</bean>
	  -->
</beans>

db.properties

jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://127.0.0.1:3306/db_medicine
jdbc.username=root
jdbc.password=123456
initialSize=0
maxActive=20
maxIdle=20
minIdle=1
maxWait=60000

log4j.properties

# Global logging configuration\uff0c\u5efa\u8bae\u5f00\u53d1\u73af\u5883\u4e2d\u8981\u7528debug
log4j.rootLogger=DEBUG, stdout
# Console output...
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
  <display-name>Medicine</display-name>
  <welcome-file-list>
    <welcome-file>login.jsp</welcome-file>
  </welcome-file-list>
  
  <context-param>
  	<param-name>contextConfigLocation</param-name>
  	<param-value>/WEB-INF/classes/spring/applicationContext-*.xml</param-value>
  </context-param>
  
  <listener>
  	<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>
  
  <servlet>
  	<servlet-name>springmvc</servlet-name>
  	<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  	<init-param>
  		<param-name>contextConfigLocation</param-name>
  		<param-value>classpath:spring/springmvc.xml</param-value>
  	</init-param>
  	<load-on-startup>1</load-on-startup>
  	<async-supported>true</async-supported>
  </servlet>
  
  <servlet-mapping>
  	<servlet-name>springmvc</servlet-name>
  	<url-pattern>/</url-pattern>
  </servlet-mapping>
  
  <filter>
  	<filter-name>CharacterFilter</filter-name>
  	<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
  	<init-param>
  		<param-name>encoding</param-name>
  		<param-value>UTF-8</param-value>
  	</init-param>	
  </filter>
  
  <filter-mapping>
  	<filter-name>CharacterFilter</filter-name>
  	<url-pattern>/*</url-pattern>
  </filter-mapping>
  
  
</web-app>

SqlMapConfig.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
	<typeAliases>
		<package name="com.czj.pojo" />
	</typeAliases>
</configuration>

Mapper.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.czj.mapper.TbDepartmentMapper">
	<resultMap id="BaseResultMap"
		type="com.czj.pojo.TbDepartment">
		<id column="bmbh" property="bmbh" jdbcType="VARCHAR" />
		<result column="bmmc" property="bmmc" jdbcType="VARCHAR" />
	</resultMap>
	<sql id="Example_Where_Clause">
		<where>
			<foreach collection="oredCriteria" item="criteria"
				separator="or">
				<if test="criteria.valid">
					<trim prefix="(" suffix=")" prefixOverrides="and">
						<foreach collection="criteria.criteria" item="criterion">
							<choose>
								<when test="criterion.noValue">
									and ${criterion.condition}
								</when>
								<when test="criterion.singleValue">
									and ${criterion.condition} #{criterion.value}
								</when>
								<when test="criterion.betweenValue">
									and ${criterion.condition} #{criterion.value}
									and
									#{criterion.secondValue}
								</when>
								<when test="criterion.listValue">
									and ${criterion.condition}
									<foreach collection="criterion.value" item="listItem"
										open="(" close=")" separator=",">
										#{listItem}
									</foreach>
								</when>
							</choose>
						</foreach>
					</trim>
				</if>
			</foreach>
		</where>
	</sql>
	<sql id="Update_By_Example_Where_Clause">
		<where>
			<foreach collection="example.oredCriteria" item="criteria"
				separator="or">
				<if test="criteria.valid">
					<trim prefix="(" suffix=")" prefixOverrides="and">
						<foreach collection="criteria.criteria" item="criterion">
							<choose>
								<when test="criterion.noValue">
									and ${criterion.condition}
								</when>
								<when test="criterion.singleValue">
									and ${criterion.condition} #{criterion.value}
								</when>
								<when test="criterion.betweenValue">
									and ${criterion.condition} #{criterion.value}
									and
									#{criterion.secondValue}
								</when>
								<when test="criterion.listValue">
									and ${criterion.condition}
									<foreach collection="criterion.value" item="listItem"
										open="(" close=")" separator=",">
										#{listItem}
									</foreach>
								</when>
							</choose>
						</foreach>
					</trim>
				</if>
			</foreach>
		</where>
	</sql>
	<sql id="Base_Column_List">
		bmbh, bmmc
	</sql>
	<select id="selectByExample" resultMap="BaseResultMap"
		parameterType="com.czj.pojo.TbDepartmentExample">
		select
		<if test="distinct">
			distinct
		</if>
		<include refid="Base_Column_List" />
		from tb_department
		<if test="_parameter != null">
			<include refid="Example_Where_Clause" />
		</if>
		<if test="orderByClause != null">
			order by ${orderByClause}
		</if>
		<if test="offset != null and limit != null">
			limit ${offset},${limit}
		</if>
	</select>
	<select id="selectByPrimaryKey" resultMap="BaseResultMap"
		parameterType="java.lang.String">
		select
		<include refid="Base_Column_List" />
		from tb_department
		where bmbh = #{bmbh,jdbcType=VARCHAR}
	</select>
	<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
		delete from
		tb_department
		where bmbh = #{bmbh,jdbcType=VARCHAR}
	</delete>
	<delete id="deleteByExample"
		parameterType="com.czj.pojo.TbDepartmentExample">
		delete from tb_department
		<if test="_parameter != null">
			<include refid="Example_Where_Clause" />
		</if>
	</delete>
	<insert id="insert" parameterType="com.czj.pojo.TbDepartment">
		insert into tb_department
		(bmbh, bmmc)
		values (#{bmbh,jdbcType=VARCHAR},
		#{bmmc,jdbcType=VARCHAR})
	</insert>
	<insert id="insertSelective"
		parameterType="com.czj.pojo.TbDepartment">
		insert into tb_department
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="bmbh != null">
				bmbh,
			</if>
			<if test="bmmc != null">
				bmmc,
			</if>
		</trim>
		<trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="bmbh != null">
				#{bmbh,jdbcType=VARCHAR},
			</if>
			<if test="bmmc != null">
				#{bmmc,jdbcType=VARCHAR},
			</if>
		</trim>
	</insert>
	<select id="countByExample"
		parameterType="com.czj.pojo.TbDepartmentExample"
		resultType="java.lang.Integer">
		select count(*) from tb_department
		<if test="_parameter != null">
			<include refid="Example_Where_Clause" />
		</if>
	</select>
	<update id="updateByExampleSelective" parameterType="map">
		update tb_department
		<set>
			<if test="record.bmbh != null">
				bmbh = #{record.bmbh,jdbcType=VARCHAR},
			</if>
			<if test="record.bmmc != null">
				bmmc = #{record.bmmc,jdbcType=VARCHAR},
			</if>
		</set>
		<if test="_parameter != null">
			<include refid="Update_By_Example_Where_Clause" />
		</if>
	</update>
	<update id="updateByExample" parameterType="map">
		update tb_department
		set bmbh = #{record.bmbh,jdbcType=VARCHAR},
		bmmc =
		#{record.bmmc,jdbcType=VARCHAR}
		<if test="_parameter != null">
			<include refid="Update_By_Example_Where_Clause" />
		</if>
	</update>
	<update id="updateByPrimaryKeySelective"
		parameterType="com.czj.pojo.TbDepartment">
		update tb_department
		<set>
			<if test="bmmc != null">
				bmmc = #{bmmc,jdbcType=VARCHAR},
			</if>
		</set>
		where bmbh = #{bmbh,jdbcType=VARCHAR}
	</update>
	<update id="updateByPrimaryKey"
		parameterType="com.czj.pojo.TbDepartment">
		update tb_department
		set bmmc = #{bmmc,jdbcType=VARCHAR}
		where bmbh = #{bmbh,jdbcType=VARCHAR}
	</update>
</mapper>

Mapper.java

package com.czj.mapper;

import com.czj.pojo.TbDepartment;
import com.czj.pojo.TbDepartmentExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;

public interface TbDepartmentMapper {
    int countByExample(TbDepartmentExample example);

    int deleteByExample(TbDepartmentExample example);

    int deleteByPrimaryKey(String bmbh);

    int insert(TbDepartment record);

    int insertSelective(TbDepartment record);

    List<TbDepartment> selectByExample(TbDepartmentExample example);

    TbDepartment selectByPrimaryKey(String bmbh);

    int updateByExampleSelective(@Param("record") TbDepartment record, @Param("example") TbDepartmentExample example);

    int updateByExample(@Param("record") TbDepartment record, @Param("example") TbDepartmentExample example);

    int updateByPrimaryKeySelective(TbDepartment record);

    int updateByPrimaryKey(TbDepartment record);
}

Service.java

package com.czj.service;
/**   
* @Title: TbDepartmentService.java 
* @Package com.czj.service 
* @Description: TODO 部门信息Service类
* @author : 杜小叶(陈真杰)
* @date : 2019年12月2日 上午9:59:26 
* @version V1.0
*/

import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.czj.mapper.TbDepartmentMapper;
import com.czj.pojo.TbDepartment;
import com.czj.pojo.TbDepartmentExample;
import config.MyConfig;

@Service
public class TbDepartmentService {
	@Resource
	TbDepartmentMapper tbDepartmentMapper;
	
	public TbDepartmentMapper getTbDepartmentMapper() {
		return tbDepartmentMapper;
	}
	
	public void setTbDepartmentMapper(TbDepartmentMapper tbDepartmentMapper) {
		this.tbDepartmentMapper = tbDepartmentMapper;
	}
	/**
	 * 
	* @Title: addDepartment 
	* @Description: TODO 添加部门信息
	* @param @param tbDepartment 待添加部门信息
	* @return void 
	* @throws
	 */
	public void addDepartment(TbDepartment tbDepartment) {
		tbDepartmentMapper.insert(tbDepartment);	
	}
	
	/**
	 * 
	* @Title: getAllDepartment 
	* @Description: TODO 获取所有部门信息
	* @param @return
	* @return List<TbDepartment>
	* @throws
	 */
	public List<TbDepartment> getAllDepartment(){
		TbDepartmentExample example = new TbDepartmentExample();
		List<TbDepartment> list = tbDepartmentMapper.selectByExample(example);	
		return list;
	}
}

Controller.java

package com.czj.controller;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.czj.pojo.TbBuyMain;
import com.czj.service.TbBuyMainService;

import config.MyConfig;

/**   
* @Title: TbBuyMainController.java 
* @Package com.czj.controller 
* @Description: TODO 采购单请求响应Controller
* @author : 杜小叶(陈真杰)
* @date : 2019年12月2日 上午10:02:17 
* @version V1.0
*/
@Controller
@RequestMapping("/BuyMain")
public class TbBuyMainController {
	
	@Resource
	TbBuyMainService service;
	
	@InitBinder("tbBuyMain")
	public void initBinderBuyMain(WebDataBinder binder) {
		binder.setFieldDefaultPrefix("tbBuyMain.");
	}
	
	
	@RequestMapping(value="/addBuyMain",method=RequestMethod.POST)
	public void addBuyMain(TbBuyMain tbBuyMain,HttpServletResponse response) throws IOException, JSONException {
		MyConfig.printfInfo(tbBuyMain.toString());
		boolean success;
		String msg;
		if(service.getBuyMainByCgbh(tbBuyMain.getCgbh()+"")!=null){
			success = false;
			msg = "药品编号已存在!";
		}else {
			service.addBuyMain(tbBuyMain);
			success = true;
			msg = "药品添加成功!";
		}
		response.setContentType("text/json;charset=utf-8");
		PrintWriter out = response.getWriter();
		JSONObject json = new JSONObject();
		json.accumulate("success", success);
		json.accumulate("message", msg);
		out.println(json.toString());
		out.flush();
		out.close();
	}
	
	/**
	 * 
	* @Title: getAllBuyMain 
	* @Description: TODO 分页获取药品信息并排序
	* @param @param tbBuyMain
	* @param @param page
	* @param @param rows
	* @param @param order
	* @param @param response
	* @param @throws JSONException
	* @param @throws IOException
	* @return void
	* @throws
	 */
	@RequestMapping(value="/getAllBuyMain",method=RequestMethod.POST)
	public void getAllBuyMain(TbBuyMain tbBuyMain,Integer page,Integer rows,String order,HttpServletResponse response) throws JSONException, IOException {
		if(tbBuyMain!=null)
			MyConfig.printfInfo(tbBuyMain.toString());
	
		Integer total = service.getBuyMainCount();
		MyConfig.printfInfo(page+"&"+rows+"&"+order+"&"+total);
		
//		查看页数与大小
		page-=1;
		Integer start = page*rows;
		
		JSONArray arry = new JSONArray();     
		List<TbBuyMain> list = service.getAllBuyMain(order, start, rows);
		for(int i=0;i<list.size();i++) {
			arry.put(list.get(i).getJsonObject());
		}
		MyConfig.printfInfo(list.size());
		JSONObject js = new JSONObject();
		js.accumulate("total", total);
		js.accumulate("rows", arry);
		
		response.setContentType("text/json;charset=utf-8");
		PrintWriter out = response.getWriter();
		out.println(js.toString());
		out.flush();
		out.close();
		return;
	}
	
	/**
	 * 
	* @Title: update 
	* @Description: TODO 获取待更新药品信息
	* @param @param cgbh
	* @param @param model
	* @param @param request
	* @param @param response
	* @param @throws Exception
	* @return void
	* @throws
	 */
	@RequestMapping(value="/{cgbh}/update",method=RequestMethod.GET)
	public void update(@PathVariable String cgbh,Model model,HttpServletRequest request,HttpServletResponse response)throws Exception{
		TbBuyMain tbBuyMain = service.getBuyMainByCgbh(cgbh);
		response.setContentType("text/json;charset=utf-8");
		PrintWriter out = response.getWriter();
		MyConfig.printfInfo(tbBuyMain.getJsonObject().toString());
		out.println(tbBuyMain.getJsonObject().toString());
		out.flush();
		out.close();
		return;
	}
	
	/**
	 * 
	* @Title: update 
	* @Description: TODO 更新药品信息
	* @param @param cgbh
	* @param @param tbBuyMain
	* @param @param br
	* @param @param model
	* @param @param request
	* @param @param response
	* @param @throws Exception
	* @return void
	* @throws
	 */
	@RequestMapping(value="/{cgbh}/update",method=RequestMethod.POST)
	public void update(@PathVariable("cgbh") String cgbh,TbBuyMain tbBuyMain,BindingResult br,Model model,HttpServletRequest request,HttpServletResponse response)throws Exception{
		
		MyConfig.printfInfo(tbBuyMain.getJsonObject().toString());
		
		boolean success = true;
		String msg = "";
		if(br.hasErrors()) {
			msg = br.getAllErrors().toString();
			success = false;
		}else {
			service.updateBuyMain(tbBuyMain);
			msg = "药品信息修改成功!";
		}
		response.setContentType("text/json;charset=utf-8");
		PrintWriter out = response.getWriter();
		JSONObject json = new JSONObject();
		json.accumulate("success", success);
		json.accumulate("message", msg);
		out.println(json.toString());
		out.flush();
		out.close();
		return ;
	}
	
	/**
	 * 
	* @Title: deleteBuyMainByBmbh 
	* @Description: TODO 批量删除药品信息
	* @param @param cgbhs
	* @param @param response
	* @param @throws JSONException
	* @param @throws IOException
	* @return void
	* @throws
	 */
	@RequestMapping(value="/deletes",method=RequestMethod.POST)
	public void deleteBuyMainByBmbh(String cgbhs,HttpServletResponse response) throws JSONException, IOException {
		String cgbh[] = cgbhs.split(",");
		String message ="";
		boolean success = false;
		
		for(int i=0;i<cgbh.length;i++) {
			service.deleteBuyMain(cgbh[i]);
		}
		message = "信息删除成功!";
		success = true;
		response.setContentType("text/json;charset=utf-8");
		PrintWriter out = response.getWriter();
		JSONObject json = new JSONObject();
		json.accumulate("success", success);
		json.accumulate("message", message);
		out.println(json.toString());
		out.flush();
		out.close();
		return;
	}

}
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值