Merge pull request 'aike' (#275) from aike into master
Reviewed-on: http://git.xdadan.loc/tanex/emis-service/pulls/275
This commit is contained in:
commit
d6223ab13b
@ -100,6 +100,15 @@ public class EmisCustomerUserController extends EmisBaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@GetMapping("/listMoneyUserAll")
|
||||
public TableDataInfo listMoneyUserAll(EmisCustomerUser emisCustomerUser)
|
||||
{
|
||||
startPage();
|
||||
emisCustomerUser.setCustomerType("1");
|
||||
List<EmisCustomerUser> list = emisCustomerUserService.selectEmisCustomerUserList(emisCustomerUser);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
// @PreAuthorize("@ss.hasPermi('emis:emisCustomerUser:list')")
|
||||
@GetMapping("/listSimple")
|
||||
@ -530,4 +539,64 @@ public class EmisCustomerUserController extends EmisBaseController
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定现金客户
|
||||
* 批量更新客户用户的moneyUserId
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:emisCustomerUser:bindMoneyUser')")
|
||||
@Log(title = "绑定现金客户", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/bindMoneyUser")
|
||||
public AjaxResult bindMoneyUser(@RequestBody EmisCustomerUser emisCustomerUser) {
|
||||
try {
|
||||
// 从params中获取ids(逗号分隔的字符串)
|
||||
if (emisCustomerUser.getParams() == null || emisCustomerUser.getParams().get("ids") == null) {
|
||||
return AjaxResult.error("客户用户ID列表不能为空");
|
||||
}
|
||||
|
||||
String idsStr = emisCustomerUser.getParams().get("ids").toString().trim();
|
||||
if (StringUtils.isEmpty(idsStr)) {
|
||||
return AjaxResult.error("客户用户ID列表不能为空");
|
||||
}
|
||||
|
||||
// 解析逗号分隔的字符串为Long数组
|
||||
String[] idStrArray = idsStr.split(",");
|
||||
Long[] ids = new Long[idStrArray.length];
|
||||
for (int i = 0; i < idStrArray.length; i++) {
|
||||
try {
|
||||
ids[i] = Long.parseLong(idStrArray[i].trim());
|
||||
} catch (NumberFormatException e) {
|
||||
return AjaxResult.error("客户用户ID格式错误:" + idStrArray[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (ids.length == 0) {
|
||||
return AjaxResult.error("客户用户ID列表不能为空");
|
||||
}
|
||||
|
||||
// 从对象中获取moneyUserId
|
||||
if (emisCustomerUser.getMoneyUserId() == null) {
|
||||
return AjaxResult.error("现金客户ID不能为空");
|
||||
}
|
||||
Long moneyUserId = emisCustomerUser.getMoneyUserId();
|
||||
|
||||
// 获取当前登录用户信息
|
||||
String updateBy = null;
|
||||
String updateSite = null;
|
||||
try {
|
||||
updateBy = getLoginUser().getUser().getEmpCode();
|
||||
updateSite = getLoginUser().getUser().getOwnerSiteCode();
|
||||
} catch (Exception e) {
|
||||
// 如果获取不到用户信息,使用默认值或继续执行
|
||||
}
|
||||
|
||||
return toAjax(emisCustomerUserService.batchUpdateMoneyUserId(ids, moneyUserId, updateBy, updateSite));
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
return AjaxResult.error("参数格式错误:" + e.getMessage());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return AjaxResult.error("绑定失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,132 @@
|
||||
/**
|
||||
* @Project: emis
|
||||
* @Title: EmisMoneyUserController.java
|
||||
* @author heyu
|
||||
* @date 2025-12-20 06:55:09
|
||||
* @Copyright: ShangHai Duta 2025 All rights reserved.
|
||||
* @version v1.0
|
||||
* @Description: <p> 现金用户 控制器 </p>
|
||||
*/
|
||||
|
||||
package com.xdadan.erp.web.emis;
|
||||
|
||||
import com.xdadan.erp.common.annotation.Log;
|
||||
import com.xdadan.erp.common.core.domain.AjaxResult;
|
||||
import com.xdadan.erp.common.core.page.TableDataInfo;
|
||||
import com.xdadan.erp.common.enums.BusinessType;
|
||||
import com.xdadan.erp.common.utils.poi.ExcelUtil;
|
||||
import com.xdadan.erp.emis.domain.EmisMoneyUser;
|
||||
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||
import com.xdadan.erp.emis.service.IEmisMoneyUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DuplicateKeyException;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 现金用户Controller
|
||||
*
|
||||
* @author heyu
|
||||
* @date 2025-12-20 06:55:09
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/emis/emisMoneyUser")
|
||||
public class EmisMoneyUserController extends EmisBaseController
|
||||
{
|
||||
@Autowired
|
||||
private IEmisMoneyUserService emisMoneyUserService;
|
||||
|
||||
/**
|
||||
* 查询现金用户列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:emisMoneyUser:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(EmisMoneyUser emisMoneyUser)
|
||||
{
|
||||
startPage();
|
||||
setPrivParams(emisMoneyUser);
|
||||
List<EmisMoneyUser> list = emisMoneyUserService.selectEmisMoneyUserList(emisMoneyUser);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出现金用户列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:emisMoneyUser:export')")
|
||||
@Log(title = "现金用户", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, EmisMoneyUser emisMoneyUser)
|
||||
{
|
||||
List<EmisMoneyUser> list = emisMoneyUserService.selectEmisMoneyUserList(emisMoneyUser);
|
||||
ExcelUtil<EmisMoneyUser> util = new ExcelUtil<EmisMoneyUser>(EmisMoneyUser.class);
|
||||
util.exportExcel(response, list, "现金用户数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取现金用户详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:emisMoneyUser:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return AjaxResult.success(emisMoneyUserService.selectEmisMoneyUserById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增现金用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:emisMoneyUser:add')")
|
||||
@Log(title = "现金用户", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody EmisMoneyUser emisMoneyUser) throws EmisBizError {
|
||||
try {
|
||||
return toAjax(emisMoneyUserService.insertEmisMoneyUser(emisMoneyUser));
|
||||
} catch (DuplicateKeyException e) {
|
||||
e.printStackTrace();
|
||||
return AjaxResult.error("数据重复!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改现金用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:emisMoneyUser:edit')")
|
||||
@Log(title = "现金用户", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody EmisMoneyUser emisMoneyUser) throws EmisBizError {
|
||||
try {
|
||||
return toAjax(emisMoneyUserService.updateEmisMoneyUser(emisMoneyUser));
|
||||
} catch (DuplicateKeyException e) {
|
||||
e.printStackTrace();
|
||||
return AjaxResult.error("数据重复!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除现金用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:emisMoneyUser:remove')")
|
||||
@Log(title = "现金用户", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(emisMoneyUserService.deleteEmisMoneyUserByIds(ids));
|
||||
}
|
||||
|
||||
@GetMapping("/listMoneyUserAll")
|
||||
public TableDataInfo listMoneyUserAll(EmisMoneyUser emisMoneyUser)
|
||||
{
|
||||
startPage();
|
||||
List<EmisMoneyUser> list = emisMoneyUserService.selectEmisMoneyUserList(emisMoneyUser);
|
||||
return getDataTable(list);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -13,15 +13,11 @@ package com.xdadan.erp.emis.domain;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.xdadan.erp.common.annotation.Excel;
|
||||
import com.xdadan.erp.common.core.domain.BaseEntity;
|
||||
import com.xdadan.erp.common.core.domain.TreeEntity;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
@ -39,6 +35,10 @@ public class EmisCustomerUser extends BaseEntity
|
||||
/* id */
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
/* 现金客户表id */
|
||||
private Long moneyUserId;
|
||||
/* 现金客户表客户名称 */
|
||||
private String moneyUserName;
|
||||
/* 客户编码 */
|
||||
private String customerCode;
|
||||
/* 客户名称 */
|
||||
|
||||
@ -0,0 +1,54 @@
|
||||
/**
|
||||
* @Project: emis
|
||||
* @Title: EmisMoneyUser.java
|
||||
* @author heyu
|
||||
* @date 2025-12-20 06:55:09
|
||||
* @Copyright: ShangHai Duta 2025 All rights reserved.
|
||||
* @version v1.0
|
||||
* @Description: <p> 现金用户 实体类 </p>
|
||||
*/
|
||||
|
||||
package com.xdadan.erp.emis.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.xdadan.erp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* @ClassName EmisMoneyUser
|
||||
* @Description 现金用户
|
||||
* @author 何宇
|
||||
* @date 2025-12-20 06:55:09
|
||||
*/
|
||||
@Data
|
||||
@TableName("emis_money_user")
|
||||
public class EmisMoneyUser extends BaseEntity
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/* id */
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
/* 客户名称 */
|
||||
private String company;
|
||||
/* 回款联系人 */
|
||||
private String payee;
|
||||
/* 销售联系人 */
|
||||
private String salesmen;
|
||||
/* 销售支持 */
|
||||
private String salesSupport;
|
||||
/* 销售主管 */
|
||||
private String salesExecutive;
|
||||
/* 企业名称 */
|
||||
private String enterpriseName;
|
||||
/* 企业税号 */
|
||||
private String enterpriseTaxId;
|
||||
/* 启用状态 1-启用 0-未启用 */
|
||||
private String status;
|
||||
|
||||
|
||||
}
|
||||
@ -10,9 +10,12 @@
|
||||
*/
|
||||
package com.xdadan.erp.emis.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.xdadan.erp.emis.domain.EmisCustomerUser;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName EmisCustomerUserMapper
|
||||
* @Description <p> 快递客户用户 Mapper 接口 </p>
|
||||
@ -96,6 +99,13 @@ public interface EmisCustomerUserMapper extends BaseMapper<EmisCustomerUser>
|
||||
|
||||
public EmisCustomerUser selectMonthCustomerByMonthlyPayCode(String monthlyPayCode);
|
||||
|
||||
/**
|
||||
* 根据公司名称查询现金客户列表
|
||||
* @param company 公司名称
|
||||
* @return 现金客户列表
|
||||
*/
|
||||
public List<EmisCustomerUser> selectMoneyCustomerByCompany(String company);
|
||||
|
||||
|
||||
public int insertSysOmsUserRole(Long omsUserId);
|
||||
|
||||
@ -106,4 +116,24 @@ public interface EmisCustomerUserMapper extends BaseMapper<EmisCustomerUser>
|
||||
*/
|
||||
public int updateEnterpriseInfoByMonthlyPayCode(EmisCustomerUser emisCustomerUser);
|
||||
|
||||
/**
|
||||
* 批量更新客户用户的moneyUserId
|
||||
*
|
||||
* @param ids 客户用户ID数组
|
||||
* @param moneyUserId 现金客户ID
|
||||
* @param updateBy 更新人
|
||||
* @param updateSite 更新站点
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchUpdateMoneyUserId(@Param("ids") Long[] ids, @Param("moneyUserId") Long moneyUserId,
|
||||
@Param("updateBy") String updateBy, @Param("updateSite") String updateSite);
|
||||
|
||||
/**
|
||||
* 根据现金客户ID数组,清空关联客户用户表中的 money_user_id 字段
|
||||
*
|
||||
* @param moneyUserIds 现金客户ID数组
|
||||
* @return 结果
|
||||
*/
|
||||
public int clearMoneyUserIdByMoneyUserIds(@Param("moneyUserIds") Long[] moneyUserIds);
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,87 @@
|
||||
/**
|
||||
* @Project: emis
|
||||
* @Title: EmisMoneyUserMapper.java
|
||||
* @author heyu
|
||||
* @date 2025-12-20 06:55:09
|
||||
* @Copyright: ShangHai Doitinfo 2025 All rights reserved.
|
||||
* @version v1.0
|
||||
* @Description: <p> 现金用户 Mapper 接口 </p>
|
||||
* <span style='color:red'> Warning : This file is generate by ai tools,don't edit!!! </span>
|
||||
*/
|
||||
package com.xdadan.erp.emis.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.xdadan.erp.emis.domain.EmisMoneyUser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName EmisMoneyUserMapper
|
||||
* @Description <p> 现金用户 Mapper 接口 </p>
|
||||
* @author heyu
|
||||
* @date 2025-12-20 06:55:09
|
||||
*/
|
||||
public interface EmisMoneyUserMapper extends BaseMapper<EmisMoneyUser>
|
||||
{
|
||||
/**
|
||||
* 主键查询
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public EmisMoneyUser selectEmisMoneyUserById(Long id);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*
|
||||
* @param emisMoneyUser
|
||||
* @return 集合
|
||||
*/
|
||||
public List<EmisMoneyUser> selectEmisMoneyUserList(EmisMoneyUser emisMoneyUser);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param emisMoneyUser
|
||||
* @return
|
||||
*/
|
||||
public int insertEmisMoneyUser(EmisMoneyUser emisMoneyUser);
|
||||
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param emisMoneyUser
|
||||
* @return
|
||||
*/
|
||||
public int updateEmisMoneyUser(EmisMoneyUser emisMoneyUser);
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmisMoneyUserById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmisMoneyUserByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 根据公司名称查询现金用户(用于唯一性校验)
|
||||
*
|
||||
* @param company 公司名称
|
||||
* @return 现金用户
|
||||
*/
|
||||
public EmisMoneyUser selectMoneyUserByCompany(String company);
|
||||
|
||||
|
||||
EmisMoneyUser selectEmisMoneyUserByCompany(String moneyUserCompany);
|
||||
}
|
||||
|
||||
|
||||
@ -9,13 +9,14 @@
|
||||
*/
|
||||
package com.xdadan.erp.emis.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.xdadan.erp.emis.domain.EmisCustomerUser;
|
||||
import com.xdadan.erp.emis.domain.EmisWaybill;
|
||||
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||
import com.xdadan.erp.emis.domain.vo.MonthlyCustomerShipmentStatVO;
|
||||
import com.xdadan.erp.emis.domain.EmisCustomerUser;
|
||||
import com.xdadan.erp.emis.domain.EmisWaybill;
|
||||
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||
import com.xdadan.erp.emis.domain.vo.MonthlyCustomerShipmentStatVO;
|
||||
|
||||
/**
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName EmisCustomerUserService
|
||||
* @Description 快递客户用户
|
||||
* @author linfso
|
||||
@ -99,11 +100,22 @@ public interface IEmisCustomerUserService
|
||||
*/
|
||||
public List<MonthlyCustomerShipmentStatVO> selectMonthlyCustomerShipmentStat(EmisWaybill emisWaybill) throws EmisBizError;
|
||||
|
||||
/**
|
||||
* 查询月结客户出货明细
|
||||
*
|
||||
* @param emisWaybill 查询条件
|
||||
* @return 运单明细列表
|
||||
*/
|
||||
public List<EmisWaybill> selectMonthlyCustomerShipmentDetail(EmisWaybill emisWaybill);
|
||||
}
|
||||
/**
|
||||
* 查询月结客户出货明细
|
||||
*
|
||||
* @param emisWaybill 查询条件
|
||||
* @return 运单明细列表
|
||||
*/
|
||||
public List<EmisWaybill> selectMonthlyCustomerShipmentDetail(EmisWaybill emisWaybill);
|
||||
|
||||
/**
|
||||
* 批量更新客户用户的moneyUserId
|
||||
*
|
||||
* @param ids 客户用户ID数组
|
||||
* @param moneyUserId 现金客户ID
|
||||
* @param updateBy 更新人
|
||||
* @param updateSite 更新站点
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchUpdateMoneyUserId(Long[] ids, Long moneyUserId, String updateBy, String updateSite);
|
||||
}
|
||||
|
||||
@ -0,0 +1,75 @@
|
||||
/**
|
||||
* @Project: emis
|
||||
* @Title: IEmisMoneyUserService.java
|
||||
* @author heyu
|
||||
* @date 2025-12-20 06:55:09
|
||||
* @Copyright: ShangHai Duta 2025 All rights reserved.
|
||||
* @version v1.0
|
||||
* @Description: <p> 现金用户 服务类接口 </p>
|
||||
*/
|
||||
package com.xdadan.erp.emis.service;
|
||||
|
||||
import com.xdadan.erp.emis.domain.EmisMoneyUser;
|
||||
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName IEmisMoneyUserService
|
||||
* @Description 现金用户
|
||||
* @author heyu
|
||||
* @date 2025-12-20 06:55:09
|
||||
*/
|
||||
public interface IEmisMoneyUserService
|
||||
{
|
||||
/**
|
||||
* 主键查询
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public EmisMoneyUser selectEmisMoneyUserById(Long id);
|
||||
|
||||
/**
|
||||
* 查询现金用户列表
|
||||
*
|
||||
* @param emisMoneyUser 现金用户
|
||||
* @return 现金用户集合
|
||||
*/
|
||||
public List<EmisMoneyUser> selectEmisMoneyUserList(EmisMoneyUser emisMoneyUser);
|
||||
|
||||
/**
|
||||
* 新增现金用户
|
||||
*
|
||||
* @param emisMoneyUser 现金用户
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEmisMoneyUser(EmisMoneyUser emisMoneyUser) throws EmisBizError;
|
||||
|
||||
/**
|
||||
* 修改现金用户
|
||||
*
|
||||
* @param emisMoneyUser 现金用户
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEmisMoneyUser(EmisMoneyUser emisMoneyUser) throws EmisBizError;
|
||||
|
||||
/**
|
||||
* 批量删除现金用户
|
||||
*
|
||||
* @param ids 需要删除的现金用户主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmisMoneyUserByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除现金用户信息
|
||||
*
|
||||
* @param id 现金用户主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmisMoneyUserById(Long id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -380,4 +380,20 @@ public class EmisCustomerUserServiceImpl extends EmisBaseService implements IEmi
|
||||
return emisWaybillMapper.selectMonthlyCustomerShipmentDetail(emisWaybill);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量更新客户用户的moneyUserId
|
||||
*
|
||||
* @param ids 客户用户ID数组
|
||||
* @param moneyUserId 现金客户ID
|
||||
* @param updateBy 更新人
|
||||
* @param updateSite 更新站点
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int batchUpdateMoneyUserId(Long[] ids, Long moneyUserId, String updateBy, String updateSite) {
|
||||
if (ids == null || ids.length == 0) {
|
||||
return 0;
|
||||
}
|
||||
return emisCustomerUserMapper.batchUpdateMoneyUserId(ids, moneyUserId, updateBy, updateSite);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,136 @@
|
||||
/**
|
||||
* @Project: emis
|
||||
* @Title: EmisMoneyUserServiceImpl.java
|
||||
* @author heyu
|
||||
* @date 2025-12-20 06:55:09
|
||||
* @Copyright: ShangHai Duta 2025 All rights reserved.
|
||||
* @version v1.0
|
||||
* @Description: <p> 现金用户 服务类实现 </p>
|
||||
*/
|
||||
|
||||
package com.xdadan.erp.emis.service.impl;
|
||||
|
||||
import com.xdadan.erp.emis.domain.EmisMoneyUser;
|
||||
import com.xdadan.erp.emis.domain.enumtype.EmisBizErrorType;
|
||||
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||
import com.xdadan.erp.emis.mapper.EmisMoneyUserMapper;
|
||||
import com.xdadan.erp.emis.service.EmisBaseService;
|
||||
import com.xdadan.erp.emis.service.IEmisMoneyUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 现金用户Service业务层处理
|
||||
*
|
||||
* @author heyu
|
||||
* @date 2025-12-20 06:55:09
|
||||
*/
|
||||
@Service
|
||||
public class EmisMoneyUserServiceImpl extends EmisBaseService implements IEmisMoneyUserService
|
||||
{
|
||||
@Autowired
|
||||
private EmisMoneyUserMapper emisMoneyUserMapper;
|
||||
|
||||
/**
|
||||
* 查询现金用户
|
||||
*
|
||||
* @param id 现金用户主键
|
||||
* @return 现金用户
|
||||
*/
|
||||
@Override
|
||||
public EmisMoneyUser selectEmisMoneyUserById(Long id)
|
||||
{
|
||||
return emisMoneyUserMapper.selectEmisMoneyUserById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询现金用户列表
|
||||
*
|
||||
* @param emisMoneyUser 现金用户
|
||||
* @return 现金用户
|
||||
*/
|
||||
@Override
|
||||
public List<EmisMoneyUser> selectEmisMoneyUserList(EmisMoneyUser emisMoneyUser)
|
||||
{
|
||||
return emisMoneyUserMapper.selectEmisMoneyUserList(emisMoneyUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增现金用户
|
||||
*
|
||||
* @param emisMoneyUser 现金用户
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertEmisMoneyUser(EmisMoneyUser emisMoneyUser) throws EmisBizError {
|
||||
|
||||
// company 唯一性校验
|
||||
if (org.apache.commons.lang3.StringUtils.isNotBlank(emisMoneyUser.getCompany())) {
|
||||
EmisMoneyUser exists = emisMoneyUserMapper.selectMoneyUserByCompany(emisMoneyUser.getCompany());
|
||||
if (exists != null) {
|
||||
throw new EmisBizError(EmisBizErrorType.EXISTS, "客户名称" +
|
||||
"已存在");
|
||||
}
|
||||
}
|
||||
|
||||
emisMoneyUser.preInsert();
|
||||
return emisMoneyUserMapper.insertEmisMoneyUser(emisMoneyUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改现金用户
|
||||
*
|
||||
* @param emisMoneyUser 现金用户
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateEmisMoneyUser(EmisMoneyUser emisMoneyUser) throws EmisBizError {
|
||||
// company 唯一性校验(排除自身)
|
||||
if (org.apache.commons.lang3.StringUtils.isNotBlank(emisMoneyUser.getCompany())) {
|
||||
EmisMoneyUser exists = emisMoneyUserMapper.selectMoneyUserByCompany(emisMoneyUser.getCompany());
|
||||
if (exists != null && !exists.getId().equals(emisMoneyUser.getId())) {
|
||||
throw new EmisBizError(EmisBizErrorType.EXISTS, "客户名称已存在");
|
||||
}
|
||||
}
|
||||
emisMoneyUser.preUpdate();
|
||||
return emisMoneyUserMapper.updateEmisMoneyUser(emisMoneyUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除现金用户
|
||||
*
|
||||
* @param ids 需要删除的现金用户主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEmisMoneyUserByIds(Long[] ids)
|
||||
{
|
||||
if (ids == null || ids.length == 0) {
|
||||
return 0;
|
||||
}
|
||||
// 删除现金用户前,先清空客户用户表中关联的 money_user_id
|
||||
emisCustomerUserMapper.clearMoneyUserIdByMoneyUserIds(ids);
|
||||
return emisMoneyUserMapper.deleteEmisMoneyUserByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除现金用户信息
|
||||
*
|
||||
* @param id 现金用户主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEmisMoneyUserById(Long id)
|
||||
{
|
||||
if (id == null) {
|
||||
return 0;
|
||||
}
|
||||
// 删除单个现金用户前,先清空客户用户表中关联的 money_user_id
|
||||
emisCustomerUserMapper.clearMoneyUserIdByMoneyUserIds(new Long[]{id});
|
||||
return emisMoneyUserMapper.deleteEmisMoneyUserById(id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -6,6 +6,8 @@
|
||||
|
||||
<resultMap type="EmisCustomerUser" id="EmisCustomerUserResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResultAll">
|
||||
<result property="id" column="id" />
|
||||
<result property="moneyUserId" column="money_user_id" />
|
||||
<result property="moneyUserName" column="money_user_name" />
|
||||
<result property="customerCode" column="customer_code" />
|
||||
<result property="customerName" column="customer_name" />
|
||||
<result property="customerNameEn" column="customer_name_en" />
|
||||
@ -88,6 +90,8 @@
|
||||
<sql id="selectEmisCustomerUserVo">
|
||||
select /*+ INDEX(a idx_emis_customer_user_owner_site) */
|
||||
a.id,
|
||||
a.money_user_id,
|
||||
mu.company as money_user_name,
|
||||
a.customer_code,
|
||||
a.customer_name,
|
||||
a.customer_name_en,
|
||||
@ -164,6 +168,7 @@
|
||||
us.site_name as update_site_name,
|
||||
lw.last_order_time
|
||||
from emis_customer_user a
|
||||
left join emis_money_user mu on mu.id = a.money_user_id
|
||||
left join emis_country c on c.code = a.country
|
||||
left join emis_region rp on rp.region_code = a.province
|
||||
left join emis_region rc on rc.region_code = a.city
|
||||
@ -252,6 +257,9 @@
|
||||
<if test="settleDay != null "> and a.settle_day = #{settleDay}</if>
|
||||
<if test="salesSupport != null and salesSupport != ''"> and a.sales_support = #{salesSupport}</if>
|
||||
<if test="salesExecutive != null and salesExecutive != ''"> and a.sales_executive = #{salesExecutive}</if>
|
||||
<if test="searchValue != null and searchValue != ''">
|
||||
and ( a.customer_name like concat('%',#{searchValue}, '%') or a.customer_code like concat('%',#{searchValue}, '%') or a.company like concat('%',#{searchValue}, '%') or a.phone like concat('%',#{searchValue}, '%') )
|
||||
</if>
|
||||
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
|
||||
and (
|
||||
a.salesmen=#{params.privEmpName}
|
||||
@ -279,7 +287,7 @@
|
||||
</select>
|
||||
|
||||
<select id="selectEmisCustomerUserById" parameterType="Long" resultMap="EmisCustomerUserResult">
|
||||
select id, customer_code, customer_name, customer_name_en, simple_name, contact, phone, mobile, customer_type, settled_type, user_type, company, lic_no, dept_id, avatar, sex, invitation_info, login_ip, login_date, nick_name, union_id, openid, monthly_pay_code, user_name, password, owner_site, biz_site, biz_site_name, country, province, city, county, town, address, email, post_code, real_name, id_no, id_type, id_pic1, id_pic2, id_verify_status, payee, salesmen, data_from, bl_open_oms, bl_sms, op_emp_code, first_signing_day, credit_period_type, credit_period, settle_day, status, order_num, sales_support, sales_executive, enterprise_name, enterprise_tax_id, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||
select id, money_user_id, (select company from emis_money_user where id=a.money_user_id) as money_user_name, customer_code, customer_name, customer_name_en, simple_name, contact, phone, mobile, customer_type, settled_type, user_type, company, lic_no, dept_id, avatar, sex, invitation_info, login_ip, login_date, nick_name, union_id, openid, monthly_pay_code, user_name, password, owner_site, biz_site, biz_site_name, country, province, city, county, town, address, email, post_code, real_name, id_no, id_type, id_pic1, id_pic2, id_verify_status, payee, salesmen, data_from, bl_open_oms, bl_sms, op_emp_code, first_signing_day, credit_period_type, credit_period, settle_day, status, order_num, sales_support, sales_executive, enterprise_name, enterprise_tax_id, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||
from emis_customer_user a
|
||||
where a.id = #{id}
|
||||
</select>
|
||||
@ -287,6 +295,7 @@
|
||||
<insert id="insertEmisCustomerUser" parameterType="EmisCustomerUser" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into emis_customer_user
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="moneyUserId != null">money_user_id,</if>
|
||||
<if test="customerCode != null and customerCode != ''">customer_code,</if>
|
||||
<if test="customerName != null and customerName != ''">customer_name,</if>
|
||||
<if test="customerNameEn != null and customerNameEn != ''">customer_name_en,</if>
|
||||
@ -354,6 +363,7 @@
|
||||
<if test="updateSite != null and updateSite != ''">update_site,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="moneyUserId != null">#{moneyUserId},</if>
|
||||
<if test="customerCode != null and customerCode != ''">#{customerCode},</if>
|
||||
<if test="customerName != null and customerName != ''">#{customerName},</if>
|
||||
<if test="customerNameEn != null and customerNameEn != ''">#{customerNameEn},</if>
|
||||
@ -425,6 +435,7 @@
|
||||
<update id="updateEmisCustomerUser" parameterType="EmisCustomerUser">
|
||||
update emis_customer_user
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="moneyUserId != null">money_user_id = #{moneyUserId},</if>
|
||||
<if test="customerCode != null and customerCode != ''">customer_code = #{customerCode},</if>
|
||||
<if test="customerName != null and customerName != ''">customer_name = #{customerName},</if>
|
||||
<if test="customerNameEn != null and customerNameEn != ''">customer_name_en = #{customerNameEn},</if>
|
||||
@ -529,29 +540,35 @@
|
||||
<!-- </select>-->
|
||||
|
||||
<select id="selectEmisCustomerUserByPhone" parameterType="string" resultMap="EmisCustomerUserResult">
|
||||
select id, customer_code, customer_name, customer_name_en, simple_name, contact, phone, mobile, customer_type, settled_type, user_type, company, lic_no, dept_id, avatar, sex, invitation_info, login_ip, login_date, nick_name, union_id, openid, monthly_pay_code, user_name, password, owner_site, biz_site, biz_site_name, country, province, city, county, town, address, email, post_code, real_name, id_no, id_type, id_pic1, id_pic2, id_verify_status, payee, salesmen, data_from, bl_open_oms, bl_sms, op_emp_code, first_signing_day, credit_period_type, credit_period, settle_day, status, order_num, sales_support, sales_executive, enterprise_name, enterprise_tax_id, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||
select id, money_user_id, customer_code, customer_name, customer_name_en, simple_name, contact, phone, mobile, customer_type, settled_type, user_type, company, lic_no, dept_id, avatar, sex, invitation_info, login_ip, login_date, nick_name, union_id, openid, monthly_pay_code, user_name, password, owner_site, biz_site, biz_site_name, country, province, city, county, town, address, email, post_code, real_name, id_no, id_type, id_pic1, id_pic2, id_verify_status, payee, salesmen, data_from, bl_open_oms, bl_sms, op_emp_code, first_signing_day, credit_period_type, credit_period, settle_day, status, order_num, sales_support, sales_executive, enterprise_name, enterprise_tax_id, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||
from emis_customer_user a
|
||||
where a.del_flag='0' and a.phone = #{phone}
|
||||
</select>
|
||||
|
||||
<select id="selectCustomerByCustomerCode" parameterType="string" resultMap="EmisCustomerUserResult">
|
||||
select id, customer_code, customer_name, customer_name_en, simple_name, contact, phone, mobile, customer_type, settled_type, user_type, company, lic_no, dept_id, avatar, sex, invitation_info, login_ip, login_date, nick_name, union_id, openid, monthly_pay_code, user_name, password, owner_site, biz_site, biz_site_name, country, province, city, county, town, address, email, post_code, real_name, id_no, id_type, id_pic1, id_pic2, id_verify_status, payee, salesmen, data_from, bl_open_oms, bl_sms, op_emp_code, first_signing_day, credit_period_type, credit_period, settle_day, status, order_num, sales_support, sales_executive, enterprise_name, enterprise_tax_id, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||
select id, money_user_id, customer_code, customer_name, customer_name_en, simple_name, contact, phone, mobile, customer_type, settled_type, user_type, company, lic_no, dept_id, avatar, sex, invitation_info, login_ip, login_date, nick_name, union_id, openid, monthly_pay_code, user_name, password, owner_site, biz_site, biz_site_name, country, province, city, county, town, address, email, post_code, real_name, id_no, id_type, id_pic1, id_pic2, id_verify_status, payee, salesmen, data_from, bl_open_oms, bl_sms, op_emp_code, first_signing_day, credit_period_type, credit_period, settle_day, status, order_num, sales_support, sales_executive, enterprise_name, enterprise_tax_id, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||
from emis_customer_user a
|
||||
where a.del_flag='0' and a.customer_code = #{customerCode}
|
||||
</select>
|
||||
|
||||
<select id="selectMonthCustomerByName" parameterType="string" resultMap="EmisCustomerUserResult">
|
||||
select id, customer_code, customer_name, customer_name_en, simple_name, contact, phone, mobile, customer_type, settled_type, user_type, company, lic_no, dept_id, avatar, sex, invitation_info, login_ip, login_date, nick_name, union_id, openid, monthly_pay_code, user_name, password, owner_site, biz_site, biz_site_name, country, province, city, county, town, address, email, post_code, real_name, id_no, id_type, id_pic1, id_pic2, id_verify_status, payee, salesmen, data_from, bl_open_oms, bl_sms, op_emp_code, first_signing_day, credit_period_type, credit_period, settle_day, status, order_num, sales_support, sales_executive, enterprise_name, enterprise_tax_id, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||
select id, money_user_id, customer_code, customer_name, customer_name_en, simple_name, contact, phone, mobile, customer_type, settled_type, user_type, company, lic_no, dept_id, avatar, sex, invitation_info, login_ip, login_date, nick_name, union_id, openid, monthly_pay_code, user_name, password, owner_site, biz_site, biz_site_name, country, province, city, county, town, address, email, post_code, real_name, id_no, id_type, id_pic1, id_pic2, id_verify_status, payee, salesmen, data_from, bl_open_oms, bl_sms, op_emp_code, first_signing_day, credit_period_type, credit_period, settle_day, status, order_num, sales_support, sales_executive, enterprise_name, enterprise_tax_id, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||
from emis_customer_user a
|
||||
where a.del_flag='0' and a.customer_type='2' and a.customer_name = #{customerName}
|
||||
</select>
|
||||
|
||||
<select id="selectMonthCustomerByMonthlyPayCode" parameterType="string" resultMap="EmisCustomerUserResult">
|
||||
select id, customer_code, customer_name, customer_name_en, simple_name, contact, phone, mobile, customer_type, settled_type, user_type, company, lic_no, dept_id, avatar, sex, invitation_info, login_ip, login_date, nick_name, union_id, openid, monthly_pay_code, user_name, password, owner_site, biz_site, biz_site_name, country, province, city, county, town, address, email, post_code, real_name, id_no, id_type, id_pic1, id_pic2, id_verify_status, payee, salesmen, data_from, bl_open_oms, bl_sms, op_emp_code, first_signing_day, credit_period_type, credit_period, settle_day, status, order_num, sales_support, sales_executive, enterprise_name, enterprise_tax_id, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||
select id, money_user_id, customer_code, customer_name, customer_name_en, simple_name, contact, phone, mobile, customer_type, settled_type, user_type, company, lic_no, dept_id, avatar, sex, invitation_info, login_ip, login_date, nick_name, union_id, openid, monthly_pay_code, user_name, password, owner_site, biz_site, biz_site_name, country, province, city, county, town, address, email, post_code, real_name, id_no, id_type, id_pic1, id_pic2, id_verify_status, payee, salesmen, data_from, bl_open_oms, bl_sms, op_emp_code, first_signing_day, credit_period_type, credit_period, settle_day, status, order_num, sales_support, sales_executive, enterprise_name, enterprise_tax_id, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||
from emis_customer_user a
|
||||
where a.del_flag='0' and a.customer_type='2' and a.monthly_pay_code= #{monthlyPayCode}
|
||||
</select>
|
||||
|
||||
<select id="selectMoneyCustomerByCompany" parameterType="string" resultMap="EmisCustomerUserResult">
|
||||
select id, money_user_id, customer_code, customer_name, customer_name_en, simple_name, contact, phone, mobile, customer_type, settled_type, user_type, company, lic_no, dept_id, avatar, sex, invitation_info, login_ip, login_date, nick_name, union_id, openid, monthly_pay_code, user_name, password, owner_site, biz_site, biz_site_name, country, province, city, county, town, address, email, post_code, real_name, id_no, id_type, id_pic1, id_pic2, id_verify_status, payee, salesmen, data_from, bl_open_oms, bl_sms, op_emp_code, first_signing_day, credit_period_type, credit_period, settle_day, status, order_num, sales_support, sales_executive, enterprise_name, enterprise_tax_id, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||
from emis_customer_user a
|
||||
where a.del_flag='0' and a.customer_type='1' and a.company = #{company}
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insertSysOmsUserRole" parameterType="Long">
|
||||
insert into sys_oms_user_role(user_id,role_id)
|
||||
@ -564,6 +581,7 @@
|
||||
<update id="updateEnterpriseInfoByMonthlyPayCode" parameterType="EmisCustomerUser">
|
||||
update emis_customer_user
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="moneyUserId != null">money_user_id = #{moneyUserId},</if>
|
||||
<if test="customerCode != null and customerCode != ''">customer_code = #{customerCode},</if>
|
||||
<if test="customerName != null and customerName != ''">customer_name = #{customerName},</if>
|
||||
<if test="customerNameEn != null and customerNameEn != ''">customer_name_en = #{customerNameEn},</if>
|
||||
@ -633,4 +651,29 @@
|
||||
AND del_flag = '0'
|
||||
</update>
|
||||
|
||||
<!-- 批量更新客户用户的moneyUserId -->
|
||||
<update id="batchUpdateMoneyUserId">
|
||||
UPDATE emis_customer_user
|
||||
SET money_user_id = #{moneyUserId},
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
<if test="updateSite != null and updateSite != ''">update_site = #{updateSite},</if>
|
||||
update_time = NOW()
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
AND del_flag = '0'
|
||||
</update>
|
||||
|
||||
<!-- 根据现金客户ID数组,清空关联客户用户表中的 money_user_id 字段 -->
|
||||
<update id="clearMoneyUserIdByMoneyUserIds">
|
||||
UPDATE emis_customer_user
|
||||
SET money_user_id = NULL
|
||||
WHERE money_user_id IN
|
||||
<foreach collection="moneyUserIds" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
AND del_flag = '0'
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
222
emis-biz/src/main/resources/mapper/EmisMoneyUserMapper.xml
Normal file
222
emis-biz/src/main/resources/mapper/EmisMoneyUserMapper.xml
Normal file
@ -0,0 +1,222 @@
|
||||
<?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.xdadan.erp.emis.mapper.EmisMoneyUserMapper">
|
||||
|
||||
<resultMap type="EmisMoneyUser" id="EmisMoneyUserResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="company" column="company"/>
|
||||
<result property="payee" column="payee"/>
|
||||
<result property="salesmen" column="salesmen"/>
|
||||
<result property="salesSupport" column="sales_support"/>
|
||||
<result property="salesExecutive" column="sales_executive"/>
|
||||
<result property="enterpriseName" column="enterprise_name"/>
|
||||
<result property="enterpriseTaxId" column="enterprise_tax_id"/>
|
||||
<result property="status" column="status"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="selectLastOrderTimeByMoneyCode" parameterType="String" resultType="date">
|
||||
select send_date from emis_waybill where customer_code=#{code} order by send_date desc limit 1;
|
||||
</select>
|
||||
|
||||
|
||||
<sql id="selectEmisMoneyUserVo">
|
||||
select
|
||||
a.id,
|
||||
a.company,
|
||||
a.payee,
|
||||
a.salesmen,
|
||||
a.sales_support,
|
||||
a.sales_executive,
|
||||
a.enterprise_name,
|
||||
a.enterprise_tax_id,
|
||||
a.status,
|
||||
a.remark,
|
||||
a.del_flag,
|
||||
a.create_by,
|
||||
a.create_time,
|
||||
a.update_by,
|
||||
a.update_time,
|
||||
a.create_site,
|
||||
a.update_site
|
||||
from emis_money_user a
|
||||
</sql>
|
||||
|
||||
<!-- or FIND_IN_SET(#{ownerSite},biz_site)-->
|
||||
<select id="selectEmisMoneyUserList" parameterType="EmisMoneyUser" resultMap="EmisMoneyUserResult">
|
||||
<include refid="selectEmisMoneyUserVo"/>
|
||||
<where>
|
||||
a.del_flag='0'
|
||||
|
||||
<if test="id != null "> and a.id = #{id}</if>
|
||||
|
||||
<if test="company != null and company != ''"> and a.company like concat('%', #{company}, '%')</if>
|
||||
<if test="enterpriseName != null and enterpriseName != ''"> and a.enterprise_name like concat('%', #{enterpriseName}, '%')</if>
|
||||
<if test="enterpriseTaxId != null and enterpriseTaxId != ''"> and a.enterprise_tax_id like concat('%', #{enterpriseTaxId}, '%')</if>
|
||||
<if test="status != null and status != ''"> and a.status=#{status}</if>
|
||||
<if test="remark != null and remark != ''"> and a.remark like concat('%', #{remark}, '%')</if>
|
||||
<if test="delFlag != null and delFlag != ''"> and a.del_flag like concat('%', #{delFlag}, '%')</if>
|
||||
<if test="createBy != null and createBy != ''"> and a.create_by like concat('%', #{createBy}, '%')</if>
|
||||
<if test="createTime != null "> and a.create_time = #{createTime}</if>
|
||||
<if test="updateBy != null and updateBy != ''"> and a.update_by like concat('%', #{updateBy}, '%')</if>
|
||||
<if test="updateTime != null "> and a.update_time = #{updateTime}</if>
|
||||
<if test="createSite != null and createSite != ''"> and a.create_site like concat('%', #{createSite}, '%')</if>
|
||||
<if test="updateSite != null and updateSite != ''"> and a.update_site like concat('%', #{updateSite}, '%')</if>
|
||||
<if test="salesSupport != null and salesSupport != ''"> and a.sales_support = #{salesSupport}</if>
|
||||
<if test="salesExecutive != null and salesExecutive != ''"> and a.sales_executive = #{salesExecutive}</if>
|
||||
<!-- <if test="searchValue != null and searchValue != ''">-->
|
||||
<!-- and ( a.customer_name like concat('%',#{searchValue}, '%') or a.customer_code like concat('%',#{searchValue}, '%') or a.company like concat('%',#{searchValue}, '%') or a.phone like concat('%',#{searchValue}, '%') )-->
|
||||
<!-- </if>-->
|
||||
<if test="params.customerCode != null and params.customerCode != ''">
|
||||
and exists (select 1 from emis_customer_user rel where rel.del_flag='0' AND rel.bl_open='1' AND a.id=rel.money_user_id AND rel.customer_code=#{params.customerCode})
|
||||
|
||||
</if>
|
||||
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
|
||||
and (
|
||||
a.salesmen=#{params.privEmpName}
|
||||
or a.payee=#{params.privEmpName}
|
||||
or exists (select 1 from emis_salesmen_rel rel where rel.del_flag='0' AND rel.bl_open='1' AND a.salesmen=rel.salesmen AND rel.sales_ass=#{params.privEmpName})
|
||||
)
|
||||
|
||||
</if>
|
||||
|
||||
<choose>
|
||||
<when test="payee != null and payee != '' and salesmen != null and salesmen != ''">
|
||||
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
|
||||
and (a.payee=#{payee} or a.salesmen=#{salesmen})
|
||||
</if>
|
||||
</when>
|
||||
<otherwise>
|
||||
<if test="payee != null and payee != ''"> and a.payee=#{payee}</if>
|
||||
<if test="salesmen != null and salesmen != ''"> and a.salesmen=#{salesmen}</if>
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
|
||||
</where>
|
||||
order by a.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectEmisMoneyUserById" parameterType="Long" resultMap="EmisMoneyUserResult">
|
||||
select id, company, payee, salesmen, sales_support, sales_executive, enterprise_name, enterprise_tax_id, status,
|
||||
remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||
from emis_money_user a
|
||||
where a.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectEmisMoneyUserByCompany" parameterType="string" resultMap="EmisMoneyUserResult">
|
||||
select id, company, payee, salesmen, sales_support, sales_executive, enterprise_name, enterprise_tax_id, status,
|
||||
remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||
from emis_money_user a
|
||||
where a.del_flag='0' and a.company = #{company}
|
||||
</select>
|
||||
|
||||
<insert id="insertEmisMoneyUser" parameterType="EmisMoneyUser" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into emis_money_user
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="company != null and company != ''">company,</if>
|
||||
<if test="payee != null and payee != ''">payee,</if>
|
||||
<if test="salesmen != null and salesmen != ''">salesmen,</if>
|
||||
<if test="salesSupport != null and salesSupport != ''">sales_support,</if>
|
||||
<if test="salesExecutive != null and salesExecutive != ''">sales_executive,</if>
|
||||
<if test="enterpriseName != null and enterpriseName != ''">enterprise_name,</if>
|
||||
<if test="enterpriseTaxId != null and enterpriseTaxId != ''">enterprise_tax_id,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
<if test="delFlag != null and delFlag != ''">del_flag,</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="createSite != null and createSite != ''">create_site,</if>
|
||||
<if test="updateSite != null and updateSite != ''">update_site,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="company != null and company != ''">#{company},</if>
|
||||
<if test="payee != null and payee != ''">#{payee},</if>
|
||||
<if test="salesmen != null and salesmen != ''">#{salesmen},</if>
|
||||
<if test="salesSupport != null and salesSupport != ''">#{salesSupport},</if>
|
||||
<if test="salesExecutive != null and salesExecutive != ''">#{salesExecutive},</if>
|
||||
<if test="enterpriseName != null and enterpriseName != ''">#{enterpriseName},</if>
|
||||
<if test="enterpriseTaxId != null and enterpriseTaxId != ''">#{enterpriseTaxId},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
<if test="delFlag != null and delFlag != ''">#{delFlag},</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="createSite != null and createSite != ''">#{createSite},</if>
|
||||
<if test="updateSite != null and updateSite != ''">#{updateSite},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateEmisMoneyUser" parameterType="EmisMoneyUser">
|
||||
update emis_money_user
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="company != null and company != ''">company = #{company},</if>
|
||||
<if test="payee != null and payee != ''">payee = #{payee},</if>
|
||||
<if test="salesmen != null and salesmen != ''">salesmen = #{salesmen},</if>
|
||||
<if test="salesSupport != null and salesSupport != ''">sales_support = #{salesSupport},</if>
|
||||
<if test="salesExecutive != null and salesExecutive != ''">sales_executive = #{salesExecutive},</if>
|
||||
<if test="enterpriseName != null and enterpriseName != ''">enterprise_name = #{enterpriseName},</if>
|
||||
<if test="enterpriseTaxId != null and enterpriseTaxId != ''">enterprise_tax_id = #{enterpriseTaxId},</if>
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
||||
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</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="createSite != null and createSite != ''">create_site = #{createSite},</if>
|
||||
<if test="updateSite != null and updateSite != ''">update_site = #{updateSite},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="resetMoneyUserPwd" parameterType="EmisMoneyUser">
|
||||
update emis_money_user
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
password = #{password},
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="updateSite != null and updateSite != ''">update_site = #{updateSite},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
|
||||
<delete id="deleteEmisMoneyUserById" parameterType="Long">
|
||||
update emis_money_user set del_flag='1' where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteEmisMoneyUserByIds" parameterType="String">
|
||||
update emis_money_user set del_flag='1' where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
<select id="selectMaxMoneyCode" parameterType="String" resultType="Long">
|
||||
select CONCAT(CONVERT(max(customer_code),SIGNED)+1,'') as code
|
||||
from emis_money_user
|
||||
</select>
|
||||
|
||||
<select id="selectMoneyUserByCompany" parameterType="string" resultMap="EmisMoneyUserResult">
|
||||
select id, company, payee, salesmen, sales_support, sales_executive, enterprise_name, enterprise_tax_id, status,
|
||||
remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||
from emis_money_user a
|
||||
where a.del_flag='0' and a.company = #{company}
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insertSysOmsUserRole" parameterType="Long">
|
||||
insert into sys_oms_user_role(user_id,role_id)
|
||||
select #{userId},127 from dual
|
||||
where not exists (select 1 from sys_oms_user_role where user_id=#{userId} and role_id=127)
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue
Block a user