diff --git a/ics-admin/src/main/java/com/ics/admin/controller/IcsCustomerStaffController.java b/ics-admin/src/main/java/com/ics/admin/controller/IcsCustomerStaffController.java new file mode 100644 index 0000000..d2098a1 --- /dev/null +++ b/ics-admin/src/main/java/com/ics/admin/controller/IcsCustomerStaffController.java @@ -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)); + } + + +} diff --git a/ics-admin/src/main/java/com/ics/admin/domain/IcsCustomerStaff.java b/ics-admin/src/main/java/com/ics/admin/domain/IcsCustomerStaff.java new file mode 100644 index 0000000..ed32527 --- /dev/null +++ b/ics-admin/src/main/java/com/ics/admin/domain/IcsCustomerStaff.java @@ -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 { + 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; + +} diff --git a/ics-admin/src/main/java/com/ics/admin/mapper/IcsCustomerStaffMapper.java b/ics-admin/src/main/java/com/ics/admin/mapper/IcsCustomerStaffMapper.java new file mode 100644 index 0000000..cfc4d48 --- /dev/null +++ b/ics-admin/src/main/java/com/ics/admin/mapper/IcsCustomerStaffMapper.java @@ -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 { + /** + * 查询企业员工 + * + * @param id 企业员工ID + * @return 企业员工 + */ + IcsCustomerStaff selectIcsCustomerStaffById(Long id); + + /** + * 查询企业员工列表 + * + * @param icsCustomerStaff 企业员工 + * @return 企业员工集合 + */ + List 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); + +} diff --git a/ics-admin/src/main/java/com/ics/admin/service/IIcsCustomerStaffService.java b/ics-admin/src/main/java/com/ics/admin/service/IIcsCustomerStaffService.java new file mode 100644 index 0000000..bd3734b --- /dev/null +++ b/ics-admin/src/main/java/com/ics/admin/service/IIcsCustomerStaffService.java @@ -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 { + /** + * 查询企业员工 + * + * @param id 企业员工ID + * @return 企业员工 + */ + IcsCustomerStaff selectIcsCustomerStaffById(Long id); + + /** + * 查询企业员工列表 + * + * @param icsCustomerStaff 企业员工 + * @return 企业员工集合 + */ + List 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); +} diff --git a/ics-admin/src/main/java/com/ics/admin/service/impl/IcsCustomerStaffServiceImpl.java b/ics-admin/src/main/java/com/ics/admin/service/impl/IcsCustomerStaffServiceImpl.java new file mode 100644 index 0000000..080d02b --- /dev/null +++ b/ics-admin/src/main/java/com/ics/admin/service/impl/IcsCustomerStaffServiceImpl.java @@ -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 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 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); + } +} diff --git a/ics-admin/src/main/resources/mapper/admin/IcsCustomerStaffMapper.xml b/ics-admin/src/main/resources/mapper/admin/IcsCustomerStaffMapper.xml new file mode 100644 index 0000000..f86e82e --- /dev/null +++ b/ics-admin/src/main/resources/mapper/admin/IcsCustomerStaffMapper.xml @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + + + + + INSERT INTO ics_customer_staff + + id, + username, + mobile, + password, + create_by, + create_time, + update_by, + update_time, + delete_flag, + ics_customer_id, + openid, + avatar, + gender, + status, + park_id, + + + #{id}, + #{username}, + #{mobile}, + #{password}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{deleteFlag}, + #{icsCustomerId}, + #{openid}, + #{avatar}, + #{gender}, + #{status}, + #{parkId}, + + + + + UPDATE ics_customer_staff + + username = #{username}, + mobile = #{mobile}, + password = #{password}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + delete_flag = #{deleteFlag}, + ics_customer_id = #{icsCustomerId}, + openid = #{openid}, + avatar = #{avatar}, + gender = #{gender}, + status = #{status}, + park_id = #{parkId}, + + WHERE id = #{id} + + + + DELETE FROM ics_customer_staff WHERE id = #{id} + + + + DELETE FROM ics_customer_staff where id in + + #{id} + + + + + +