消费端:controller/service
生产端:ServiceImpl/Mapper(Dao)
主要是注意两端层级结构,两边都要有bean,消费端service接口,生产端seviceImpl,其次就是配置文件的xml的区别
生产端:Bean
package com.jk.provide.bean;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
public class TAtyUser implements Serializable{
/**
*
*/
private static final long serialVersionUID = 8526726857563431642L;
private String cId;
private String cLoginid;
private String cName;
private String cPassword;
private String cMail;
private String cIp;
private String cXmjp;
private String cCorp;
private String cDept;
private Integer nValid;
private Short nOrder;
private String usercode;
private String userpost;
private String cZw;
private String cLinkuser;
private Integer nRylx;
private Integer nShowUser;
private Integer nTxl;
private Integer nSfkq;
private String authImage;
public String getcId() {
return cId;
}
public void setcId(String cId) {
this.cId = cId == null ? null : cId.trim();
}
public String getAuthImage() {
return authImage;
}
public void setAuthImage(String authImage) {
this.authImage = authImage;
}
public String getcLoginid() {
return cLoginid;
}
public void setcLoginid(String cLoginid) {
this.cLoginid = cLoginid == null ? null : cLoginid.trim();
}
public String getcName() {
return cName;
}
public void setcName(String cName) {
this.cName = cName == null ? null : cName.trim();
}
public String getcPassword() {
return cPassword;
}
public void setcPassword(String cPassword) {
this.cPassword = cPassword == null ? null : cPassword.trim();
}
public String getcMail() {
return cMail;
}
public void setcMail(String cMail) {
this.cMail = cMail == null ? null : cMail.trim();
}
public String getcIp() {
return cIp;
}
public void setcIp(String cIp) {
this.cIp = cIp == null ? null : cIp.trim();
}
public String getcXmjp() {
return cXmjp;
}
public void setcXmjp(String cXmjp) {
this.cXmjp = cXmjp == null ? null : cXmjp.trim();
}
public String getcCorp() {
return cCorp;
}
public void setcCorp(String cCorp) {
this.cCorp = cCorp == null ? null : cCorp.trim();
}
public String getcDept() {
return cDept;
}
public void setcDept(String cDept) {
this.cDept = cDept == null ? null : cDept.trim();
}
public Short getnOrder() {
return nOrder;
}
public void setnOrder(Short nOrder) {
this.nOrder = nOrder;
}
public String getUsercode() {
return usercode;
}
public void setUsercode(String usercode) {
this.usercode = usercode == null ? null : usercode.trim();
}
public String getUserpost() {
return userpost;
}
public void setUserpost(String userpost) {
this.userpost = userpost == null ? null : userpost.trim();
}
public String getcZw() {
return cZw;
}
public void setcZw(String cZw) {
this.cZw = cZw == null ? null : cZw.trim();
}
public String getcLinkuser() {
return cLinkuser;
}
public void setcLinkuser(String cLinkuser) {
this.cLinkuser = cLinkuser == null ? null : cLinkuser.trim();
}
public Integer getnRylx() {
return nRylx;
}
public void setnRylx(Integer nRylx) {
this.nRylx = nRylx;
}
public Integer getnTxl() {
return nTxl;
}
public void setnTxl(Integer nTxl) {
this.nTxl = nTxl;
}
public Integer getnValid() {
return nValid;
}
public void setnValid(Integer nValid) {
this.nValid = nValid;
}
public Integer getnShowUser() {
return nShowUser;
}
public void setnShowUser(Integer nShowUser) {
this.nShowUser = nShowUser;
}
public Integer getnSfkq() {
return nSfkq;
}
public void setnSfkq(Integer nSfkq) {
this.nSfkq = nSfkq;
}
}
生产端:Mapper
package com.jk.provide.mapper.dao;
import java.util.List;
import com.jk.provide.bean.TAtyUser;
public interface TAtyUserMapper {
List<TAtyUser> getAllUserList();
}
生产端: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.jk.provide.mapper.dao.TAtyUserMapper" >
<resultMap id="BaseResultMap" type="com.jk.provide.bean.TAtyUser" >
<id column="C_ID" property="cId" jdbcType="VARCHAR" />
<result column="C_LoginID" property="cLoginid" jdbcType="VARCHAR" />
<result column="C_Name" property="cName" jdbcType="VARCHAR" />
<result column="C_Password" property="cPassword" jdbcType="CHAR" />
<result column="C_Mail" property="cMail" jdbcType="VARCHAR" />
<result column="C_IP" property="cIp" jdbcType="VARCHAR" />
<result column="C_XMJP" property="cXmjp" jdbcType="VARCHAR" />
<result column="C_CORP" property="cCorp" jdbcType="VARCHAR" />
<result column="C_DEPT" property="cDept" jdbcType="VARCHAR" />
<result column="N_Valid" property="nValid" jdbcType="TINYINT" />
<result column="N_Order" property="nOrder" jdbcType="SMALLINT" />
<result column="userCode" property="usercode" jdbcType="VARCHAR" />
<result column="userPost" property="userpost" jdbcType="VARCHAR" />
<result column="C_ZW" property="cZw" jdbcType="VARCHAR" />
<result column="C_LINKUSER" property="cLinkuser" jdbcType="VARCHAR" />
<result column="N_RYLX" property="nRylx" jdbcType="INTEGER" />
<result column="N_SHOW_USER" property="nShowUser" jdbcType="TINYINT" />
<result column="N_TXL" property="nTxl" jdbcType="INTEGER" />
<result column="N_SFKQ" property="nSfkq" jdbcType="TINYINT" />
</resultMap>
<sql id="Base_Column_List" >
C_ID, C_LoginID, C_Name, C_Password, C_Mail, C_IP, C_XMJP, C_CORP, C_DEPT, N_Valid,
N_Order, userCode, userPost, C_ZW, C_LINKUSER, N_RYLX, N_SHOW_USER, N_TXL, N_SFKQ
</sql>
<select id="getAllUserList" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
from t_aty_user
</select>
</mapper>
生产端:ServiceImpl
package com.jk.provide.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.jk.provide.bean.TAtyUser;
import com.jk.provide.mapper.dao.TAtyUserMapper;
import com.jk.provide.service.IUserInfoService;
/**
* @author 作者 尚峰:
* @version 创建时间:2017年11月15日 上午10:14:20
* 类说明
*/
@Service("userservice")
public class UserInfoServiceImpl implements IUserInfoService {
@Autowired
private TAtyUserMapper tAtyUserMapper;
@Override
public List<TAtyUser> getAllUserList() {
return tAtyUserMapper.getAllUserList();
}
@Override
public String testRequest(TAtyUser user) {
System.out.println(user.getcName());
System.out.println(user.getcPassword());
return "success";
}
}
生产端:Service
package com.jk.provide.service;
import java.util.List;
import com.jk.provide.bean.TAtyUser;
/**
* @author 作者 尚峰:
* @version 创建时间:2017年11月15日 上午10:13:41
* 类说明
*/
public interface IUserInfoService {
List<TAtyUser> getAllUserList();
String testRequest(TAtyUser user);
}
#db driver
jdbc.driver=com.mysql.jdbc.Driver
#db url
jdbc.url=jdbc:mysql://localhost:3306/test2?useUnicode=true&characterEncoding=utf-8
#db username
jdbc.username=root
#db password
jdbc.password=root
#db maxActive
jdbc.maxActive=2
#db minIdle
jdbc.minIdle=5
#db maxIdle
jdbc.maxIdle=5
#\u6700\u592