authorization
parent
ea667b0258
commit
111cdcd492
|
@ -0,0 +1,75 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="Spring" name="Spring">
|
||||
<configuration />
|
||||
</facet>
|
||||
<facet type="web" name="Web">
|
||||
<configuration>
|
||||
<webroots />
|
||||
<sourceRoots>
|
||||
<root url="file://$MODULE_DIR$/src/main/java" />
|
||||
<root url="file://$MODULE_DIR$/src/main/resources" />
|
||||
</sourceRoots>
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.11.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.11.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.26" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.3.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.1.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.1.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.23" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.9" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.9.9" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.9.9" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.9" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.9.9" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.21" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:9.0.21" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.21" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.0.17.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.validation:validation-api:2.0.1.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.2.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.4.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.1.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.1.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.1.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.1.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.1.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.1.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-devtools:2.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: mysql:mysql-connector-java:8.0.15" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:1.3.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.1.6.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.2.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.26" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.1.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.1.8.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:1.3.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.4.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:1.3.1" level="project" />
|
||||
</component>
|
||||
</module>
|
|
@ -0,0 +1,59 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>SpringBoot2</artifactId>
|
||||
<groupId>zz</groupId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>SpringBootMybatis</artifactId>
|
||||
|
||||
|
||||
<!-- Add typical dependencies for a web application -->
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--目的:《可选》引入springboot 热启动,每次修改以后,会自动把改动加载,不需要重启服务了-->
|
||||
<dependency> <groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.15</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.mybatis.spring.boot/mybatis-spring-boot-starter -->
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>1.3.1</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>alimaven</id>
|
||||
<name>aliyun maven</name>
|
||||
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,38 @@
|
|||
package com.zz.util;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
public class DateUtil {
|
||||
|
||||
/**
|
||||
* util date 转 sql date
|
||||
* @param udate
|
||||
* @return
|
||||
*/
|
||||
public static java.sql.Date tranceToSqlDate(Date udate){
|
||||
//转成sql date
|
||||
return new java.sql.Date(udate.getTime());
|
||||
}
|
||||
/**
|
||||
* String to uitil Date
|
||||
* "yyyy-MM-dd"
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
|
||||
public static Date tranceToDate(String str){
|
||||
SimpleDateFormat s=new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date d1=null;
|
||||
try {
|
||||
d1=s.parse(str);
|
||||
} catch (ParseException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return d1;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.zz.util;
|
||||
import java.util.Random;
|
||||
|
||||
public class KeyUtil {
|
||||
|
||||
/**
|
||||
* 生成唯一的主键
|
||||
* 格式: 时间+随机数
|
||||
* @return
|
||||
*/
|
||||
public static String genUniqueKey() {
|
||||
Random random = new Random();
|
||||
Integer number = random.nextInt(900000) + 100000;
|
||||
|
||||
return System.currentTimeMillis() + String.valueOf(number);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
<?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.zz.mapper.PermissionMapper">
|
||||
<resultMap id="BaseResultMap" type="com.zz.entity.Permission">
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="url" jdbcType="VARCHAR" property="url" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, name, url
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from t_permission
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
||||
delete from t_permission
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.zz.entity.Permission">
|
||||
insert into t_permission (id, name, url
|
||||
)
|
||||
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.zz.entity.Permission">
|
||||
insert into t_permission
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="name != null">
|
||||
name,
|
||||
</if>
|
||||
<if test="url != null">
|
||||
url,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="name != null">
|
||||
#{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="url != null">
|
||||
#{url,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.zz.entity.Permission">
|
||||
update t_permission
|
||||
<set>
|
||||
<if test="name != null">
|
||||
name = #{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="url != null">
|
||||
url = #{url,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.zz.entity.Permission">
|
||||
update t_permission
|
||||
set name = #{name,jdbcType=VARCHAR},
|
||||
url = #{url,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
|
@ -0,0 +1,71 @@
|
|||
<?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.zz.mapper.RoleMapper">
|
||||
<resultMap id="BaseResultMap" type="com.zz.entity.Role">
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="detail" jdbcType="VARCHAR" property="detail" />
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, detail, name
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from t_role
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
||||
delete from t_role
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.zz.entity.Role">
|
||||
insert into t_role (id, detail, name
|
||||
)
|
||||
values (#{id,jdbcType=VARCHAR}, #{detail,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.zz.entity.Role">
|
||||
insert into t_role
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="detail != null">
|
||||
detail,
|
||||
</if>
|
||||
<if test="name != null">
|
||||
name,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="detail != null">
|
||||
#{detail,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="name != null">
|
||||
#{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.zz.entity.Role">
|
||||
update t_role
|
||||
<set>
|
||||
<if test="detail != null">
|
||||
detail = #{detail,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="name != null">
|
||||
name = #{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.zz.entity.Role">
|
||||
update t_role
|
||||
set detail = #{detail,jdbcType=VARCHAR},
|
||||
name = #{name,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
|
@ -0,0 +1,36 @@
|
|||
<?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.zz.mapper.RolePermissionMapper">
|
||||
<resultMap id="BaseResultMap" type="com.zz.entity.RolePermissionKey">
|
||||
<id column="r_id" jdbcType="VARCHAR" property="rId" />
|
||||
<id column="p_id" jdbcType="VARCHAR" property="pId" />
|
||||
</resultMap>
|
||||
<delete id="deleteByPrimaryKey" parameterType="com.zz.entity.RolePermissionKey">
|
||||
delete from t_role_permission
|
||||
where r_id = #{rId,jdbcType=VARCHAR}
|
||||
and p_id = #{pId,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.zz.entity.RolePermissionKey">
|
||||
insert into t_role_permission (r_id, p_id)
|
||||
values (#{rId,jdbcType=VARCHAR}, #{pId,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.zz.entity.RolePermissionKey">
|
||||
insert into t_role_permission
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="rId != null">
|
||||
r_id,
|
||||
</if>
|
||||
<if test="pId != null">
|
||||
p_id,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="rId != null">
|
||||
#{rId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="pId != null">
|
||||
#{pId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
</mapper>
|
|
@ -0,0 +1,93 @@
|
|||
<?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.zz.mapper.UserMapper">
|
||||
<resultMap id="BaseResultMap" type="com.zz.entity.User">
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="create_time" jdbcType="DATE" property="createTime" />
|
||||
<result column="passwd" jdbcType="VARCHAR" property="passwd" />
|
||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||
<result column="username" jdbcType="VARCHAR" property="username" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, create_time, passwd, status, username
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from t_user
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
||||
delete from t_user
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.zz.entity.User">
|
||||
insert into t_user (id, create_time, passwd,
|
||||
status, username)
|
||||
values (#{id,jdbcType=VARCHAR}, #{createTime,jdbcType=DATE}, #{passwd,jdbcType=VARCHAR},
|
||||
#{status,jdbcType=VARCHAR}, #{username,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.zz.entity.User">
|
||||
insert into t_user
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="passwd != null">
|
||||
passwd,
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status,
|
||||
</if>
|
||||
<if test="username != null">
|
||||
username,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=DATE},
|
||||
</if>
|
||||
<if test="passwd != null">
|
||||
#{passwd,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
#{status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="username != null">
|
||||
#{username,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.zz.entity.User">
|
||||
update t_user
|
||||
<set>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=DATE},
|
||||
</if>
|
||||
<if test="passwd != null">
|
||||
passwd = #{passwd,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="username != null">
|
||||
username = #{username,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.zz.entity.User">
|
||||
update t_user
|
||||
set create_time = #{createTime,jdbcType=DATE},
|
||||
passwd = #{passwd,jdbcType=VARCHAR},
|
||||
status = #{status,jdbcType=VARCHAR},
|
||||
username = #{username,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
|
@ -0,0 +1,36 @@
|
|||
<?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.zz.mapper.UserRoleMapper">
|
||||
<resultMap id="BaseResultMap" type="com.zz.entity.UserRoleKey">
|
||||
<id column="u_id" jdbcType="VARCHAR" property="uId" />
|
||||
<id column="r_id" jdbcType="VARCHAR" property="rId" />
|
||||
</resultMap>
|
||||
<delete id="deleteByPrimaryKey" parameterType="com.zz.entity.UserRoleKey">
|
||||
delete from t_user_role
|
||||
where u_id = #{uId,jdbcType=VARCHAR}
|
||||
and r_id = #{rId,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.zz.entity.UserRoleKey">
|
||||
insert into t_user_role (u_id, r_id)
|
||||
values (#{uId,jdbcType=VARCHAR}, #{rId,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.zz.entity.UserRoleKey">
|
||||
insert into t_user_role
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="uId != null">
|
||||
u_id,
|
||||
</if>
|
||||
<if test="rId != null">
|
||||
r_id,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="uId != null">
|
||||
#{uId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="rId != null">
|
||||
#{rId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
</mapper>
|
Loading…
Reference in New Issue