企业用户管理

This commit is contained in:
st 2024-02-25 11:16:55 +08:00
parent 2be79492c5
commit 93dc71cded
6 changed files with 480 additions and 0 deletions

View File

@ -0,0 +1,82 @@
package com.ics.admin.controller;
import com.ics.admin.domain.IcsCustomerStaff;
import com.ics.admin.service.IIcsCustomerStaffService;
import com.ics.common.constant.Constants;
import com.ics.common.core.controller.BaseController;
import com.ics.common.core.domain.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.wf.jwtp.annotation.RequiresPermissions;
import java.util.Date;
/**
* 企业员工 提供者
*
* @author ics
* @date 2024-02-19
*/
@RestController
@RequestMapping("/admin/staff")
public class IcsCustomerStaffController extends BaseController {
private final static String ACCESS_USERID = Constants.ACCESS_USERID;
@Autowired
private IIcsCustomerStaffService icsCustomerStaffService;
/**
* 查询企业员工
*/
@GetMapping("get/{id}")
public IcsCustomerStaff get(@PathVariable("id") Long id) {
return icsCustomerStaffService.selectIcsCustomerStaffById(id);
}
/**
* 查询企业员工列表
*/
@RequiresPermissions("admin:staff:list")
@GetMapping("list")
public R list(IcsCustomerStaff icsCustomerStaff) {
startPage();
icsCustomerStaff.setIcsCustomerId(1L);//临时设置
return result(icsCustomerStaffService.selectIcsCustomerStaffList(icsCustomerStaff));
}
/**
* 新增保存企业员工
*/
@RequiresPermissions("admin:staff:add")
@PostMapping("save")
public R addSave(@RequestBody IcsCustomerStaff icsCustomerStaff) {
icsCustomerStaff.setIcsCustomerId(1L);
icsCustomerStaff.setCreateTime(new Date());
icsCustomerStaff.setCreateBy(getLoginName());
return toAjax(icsCustomerStaffService.insertIcsCustomerStaff(icsCustomerStaff));
}
/**
* 修改保存企业员工
*/
@RequiresPermissions("admin:staff:edit")
@PostMapping("update")
public R editSave(@RequestBody IcsCustomerStaff icsCustomerStaff) {
icsCustomerStaff.setUpdateTime(new Date());
icsCustomerStaff.setUpdateBy(getLoginName());
return toAjax(icsCustomerStaffService.updateIcsCustomerStaff(icsCustomerStaff));
}
/**
* 删除企业员工
*/
@RequiresPermissions("admin:staff:remove")
@PostMapping("remove")
public R remove(String ids) {
return toAjax(icsCustomerStaffService.deleteIcsCustomerStaffByIds(ids));
}
}

View File

@ -0,0 +1,42 @@
package com.ics.admin.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ics.common.core.domain.BaseEntity;
import lombok.Data;
/**
* 企业员工对象 ics_customer_staff
*
* @author ics
* @date 2024-02-19
*/
@Data
@TableName("ics_customer_staff")
public class IcsCustomerStaff extends BaseEntity<IcsCustomerStaff> {
private static final long serialVersionUID = 1L;
/** 姓名 */
private String username;
/** 电话 */
private String mobile;
/** 企业客户id */
private Long icsCustomerId;
/** 微信openid */
private String openid;
/** 用户头像 */
private String avatar;
/** 用户性别0男 1女 2未知 */
private String gender;
/** 帐号状态0正常 1停用 */
private String status;
/** 园区ID */
private Long parkId;
}

View File

@ -0,0 +1,72 @@
package com.ics.admin.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ics.admin.domain.IcsCustomerStaff;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 企业员工Mapper接口
*
* @author ics
* @date 2024-02-19
*/
@Mapper
public interface IcsCustomerStaffMapper extends BaseMapper<IcsCustomerStaff> {
/**
* 查询企业员工
*
* @param id 企业员工ID
* @return 企业员工
*/
IcsCustomerStaff selectIcsCustomerStaffById(Long id);
/**
* 查询企业员工列表
*
* @param icsCustomerStaff 企业员工
* @return 企业员工集合
*/
List<IcsCustomerStaff> selectIcsCustomerStaffList(IcsCustomerStaff icsCustomerStaff);
/**
* 新增企业员工
*
* @param icsCustomerStaff 企业员工
* @return 结果
*/
int insertIcsCustomerStaff(IcsCustomerStaff icsCustomerStaff);
/**
* 修改企业员工
*
* @param icsCustomerStaff 企业员工
* @return 结果
*/
int updateIcsCustomerStaff(IcsCustomerStaff icsCustomerStaff);
/**
* 删除企业员工
*
* @param id 企业员工ID
* @return 结果
*/
int deleteIcsCustomerStaffById(Long id);
/**
* 批量删除企业员工
*
* @param ids 需要删除的数据ID
* @return 结果
*/
int deleteIcsCustomerStaffByIds(String[] ids);
/**
* 检查是否唯一手机号码
* @param icsCustomerStaff
* @return
*/
String checkMobileUnique(IcsCustomerStaff icsCustomerStaff);
}

