批量操作备注
parent
df720853c2
commit
c5d7b88f5b
@ -0,0 +1,53 @@
|
||||
package com.flossom.common.core.domain.req;
|
||||
|
||||
import com.flossom.common.core.web.domain.BaseEntity;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 微信用户备注列对象 wx_user_remark
|
||||
*
|
||||
* @author flossom
|
||||
* @date 2023-12-21
|
||||
*/
|
||||
public class WxUserRemarkReq {
|
||||
|
||||
/**
|
||||
* 微信用户id列表
|
||||
*/
|
||||
private List<Long> userIdList;
|
||||
|
||||
/**
|
||||
* 备注内容
|
||||
*/
|
||||
@NotBlank(message = "请输入备注")
|
||||
@Length(min = 0, max = 100, message = "备注内容不能为空")
|
||||
private String content;
|
||||
|
||||
|
||||
public WxUserRemarkReq() {
|
||||
}
|
||||
|
||||
public WxUserRemarkReq(List<Long> userIdList, String content) {
|
||||
this.userIdList = userIdList;
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public List<Long> getUserIdList() {
|
||||
return userIdList;
|
||||
}
|
||||
|
||||
public void setUserIdList(List<Long> userIdList) {
|
||||
this.userIdList = userIdList;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
package com.flossom.common.core.mapper;
|
||||
|
||||
import com.flossom.common.core.domain.entity.WxUserRemark;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 微信用户备注列Mapper接口
|
||||
*
|
||||
* @author flossom
|
||||
* @date 2023-12-21
|
||||
*/
|
||||
public interface WxUserRemarkMapper {
|
||||
/**
|
||||
* 查询微信用户备注列
|
||||
*
|
||||
* @param id 微信用户备注列主键
|
||||
* @return 微信用户备注列
|
||||
*/
|
||||
public WxUserRemark selectWxUserRemarkById(Long id);
|
||||
|
||||
/**
|
||||
* 查询微信用户备注列列表
|
||||
*
|
||||
* @param wxUserRemark 微信用户备注列
|
||||
* @return 微信用户备注列集合
|
||||
*/
|
||||
public List<WxUserRemark> selectWxUserRemarkList(WxUserRemark wxUserRemark);
|
||||
|
||||
/**
|
||||
* 新增微信用户备注列
|
||||
*
|
||||
* @param wxUserRemark 微信用户备注列
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertWxUserRemark(WxUserRemark wxUserRemark);
|
||||
|
||||
/**
|
||||
* 修改微信用户备注列
|
||||
*
|
||||
* @param wxUserRemark 微信用户备注列
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateWxUserRemark(WxUserRemark wxUserRemark);
|
||||
|
||||
/**
|
||||
* 删除微信用户备注列
|
||||
*
|
||||
* @param id 微信用户备注列主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWxUserRemarkById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除微信用户备注列
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWxUserRemarkByIds(Long[] ids);
|
||||
}
|
||||
@ -0,0 +1,82 @@
|
||||
<?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.flossom.common.core.mapper.WxUserRemarkMapper">
|
||||
|
||||
<resultMap type="WxUserRemark" id="WxUserRemarkResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="content" column="content" />
|
||||
<result property="status" column="status" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectWxUserRemarkVo">
|
||||
select id, user_id, content, status, create_by, create_time, update_by, update_time from wx_user_remark
|
||||
</sql>
|
||||
|
||||
<select id="selectWxUserRemarkList" parameterType="WxUserRemark" resultMap="WxUserRemarkResult">
|
||||
<include refid="selectWxUserRemarkVo"/>
|
||||
<where>
|
||||
<if test="userId != null "> and user_id = #{userId}</if>
|
||||
<if test="content != null and content != ''"> and content = #{content}</if>
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectWxUserRemarkById" parameterType="Long" resultMap="WxUserRemarkResult">
|
||||
<include refid="selectWxUserRemarkVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertWxUserRemark" parameterType="WxUserRemark" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into wx_user_remark
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="content != ''">content,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="content != ''">#{content},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateWxUserRemark" parameterType="WxUserRemark">
|
||||
update wx_user_remark
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="userId != null">user_id = #{userId},</if>
|
||||
<if test="content != null">content = #{content},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteWxUserRemarkById" parameterType="Long">
|
||||
delete from wx_user_remark where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteWxUserRemarkByIds" parameterType="String">
|
||||
delete from wx_user_remark where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@ -0,0 +1,107 @@
|
||||
package com.flossom.system.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.flossom.common.core.domain.R;
|
||||
import com.flossom.common.core.domain.entity.WxUserRemark;
|
||||
import com.flossom.common.core.domain.req.WxUserIntegralVm;
|
||||
import com.flossom.common.core.domain.req.WxUserRemarkReq;
|
||||
import com.flossom.common.core.enums.IntegralChangeTypeEnum;
|
||||
import com.flossom.common.core.exception.ServiceException;
|
||||
import com.flossom.common.core.utils.poi.ExcelUtil;
|
||||
import com.flossom.common.core.web.controller.BaseController;
|
||||
import com.flossom.common.core.web.domain.AjaxResult;
|
||||
import com.flossom.common.core.web.page.TableDataInfo;
|
||||
import com.flossom.common.log.annotation.Log;
|
||||
import com.flossom.common.log.enums.BusinessType;
|
||||
import com.flossom.common.security.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.flossom.system.service.IWxUserRemarkService;
|
||||
|
||||
/**
|
||||
* 微信用户备注列Controller
|
||||
*
|
||||
* @author flossom
|
||||
* @date 2023-12-21
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/wxUserRemark")
|
||||
public class WxUserRemarkController extends BaseController {
|
||||
@Autowired
|
||||
private IWxUserRemarkService wxUserRemarkService;
|
||||
|
||||
/**
|
||||
* 查询微信用户备注列列表
|
||||
*/
|
||||
@RequiresPermissions("system:wxUserRemark:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(WxUserRemark wxUserRemark) {
|
||||
startPage();
|
||||
List<WxUserRemark> list = wxUserRemarkService.selectWxUserRemarkList(wxUserRemark);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出微信用户备注列列表
|
||||
*/
|
||||
@RequiresPermissions("system:wxUserRemark:export")
|
||||
@Log(title = "微信用户备注列", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, WxUserRemark wxUserRemark) {
|
||||
List<WxUserRemark> list = wxUserRemarkService.selectWxUserRemarkList(wxUserRemark);
|
||||
ExcelUtil<WxUserRemark> util = new ExcelUtil<WxUserRemark>(WxUserRemark.class);
|
||||
util.exportExcel(response, list, "微信用户备注列数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取微信用户备注列详细信息
|
||||
*/
|
||||
@RequiresPermissions("system:wxUserRemark:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return success(wxUserRemarkService.selectWxUserRemarkById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增微信用户备注列
|
||||
*/
|
||||
@RequiresPermissions("system:wxUserRemark:add")
|
||||
@Log(title = "微信用户备注列", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody WxUserRemark wxUserRemark) {
|
||||
return toAjax(wxUserRemarkService.insertWxUserRemark(wxUserRemark));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改微信用户备注列
|
||||
*/
|
||||
@RequiresPermissions("system:wxUserRemark:edit")
|
||||
@Log(title = "微信用户备注列", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody WxUserRemark wxUserRemark) {
|
||||
return toAjax(wxUserRemarkService.updateWxUserRemark(wxUserRemark));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除微信用户备注列
|
||||
*/
|
||||
@RequiresPermissions("system:wxUserRemark:remove")
|
||||
@Log(title = "微信用户备注列", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(wxUserRemarkService.deleteWxUserRemarkByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量 添加备注
|
||||
*/
|
||||
@PostMapping("/batchAddRemark")
|
||||
public R batchAddRemark(@RequestBody @Validated WxUserRemarkReq wxUserRemarkReq) {
|
||||
wxUserRemarkService.batchAddRemark(wxUserRemarkReq);
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,64 @@
|
||||
package com.flossom.system.service;
|
||||
|
||||
import com.flossom.common.core.domain.entity.WxUserRemark;
|
||||
import com.flossom.common.core.domain.req.WxUserRemarkReq;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 微信用户备注列Service接口
|
||||
*
|
||||
* @author flossom
|
||||
* @date 2023-12-21
|
||||
*/
|
||||
public interface IWxUserRemarkService {
|
||||
/**
|
||||
* 查询微信用户备注列
|
||||
*
|
||||
* @param id 微信用户备注列主键
|
||||
* @return 微信用户备注列
|
||||
*/
|
||||
public WxUserRemark selectWxUserRemarkById(Long id);
|
||||
|
||||
/**
|
||||
* 查询微信用户备注列列表
|
||||
*
|
||||
* @param wxUserRemark 微信用户备注列
|
||||
* @return 微信用户备注列集合
|
||||
*/
|
||||
public List<WxUserRemark> selectWxUserRemarkList(WxUserRemark wxUserRemark);
|
||||
|
||||
/**
|
||||
* 新增微信用户备注列
|
||||
*
|
||||
* @param wxUserRemark 微信用户备注列
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertWxUserRemark(WxUserRemark wxUserRemark);
|
||||
|
||||
/**
|
||||
* 修改微信用户备注列
|
||||
*
|
||||
* @param wxUserRemark 微信用户备注列
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateWxUserRemark(WxUserRemark wxUserRemark);
|
||||
|
||||
/**
|
||||
* 批量删除微信用户备注列
|
||||
*
|
||||
* @param ids 需要删除的微信用户备注列主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWxUserRemarkByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除微信用户备注列信息
|
||||
*
|
||||
* @param id 微信用户备注列主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWxUserRemarkById(Long id);
|
||||
|
||||
void batchAddRemark(WxUserRemarkReq wxUserRemarkReq);
|
||||
}
|
||||
@ -0,0 +1,122 @@
|
||||
package com.flossom.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.flossom.common.core.domain.entity.WxUserRemark;
|
||||
import com.flossom.common.core.domain.req.WxUserRemarkReq;
|
||||
import com.flossom.common.core.enums.Status;
|
||||
import com.flossom.common.core.mapper.WxUserMemberMapper;
|
||||
import com.flossom.common.core.mapper.WxUserRemarkMapper;
|
||||
import com.flossom.common.core.utils.DateUtils;
|
||||
import com.flossom.common.security.utils.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.flossom.system.service.IWxUserRemarkService;
|
||||
|
||||
/**
|
||||
* 微信用户备注列Service业务层处理
|
||||
*
|
||||
* @author flossom
|
||||
* @date 2023-12-21
|
||||
*/
|
||||
@Service
|
||||
public class WxUserRemarkServiceImpl implements IWxUserRemarkService {
|
||||
|
||||
@Autowired
|
||||
private WxUserRemarkMapper wxUserRemarkMapper;
|
||||
|
||||
@Autowired
|
||||
private WxUserMemberMapper wxUserMemberMapper;
|
||||
|
||||
/**
|
||||
* 查询微信用户备注列
|
||||
*
|
||||
* @param id 微信用户备注列主键
|
||||
* @return 微信用户备注列
|
||||
*/
|
||||
@Override
|
||||
public WxUserRemark selectWxUserRemarkById(Long id) {
|
||||
return wxUserRemarkMapper.selectWxUserRemarkById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询微信用户备注列列表
|
||||
*
|
||||
* @param wxUserRemark 微信用户备注列
|
||||
* @return 微信用户备注列
|
||||
*/
|
||||
@Override
|
||||
public List<WxUserRemark> selectWxUserRemarkList(WxUserRemark wxUserRemark) {
|
||||
return wxUserRemarkMapper.selectWxUserRemarkList(wxUserRemark);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增微信用户备注列
|
||||
*
|
||||
* @param wxUserRemark 微信用户备注列
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertWxUserRemark(WxUserRemark wxUserRemark) {
|
||||
wxUserRemark.setCreateTime(DateUtils.getNowDate());
|
||||
return wxUserRemarkMapper.insertWxUserRemark(wxUserRemark);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改微信用户备注列
|
||||
*
|
||||
* @param wxUserRemark 微信用户备注列
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateWxUserRemark(WxUserRemark wxUserRemark) {
|
||||
wxUserRemark.setUpdateTime(DateUtils.getNowDate());
|
||||
return wxUserRemarkMapper.updateWxUserRemark(wxUserRemark);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除微信用户备注列
|
||||
*
|
||||
* @param ids 需要删除的微信用户备注列主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteWxUserRemarkByIds(Long[] ids) {
|
||||
return wxUserRemarkMapper.deleteWxUserRemarkByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除微信用户备注列信息
|
||||
*
|
||||
* @param id 微信用户备注列主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteWxUserRemarkById(Long id) {
|
||||
return wxUserRemarkMapper.deleteWxUserRemarkById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchAddRemark(WxUserRemarkReq wxUserRemarkReq) {
|
||||
if (wxUserRemarkReq.getUserIdList() == null || wxUserRemarkReq.getUserIdList().size() == 0) {
|
||||
List<Integer> userIdList = wxUserMemberMapper.selectWxUserMemberIdList();
|
||||
if (userIdList != null && userIdList.size() > 0) {
|
||||
List<Long> collect = userIdList.stream().map(Integer::longValue).collect(Collectors.toList());
|
||||
wxUserRemarkReq.setUserIdList(collect);
|
||||
}
|
||||
}
|
||||
|
||||
if (wxUserRemarkReq.getUserIdList() != null && wxUserRemarkReq.getUserIdList().size() > 0) {
|
||||
WxUserRemark wxUserRemark = new WxUserRemark();
|
||||
for (Long userId : wxUserRemarkReq.getUserIdList()) {
|
||||
wxUserRemark.setUserId(userId);
|
||||
wxUserRemark.setContent(wxUserRemarkReq.getContent());
|
||||
wxUserRemark.setStatus(Status.OK.getCode());
|
||||
wxUserRemark.setCreateTime(DateUtils.getNowDate());
|
||||
// wxUserRemark.setCreateBy(SecurityUtils.getUsername());
|
||||
wxUserRemarkMapper.insertWxUserRemark(wxUserRemark);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue