Commit fe12b7e2 by HaoN

上传客户相关接口

1 parent 96f1adc5
package com.linkwechat.web.controller.wecom;
import java.util.List;
import com.linkwechat.common.annotation.Log;
import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.common.utils.poi.ExcelUtil;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.linkwechat.wecom.domain.WeCustomer;
import com.linkwechat.wecom.service.IWeCustomerService;
/**
* 企业微信客户Controller
*
* @author ruoyi
* @date 2020-09-13
*/
@RestController
@RequestMapping("/wecom/customer")
public class WeCustomerController extends BaseController
{
@Autowired
private IWeCustomerService weCustomerService;
/**
* 查询企业微信客户列表
*/
@PreAuthorize("@ss.hasPermi('wecom:customer:list')")
@GetMapping("/list")
public TableDataInfo list(WeCustomer weCustomer)
{
startPage();
List<WeCustomer> list = weCustomerService.selectWeCustomerList(weCustomer);
return getDataTable(list);
}
/**
* 导出企业微信客户列表
*/
@PreAuthorize("@ss.hasPermi('wecom:customer:export')")
@Log(title = "企业微信客户", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(WeCustomer weCustomer)
{
List<WeCustomer> list = weCustomerService.selectWeCustomerList(weCustomer);
ExcelUtil<WeCustomer> util = new ExcelUtil<WeCustomer>(WeCustomer.class);
return util.exportExcel(list, "customer");
}
/**
* 获取企业微信客户详细信息
*/
@PreAuthorize("@ss.hasPermi('wecom:customer:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(weCustomerService.selectWeCustomerById(id));
}
/**
* 新增企业微信客户
*/
@PreAuthorize("@ss.hasPermi('wecom:customer:add')")
@Log(title = "企业微信客户", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WeCustomer weCustomer)
{
return toAjax(weCustomerService.insertWeCustomer(weCustomer));
}
/**
* 修改企业微信客户
*/
@PreAuthorize("@ss.hasPermi('wecom:customer:edit')")
@Log(title = "企业微信客户", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WeCustomer weCustomer)
{
return toAjax(weCustomerService.updateWeCustomer(weCustomer));
}
/**
* 删除企业微信客户
*/
@PreAuthorize("@ss.hasPermi('wecom:customer:remove')")
@Log(title = "企业微信客户", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(weCustomerService.deleteWeCustomerByIds(ids));
}
}
package com.linkwechat.wecom.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.linkwechat.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 企业微信客户对象 we_customer
*
* @author ruoyi
* @date 2020-09-13
*/
public class WeCustomer extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 外部联系人的userid */
private String externalUserid;
/** 外部联系人名称 */
private String name;
/** 外部联系人头像 */
private String avatar;
/** 外部联系人的类型,1表示该外部联系人是微信用户,2表示该外部联系人是企业微信用户 */
private Long type;
/** 外部联系人性别 0-未知 1-男性 2-女性 */
private Long gender;
/** 外部联系人在微信开放平台的唯一身份标识,通过此字段企业可将外部联系人与公众号/小程序用户关联起来。 */
private String unionid;
/** 生日 */
@JsonFormat(pattern = "yyyy-MM-dd")
private Date birthday;
/** 添加人员id */
private String userId;
/** 添加人员名称 */
private String userName;
/** 所在部门名称 */
private String departmentName;
/** 描述 */
private String description;
/** 客户备注的手机号码 */
private String remarkMobiles;
/** 客户备注的企业名称 */
private String remarkCorpName;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setExternalUserid(String externalUserid)
{
this.externalUserid = externalUserid;
}
public String getExternalUserid()
{
return externalUserid;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setAvatar(String avatar)
{
this.avatar = avatar;
}
public String getAvatar()
{
return avatar;
}
public void setType(Long type)
{
this.type = type;
}
public Long getType()
{
return type;
}
public void setGender(Long gender)
{
this.gender = gender;
}
public Long getGender()
{
return gender;
}
public void setUnionid(String unionid)
{
this.unionid = unionid;
}
public String getUnionid()
{
return unionid;
}
public void setBirthday(Date birthday)
{
this.birthday = birthday;
}
public Date getBirthday()
{
return birthday;
}
public void setUserId(String userId)
{
this.userId = userId;
}
public String getUserId()
{
return userId;
}
public void setUserName(String userName)
{
this.userName = userName;
}
public String getUserName()
{
return userName;
}
public void setDepartmentName(String departmentName)
{
this.departmentName = departmentName;
}
public String getDepartmentName()
{
return departmentName;
}
public void setDescription(String description)
{
this.description = description;
}
public String getDescription()
{
return description;
}
public void setRemarkMobiles(String remarkMobiles)
{
this.remarkMobiles = remarkMobiles;
}
public String getRemarkMobiles()
{
return remarkMobiles;
}
public void setRemarkCorpName(String remarkCorpName)
{
this.remarkCorpName = remarkCorpName;
}
public String getRemarkCorpName()
{
return remarkCorpName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("externalUserid", getExternalUserid())
.append("name", getName())
.append("avatar", getAvatar())
.append("type", getType())
.append("gender", getGender())
.append("unionid", getUnionid())
.append("birthday", getBirthday())
.append("userId", getUserId())
.append("userName", getUserName())
.append("createTime", getCreateTime())
.append("departmentName", getDepartmentName())
.append("description", getDescription())
.append("remarkMobiles", getRemarkMobiles())
.append("remarkCorpName", getRemarkCorpName())
.toString();
}
}
package com.linkwechat.wecom.domain;
import com.linkwechat.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 客户标签关系对象 we_customer_tag_rel
*
* @author ruoyi
* @date 2020-09-13
*/
public class WeCustomerTagRel extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 客户id */
private Long customerId;
/** 标签id */
private Long tagId;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setCustomerId(Long customerId)
{
this.customerId = customerId;
}
public Long getCustomerId()
{
return customerId;
}
public void setTagId(Long tagId)
{
this.tagId = tagId;
}
public Long getTagId()
{
return tagId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("customerId", getCustomerId())
.append("tagId", getTagId())
.append("createTime", getCreateTime())
.toString();
}
}
package com.linkwechat.wecom.mapper;
import java.util.List;
import com.linkwechat.wecom.domain.WeCustomer;
/**
* 企业微信客户Mapper接口
*
* @author ruoyi
* @date 2020-09-13
*/
public interface WeCustomerMapper
{
/**
* 查询企业微信客户
*
* @param id 企业微信客户ID
* @return 企业微信客户
*/
public WeCustomer selectWeCustomerById(Long id);
/**
* 查询企业微信客户列表
*
* @param weCustomer 企业微信客户
* @return 企业微信客户集合
*/
public List<WeCustomer> selectWeCustomerList(WeCustomer weCustomer);
/**
* 新增企业微信客户
*
* @param weCustomer 企业微信客户
* @return 结果
*/
public int insertWeCustomer(WeCustomer weCustomer);
/**
* 修改企业微信客户
*
* @param weCustomer 企业微信客户
* @return 结果
*/
public int updateWeCustomer(WeCustomer weCustomer);
/**
* 删除企业微信客户
*
* @param id 企业微信客户ID
* @return 结果
*/
public int deleteWeCustomerById(Long id);
/**
* 批量删除企业微信客户
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteWeCustomerByIds(Long[] ids);
}
package com.linkwechat.wecom.mapper;
import java.util.List;
import com.linkwechat.wecom.domain.WeCustomerTagRel;
/**
* 客户标签关系Mapper接口
*
* @author ruoyi
* @date 2020-09-13
*/
public interface WeCustomerTagRelMapper
{
/**
* 查询客户标签关系
*
* @param id 客户标签关系ID
* @return 客户标签关系
*/
public WeCustomerTagRel selectWeCustomerTagRelById(Long id);
/**
* 查询客户标签关系列表
*
* @param weCustomerTagRel 客户标签关系
* @return 客户标签关系集合
*/
public List<WeCustomerTagRel> selectWeCustomerTagRelList(WeCustomerTagRel weCustomerTagRel);
/**
* 新增客户标签关系
*
* @param weCustomerTagRel 客户标签关系
* @return 结果
*/
public int insertWeCustomerTagRel(WeCustomerTagRel weCustomerTagRel);
/**
* 修改客户标签关系
*
* @param weCustomerTagRel 客户标签关系
* @return 结果
*/
public int updateWeCustomerTagRel(WeCustomerTagRel weCustomerTagRel);
/**
* 删除客户标签关系
*
* @param id 客户标签关系ID
* @return 结果
*/
public int deleteWeCustomerTagRelById(Long id);
/**
* 批量删除客户标签关系
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteWeCustomerTagRelByIds(Long[] ids);
}
package com.linkwechat.wecom.service;
import java.util.List;
import com.linkwechat.wecom.domain.WeCustomer;
/**
* 企业微信客户Service接口
*
* @author ruoyi
* @date 2020-09-13
*/
public interface IWeCustomerService
{
/**
* 查询企业微信客户
*
* @param id 企业微信客户ID
* @return 企业微信客户
*/
public WeCustomer selectWeCustomerById(Long id);
/**
* 查询企业微信客户列表
*
* @param weCustomer 企业微信客户
* @return 企业微信客户集合
*/
public List<WeCustomer> selectWeCustomerList(WeCustomer weCustomer);
/**
* 新增企业微信客户
*
* @param weCustomer 企业微信客户
* @return 结果
*/
public int insertWeCustomer(WeCustomer weCustomer);
/**
* 修改企业微信客户
*
* @param weCustomer 企业微信客户
* @return 结果
*/
public int updateWeCustomer(WeCustomer weCustomer);
/**
* 批量删除企业微信客户
*
* @param ids 需要删除的企业微信客户ID
* @return 结果
*/
public int deleteWeCustomerByIds(Long[] ids);
/**
* 删除企业微信客户信息
*
* @param id 企业微信客户ID
* @return 结果
*/
public int deleteWeCustomerById(Long id);
}
package com.linkwechat.wecom.service;
import java.util.List;
import com.linkwechat.wecom.domain.WeCustomerTagRel;
/**
* 客户标签关系Service接口
*
* @author ruoyi
* @date 2020-09-13
*/
public interface IWeCustomerTagRelService
{
/**
* 查询客户标签关系
*
* @param id 客户标签关系ID
* @return 客户标签关系
*/
public WeCustomerTagRel selectWeCustomerTagRelById(Long id);
/**
* 查询客户标签关系列表
*
* @param weCustomerTagRel 客户标签关系
* @return 客户标签关系集合
*/
public List<WeCustomerTagRel> selectWeCustomerTagRelList(WeCustomerTagRel weCustomerTagRel);
/**
* 新增客户标签关系
*
* @param weCustomerTagRel 客户标签关系
* @return 结果
*/
public int insertWeCustomerTagRel(WeCustomerTagRel weCustomerTagRel);
/**
* 修改客户标签关系
*
* @param weCustomerTagRel 客户标签关系
* @return 结果
*/
public int updateWeCustomerTagRel(WeCustomerTagRel weCustomerTagRel);
/**
* 批量删除客户标签关系
*
* @param ids 需要删除的客户标签关系ID
* @return 结果
*/
public int deleteWeCustomerTagRelByIds(Long[] ids);
/**
* 删除客户标签关系信息
*
* @param id 客户标签关系ID
* @return 结果
*/
public int deleteWeCustomerTagRelById(Long id);
}
package com.linkwechat.wecom.service.impl;
import java.util.List;
import com.linkwechat.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.linkwechat.wecom.mapper.WeCustomerMapper;
import com.linkwechat.wecom.domain.WeCustomer;
import com.linkwechat.wecom.service.IWeCustomerService;
/**
* 企业微信客户Service业务层处理
*
* @author ruoyi
* @date 2020-09-13
*/
@Service
public class WeCustomerServiceImpl implements IWeCustomerService
{
@Autowired
private WeCustomerMapper weCustomerMapper;
/**
* 查询企业微信客户
*
* @param id 企业微信客户ID
* @return 企业微信客户
*/
@Override
public WeCustomer selectWeCustomerById(Long id)
{
return weCustomerMapper.selectWeCustomerById(id);
}
/**
* 查询企业微信客户列表
*
* @param weCustomer 企业微信客户
* @return 企业微信客户
*/
@Override
public List<WeCustomer> selectWeCustomerList(WeCustomer weCustomer)
{
return weCustomerMapper.selectWeCustomerList(weCustomer);
}
/**
* 新增企业微信客户
*
* @param weCustomer 企业微信客户
* @return 结果
*/
@Override
public int insertWeCustomer(WeCustomer weCustomer)
{
weCustomer.setCreateTime(DateUtils.getNowDate());
return weCustomerMapper.insertWeCustomer(weCustomer);
}
/**
* 修改企业微信客户
*
* @param weCustomer 企业微信客户
* @return 结果
*/
@Override
public int updateWeCustomer(WeCustomer weCustomer)
{
return weCustomerMapper.updateWeCustomer(weCustomer);
}
/**
* 批量删除企业微信客户
*
* @param ids 需要删除的企业微信客户ID
* @return 结果
*/
@Override
public int deleteWeCustomerByIds(Long[] ids)
{
return weCustomerMapper.deleteWeCustomerByIds(ids);
}
/**
* 删除企业微信客户信息
*
* @param id 企业微信客户ID
* @return 结果
*/
@Override
public int deleteWeCustomerById(Long id)
{
return weCustomerMapper.deleteWeCustomerById(id);
}
}
package com.linkwechat.wecom.service.impl;
import java.util.List;
import com.linkwechat.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.linkwechat.wecom.mapper.WeCustomerTagRelMapper;
import com.linkwechat.wecom.domain.WeCustomerTagRel;
import com.linkwechat.wecom.service.IWeCustomerTagRelService;
/**
* 客户标签关系Service业务层处理
*
* @author ruoyi
* @date 2020-09-13
*/
@Service
public class WeCustomerTagRelServiceImpl implements IWeCustomerTagRelService
{
@Autowired
private WeCustomerTagRelMapper weCustomerTagRelMapper;
/**
* 查询客户标签关系
*
* @param id 客户标签关系ID
* @return 客户标签关系
*/
@Override
public WeCustomerTagRel selectWeCustomerTagRelById(Long id)
{
return weCustomerTagRelMapper.selectWeCustomerTagRelById(id);
}
/**
* 查询客户标签关系列表
*
* @param weCustomerTagRel 客户标签关系
* @return 客户标签关系
*/
@Override
public List<WeCustomerTagRel> selectWeCustomerTagRelList(WeCustomerTagRel weCustomerTagRel)
{
return weCustomerTagRelMapper.selectWeCustomerTagRelList(weCustomerTagRel);
}
/**
* 新增客户标签关系
*
* @param weCustomerTagRel 客户标签关系
* @return 结果
*/
@Override
public int insertWeCustomerTagRel(WeCustomerTagRel weCustomerTagRel)
{
weCustomerTagRel.setCreateTime(DateUtils.getNowDate());
return weCustomerTagRelMapper.insertWeCustomerTagRel(weCustomerTagRel);
}
/**
* 修改客户标签关系
*
* @param weCustomerTagRel 客户标签关系
* @return 结果
*/
@Override
public int updateWeCustomerTagRel(WeCustomerTagRel weCustomerTagRel)
{
return weCustomerTagRelMapper.updateWeCustomerTagRel(weCustomerTagRel);
}
/**
* 批量删除客户标签关系
*
* @param ids 需要删除的客户标签关系ID
* @return 结果
*/
@Override
public int deleteWeCustomerTagRelByIds(Long[] ids)
{
return weCustomerTagRelMapper.deleteWeCustomerTagRelByIds(ids);
}
/**
* 删除客户标签关系信息
*
* @param id 客户标签关系ID
* @return 结果
*/
@Override
public int deleteWeCustomerTagRelById(Long id)
{
return weCustomerTagRelMapper.deleteWeCustomerTagRelById(id);
}
}
<?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.linkwechat.wecom.mapper.WeCustomerMapper">
<resultMap type="WeCustomer" id="WeCustomerResult">
<result property="id" column="id" />
<result property="externalUserid" column="external_userid" />
<result property="name" column="name" />
<result property="avatar" column="avatar" />
<result property="type" column="type" />
<result property="gender" column="gender" />
<result property="unionid" column="unionid" />
<result property="birthday" column="birthday" />
<result property="userId" column="user_id" />
<result property="userName" column="user_name" />
<result property="createTime" column="create_time" />
<result property="departmentName" column="department_name" />
<result property="description" column="description" />
<result property="remarkMobiles" column="remark_mobiles" />
<result property="remarkCorpName" column="remark_corp_name" />
</resultMap>
<sql id="selectWeCustomerVo">
select id, external_userid, name, avatar, type, gender, unionid, birthday, user_id, user_name, create_time, department_name, description, remark_mobiles, remark_corp_name from we_customer
</sql>
<select id="selectWeCustomerList" parameterType="WeCustomer" resultMap="WeCustomerResult">
<include refid="selectWeCustomerVo"/>
<where>
<if test="externalUserid != null and externalUserid != ''"> and external_userid = #{externalUserid}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="avatar != null and avatar != ''"> and avatar = #{avatar}</if>
<if test="type != null "> and type = #{type}</if>
<if test="gender != null "> and gender = #{gender}</if>
<if test="unionid != null and unionid != ''"> and unionid = #{unionid}</if>
<if test="birthday != null "> and birthday = #{birthday}</if>
<if test="userId != null and userId != ''"> and user_id = #{userId}</if>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
<if test="departmentName != null and departmentName != ''"> and department_name like concat('%', #{departmentName}, '%')</if>
<if test="description != null and description != ''"> and description = #{description}</if>
<if test="remarkMobiles != null and remarkMobiles != ''"> and remark_mobiles = #{remarkMobiles}</if>
<if test="remarkCorpName != null and remarkCorpName != ''"> and remark_corp_name like concat('%', #{remarkCorpName}, '%')</if>
</where>
</select>
<select id="selectWeCustomerById" parameterType="Long" resultMap="WeCustomerResult">
<include refid="selectWeCustomerVo"/>
where id = #{id}
</select>
<insert id="insertWeCustomer" parameterType="WeCustomer">
insert into we_customer
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="externalUserid != null">external_userid,</if>
<if test="name != null">name,</if>
<if test="avatar != null">avatar,</if>
<if test="type != null">type,</if>
<if test="gender != null">gender,</if>
<if test="unionid != null">unionid,</if>
<if test="birthday != null">birthday,</if>
<if test="userId != null">user_id,</if>
<if test="userName != null">user_name,</if>
<if test="createTime != null">create_time,</if>
<if test="departmentName != null">department_name,</if>
<if test="description != null">description,</if>
<if test="remarkMobiles != null">remark_mobiles,</if>
<if test="remarkCorpName != null">remark_corp_name,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="externalUserid != null">#{externalUserid},</if>
<if test="name != null">#{name},</if>
<if test="avatar != null">#{avatar},</if>
<if test="type != null">#{type},</if>
<if test="gender != null">#{gender},</if>
<if test="unionid != null">#{unionid},</if>
<if test="birthday != null">#{birthday},</if>
<if test="userId != null">#{userId},</if>
<if test="userName != null">#{userName},</if>
<if test="createTime != null">#{createTime},</if>
<if test="departmentName != null">#{departmentName},</if>
<if test="description != null">#{description},</if>
<if test="remarkMobiles != null">#{remarkMobiles},</if>
<if test="remarkCorpName != null">#{remarkCorpName},</if>
</trim>
</insert>
<update id="updateWeCustomer" parameterType="WeCustomer">
update we_customer
<trim prefix="SET" suffixOverrides=",">
<if test="externalUserid != null">external_userid = #{externalUserid},</if>
<if test="name != null">name = #{name},</if>
<if test="avatar != null">avatar = #{avatar},</if>
<if test="type != null">type = #{type},</if>
<if test="gender != null">gender = #{gender},</if>
<if test="unionid != null">unionid = #{unionid},</if>
<if test="birthday != null">birthday = #{birthday},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="userName != null">user_name = #{userName},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="departmentName != null">department_name = #{departmentName},</if>
<if test="description != null">description = #{description},</if>
<if test="remarkMobiles != null">remark_mobiles = #{remarkMobiles},</if>
<if test="remarkCorpName != null">remark_corp_name = #{remarkCorpName},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteWeCustomerById" parameterType="Long">
delete from we_customer where id = #{id}
</delete>
<delete id="deleteWeCustomerByIds" parameterType="String">
delete from we_customer where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ 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.linkwechat.wecom.mapper.WeCustomerTagRelMapper">
<resultMap type="WeCustomerTagRel" id="WeCustomerTagRelResult">
<result property="id" column="id" />
<result property="customerId" column="customer_id" />
<result property="tagId" column="tag_id" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectWeCustomerTagRelVo">
select id, customer_id, tag_id, create_time from we_customer_tag_rel
</sql>
<select id="selectWeCustomerTagRelList" parameterType="WeCustomerTagRel" resultMap="WeCustomerTagRelResult">
<include refid="selectWeCustomerTagRelVo"/>
<where>
<if test="customerId != null "> and customer_id = #{customerId}</if>
<if test="tagId != null "> and tag_id = #{tagId}</if>
</where>
</select>
<select id="selectWeCustomerTagRelById" parameterType="Long" resultMap="WeCustomerTagRelResult">
<include refid="selectWeCustomerTagRelVo"/>
where id = #{id}
</select>
<insert id="insertWeCustomerTagRel" parameterType="WeCustomerTagRel">
insert into we_customer_tag_rel
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="customerId != null">customer_id,</if>
<if test="tagId != null">tag_id,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="customerId != null">#{customerId},</if>
<if test="tagId != null">#{tagId},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateWeCustomerTagRel" parameterType="WeCustomerTagRel">
update we_customer_tag_rel
<trim prefix="SET" suffixOverrides=",">
<if test="customerId != null">customer_id = #{customerId},</if>
<if test="tagId != null">tag_id = #{tagId},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteWeCustomerTagRelById" parameterType="Long">
delete from we_customer_tag_rel where id = #{id}
</delete>
<delete id="deleteWeCustomerTagRelByIds" parameterType="String">
delete from we_customer_tag_rel where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!