View File

@ -0,0 +1,71 @@
package com.ics.admin.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ics.admin.domain.IcsCustomerStaff;
import com.ics.system.domain.User;
import java.util.List;
/**
* 企业员工Service接口
*
* @author ics
* @date 2024-02-19
*/
public interface IIcsCustomerStaffService extends IService<IcsCustomerStaff> {
/**
* 查询企业员工
*
* @param id 企业员工ID
* @return 企业员工
*/
IcsCustomerStaff selectIcsCustomerStaffById(Long id);
/**
* 查询企业员工列表
*
* @param icsCustomerStaff 企业员工
* @return 企业员工集合
*/
List<IcsCustomerStaff> selectIcsCustomerStaffList(IcsCustomerStaff icsCustomerStaff);
/**
* 新增企业员工
*
* @param icsCustomerStaff 企业员工
* @return 结果
*/
int insertIcsCustomerStaff(IcsCustomerStaff icsCustomerStaff);
/**
* 修改企业员工
*
* @param icsCustomerStaff 企业员工
* @return 结果
*/
int updateIcsCustomerStaff(IcsCustomerStaff icsCustomerStaff);
/**
* 批量删除企业员工
*
* @param ids 需要删除的数据ID
* @return 结果
*/
int deleteIcsCustomerStaffByIds(String ids);
/**
* 删除企业员工信息
*
* @param id 企业员工ID
* @return 结果
*/
int deleteIcsCustomerStaffById(Long id);
/**
* 检查手机号码是否唯一
* @param icsCustomerStaff
* @return
*/
String checkMobileUnique(IcsCustomerStaff icsCustomerStaff);
}

View File

@ -0,0 +1,97 @@
package com.ics.admin.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ics.admin.domain.IcsCustomerStaff;
import com.ics.admin.mapper.IcsCustomerStaffMapper;
import com.ics.admin.service.IIcsCustomerStaffService;
import com.ics.common.utils.StringUtils;
import com.ics.system.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 企业员工Service业务层处理
*
* @author ics
* @date 2024-02-19
*/
@Service
public class IcsCustomerStaffServiceImpl extends ServiceImpl<IcsCustomerStaffMapper, IcsCustomerStaff> implements IIcsCustomerStaffService {
@Autowired
private IcsCustomerStaffMapper icsCustomerStaffMapper;
/**
* 查询企业员工
*
* @param id 企业员工ID
* @return 企业员工
*/
@Override
public IcsCustomerStaff selectIcsCustomerStaffById(Long id) {
return icsCustomerStaffMapper.selectById(id);
}
/**
* 查询企业员工列表
*
* @param icsCustomerStaff 企业员工
* @return 企业员工
*/
@Override
public List<IcsCustomerStaff> selectIcsCustomerStaffList(IcsCustomerStaff icsCustomerStaff) {
return icsCustomerStaffMapper.selectIcsCustomerStaffList(icsCustomerStaff);
}
/**
* 新增企业员工
*
* @param icsCustomerStaff 企业员工
* @return 结果
*/
@Override
public int insertIcsCustomerStaff(IcsCustomerStaff icsCustomerStaff) {
return icsCustomerStaffMapper.insert(icsCustomerStaff);
}
/**
* 修改企业员工
*
* @param icsCustomerStaff 企业员工
* @return 结果
*/
@Override
public int updateIcsCustomerStaff(IcsCustomerStaff icsCustomerStaff) {
return icsCustomerStaffMapper.updateById(icsCustomerStaff);
}
/**
* 删除企业员工对象
*
* @param ids 需要删除的数据ID
* @return 结果
*/
@Override
public int deleteIcsCustomerStaffByIds(String ids) {
String[] idsArray = StringUtils.split(ids,",");
return icsCustomerStaffMapper.deleteBatchIds(CollUtil.toList(idsArray));
}
/**
* 删除企业员工信息
*
* @param id 企业员工ID
* @return 结果
*/
@Override
public int deleteIcsCustomerStaffById(Long id) {
return icsCustomerStaffMapper.deleteIcsCustomerStaffById(id);
}
public String checkMobileUnique(IcsCustomerStaff icsCustomerStaff){
return icsCustomerStaffMapper.checkMobileUnique(icsCustomerStaff);
}
}

