2019/04/08_SpringBoot_@RequestBody(required=false)_啓動文件_Springboot 裝載mybatis正在學習

指定

appoint; assign; allocate; appointment; destine; designation; assigning:

(通過法律手續)指定把財產授與某人

settle one's property on sb.;

指定某人任某職

designate sb. to an office;

指定某人做某事

assign sb. to do sth.;

指定一個日期

appoint a date

執行

執行命令

execute an order;

執行任務

carry out a task

int 與 Integer

非new生成的Integer變量指向的是java常量池中的對象,而new Integer()生成的變量指向堆中新建的對象,兩者在內存中的地址不同。所以 輸出爲false。

@RequestBody(required=false) 表示map對象可以不傳入

public ResponseBodyVO<Integer> approveDisagreeDo(@RequestBody(required=false) Map<String, Object> map) throws BusinessException {
   	/*
   	 * 1.審批的操作:調用審批接口的操作
   	 * 2.工作流的操作:把運行表中的審批人ID置爲空
   	 * 
   	 * approverAction:1:駁回 2:駁回並修改
   	 */
   	Integer approverAction = (Integer)map.get("approverAction");
   	String approvalStatus = null;
   	switch (approverAction) {
   	case 1:
   		approvalStatus="駁回";
   		break;
   	case 2:
   		approvalStatus="駁回並修改";
   		break;
   	}
   	approveBusiService.approveDo(map, approverAction);
   	logger.debug("組裝更新運行表的map");
   	Map<String, Object> uMap = new HashMap<String,Object>();
   	uMap.put("applyId", map.get("applyId"));
   	uMap.put("curUserID", "");
   	uMap.put("approvalStatus",approvalStatus);
   	uMap.put("invariantField", "applyId");
   	rows=workflowApplyRunningService.updateMap(uMap);
   	ResponseBodyVO<Integer> responseBodyVO=new ResponseBodyVO<>();
   	responseBodyVO.setSuccessResult(rows);
   	return  responseBodyVO;
   }

Spring boot啓動默認是要加載數據源,因此在 model 層出現問題的話,程序啓動異常

Spring Boot 配置 mybatis

<dependency>
   <groupId>org.mybatis.spring.boot</groupId>
   <artifactId>mybatis-spring-boot-starter</artifactId>
   <version>1.3.0</version>
</dependency>

Spring Boot
啓動文件
Spring 註解

package com.boxin.productions.stp.ttc;

import com.boxin.productions.sss.common.component.BaseComponent;
import com.boxin.productions.sss.common.component.interceptor.RequestInterceptor;
import com.boxin.productions.sss.common.jpa.service.SysUserService;

//import com.boxin.productions.sss.common.jpa.service.TicketsPropCategoryService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.scheduling.annotation.EnableScheduling;


@Configuration
@SpringBootApplication
@EnableAspectJAutoProxy
@EnableAutoConfiguration(exclude={MongoAutoConfiguration.class, MongoDataAutoConfiguration.class })
@EnableScheduling
//@EnableFeignClients
//@EnableDiscoveryClient
@ComponentScan(basePackageClasses = { boxinApplication.class, BaseComponent.class, SysUserService.class, RequestInterceptor.class})
public class boxinApplication extends SpringBootServletInitializer {
	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
		return application.sources(boxinApplication.class);
	}

	public static void main(String[] args) throws Exception {
		SpringApplication app = new SpringApplication(boxinApplication.class);
		app.run(args);
	}

}

Springboot 裝載mybatis
MyBatis註解應用之動態SQL語句
	@DeleteProvider(type = DynamicSqlProvider.class, method = "deleteListByIds")

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章