Commit a175510d by jinxin

许可账号续期成员表增删查改

parent 1f94a2db
package com.gic.haoban.manage.service.dao.mapper;
import com.gic.haoban.manage.service.entity.TabHaobanRenewalUser;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.List;
/**
* (TabHaobanRenewalUser)表数据库访问层
*
* @author makejava
* @since 2023-06-08 15:11:49
*/
public interface TabHaobanRenewalUserDao {
/**
* 通过ID查询单条数据
*
* @param renewalId 主键
* @return 实例对象
*/
TabHaobanRenewalUser queryById(Long renewalId);
/**
* 查询指定行数据
*
* @param tabHaobanRenewalUser 查询条件
* @param pageable 分页对象
* @return 对象列表
*/
List<TabHaobanRenewalUser> queryAllByLimit(TabHaobanRenewalUser tabHaobanRenewalUser, @Param("pageable") Pageable pageable);
/**
* 统计总行数
*
* @param tabHaobanRenewalUser 查询条件
* @return 总行数
*/
long count(TabHaobanRenewalUser tabHaobanRenewalUser);
/**
* 新增数据
*
* @param tabHaobanRenewalUser 实例对象
* @return 影响行数
*/
int insert(TabHaobanRenewalUser tabHaobanRenewalUser);
/**
* 批量新增数据(MyBatis原生foreach方法)
*
* @param entities List<TabHaobanRenewalUser> 实例对象列表
* @return 影响行数
*/
int insertBatch(@Param("entities") List<TabHaobanRenewalUser> entities);
/**
* 批量新增或按主键更新数据(MyBatis原生foreach方法)
*
* @param entities List<TabHaobanRenewalUser> 实例对象列表
* @return 影响行数
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
*/
int insertOrUpdateBatch(@Param("entities") List<TabHaobanRenewalUser> entities);
/**
* 修改数据
*
* @param tabHaobanRenewalUser 实例对象
* @return 影响行数
*/
int update(TabHaobanRenewalUser tabHaobanRenewalUser);
/**
* 通过主键删除数据
*
* @param renewalId 主键
* @return 影响行数
*/
int deleteById(Long renewalId);
}
package com.gic.haoban.manage.service.entity;
import java.util.Date;
import java.io.Serializable;
/**
* (TabHaobanRenewalUser)实体类
*
* @author makejava
* @since 2023-06-08 15:11:49
*/
public class TabHaobanRenewalUser implements Serializable {
private static final long serialVersionUID = -16922328852683963L;
/**
* id
*/
private Long renewalId;
/**
* wx企业Id
*/
private String wxEnterpriseId;
/**
* 微信userId
*/
private String wxUserId;
/**
* 订单id
*/
private Long orderId;
/**
* 电话
*/
private String phone;
/**
* 名称
*/
private String name;
/**
* 职位
*/
private String postion;
/**
* 续期是否合法 0 否 1是
*/
private Integer invalidFlag;
/**
* 不合法错误码
*/
private String invalidCode;
/**
* 不合法错误描述
*/
private String invalidMsg;
/**
* 更新时间
*/
private Date updateTime;
/**
* 创建时间
*/
private Date createTime;
/**
* 逻辑删除,0未删除,1删除
*/
private Integer deleteFlag;
public Long getRenewalId() {
return renewalId;
}
public void setRenewalId(Long renewalId) {
this.renewalId = renewalId;
}
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public String getWxUserId() {
return wxUserId;
}
public void setWxUserId(String wxUserId) {
this.wxUserId = wxUserId;
}
public Long getOrderId() {
return orderId;
}
public void setOrderId(Long orderId) {
this.orderId = orderId;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPostion() {
return postion;
}
public void setPostion(String postion) {
this.postion = postion;
}
public Integer getInvalidFlag() {
return invalidFlag;
}
public void setInvalidFlag(Integer invalidFlag) {
this.invalidFlag = invalidFlag;
}
public String getInvalidCode() {
return invalidCode;
}
public void setInvalidCode(String invalidCode) {
this.invalidCode = invalidCode;
}
public String getInvalidMsg() {
return invalidMsg;
}
public void setInvalidMsg(String invalidMsg) {
this.invalidMsg = invalidMsg;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Integer getDeleteFlag() {
return deleteFlag;
}
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
}
package com.gic.haoban.manage.service.service;
import com.gic.haoban.manage.service.entity.TabHaobanRenewalUser;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
/**
* (TabHaobanRenewalUser)表服务接口
*
* @author makejava
* @since 2023-06-08 15:11:49
*/
public interface TabHaobanRenewalUserService {
/**
* 通过ID查询单条数据
*
* @param renewalId 主键
* @return 实例对象
*/
TabHaobanRenewalUser queryById(Long renewalId);
/**
* 分页查询
*
* @param tabHaobanRenewalUser 筛选条件
* @param pageRequest 分页对象
* @return 查询结果
*/
Page<TabHaobanRenewalUser> queryByPage(TabHaobanRenewalUser tabHaobanRenewalUser, PageRequest pageRequest);
/**
* 新增数据
*
* @param tabHaobanRenewalUser 实例对象
* @return 实例对象
*/
TabHaobanRenewalUser insert(TabHaobanRenewalUser tabHaobanRenewalUser);
/**
* 修改数据
*
* @param tabHaobanRenewalUser 实例对象
* @return 实例对象
*/
TabHaobanRenewalUser update(TabHaobanRenewalUser tabHaobanRenewalUser);
/**
* 通过主键删除数据
*
* @param renewalId 主键
* @return 是否成功
*/
boolean deleteById(Long renewalId);
}
package com.gic.haoban.manage.service.service.impl;
import com.gic.haoban.manage.service.entity.TabHaobanRenewalUser;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanRenewalUserDao;
import com.gic.haoban.manage.service.service.TabHaobanRenewalUserService;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import javax.annotation.Resource;
/**
* (TabHaobanRenewalUser)表服务实现类
*
* @author makejava
* @since 2023-06-08 15:11:49
*/
@Service("tabHaobanRenewalUserService")
public class TabHaobanRenewalUserServiceImpl implements TabHaobanRenewalUserService {
@Resource
private TabHaobanRenewalUserDao tabHaobanRenewalUserDao;
/**
* 通过ID查询单条数据
*
* @param renewalId 主键
* @return 实例对象
*/
@Override
public TabHaobanRenewalUser queryById(Long renewalId) {
return this.tabHaobanRenewalUserDao.queryById(renewalId);
}
/**
* 分页查询
*
* @param tabHaobanRenewalUser 筛选条件
* @param pageRequest 分页对象
* @return 查询结果
*/
@Override
public Page<TabHaobanRenewalUser> queryByPage(TabHaobanRenewalUser tabHaobanRenewalUser, PageRequest pageRequest) {
long total = this.tabHaobanRenewalUserDao.count(tabHaobanRenewalUser);
return new PageImpl<>(this.tabHaobanRenewalUserDao.queryAllByLimit(tabHaobanRenewalUser, pageRequest), pageRequest, total);
}
/**
* 新增数据
*
* @param tabHaobanRenewalUser 实例对象
* @return 实例对象
*/
@Override
public TabHaobanRenewalUser insert(TabHaobanRenewalUser tabHaobanRenewalUser) {
this.tabHaobanRenewalUserDao.insert(tabHaobanRenewalUser);
return tabHaobanRenewalUser;
}
/**
* 修改数据
*
* @param tabHaobanRenewalUser 实例对象
* @return 实例对象
*/
@Override
public TabHaobanRenewalUser update(TabHaobanRenewalUser tabHaobanRenewalUser) {
this.tabHaobanRenewalUserDao.update(tabHaobanRenewalUser);
return this.queryById(tabHaobanRenewalUser.getRenewalId());
}
/**
* 通过主键删除数据
*
* @param renewalId 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Long renewalId) {
return this.tabHaobanRenewalUserDao.deleteById(renewalId) > 0;
}
}
<?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.gic.haoban.manage.service.dao.mapper.TabHaobanRenewalUserDao">
<resultMap type="com.gic.haoban.manage.service.entity.TabHaobanRenewalUser" id="TabHaobanRenewalUserMap">
<result property="renewalId" column="renewal_id" jdbcType="INTEGER"/>
<result property="wxEnterpriseId" column="wx_enterprise_id" jdbcType="VARCHAR"/>
<result property="wxUserId" column="wx_user_id" jdbcType="VARCHAR"/>
<result property="orderId" column="order_id" jdbcType="INTEGER"/>
<result property="phone" column="phone" jdbcType="VARCHAR"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="postion" column="postion" jdbcType="VARCHAR"/>
<result property="invalidFlag" column="invalid_flag" jdbcType="INTEGER"/>
<result property="invalidCode" column="invalid_code" jdbcType="VARCHAR"/>
<result property="invalidMsg" column="invalid_msg" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="deleteFlag" column="delete_flag" jdbcType="INTEGER"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="TabHaobanRenewalUserMap">
select
renewal_id, wx_enterprise_id, wx_user_id, order_id, phone, name, postion, invalid_flag, invalid_code, invalid_msg, update_time, create_time, delete_flag
from tab_haoban_renewal_user
where renewal_id = #{renewalId}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="TabHaobanRenewalUserMap">
select
renewal_id, wx_enterprise_id, wx_user_id, order_id, phone, name, postion, invalid_flag, invalid_code, invalid_msg, update_time, create_time, delete_flag
from tab_haoban_renewal_user
<where>
<if test="renewalId != null">
and renewal_id = #{renewalId}
</if>
<if test="wxEnterpriseId != null and wxEnterpriseId != ''">
and wx_enterprise_id = #{wxEnterpriseId}
</if>
<if test="wxUserId != null and wxUserId != ''">
and wx_user_id = #{wxUserId}
</if>
<if test="orderId != null">
and order_id = #{orderId}
</if>
<if test="phone != null and phone != ''">
and phone = #{phone}
</if>
<if test="name != null and name != ''">
and name = #{name}
</if>
<if test="postion != null and postion != ''">
and postion = #{postion}
</if>
<if test="invalidFlag != null">
and invalid_flag = #{invalidFlag}
</if>
<if test="invalidCode != null and invalidCode != ''">
and invalid_code = #{invalidCode}
</if>
<if test="invalidMsg != null and invalidMsg != ''">
and invalid_msg = #{invalidMsg}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
<if test="deleteFlag != null">
and delete_flag = #{deleteFlag}
</if>
</where>
limit #{pageable.offset}, #{pageable.pageSize}
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from tab_haoban_renewal_user
<where>
<if test="renewalId != null">
and renewal_id = #{renewalId}
</if>
<if test="wxEnterpriseId != null and wxEnterpriseId != ''">
and wx_enterprise_id = #{wxEnterpriseId}
</if>
<if test="wxUserId != null and wxUserId != ''">
and wx_user_id = #{wxUserId}
</if>
<if test="orderId != null">
and order_id = #{orderId}
</if>
<if test="phone != null and phone != ''">
and phone = #{phone}
</if>
<if test="name != null and name != ''">
and name = #{name}
</if>
<if test="postion != null and postion != ''">
and postion = #{postion}
</if>
<if test="invalidFlag != null">
and invalid_flag = #{invalidFlag}
</if>
<if test="invalidCode != null and invalidCode != ''">
and invalid_code = #{invalidCode}
</if>
<if test="invalidMsg != null and invalidMsg != ''">
and invalid_msg = #{invalidMsg}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
<if test="deleteFlag != null">
and delete_flag = #{deleteFlag}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="renewalId" useGeneratedKeys="true">
insert into tab_haoban_renewal_user(wx_enterprise_id, wx_user_id, order_id, phone, name, postion, invalid_flag, invalid_code, invalid_msg, update_time, create_time, delete_flag)
values (#{wxEnterpriseId}, #{wxUserId}, #{orderId}, #{phone}, #{name}, #{postion}, #{invalidFlag}, #{invalidCode}, #{invalidMsg}, #{updateTime}, #{createTime}, #{deleteFlag})
</insert>
<insert id="insertBatch" keyProperty="renewalId" useGeneratedKeys="true">
insert into tab_haoban_renewal_user(wx_enterprise_id, wx_user_id, order_id, phone, name, postion, invalid_flag, invalid_code, invalid_msg, update_time, create_time, delete_flag)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.wxEnterpriseId}, #{entity.wxUserId}, #{entity.orderId}, #{entity.phone}, #{entity.name}, #{entity.postion}, #{entity.invalidFlag}, #{entity.invalidCode}, #{entity.invalidMsg}, #{entity.updateTime}, #{entity.createTime}, #{entity.deleteFlag})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="renewalId" useGeneratedKeys="true">
insert into tab_haoban_renewal_user(wx_enterprise_id, wx_user_id, order_id, phone, name, postion, invalid_flag, invalid_code, invalid_msg, update_time, create_time, delete_flag)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.wxEnterpriseId}, #{entity.wxUserId}, #{entity.orderId}, #{entity.phone}, #{entity.name}, #{entity.postion}, #{entity.invalidFlag}, #{entity.invalidCode}, #{entity.invalidMsg}, #{entity.updateTime}, #{entity.createTime}, #{entity.deleteFlag})
</foreach>
on duplicate key update
wx_enterprise_id = values(wx_enterprise_id),
wx_user_id = values(wx_user_id),
order_id = values(order_id),
phone = values(phone),
name = values(name),
postion = values(postion),
invalid_flag = values(invalid_flag),
invalid_code = values(invalid_code),
invalid_msg = values(invalid_msg),
update_time = values(update_time),
create_time = values(create_time),
delete_flag = values(delete_flag)
</insert>
<!--通过主键修改数据-->
<update id="update">
update tab_haoban_renewal_user
<set>
<if test="wxEnterpriseId != null and wxEnterpriseId != ''">
wx_enterprise_id = #{wxEnterpriseId},
</if>
<if test="wxUserId != null and wxUserId != ''">
wx_user_id = #{wxUserId},
</if>
<if test="orderId != null">
order_id = #{orderId},
</if>
<if test="phone != null and phone != ''">
phone = #{phone},
</if>
<if test="name != null and name != ''">
name = #{name},
</if>
<if test="postion != null and postion != ''">
postion = #{postion},
</if>
<if test="invalidFlag != null">
invalid_flag = #{invalidFlag},
</if>
<if test="invalidCode != null and invalidCode != ''">
invalid_code = #{invalidCode},
</if>
<if test="invalidMsg != null and invalidMsg != ''">
invalid_msg = #{invalidMsg},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="deleteFlag != null">
delete_flag = #{deleteFlag},
</if>
</set>
where renewal_id = #{renewalId}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from tab_haoban_renewal_user where renewal_id = #{renewalId}
</delete>
</mapper>
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