3 changed files with 210 additions and 0 deletions
@ -0,0 +1,89 @@ |
|||
package cn.chjyj.szwh.bean; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* 证书实体 |
|||
* xy |
|||
*/ |
|||
public class Cert implements Serializable { |
|||
/** |
|||
* cert |
|||
* id,public_key as publicKey,private_key as privateKey,token,`status`,`type` |
|||
*/ |
|||
private Integer id; |
|||
/** |
|||
* 公钥地址 |
|||
*/ |
|||
private String publicKey; |
|||
|
|||
/** |
|||
* 私钥地址 |
|||
*/ |
|||
private String privateKey; |
|||
|
|||
/** |
|||
* 系统标识 |
|||
*/ |
|||
private String token; |
|||
|
|||
/** |
|||
* 状态;0:启用;1:禁用 |
|||
*/ |
|||
private Integer status; |
|||
|
|||
/** |
|||
* 类型 |
|||
*/ |
|||
private String type; |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
public Integer getId() { |
|||
return id; |
|||
} |
|||
|
|||
public void setId(Integer id) { |
|||
this.id = id; |
|||
} |
|||
|
|||
public String getPublicKey() { |
|||
return publicKey; |
|||
} |
|||
|
|||
public void setPublicKey(String publicKey) { |
|||
this.publicKey = publicKey; |
|||
} |
|||
|
|||
public String getPrivateKey() { |
|||
return privateKey; |
|||
} |
|||
|
|||
public void setPrivateKey(String privateKey) { |
|||
this.privateKey = privateKey; |
|||
} |
|||
|
|||
public String getToken() { |
|||
return token; |
|||
} |
|||
|
|||
public void setToken(String token) { |
|||
this.token = token; |
|||
} |
|||
|
|||
public Integer getStatus() { |
|||
return status; |
|||
} |
|||
|
|||
public void setStatus(Integer status) { |
|||
this.status = status; |
|||
} |
|||
|
|||
public String getType() { |
|||
return type; |
|||
} |
|||
|
|||
public void setType(String type) { |
|||
this.type = type; |
|||
} |
|||
} |
|||
@ -0,0 +1,24 @@ |
|||
package cn.chjyj.szwh.mapper; |
|||
|
|||
import cn.chjyj.szwh.bean.Cert; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 证书mapper |
|||
*/ |
|||
@Component |
|||
public interface CertMapper { |
|||
/** |
|||
* 根据编号查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
Cert getCertByid(Integer id); |
|||
|
|||
/** |
|||
* 根据类型查询 |
|||
* @param stype |
|||
* @return |
|||
*/ |
|||
Cert getCertByType(String stype); |
|||
} |
|||
@ -0,0 +1,97 @@ |
|||
<?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="cn.chjyj.szwh.mapper.CertMapper"> |
|||
|
|||
<sql id="column"> |
|||
id,public_key as publicKey,private_key as privateKey,token,`status`,`type` |
|||
</sql> |
|||
<sql id="tbName">cert</sql> |
|||
|
|||
<!--查询记录列表--> |
|||
<select id="getGoodsList" parameterType="java.lang.Integer" resultType="cn.chjyj.szwh.bean.Cert"> |
|||
WITH mm as (select * from |
|||
<include refid="tbName"/> |
|||
where id>#{startRs} limit #{pageSize} |
|||
)SELECT * FROM mm ORDER BY id DESC; |
|||
</select> |
|||
|
|||
<!--根据id查询--> |
|||
<select id="getCertByid" parameterType="java.lang.Integer" resultType="cn.chjyj.szwh.bean.Cert"> |
|||
select <include refid="column"/> |
|||
from <include refid="tbName"/> |
|||
where id=#{id} |
|||
</select> |
|||
|
|||
<!-- 安装类型查询 --> |
|||
<select id="getCertByType" parameterType="java.lang.String" resultType="cn.chjyj.szwh.bean.Cert"> |
|||
select <include refid="column"/> |
|||
from <include refid="tbName"/> |
|||
where `type`=#{stype} limit 1; |
|||
</select> |
|||
|
|||
<!--查询用户--> |
|||
<select id="getSingleUserByOpenid" parameterType="java.lang.String" resultType="cn.chjyj.szwh.bean.Goods"> |
|||
select <include refid="column"/> from |
|||
<include refid="tbName"/> |
|||
where openid=#{openid}; |
|||
</select> |
|||
|
|||
<!--新增用户--> |
|||
<insert id="addUser" parameterType="cn.chjyj.szwh.bean.Goods" useGeneratedKeys="true" keyColumn="id"> |
|||
insert into <include refid="tbName"/> |
|||
(uname,password,gender,urealname,ubirth,nickname,avatarurl,platfrom,sessionkey,openid) |
|||
values ( |
|||
#{uname}, |
|||
#{password}, |
|||
#{gender}, |
|||
#{urealname}, |
|||
#{ubirth}, |
|||
#{nickname}, |
|||
#{avatarurl}, |
|||
#{platfrom}, |
|||
#{sessionkey}, |
|||
#{openid} |
|||
) |
|||
</insert> |
|||
|
|||
<update id="upUser" parameterType="cn.chjyj.szwh.bean.Goods"> |
|||
update <include refid="tbName"/> |
|||
set |
|||
|
|||
<if test="password!=null"> |
|||
password=#{password}, |
|||
</if> |
|||
<if test="urealname!=null"> |
|||
urealname=#{urealname}, |
|||
</if> |
|||
<if test="ubirth!=null"> |
|||
ubirth =#{ubirth}, |
|||
</if> |
|||
<if test="gender!=null"> |
|||
gender=#{gender}, |
|||
</if> |
|||
<if test="nickName!=null"> |
|||
nickname=#{nickName}, |
|||
</if> |
|||
<if test="avatarurl!=null"> |
|||
avatarurl=#{avatarurl}, |
|||
</if> |
|||
<if test="nickname!=null"> |
|||
nickname=#{nickname}, |
|||
</if> |
|||
<if test="platfrom!=null"> |
|||
platfrom=#{platfrom}, |
|||
</if> |
|||
<if test="sessionkey!=null"> |
|||
sessionkey=#{sessionkey}, |
|||
</if> |
|||
<if test="openid!=null"> |
|||
openid=#{openid}, |
|||
</if> |
|||
uname=#{uname} |
|||
where uid=#{uid}; |
|||
</update> |
|||
|
|||
</mapper> |
|||
Loading…
Reference in new issue