Commit 41d0a5a9 by liqiuwei

调整mybaties使用用例

parent b516760c
......@@ -15,6 +15,7 @@
*.iml
*.ipr
*.lst
*.versionsBackup
### NetBeans ###
/nbproject/private/
......
# 简介
# 一、简介 ***
Matrix-sample是matrix组件的示例项目,包括redis、rocketmq等中间件以及提供通用util工具类使用方式等
\ No newline at end of file
***
## 1.模块说明
- matrix-sample-xxx-biz为业务的实现模块,公共模块
- matrix-sample-xxx-spring为传统的spring项目的demo,主要参考如何进行配置和使用
- matrix-sample-xxx-springboot为springboot的示例
\ No newline at end of file
......@@ -5,7 +5,7 @@
<parent>
<artifactId>matrix-sample-dubbo</artifactId>
<groupId>com.secoo.mall</groupId>
<version>1.3.2.RELEASE</version>
<version>2.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>matrix-sample-dubbo</artifactId>
<groupId>com.secoo.mall</groupId>
<version>1.3.2.RELEASE</version>
<version>2.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>matrix-sample-dubbo</artifactId>
<groupId>com.secoo.mall</groupId>
<version>1.3.2.RELEASE</version>
<version>2.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>matrix-sample-dubbo-springboot</artifactId>
<groupId>com.secoo.mall</groupId>
<version>1.3.2.RELEASE</version>
<version>2.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>matrix-sample-dubbo-springboot</artifactId>
<groupId>com.secoo.mall</groupId>
<version>1.3.2.RELEASE</version>
<version>2.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>matrix-sample-dubbo</artifactId>
<groupId>com.secoo.mall</groupId>
<version>1.3.2.RELEASE</version>
<version>2.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>matrix-sample</artifactId>
<groupId>com.secoo.mall</groupId>
<version>1.3.2.RELEASE</version>
<version>2.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......@@ -22,12 +22,12 @@
<dependency>
<groupId>com.secoo.mall</groupId>
<artifactId>matrix-sample-dubbo-api</artifactId>
<version>1.3.2.RELEASE</version>
<version>2.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.secoo.mall</groupId>
<artifactId>matrix-sample-dubbo-biz</artifactId>
<version>1.3.2.RELEASE</version>
<version>2.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</dependencyManagement>
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>matrix-sample-hbase</artifactId>
<groupId>com.secoo.mall</groupId>
<version>1.3.2.RELEASE</version>
<version>2.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......
......@@ -5,11 +5,11 @@
<parent>
<artifactId>matrix-sample-hbase</artifactId>
<groupId>com.secoo.mall</groupId>
<version>1.3.2.RELEASE</version>
<version>2.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>matrix-sample-hbase-starter</artifactId>
<artifactId>matrix-sample-hbase-springboot</artifactId>
<dependencies>
<dependency>
<groupId>com.secoo.mall</groupId>
......
......@@ -3,7 +3,6 @@ spring:
name: matrix-bigdata-demo
server:
port: 6080
hbase:
zookeeper:
quorum: 172.17.105.72:2181
......@@ -5,7 +5,7 @@
<parent>
<artifactId>matrix-sample</artifactId>
<groupId>com.secoo.mall</groupId>
<version>1.3.2.RELEASE</version>
<version>2.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......
......@@ -5,11 +5,38 @@
<parent>
<artifactId>matrix-sample-mybatis</artifactId>
<groupId>com.secoo.mall</groupId>
<version>2.0.1.RELEASE</version>
<version>2.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>matrix-sample-mybatis-biz</artifactId>
<dependencies>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.22</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.secoo.mall</groupId>
<artifactId>common-core</artifactId>
</dependency>
<dependency>
<groupId>com.secoo.mall</groupId>
<artifactId>matrix-mybatis-core</artifactId>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>${project.basedir}/src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</build>
</project>
\ No newline at end of file
package com.secoo.mall.appms.bean.domain;
package com.secoo.mall.mybatis.bean.entity;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.FieldFill;
......
package com.secoo.mall.appms.bean.domain;
package com.secoo.mall.mybatis.bean.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
......
package com.secoo.mall.appms.bean.domain;
package com.secoo.mall.mybatis.bean.entity;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.FieldFill;
......
package com.secoo.mall.appms.bean.vo;
package com.secoo.mall.mybatis.bean.vo;
import com.secoo.mall.appms.bean.domain.UserProjectRelation;
import com.secoo.mall.appms.util.constant.UserProjectRelationConstant;
import com.secoo.mall.common.util.colletion.CollectionUtil;
import com.secoo.mall.common.util.json.FastJsonUtil;
import com.secoo.mall.common.util.string.StringUtil;
import com.secoo.mall.mybatis.bean.entity.UserProjectRelation;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -35,33 +35,4 @@ public class UserProjectRelationVo extends UserProjectRelation {
@ApiModelProperty(value = "用于转换数组")
private List<Integer> warnChannelList;
/**
* 由view到db
*
* @param warnChannelList
*/
public void setWarnChannelList(List<Integer> warnChannelList) {
if (UserProjectRelationConstant.WarnFlag.REJECT.equals(this.getWarnFlag())) {
warnChannelList = null;
}
if (CollectionUtil.isNotEmpty(warnChannelList)) {
this.setWarnChannels(FastJsonUtil.toString(warnChannelList));
}
}
/**
* 由db到view
*
* @param warnChannels
*/
@Override
public void setWarnChannels(String warnChannels) {
if (StringUtil.isNotEmpty(warnChannels)) {
this.warnChannelList = FastJsonUtil.toList(warnChannels, Integer.class);
}
super.setWarnChannels(warnChannels);
}
}
\ No newline at end of file
package com.secoo.mall.mybatis.config;
import com.baomidou.mybatisplus.core.MybatisConfiguration;
import com.secoo.mall.datasource.bean.MatrixDataSource;
import com.secoo.mall.mybatis.bean.MatrixMybatisSqlSessionFactoryBean;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import javax.sql.DataSource;
/**
* @Description:
* @Copyright: Copyright (c) 2020 ALL RIGHTS RESERVED.
......@@ -10,6 +22,31 @@ package com.secoo.mall.mybatis.config;
* @UpdateRemark: init
* @Version: 1.0
* @menu ${description}
* @note 如果数据源中不存在多个sessionfactory示例,可以在mapper接口类直接使用@Mapper注解
*/
@Configuration
@MapperScan(value = "com.secoo.mall.mybatis.dao.mapper",sqlSessionFactoryRef = "demoSqlSessionFactory")
public class DataConfig {
/**
* 定义数据源
*
* @return
*/
@Bean
public DataSource demoDataSource() {
return new MatrixDataSource("default");
}
@Bean
public SqlSessionFactory demoSqlSessionFactory(DataSource demoDataSource, MatrixMybatisGlobalConfig globalConfig, MybatisConfiguration mybatisConfiguration) throws Exception {
MatrixMybatisSqlSessionFactoryBean factory = new MatrixMybatisSqlSessionFactoryBean();
factory.setConfiguration(mybatisConfiguration);
factory.setGlobalConfig(globalConfig);
factory.setDataSource(demoDataSource);
return factory.getObject();
}
}
package com.secoo.mall.appms.dao.mapper;
package com.secoo.mall.mybatis.dao.mapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.secoo.mall.appms.bean.domain.User;
import com.secoo.mall.appms.util.constant.UserConstant;
import com.secoo.mall.common.util.string.StringUtil;
import com.secoo.mall.mybatis.bean.entity.User;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface UserMapper extends BaseMapper<User> {
......@@ -21,39 +20,8 @@ public interface UserMapper extends BaseMapper<User> {
return this.selectOne(new QueryWrapper<User>().lambda().eq(User::getEmail, email).last("limit 1"));
}
default User getByName(String name) {
return this.selectOne(new QueryWrapper<User>().lambda().eq(User::getName, name).last("limit 1"));
}
default List<User> getAllUsers() {
return this.selectList(new QueryWrapper<User>().lambda().eq(User::getStatus, UserConstant.Status.NORMAL));
}
default User getByMobile(String mobile) {
return this.selectOne(new QueryWrapper<User>().lambda().eq(User::getMobile, mobile).last("limit 1"));
}
default User getOne(User user) {
LambdaQueryWrapper<User> queryWrapper = new QueryWrapper<User>().lambda();
if (StringUtil.isNotEmpty(user.getName())) {
queryWrapper.eq(User::getName, user.getName()).or();
}
if (StringUtil.isNotEmpty(user.getWorkNum())) {
queryWrapper.eq(User::getWorkNum, user.getWorkNum()).or();
}
if (StringUtil.isNotEmpty(user.getEmail())) {
queryWrapper.eq(User::getEmail, user.getEmail()).or();
}
return this.selectOne(queryWrapper);
}
default IPage<User> search(User user, Page page) {
LambdaQueryWrapper<User> queryWrapper = new QueryWrapper<User>().lambda().ne(User::getStatus, UserConstant.Status.DELETE);
LambdaQueryWrapper<User> queryWrapper = new QueryWrapper<User>().lambda();
if (StringUtil.isNotEmpty(user.getName()) || StringUtil.isNotEmpty(user.getCnName()) || StringUtil.isNotEmpty(user.getWorkNum())) {
queryWrapper.and(wapper -> wapper.like(User::getName, user.getName())
.or().like(User::getCnName, user.getCnName())
......
package com.secoo.mall.appms.dao.mapper;
package com.secoo.mall.mybatis.dao.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.secoo.mall.appms.bean.domain.UserProjectRelation;
import com.secoo.mall.appms.bean.vo.UserProjectRelationVo;
import com.secoo.mall.mybatis.bean.entity.UserProjectRelation;
import com.secoo.mall.mybatis.bean.vo.UserProjectRelationVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface UserProjectRelationMapper extends BaseMapper<UserProjectRelation> {
IPage<Object> getUsersByIdAndUser(long projectId, String name, String cnName);
List<UserProjectRelationVo> getUsersByProjectId(@Param("projectId") Long projectId);
List<UserProjectRelationVo> getWarnUsersByProjectId(@Param("projectId") Long projectId);
default List<UserProjectRelation> getByUserIdAndProjectIds(Long userId, List<Long> projectIds) {
return this.selectList(new QueryWrapper<UserProjectRelation>().lambda().eq(UserProjectRelation::getUserId, userId).in(UserProjectRelation::getProjectId, projectIds));
}
IPage<UserProjectRelationVo> searchByProjectId(Page<UserProjectRelationVo> page, @Param("projectId") Long projectId, @Param("relationVo") UserProjectRelationVo userProjectRelationVo);
default Integer getCntByReposIdAndUserId(Long repositoryId, Long userId) {
return this.selectCount(new QueryWrapper<UserProjectRelation>().lambda().eq(UserProjectRelation::getRepositoryId, repositoryId).eq(UserProjectRelation::getUserId, userId));
}
default UserProjectRelation getByProjectIdAndUserId(Long projectId, Long userId) {
return this.selectOne(new QueryWrapper<UserProjectRelation>().lambda().eq(UserProjectRelation::getProjectId, projectId).eq(UserProjectRelation::getUserId, userId));
}
default UserProjectRelation getByUserIdAndProjectId(Long userId, Long projectId) {
return this.selectOne(new QueryWrapper<UserProjectRelation>().lambda().eq(UserProjectRelation::getUserId, userId).eq(UserProjectRelation::getProjectId, projectId));
}
default Integer deleteByUserId(Long userId) {
return this.delete(new QueryWrapper<UserProjectRelation>().lambda().eq(UserProjectRelation::getUserId, userId));
}
default Integer deleteByProjectId(Long projectId) {
return this.delete(new QueryWrapper<UserProjectRelation>().lambda().eq(UserProjectRelation::getProjectId, projectId));
}
}
\ No newline at end of file
<?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.secoo.mall.appms.dao.mapper.UserProjectRelationMapper">
<mapper namespace="com.secoo.mall.mybatis.dao.mapper.UserProjectRelationMapper">
<sql id="base_feild_List">
id, user_id , project_id, update_time, create_time
......@@ -19,128 +19,11 @@
</where>
</sql>
<select id="getUsersByProjectId" resultType="com.secoo.mall.appms.bean.vo.UserProjectRelationVo">
select
<include refid="user_map_field_List"/>
from user a inner join user_project_relation b on a.id=b.user_id and b.project_id=#{projectId}
</select>
<select id="getWarnUsersByProjectId" resultType="com.secoo.mall.appms.bean.vo.UserProjectRelationVo">
select
<include refid="user_map_field_List"/>
from user a inner join user_project_relation b on a.id=b.user_id and b.project_id=#{projectId} and b.warn_flag=1
</select>
<select id="searchByProjectId" resultType="com.secoo.mall.appms.bean.vo.UserProjectRelationVo">
<select id="searchByProjectId" resultType="com.secoo.mall.mybatis.bean.vo.UserProjectRelationVo">
select
<include refid="user_map_field_List"/>
from user a inner join user_project_relation b on a.id=b.user_id and b.project_id=#{projectId}
<include refid="search_where"/>
</select>
<!--
<select id="getUsersByIdAndUser" resultType="java.util.Map"
parameterType="com.secoo.mall.appms.bean.vo.UserProjectVo">
SELECT
u.id,
u.name,
u.email,
u.mobile,
u.remark,
u.cn_name as 'cnName',
u.work_num as 'workNum',
u.status,
u.create_time as 'createTime',
u.update_time as 'updateTime'
FROM
user_project_relation up
INNER JOIN user u on u.id = up.user_id
INNER JOIN project p on p.id = up.project_id
WHERE 1=1
<if test="projectId != null">
and p.id = #{projectId,jdbcType=BIGINT}
</if>
<if test="name != null">
and u.name like CONCAT('%',TRIM(#{name,jdbcType=VARCHAR}),'%')
</if>
<if test="cnName != null">
and u.cn_name like CONCAT('%',TRIM(#{cnName,jdbcType=VARCHAR}),'%')
</if>
GROUP BY u.id
</select>
<select id="search" resultType="java.util.Map"
parameterType="com.secoo.mall.appms.bean.vo.UserProjectVo">
SELECT
up.id,
up.user_id,
up.project_id,
up.update_time ,
up.create_time ,
u.name as 'user_name',
u.email,
u.mobile,
u.remark as 'user_remark',
u.status as 'user_status',
u.create_time as 'user_create_time',
u.update_time as 'user_update_time',
p.name as 'project_name',
p.git_url ,
p.group_name ,
p.owner_id ,
p.owner_name ,
p.remark as 'project_remark',
p.status as 'project_status',
p.create_time as 'project_create_time',
p.update_time as 'project_update_time'
FROM
user_project_relation up
INNER JOIN user u on u.id = up.user_id
INNER JOIN project p on p.id = up.project_id
WHERE 1=1
<if test="id != null">
and up.id = #{id,jdbcType=BIGINT}
</if>
<if test="userId != null">
and u.id = #{userId,jdbcType=BIGINT}
</if>
<if test="projectId != null">
and p.id = #{projectId,jdbcType=BIGINT}
</if>
<if test="owner != null">
and p.owner_id = #{owner,jdbcType=BIGINT}
</if>
<if test="userName != null">
and u.name like CONCAT('%',TRIM(#{userName,jdbcType=VARCHAR}),'%')
</if>
<if test="email != null">
and u.email like CONCAT('%',TRIM(#{email,jdbcType=VARCHAR}),'%')
</if>
<if test="mobile != null">
and u.mobile like CONCAT('%',TRIM(#{mobile,jdbcType=VARCHAR}),'%')
</if>
<if test="projectName != null">
and p.name like CONCAT('%',TRIM(#{projectName,jdbcType=VARCHAR}),'%')
</if>
<if test="gitUrl != null">
and p.git_url like CONCAT('%',TRIM(#{gitUrl,jdbcType=VARCHAR}),'%')
</if>
<if test="groupName != null">
and p.group_name like CONCAT('%',TRIM(#{groupName,jdbcType=VARCHAR}),'%')
</if>
<if test="ownerName != null">
and p.owner_name like CONCAT('%',TRIM(#{ownerName,jdbcType=VARCHAR}),'%')
</if>
<if test="ascSort != null and descSort == null ">
order by ${ascSort} asc
</if>
<if test="descSort != null and ascSort == null ">
order by ${descSort} desc
</if>
<if test="descSort != null and ascSort != null ">
order by ${ascSort} asc,${descSort} desc
</if>
limit #{page,jdbcType=BIGINT},#{pageSize,jdbcType=BIGINT}
</select>-->
</mapper>
\ No newline at end of file
......@@ -5,7 +5,7 @@
<parent>
<artifactId>matrix-sample-mybatis</artifactId>
<groupId>com.secoo.mall</groupId>
<version>2.0.1.RELEASE</version>
<version>2.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......
......@@ -5,11 +5,30 @@
<parent>
<artifactId>matrix-sample-mybatis</artifactId>
<groupId>com.secoo.mall</groupId>
<version>2.0.1.RELEASE</version>
<version>2.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>matrix-sample-mybatis-springboot</artifactId>
<dependencies>
<dependency>
<groupId>com.secoo.mall</groupId>
<artifactId>matrix-sample-mybatis-biz</artifactId>
</dependency>
<dependency>
<groupId>com.secoo.mall</groupId>
<artifactId>matrix-mybatis-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
</dependency>
<!--接入日志组件-->
<dependency>
<groupId>com.secoo.mall</groupId>
<artifactId>logger-starter</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.secoo.mall.mybatis;
public class MybatisSampleApplication {
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.secoo.mall.common.core.bean.ReqPage;
import com.secoo.mall.mybatis.bean.entity.User;
import com.secoo.mall.mybatis.bean.entity.UserProjectRelation;
import com.secoo.mall.mybatis.bean.vo.UserProjectRelationVo;
import com.secoo.mall.mybatis.dao.mapper.UserMapper;
import com.secoo.mall.mybatis.dao.mapper.UserProjectRelationMapper;
import com.secoo.mall.mybatis.util.PageUtil;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import javax.annotation.Resource;
/**
* @Description: 支持特性:
* <p>1.控制台直接打印sql</p>
* <p>2.分页封装</p>
* <p>3.关联表查询</p>
* @Author: liqiuwei
* @UpdateUser: liqiuwei
* @Param:
* @Return:
* @CreateDate: 2020/4/7 10:45
* @UpdateDate: 2020/4/7 10:45
* @version: 1.0
* @status: done
*/
@SpringBootApplication
//@MapperScan("com.secoo.mall.mybatis.dao.mapper")
public class MybatisSampleApplication implements ApplicationRunner {
@Resource
private UserMapper userMapper;
@Resource
private UserProjectRelationMapper userProjectRelationMapper;
public static void main(String[] args) {
new SpringApplicationBuilder(MybatisSampleApplication.class)
.run(args);
}
@Override
public void run(ApplicationArguments args) throws Exception {
// testGetByEmail("liqiuwei@secoo.com");
//测试查询分页
UserProjectRelationVo vo=new UserProjectRelationVo();
vo.setUserName("liqiuwei");
testSearch(1262L,vo,new ReqPage(0L,10L));
// testSave();
}
/**
* @Description: 按照固定条件查询,如邮箱
* @Author: liqiuwei
* @UpdateUser: liqiuwei
* @Param: [email] 邮箱
* @Return: {@link User}
* @CreateDate: 2020/4/7 10:15
* @UpdateDate: 2020/4/7 10:15
* @version: 1.0
* @status: done
*/
public User testGetByEmail(String email) {
User u1 = userMapper.getByEmail(email);
System.out.println(u1);
return u1;
}
/**
* @Description: 按照id进行查询
* @Author: liqiuwei
* @UpdateUser: liqiuwei
* @Param: [id]
* @Return: com.secoo.mall.mybatis.bean.entity.User
* @CreateDate: 2020/4/7 10:40
* @UpdateDate: 2020/4/7 10:40
* @version: 1.0
* @status: done
*/
public User testGetById(Long id) {
User u1 = userMapper.selectById(id);
System.out.println(u1);
return u1;
}
/***
* @Description:
* @Author: liqiuwei
* @UpdateUser: liqiuwei
* @Param: [id, reqPage] reqPage 为controller层传输参数
* @Return: com.secoo.mall.mybatis.bean.entity.User
* @CreateDate: 2020/4/7 11:31
* @UpdateDate: 2020/4/7 11:31
* @version: 1.0
* @status: done
*/
public IPage testSearch(Long id, UserProjectRelationVo userProjectRelationVo, ReqPage reqPage) {
Page<UserProjectRelationVo> page = PageUtil.createPage(reqPage);
IPage<UserProjectRelationVo> pageData = userProjectRelationMapper.searchByProjectId(page, id, userProjectRelationVo);
System.out.println(pageData.getRecords().size());
return pageData;
}
/**
* @Description: 保存数据.由于属性createTime使用@TableField(fill = FieldFill.INSERT),框架通过拦截器自动进行赋值
* @Author: liqiuwei
* @UpdateUser: liqiuwei
* @Param: []
* @Return: com.secoo.mall.mybatis.bean.entity.UserProjectRelation
* @CreateDate: 2020/4/8 9:56
* @UpdateDate: 2020/4/8 9:56
* @version: 1.0
* @status: done
*/
public UserProjectRelation testSave() {
UserProjectRelation relation = new UserProjectRelation();
relation.setProjectId(1261L);
relation.setUserId(1L);
userProjectRelationMapper.insert(relation);
return relation;
}
}
s
\ No newline at end of file
spring:
application:
name: appms
profiles:
active: dev
......@@ -5,11 +5,26 @@
<parent>
<artifactId>matrix-sample</artifactId>
<groupId>com.secoo.mall</groupId>
<version>2.0.1.RELEASE</version>
<version>2.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>matrix-sample-mybaties</artifactId>
<artifactId>matrix-sample-mybatis</artifactId>
<packaging>pom</packaging>
<modules>
<module>matrix-sample-mybatis-spring</module>
<module>matrix-sample-mybatis-springboot</module>
<module>matrix-sample-mybatis-biz</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.secoo.mall</groupId>
<artifactId>matrix-sample-mybatis-biz</artifactId>
<version>2.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
\ No newline at end of file
......@@ -5,7 +5,7 @@
<parent>
<artifactId>matrix-sample-redis</artifactId>
<groupId>com.secoo.mall</groupId>
<version>1.3.2.RELEASE</version>
<version>2.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......@@ -16,16 +16,8 @@
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<groupId>com.secoo.mall</groupId>
<artifactId>common-util</artifactId>
</dependency>
</dependencies>
......
......@@ -34,7 +34,7 @@ public class Person {
* 部门名称
*/
// private String deptName;
private String deptName;
/**
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>matrix-sample-redis</artifactId>
<groupId>com.secoo.mall</groupId>
<version>1.3.2.RELEASE</version>
<version>2.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>matrix-sample-redis</artifactId>
<groupId>com.secoo.mall</groupId>
<version>1.3.2.RELEASE</version>
<version>2.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......@@ -18,7 +18,6 @@
<dependency>
<groupId>com.secoo.mall</groupId>
<artifactId>matrix-datahelper-redis-starter</artifactId>
<version>2.0.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
......
......@@ -7,4 +7,4 @@ spring:
redis:
custom:
host: localhost
port: 6379
\ No newline at end of file
port: 6379
......@@ -5,7 +5,7 @@
<parent>
<artifactId>matrix-sample</artifactId>
<groupId>com.secoo.mall</groupId>
<version>1.3.2.RELEASE</version>
<version>2.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......@@ -21,7 +21,7 @@
<dependency>
<groupId>com.secoo.mall</groupId>
<artifactId>matrix-sample-redis-biz</artifactId>
<version>1.3.2.RELEASE</version>
<version>2.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>matrix-sample-rocketmq</artifactId>
<groupId>com.secoo.mall</groupId>
<version>1.3.2.RELEASE</version>
<version>2.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>matrix-sample-rocketmq</artifactId>
<groupId>com.secoo.mall</groupId>
<version>1.3.2.RELEASE</version>
<version>2.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......@@ -20,16 +20,6 @@
<artifactId>matrix-sample-rocketmq-biz</artifactId>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>biz.paluch.redis</groupId>
<artifactId>lettuce</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>matrix-sample-rocketmq</artifactId>
<groupId>com.secoo.mall</groupId>
<version>1.3.2.RELEASE</version>
<version>2.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>matrix-sample</artifactId>
<groupId>com.secoo.mall</groupId>
<version>1.3.2.RELEASE</version>
<version>2.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......@@ -21,7 +21,7 @@
<dependency>
<groupId>com.secoo.mall</groupId>
<artifactId>matrix-sample-rocketmq-biz</artifactId>
<version>1.3.2.RELEASE</version>
<version>2.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</dependencyManagement>
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>matrix-sample-xxl</artifactId>
<groupId>com.secoo.mall</groupId>
<version>1.3.2.RELEASE</version>
<version>2.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>matrix-sample-xxl</artifactId>
<groupId>com.secoo.mall</groupId>
<version>1.3.2.RELEASE</version>
<version>2.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>matrix-sample-xxl</artifactId>
<groupId>com.secoo.mall</groupId>
<version>1.3.2.RELEASE</version>
<version>2.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>matrix-sample</artifactId>
<groupId>com.secoo.mall</groupId>
<version>1.3.2.RELEASE</version>
<version>2.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......@@ -21,7 +21,7 @@
<dependency>
<groupId>com.secoo.mall</groupId>
<artifactId>matrix-sample-xxl-biz</artifactId>
<version>1.3.2.RELEASE</version>
<version>2.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</dependencyManagement>
......
......@@ -8,18 +8,18 @@
<parent>
<groupId>com.secoo.mall</groupId>
<artifactId>matrix</artifactId>
<version>1.3.2.RELEASE</version>
<version>2.0.1-SNAPSHOT</version>
</parent>
<artifactId>matrix-sample</artifactId>
<version>2.0.1-SNAPSHOT</version>
<modules>
<module>matrix-sample-xxl</module>
<module>matrix-sample-dubbo</module>
<module>matrix-sample-hbase</module>
<module>matrix-sample-rocketmq</module>
<module>matrix-sample-redis</module>
<module>matrix-sample-mybatis</module>
</modules>
</project>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment