也可以创建玩了后在pom.xml中配置,本人习惯用pom—
选择项目本地保存路径,然后 Finish
这是我以前的demo加载的,也可以自己去依赖仓库中找你需要的依赖
阿里云镜像仓库地址:https://maven.aliyun.com/mvn/search
<!--类注解-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--zxing二维码-->
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
<version>3.3.0</version>
</dependency>
<!--hutool图片-->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.4.4</version>
</dependency>
<!-- freemarker模板引擎视图 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-freemarker</artifactId>
</dependency>
<!-- 热部署,不用重启 ,这个在这里不需要-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<!-- jsp解析器 -->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<!--myBatisPlus-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>2.3</version>
</dependency>
<!--授权中心-->
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.6.0</version>
</dependency>
<!--lists-->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>20.0</version>
</dependency>
<!--集成redis-->
<!--springboot中的redis依赖-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<!-- lettuce pool 缓存连接池-->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
</dependency>
<!-- 自定义验证注解 -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<!--常用工具类 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<!--引入poi导入导出-->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>4.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.1.0</version>
</dependency>
<!-- swagger注解-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.7.0</version>
</dependency>
先找到本地maven仓库
设置settings.xml 没有就创建这个文件 下载依赖包就优先从阿里云下载
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<!-- Apache Maven 配置 -->
<pluginGroups/>
<proxies/>
<!-- 阿里云镜像 https://maven.aliyun.com/repository/public/-->
<mirrors>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<!-- 配置: java8, 先从阿里云下载, 没有再去私服下载 -->
<!-- 20190929 hepengju 测试结果: 影响下载顺序的是profiles标签的配置顺序(后面配置的ali仓库先下载), 而不是activeProfiles的顺序 -->
<profiles>
<!-- 全局JDK1.8配置 -->
<profile>
<id>jdk1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>
<!-- 阿里云配置: 提高国内的jar包下载速度 -->
<profile>
<id>ali</id>
<repositories>
<repository>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<!-- 激活配置 -->
<activeProfiles>
<activeProfile>jdk1.8</activeProfile>
<activeProfile>dev</activeProfile>
<activeProfile>ali</activeProfile>
</activeProfiles>
</settings>
找到resources文件下的 application 配置文件 修改为 application.yml
我这里配置了本地的数据库连接配置、redis连接配置、mybatis-plus配置
#端口
server:
port: 9999
spring :
#数据库
datasource:
url: jdbc:mysql://localhost:3306/zhaomaolin?serverTimezone=UTC&useunicode=true&characterEncoding=utf8
username: root
password: root
driver-class-name: com.mysql.cj.jdbc.Driver
#redis配置
redis:
#Redis服务器连接地址
host: 127.0.0.1
#Redis服务器连接端口
port: 6379
#Redis服务器连接密码(默认为空)
password:
jedis:
pool:
#连接池最大连接数(使用负值表示没有限制)
max-active: 8
#连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1
#连接池中的最大空闲连接
max-idle: 8
#连接池中的最小空闲连接
min-idle: 0
#连接超时时间(毫秒)
timeout: 30000
#持久层框架配置
mybatis-plus:
global-config:
db-config:
id-type: auto
field-strategy: not_empty
#驼峰下划线转换
column-underline: true
#逻辑删除配置
logic-delete-value: 0
logic-not-delete-value: 1
db-type: mysql
refresh: false
configuration:
map-underscore-to-camel-case: true
cache-enabled: false
mapper-locations: classpath:mapper/**/*Mapper.xml
import com.baomidou.mybatisplus.plugins.PaginationInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;
/**
* 分页配置类
* @author zhaomaolin
*/
@EnableTransactionManagement
@Configuration
public class MybatisPlusConfig {
@Bean
public PaginationInterceptor paginationInterceptor() {
return new PaginationInterceptor();
}
}
创建用户表
CREATE TABLE `zhao_user` (
`user_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`user_name` varchar(36) NOT NULL COMMENT '名字',
`user_nice` varchar(36) DEFAULT NULL COMMENT '昵称',
`user_phone` varchar(11) NOT NULL COMMENT '电话',
`user_password` varchar(64) NOT NULL COMMENT '密码',
`user_account` varchar(36) NOT NULL COMMENT '登录账号',
`user_gender` varchar(3) DEFAULT NULL COMMENT '性别',
`remark` varchar(255) DEFAULT NULL COMMENT '备注',
`is_active` tinyint(4) DEFAULT '1' COMMENT '是否启用 0禁用,1启用',
`is_delete` tinyint(4) DEFAULT '1' COMMENT '是否删除 0删除,1正常',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`create_person_id` int(11) DEFAULT NULL COMMENT '创建者id',
`update_time` datetime DEFAULT NULL COMMENT '修改时间',
`update_person_id` int(11) DEFAULT NULL COMMENT '修改者id',
`delete_time` datetime DEFAULT NULL COMMENT '删除时间',
`delete_person_id` int(11) DEFAULT NULL COMMENT '删除者id',
PRIMARY KEY (`user_id`) USING BTREE,
UNIQUE KEY `account` (`user_account`) USING HASH COMMENT '唯一登录账号'
) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COMMENT='用户表';
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
/**
* Entity基类配置
*
* @author zhaomaolin
*/
@Data
public class BaseEntityConfig implements Serializable {
private static final long serialVersionUID = 1L;
//是否删除
private Boolean isDelete;
//是否启用
private Boolean isActive;
//备注
private String remark;
//创建时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
//创建者id
private Integer createPersonId;
//更新时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
//更新者id
private Integer updatePersonId;
//删除时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date deleteTime;
//删除者
private Integer deletePersonId;
//请求参数
private Map<String, Object> params;
public Map<String, Object> getParams() {
if (params == null) {
params = new HashMap<>();
}
return params;
}
public void setParams(Map<String, Object> params) {
this.params = params;
}
}
创建实体类
import com.zp.vip.centre.config.BaseEntityConfig;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
@Data
public class ZhaoUser extends BaseEntityConfig{
/*主键*/
@ApiModelProperty(value = "主键" )
private Integer userId;
/*名字*/
@NotNull(message = "参数名字不能为空")
@ApiModelProperty(value = "名字" )
private String userName;
/*昵称*/
@ApiModelProperty(value = "昵称" )
private String userNice;
/*电话*/
@ApiModelProperty(value = "电话" )
private String userPhone;
/*密码*/
@ApiModelProperty(value = "密码" )
private String userPassword;
/*登录账号*/
@ApiModelProperty(value = "登录账号" )
private String userAccount;
/*性别*/
@ApiModelProperty(value = "性别" )
private String userGender;
}
创建接收类和返回类
import lombok.Data;
@Data
public class ZhaoUserDTO extends ZhaoUser{
}
import lombok.Data;
@Data
public class ZhaoUserVO extends ZhaoUser{
}
创建控制器
import com.baomidou.mybatisplus.plugins.Page;
import com.zp.vip.centre.domain.dto.PostIds;
import com.zp.vip.centre.domain.vo.BaseResponse;
import com.zp.vip.extend.entity.zhao.user.ZhaoUser;
import com.zp.vip.extend.entity.zhao.user.ZhaoUserDTO;
import com.zp.vip.extend.entity.zhao.user.ZhaoUserVO;
import com.zp.vip.extend.service.zhao.user.IZhaoUserService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.util.List;
/**
* 用户
* @author zhaomaolin
*/
//@Controller
@RestController//(前后端分离使用)
@RequestMapping("/user")
public class ZhaoUserController {
@Resource
private IZhaoUserService zhaoUserService;
/**
* 用户详情
* @param zhaoUser
* @return
*/
@GetMapping("/info")
public BaseResponse info(ZhaoUserDTO zhaoUser) {
ZhaoUser info = zhaoUserService.selectInfo(zhaoUser);
return BaseResponse.success(info);
}
/**
* 用户列表
* @param page
* @param zhaoUser
* @return
*/
@GetMapping("/list")
public Page<ZhaoUser> list(Page page,ZhaoUserDTO zhaoUser) {
Page<ZhaoUser> list = zhaoUserService.selectUserPage(page,zhaoUser);
return list;
}
/**
* 添加用户
* @param zhaoUser
* @return
*/
@PostMapping("/add")
public BaseResponse add(@Validated @RequestBody ZhaoUser zhaoUser) {
boolean res = zhaoUserService.addUser(zhaoUser);
return BaseResponse.success(res);
}
/**
* 修改用户
* @param zhaoUser
* @return
*/
@PostMapping("/edit")
public BaseResponse edit(@RequestBody ZhaoUserDTO zhaoUser) {
boolean res = zhaoUserService.editUserById(zhaoUser);
return BaseResponse.success(res);
}
/**
* 删除用户
* @param zhaoUser
* @return
*/
@PostMapping("/del")
public BaseResponse del(@RequestBody ZhaoUserDTO zhaoUser) {
try{
zhaoUserService.delUserById(zhaoUser);
}catch (Exception e){
return BaseResponse.error(e.getMessage());
}
return BaseResponse.success();
}
/**
* 批量删除用户
* @param ids
* @return
*/
@PostMapping("/deletes")
public BaseResponse deletes(@RequestBody PostIds ids) {
int res = 0;
try{
res = zhaoUserService.delUserByIds(ids.getIds());
}catch (Exception e){
return BaseResponse.error(e.getMessage());
}
return BaseResponse.success(res);
}
/**
* 启用禁用
* @param zhaoUser
* @return
*/
@PostMapping("/active")
public BaseResponse active(@RequestBody ZhaoUserDTO zhaoUser) {
boolean res = zhaoUserService.activeUserByIds(zhaoUser);
return BaseResponse.success(res);
}
}
创建业务逻辑层接口类
import com.baomidou.mybatisplus.plugins.Page;
import com.zp.vip.extend.entity.zhao.user.ZhaoUser;
import com.zp.vip.extend.entity.zhao.user.ZhaoUserDTO;
import com.zp.vip.extend.entity.zhao.user.ZhaoUserVO;
import java.util.List;
public interface IZhaoUserService {
//详情
ZhaoUserVO selectInfo(ZhaoUserDTO zhaoUser);
//列表
Page<ZhaoUserVO> selectUserPage(Page<ZhaoUserVO> page, ZhaoUserDTO zhaoUser);
//添加
boolean addUser(ZhaoUser zhaoUser);
//修改
boolean editUserById(ZhaoUserDTO zhaoUser);
//删除
boolean delUserById(ZhaoUserDTO zhaoUser)throws Exception;
//批量删除用户
int delUserByIds(List<Integer> ids)throws Exception;
//启用禁用
boolean activeUserByIds(ZhaoUserDTO zhaoUser);
}
创建业务逻辑层实现类
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.google.common.base.Joiner;
import com.zp.vip.extend.entity.zhao.user.ZhaoUser;
import com.zp.vip.centre.util.ZStringUtil;
import com.zp.vip.extend.entity.zhao.user.ZhaoUserDTO;
import com.zp.vip.extend.entity.zhao.user.ZhaoUserVO;
import org.springframework.stereotype.Service;
import java.util.List;
import static com.zp.vip.centre.domain.vo.ExceptionMsg.PARAMETER_ERROR;
@Service
public class ZhaoUserServiceImpl extends ServiceImpl<ZhaoUserMapper, ZhaoUser> implements IZhaoUserService{
//详情
@Override
public ZhaoUserVO selectInfo(ZhaoUserDTO zhaoUser) {
ZhaoUserVO user = baseMapper.selectPrimaryInfo(zhaoUser.getUserId());
return user;
}
//列表
@Override
public Page<ZhaoUserVO> selectUserPage(Page<ZhaoUserVO> page, ZhaoUserDTO zhaoUser) {
List<ZhaoUserVO> list = baseMapper.selectPrimaryList(page,zhaoUser);
page.setRecords(list);
return page;
}
//添加
@Override
public boolean addUser(ZhaoUser zhaoUser) {
//分配登录账号
zhaoUser.setUserAccount(ZStringUtil.getStr());
//创建
if(baseMapper.addPrimary(zhaoUser)==1){
return true;
}
return false;
}
//修改
@Override
public boolean editUserById(ZhaoUserDTO zhaoUser) {
//修改
if(baseMapper.editPrimaryById(zhaoUser)==1){
return true;
}
return false;
}
//删除
@Override
public boolean delUserById(ZhaoUserDTO zhaoUser) throws Exception {
//删除
if(baseMapper.delPrimaryById(zhaoUser)==1){
return true;
}
return false;
}
//批量删除用户
@Override
public int delUserByIds(List<Integer> ids) throws Exception{
if(ids==null || ids.size()<=0){
throw new Exception(PARAMETER_ERROR);
}
//数组转 字符串 - 由id 拼接起来的 (遍历拼接)
String realIds= Joiner.on(",").join(ids);
//删除
return baseMapper.delPrimaryByIds(realIds,0);
}
//启用禁用
@Override
public boolean activeUserByIds(ZhaoUserDTO zhaoUser) {
//启用禁用
if(baseMapper.activePrimaryByIds(zhaoUser)==1){
return true;
}
return false;
}
}
创建mybatis映射接口类
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
import com.zp.vip.extend.entity.zhao.user.ZhaoUser;
import com.zp.vip.extend.entity.zhao.user.ZhaoUserDTO;
import com.zp.vip.extend.entity.zhao.user.ZhaoUserVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface ZhaoUserMapper extends BaseMapper<ZhaoUser> {
//详情
ZhaoUserVO selectPrimaryInfo(Integer userId);
//列表
List<ZhaoUserVO> selectPrimaryList(Pagination page, ZhaoUser primary);
//添加
int addPrimary(ZhaoUser primary);
//修改
int editPrimaryById(ZhaoUserDTO primary);
//删除
int delPrimaryById(ZhaoUserDTO primary);
//批量删除
int delPrimaryByIds(@Param("ids") String ids,@Param("userId")Integer userId);
//启用禁用
int activePrimaryByIds(ZhaoUserDTO primary);
}
创建映射文件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.zp.vip.extend.service.zhao.user.ZhaoUserMapper" >
<resultMap id="BaseResultMap" type="com.zp.vip.extend.entity.zhao.user.ZhaoUserVO" >
<id column="user_id" property="userId" jdbcType="INTEGER" />
<result column="user_name" property="userName" jdbcType="VARCHAR" />
<result column="user_nice" property="userNice" jdbcType="VARCHAR" />
<result column="user_phone" property="userPhone" jdbcType="VARCHAR" />
<result column="user_password" property="userPassword" jdbcType="VARCHAR" />
<result column="user_account" property="userAccount" jdbcType="VARCHAR" />
<result column="user_gender" property="userGender" jdbcType="VARCHAR" />
<!--通用-->
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="create_person_id" property="createPersonId" jdbcType="INTEGER"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
<result column="update_person_id" property="updatePersonId" jdbcType="INTEGER"/>
<result column="delete_time" property="deleteTime" jdbcType="TIMESTAMP"/>
<result column="delete_person_id" property="deletePersonId" jdbcType="INTEGER"/>
<result column="is_delete" property="isDelete" jdbcType="BIT"/>
<result column="is_active" property="isActive" jdbcType="BIT"/>
<result column="remark" property="remark" jdbcType="VARCHAR"/>
<!--扩展-->
</resultMap>
<sql id="Select_Sql" >
select zu.user_id,zu.user_name,zu.user_nice,zu.user_phone,zu.user_password,zu.user_account,zu.user_gender,
zu.create_time,zu.create_person_id,zu.update_time,zu.update_person_id,zu.delete_time,zu.delete_person_id,
zu.is_delete,zu.is_active,zu.remark
from zhao_user as zu
</sql>
<!--详情-->
<select id="selectPrimaryInfo" resultMap="BaseResultMap" parameterType="java.lang.Integer">
select zu.user_id,zu.user_name,zu.user_nice,zu.user_phone,zu.user_password,zu.user_account,zu.user_gender,
zu.create_time,zu.create_person_id,zu.update_time,zu.update_person_id,zu.delete_time,zu.delete_person_id,
zu.is_delete,zu.is_active,zu.remark
from zhao_user as zu
where zu.is_delete = 1 and zu.user_id = #{userId,jdbcType=INTEGER}
</select>
<!--列表-->
<select id="selectPrimaryList" resultMap="BaseResultMap" parameterType="com.zp.vip.extend.entity.zhao.user.ZhaoUserDTO">
select zu.user_id,zu.user_name,zu.user_nice,zu.user_phone,zu.user_password,zu.user_account,zu.user_gender,
zu.create_time,zu.create_person_id,zu.update_time,zu.update_person_id,zu.delete_time,zu.delete_person_id,
zu.is_delete,zu.is_active,zu.remark
from zhao_user as zu
where zu.is_delete = 1
order by zu.create_time desc
</select>
<!--添加-->
<insert id="addPrimary" parameterType="com.zp.vip.extend.entity.zhao.user.ZhaoUser">
insert into zhao_user
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="userName != null and userName != ''" >user_name,</if>
<if test="userNice != null and userNice != ''" >user_nice,</if>
<if test="userPhone != null and userPhone != ''" >user_phone,</if>
<if test="userPassword != null and userPassword != ''" >user_password,</if>
<if test="userAccount != null and userAccount != ''" >user_account,</if>
<if test="userGender != null and userGender != ''" >user_gender,</if>
<if test="createPersonId != null" >create_person_id,</if>
<if test="remark != null" >remark,</if>
create_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="userName != null and userName !=''" >#{userName},
<if test="userNice != null and userNice !=''" >#{userNice},
<if test="userPhone != null and userPhone !=''" >#{userPhone},
<if test="userPassword != null and userPassword !=''" >#{userPassword},
<if test="userAccount != null and userAccount !=''" >#{userAccount},
<if test="userGender != null and userGender !=''" >#{userGender},
<if test="createPersonId != null" >#{createPersonId},
<if test="remark != null" >#{remark,jdbcType=VARCHAR},
now()
</trim>
</insert>
<!--修改-->
<update id="editPrimaryById" parameterType="com.zp.vip.extend.entity.zhao.user.ZhaoUserDTO">
update zhao_user
set update_time = now()
<if test="userName != null and userName !=''" >,user_name=#{userName}
<if test="userNice != null and userNice !=''" >,user_nice=#{userNice}
<if test="userPhone != null and userPhone !=''" >,user_phone=#{userPhone}
<if test="userPassword != null and userPassword !=''" >,user_password=#{userPassword}
<if test="userGender != null and userGender !=''" >,user_gender=#{userGender}update_person_id
<if test="updatePersonId != null" >,update_person_id=#{updatePersonId}
<if test="remark != null" >remark = #{remark,jdbcType=VARCHAR},
where user_id=#{userId}
</update>
<!--删除-->
<update id="delPrimaryById" parameterType="com.zp.vip.extend.entity.zhao.user.ZhaoUserDTO">
update zhao_user
set is_delete = 0,delete_time = now()
<if test="deletePersonId != null">,delete_person_id=#{deletePersonId}
where user_id = #{userId}
</update>
<!--批量删除-->
<update id="delPrimaryByIds" >
update zhao_user
set is_delete = 0,delete_time = now()
<if test="userId != null">,delete_person_id=#{userId}
where user_id in (${ids}) and is_delete = 0
</update>
<!--启用禁用-->
<update id="activePrimaryByIds" parameterType="com.zp.vip.extend.entity.zhao.user.ZhaoUserDTO">
update zhao_user
set is_active = #{isActive}
where user_id=#{userId}
</update>
</mapper>