View File

@ -0,0 +1,116 @@
<?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.ics.admin.mapper.IcsCustomerStaffMapper">
<resultMap type="com.ics.admin.domain.IcsCustomerStaff" id="IcsCustomerStaffResult">
<result property="id" column="id" />
<result property="username" column="username" />
<result property="mobile" column="mobile" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="deleteFlag" column="delete_flag" />
<result property="icsCustomerId" column="ics_customer_id" />
<result property="openid" column="openid" />
<result property="avatar" column="avatar" />
<result property="gender" column="gender" />
<result property="status" column="status" />
<result property="parkId" column="park_id" />
</resultMap>
<sql id="selectIcsCustomerStaffVo">
SELECT id, username, mobile, create_by, create_time, update_by, update_time, delete_flag, ics_customer_id, openid, avatar, gender, status, park_id FROM ics_customer_staff
</sql>
<select id="selectIcsCustomerStaffList" parameterType="IcsCustomerStaff" resultMap="IcsCustomerStaffResult">
<include refid="selectIcsCustomerStaffVo"/>
<where>
<if test="username != null and username != ''"> AND username LIKE CONCAT('%', #{username}, '%') </if>
<if test="icsCustomerId != null and icsCustomerId != ''"> AND ics_customer_id = #{icsCustomerId} </if>
</where>
</select>
<select id="selectIcsCustomerStaffById" parameterType="Long" resultMap="IcsCustomerStaffResult">
<include refid="selectIcsCustomerStaffVo"/>
WHERE id = #{id}
</select>
<insert id="insertIcsCustomerStaff" parameterType="IcsCustomerStaff">
INSERT INTO ics_customer_staff
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null ">id,</if>
<if test="username != null and username != ''">username,</if>
<if test="mobile != null and mobile != ''">mobile,</if>
<if test="password != null and password != ''">password,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null ">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null ">update_time,</if>
<if test="deleteFlag != null ">delete_flag,</if>
<if test="icsCustomerId != null ">ics_customer_id,</if>
<if test="openid != null and openid != ''">openid,</if>
<if test="avatar != null and avatar != ''">avatar,</if>
<if test="gender != null and gender != ''">gender,</if>
<if test="status != null and status != ''">status,</if>
<if test="parkId != null ">park_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null ">#{id},</if>
<if test="username != null and username != ''">#{username},</if>
<if test="mobile != null and mobile != ''">#{mobile},</if>
<if test="password != null and password != ''">#{password},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null ">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null ">#{updateTime},</if>
<if test="deleteFlag != null ">#{deleteFlag},</if>
<if test="icsCustomerId != null ">#{icsCustomerId},</if>
<if test="openid != null and openid != ''">#{openid},</if>
<if test="avatar != null and avatar != ''">#{avatar},</if>
<if test="gender != null and gender != ''">#{gender},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="parkId != null ">#{parkId},</if>
</trim>
</insert>
<update id="updateIcsCustomerStaff" parameterType="IcsCustomerStaff">
UPDATE ics_customer_staff
<trim prefix="SET" suffixOverrides=",">
<if test="username != null and username != ''">username = #{username},</if>
<if test="mobile != null and mobile != ''">mobile = #{mobile},</if>
<if test="password != null and password != ''">password = #{password},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null ">create_time = #{createTime},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null ">update_time = #{updateTime},</if>
<if test="deleteFlag != null ">delete_flag = #{deleteFlag},</if>
<if test="icsCustomerId != null ">ics_customer_id = #{icsCustomerId},</if>
<if test="openid != null and openid != ''">openid = #{openid},</if>
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
<if test="gender != null and gender != ''">gender = #{gender},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="parkId != null ">park_id = #{parkId},</if>
</trim>
WHERE id = #{id}
</update>
<delete id="deleteIcsCustomerStaffById" parameterType="Long">
DELETE FROM ics_customer_staff WHERE id = #{id}
</delete>
<delete id="deleteIcsCustomerStaffByIds" parameterType="String">
DELETE FROM ics_customer_staff where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="checkPhoneUnique" parameterType="String" resultType="IcsCustomerStaff">
<include refid="selectIcsCustomerStaffVo"/>
WHERE mobile=#{mobile}
</select>
</mapper>