代码更新完善
parent
5c92217351
commit
7b8760b43a
@ -0,0 +1,58 @@
|
||||
package com.glxp.api.dao.auth;
|
||||
|
||||
|
||||
import com.glxp.api.entity.auth.AuthRoleAdmin;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Mapper
|
||||
public interface AuthRoleAdminDao {
|
||||
|
||||
// /**
|
||||
// * 根据 adminId 查询
|
||||
// *
|
||||
// * @param adminId 传入的 adminId
|
||||
// * @return
|
||||
// */
|
||||
// List<AuthRoleAdmin> listByAdminId(Long adminId);
|
||||
//
|
||||
// /**
|
||||
// * 根据 多个 adminId 查询
|
||||
// *
|
||||
// * @param adminIds 传入的 adminIds
|
||||
// * @return
|
||||
// */
|
||||
// List<AuthRoleAdmin> listByAdminIdIn(List<Long> adminIds);
|
||||
//
|
||||
// /**
|
||||
// * 根据 role_id 查询 admin_id
|
||||
// *
|
||||
// * @param roleId 传入的 roleId
|
||||
// * @return
|
||||
// */
|
||||
// List<AuthRoleAdmin> listByRoleId(Long roleId);
|
||||
//
|
||||
// /**
|
||||
// * 批量插入
|
||||
// *
|
||||
// * @param authRoleAdminList
|
||||
// * @return
|
||||
// */
|
||||
// int insertAuthRoleAdminAll(List<AuthRoleAdmin> authRoleAdminList);
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 根据 adminId 删除
|
||||
// *
|
||||
// * @param adminId
|
||||
// * @return
|
||||
// */
|
||||
// boolean deleteByAdminId(Long adminId);
|
||||
|
||||
boolean updateAuthRoleAdmin(AuthRoleAdmin authRoleAdmin);
|
||||
|
||||
//
|
||||
// List<AuthRole> listAdminRole(Long adminId);
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package com.glxp.api.dao.basic;
|
||||
|
||||
|
||||
import com.glxp.api.dao.BaseMapperPlus;
|
||||
import com.glxp.api.entity.basic.BasicCorpEntity;
|
||||
import com.glxp.api.req.basic.BasicUnitMaintainFilterRequest;
|
||||
|
||||
import com.glxp.api.res.thrsys.ThrUnitMaintainResponse;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface BasicCorpDao extends BaseMapperPlus<BasicCorpDao, BasicCorpEntity, BasicCorpEntity> {
|
||||
List<BasicCorpEntity> filterList(BasicUnitMaintainFilterRequest basicUnitMaintainFilterRequest);
|
||||
|
||||
boolean insertBasicUnitMaintain(BasicCorpEntity basicUnitMaintainEntity);
|
||||
|
||||
boolean insertThrUnitMaintainignore(ThrUnitMaintainResponse thrUnitMaintainResponse);
|
||||
|
||||
int insertEntity(BasicCorpEntity basicUnitMaintainEntity);
|
||||
|
||||
int updateEntityById(BasicCorpEntity basicUnitMaintainSaveRequest);
|
||||
|
||||
BasicCorpEntity selectByThirdId(BasicUnitMaintainFilterRequest basicUnitMaintainFilterRequest);
|
||||
|
||||
boolean deleteById(@Param("id") String id);
|
||||
|
||||
BasicCorpEntity selectEntityById(@Param("id") String id);
|
||||
|
||||
List<BasicCorpEntity> batchSelectByIds(@Param("ids") List<Integer> id);
|
||||
|
||||
List<BasicCorpEntity> batchSelectByErpIds(@Param("erpIds") List<String> erpIds);
|
||||
|
||||
BasicCorpEntity selectByName(@Param("name") String name);
|
||||
|
||||
|
||||
boolean importBasicUnitMaintain(BasicCorpEntity basicUnitMaintainEntity);
|
||||
|
||||
List<BasicCorpEntity> batchSelectByErpIdsAndName(@Param("erpIds") List<String> erpIds, @Param("name") String name);
|
||||
|
||||
/**
|
||||
* 根据往来单位名称和社会信用号查询列表
|
||||
*
|
||||
* @param name
|
||||
* @param creditNo
|
||||
* @return
|
||||
*/
|
||||
List<BasicCorpEntity> selectByNameAndCreditNo(@Param("name") String name, @Param("creditNo") String creditNo);
|
||||
|
||||
/**
|
||||
* 根据erpId查询往来单位信息
|
||||
*
|
||||
* @param erpId
|
||||
* @return
|
||||
*/
|
||||
BasicCorpEntity selectByErpId(@Param("erpId") String erpId);
|
||||
|
||||
/**
|
||||
* 根据erpId查询往来单位名称
|
||||
*
|
||||
* @param supId
|
||||
* @return
|
||||
*/
|
||||
String selectNameByErpId(@Param("supId") String supId);
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.glxp.api.entity.auth;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户角色对应表
|
||||
*/
|
||||
@Data
|
||||
public class AuthRoleAdmin {
|
||||
private Long role_id;
|
||||
private Long user_id;
|
||||
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package com.glxp.api.res.thrsys;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class ThrUnitMaintainResponse {
|
||||
|
||||
private Integer id;
|
||||
private String erpId;
|
||||
|
||||
@NotBlank(message = "往来单位名称不能为空!")
|
||||
private String name;
|
||||
private String spell;
|
||||
private String addr;
|
||||
private String status;
|
||||
private String type;
|
||||
|
||||
@NotBlank(message = "社会信用号不能为空!")
|
||||
private String creditNo;
|
||||
private String contact;
|
||||
private String mobile;
|
||||
|
||||
private String thirdId;
|
||||
private String thirdId1;
|
||||
private String thirdId2;
|
||||
private String thirdId3;
|
||||
private String thirdId4;
|
||||
|
||||
private String thirdName;
|
||||
private String thirdName1;
|
||||
private String thirdName2;
|
||||
private String thirdName3;
|
||||
private String thirdName4;
|
||||
|
||||
private String createUser;
|
||||
private Date createTime;
|
||||
private String updateUser;
|
||||
private Date updateTime;
|
||||
private String remark;
|
||||
private Integer corpType;
|
||||
|
||||
private Integer outType;
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.glxp.api.service.auth;
|
||||
|
||||
|
||||
import com.glxp.api.entity.auth.AuthRoleAdmin;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface AuthRoleAdminService {
|
||||
|
||||
// List<AuthRoleAdmin> listByAdminId(Long adminId);
|
||||
//
|
||||
// List<AuthRoleAdmin> listByAdminIdIn(List<Long> adminIds);
|
||||
//
|
||||
// List<AuthRoleAdmin> listByRoleId(Long roleId);
|
||||
//
|
||||
// int insertAuthRoleAdminAll(List<AuthRoleAdmin> authRoleAdminList);
|
||||
//
|
||||
// int insertRolesAdminIdAll(List<Long> roles, Long adminId);
|
||||
//
|
||||
// boolean deleteByAdminId(Long adminId);
|
||||
boolean updateAuthRoleAdmin(AuthRoleAdmin authRoleAdmin);
|
||||
|
||||
// List<AuthRole> listAdminRole(Long adminId);
|
||||
}
|
@ -0,0 +1,122 @@
|
||||
package com.glxp.api.service.auth.impl;
|
||||
|
||||
import com.glxp.api.dao.auth.AuthRoleAdminDao;
|
||||
|
||||
import com.glxp.api.entity.auth.AuthRoleAdmin;
|
||||
import com.glxp.api.service.auth.AuthRoleAdminService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class AuthRoleAdminServiceImpl implements AuthRoleAdminService {
|
||||
|
||||
@Resource
|
||||
private AuthRoleAdminDao authRoleAdminDao;
|
||||
|
||||
// /**
|
||||
// * 根据 adminid 获取角色id
|
||||
// *
|
||||
// * @param adminId
|
||||
// * @return
|
||||
// */
|
||||
// @Override
|
||||
// public List<AuthRoleAdmin> listByAdminId(Long adminId) {
|
||||
// return authRoleAdminDao.listByAdminId(adminId);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 根据多个 adminId 查询角色列表
|
||||
// *
|
||||
// * @param adminIds
|
||||
// * @return
|
||||
// */
|
||||
// @Override
|
||||
// public List<AuthRoleAdmin> listByAdminIdIn(List<Long> adminIds) {
|
||||
// if (adminIds.isEmpty()) {
|
||||
// return Collections.emptyList();
|
||||
// }
|
||||
// return authRoleAdminDao.listByAdminIdIn(adminIds);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 根据 roleId 获取 管理员id
|
||||
// *
|
||||
// * @param roleId
|
||||
// * @return
|
||||
// */
|
||||
// @Override
|
||||
// public List<AuthRoleAdmin> listByRoleId(Long roleId) {
|
||||
// return authRoleAdminDao.listByRoleId(roleId);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 批量插入
|
||||
// *
|
||||
// * @param authRoleAdminList
|
||||
// * @return
|
||||
// */
|
||||
// @Override
|
||||
// public int insertAuthRoleAdminAll(List<AuthRoleAdmin> authRoleAdminList) {
|
||||
//
|
||||
// if (authRoleAdminList == null || authRoleAdminList.isEmpty()) {
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// return authRoleAdminDao.insertAuthRoleAdminAll(authRoleAdminList);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 根据 角色ids 和 管理员 adminId 批量插入
|
||||
// *
|
||||
// * @param roles
|
||||
// * @param adminId
|
||||
// * @return
|
||||
// */
|
||||
// @Override
|
||||
// public int insertRolesAdminIdAll(List<Long> roles, Long adminId) {
|
||||
//
|
||||
// List<AuthRoleAdmin> authRoleAdminList = roles.stream().map(aLong -> {
|
||||
// AuthRoleAdmin authRoleAdmin = new AuthRoleAdmin();
|
||||
// authRoleAdmin.setRole_id(aLong);
|
||||
// authRoleAdmin.setUser_id(adminId);
|
||||
// return authRoleAdmin;
|
||||
// }).collect(Collectors.toList());
|
||||
// if (!authRoleAdminList.isEmpty()) {
|
||||
// return insertAuthRoleAdminAll(authRoleAdminList);
|
||||
// }
|
||||
//
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 根据 adminId 删除对应的权限
|
||||
// *
|
||||
// * @param adminId
|
||||
// * @return
|
||||
// */
|
||||
// @Override
|
||||
// public boolean deleteByAdminId(Long adminId) {
|
||||
//
|
||||
//// // 删除之前缓存权限规则
|
||||
//// String aarKey = String.format(CacheConstant.ADMIN_AUTH_RULES, adminId);
|
||||
//// CacheUtils.delete(aarKey);
|
||||
//
|
||||
// return authRoleAdminDao.deleteByAdminId(adminId);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean updateAuthRoleAdmin(AuthRoleAdmin authRoleAdmin) {
|
||||
return authRoleAdminDao.updateAuthRoleAdmin(authRoleAdmin);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public List<AuthRole> listAdminRole(Long adminId) {
|
||||
// return authRoleAdminDao.listAdminRole(adminId);
|
||||
// }
|
||||
}
|
@ -0,0 +1,153 @@
|
||||
package com.glxp.api.service.basic.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.glxp.api.dao.basic.BasicCorpDao;
|
||||
import com.glxp.api.entity.basic.BasicCorpEntity;
|
||||
import com.glxp.api.req.basic.BasicUnitMaintainFilterRequest;
|
||||
import com.glxp.api.res.thrsys.ThrUnitMaintainResponse;
|
||||
import com.glxp.api.service.basic.BasicCorpService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class BasicCorpServiceImpl extends ServiceImpl<BasicCorpDao, BasicCorpEntity> implements BasicCorpService {
|
||||
|
||||
@Resource
|
||||
BasicCorpDao basicCorpDao;
|
||||
|
||||
@Override
|
||||
public List<BasicCorpEntity> filterList(BasicUnitMaintainFilterRequest basicUnitMaintainFilterRequest) {
|
||||
if (basicUnitMaintainFilterRequest == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (basicUnitMaintainFilterRequest.getPage() != null) {
|
||||
int offset = (basicUnitMaintainFilterRequest.getPage() - 1) * basicUnitMaintainFilterRequest.getLimit();
|
||||
PageHelper.offsetPage(offset, basicUnitMaintainFilterRequest.getLimit());
|
||||
}
|
||||
|
||||
List<BasicCorpEntity> data = basicCorpDao.filterList(basicUnitMaintainFilterRequest);
|
||||
return data;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public boolean insertThrUnitMaintainignore(ThrUnitMaintainResponse thrUnitMaintainResponse) {
|
||||
// thrUnitMaintainResponse.setUpdateTime(new Date());
|
||||
// return basicCorpDao.insertThrUnitMaintainignore(thrUnitMaintainResponse);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean insertBasicUnitMaintain(BasicCorpEntity basicUnitMaintainEntity) {
|
||||
return basicCorpDao.insertBasicUnitMaintain(basicUnitMaintainEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insert(BasicCorpEntity basicUnitMaintainEntity) {
|
||||
return basicCorpDao.insert(basicUnitMaintainEntity) == 0 ? false : true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateById(BasicCorpEntity basicUnitMaintainSaveRequest) {
|
||||
basicUnitMaintainSaveRequest.setUpdateTime(new Date());
|
||||
return basicCorpDao.updateEntityById(basicUnitMaintainSaveRequest) == 0 ? false : true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteById(String id) {
|
||||
return basicCorpDao.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasicCorpEntity selectByThirdId(String thirdId, String thirdSys) {
|
||||
|
||||
|
||||
BasicUnitMaintainFilterRequest filterUdiInfoRequest = new BasicUnitMaintainFilterRequest();
|
||||
if ("thirdId".equals(thirdSys)) {
|
||||
filterUdiInfoRequest.setThirdId(thirdId);
|
||||
} else if ("thirdId1".equals(thirdSys)) {
|
||||
filterUdiInfoRequest.setThirdId1(thirdId);
|
||||
} else if ("thirdId2".equals(thirdSys)) {
|
||||
filterUdiInfoRequest.setThirdId2(thirdId);
|
||||
} else if ("thirdId3".equals(thirdSys)) {
|
||||
filterUdiInfoRequest.setThirdId3(thirdId);
|
||||
} else if ("thirdId4".equals(thirdSys)) {
|
||||
filterUdiInfoRequest.setThirdId4(thirdId);
|
||||
}
|
||||
return basicCorpDao.selectByThirdId(filterUdiInfoRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BasicCorpEntity> batchSelectByIds(List<Integer> ids) {
|
||||
return basicCorpDao.batchSelectByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BasicCorpEntity> batchSelectByErpIds(List<String> erpIds) {
|
||||
return basicCorpDao.batchSelectByErpIds(erpIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BasicCorpEntity> batchSelectByErpIdsAndName(List<String> erpIds, String name) {
|
||||
return basicCorpDao.batchSelectByErpIdsAndName(erpIds, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean verifyExists(BasicCorpEntity basicCorpEntity) {
|
||||
List<BasicCorpEntity> list = basicCorpDao.selectByNameAndCreditNo(basicCorpEntity.getName(), basicCorpEntity.getCreditNo());
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
if (null != basicCorpEntity.getId()) {
|
||||
for (BasicCorpEntity corpEntity : list) {
|
||||
if (!Objects.equals(corpEntity.getId(), basicCorpEntity.getId())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasicCorpEntity selectById(String id) {
|
||||
return basicCorpDao.selectEntityById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasicCorpEntity selectByErpId(String id) {
|
||||
if (id == null) {
|
||||
return null;
|
||||
}
|
||||
BasicUnitMaintainFilterRequest filterUdiInfoRequest = new BasicUnitMaintainFilterRequest();
|
||||
filterUdiInfoRequest.setErpId(id);
|
||||
List<BasicCorpEntity> basicUnitMaintainEntities = basicCorpDao.filterList(filterUdiInfoRequest);
|
||||
if (basicUnitMaintainEntities != null && basicUnitMaintainEntities.size() > 0)
|
||||
return basicUnitMaintainEntities.get(0);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasicCorpEntity selectByName(String name) {
|
||||
return basicCorpDao.selectByName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isExit() {
|
||||
BasicUnitMaintainFilterRequest filterUdiInfoRequest = new BasicUnitMaintainFilterRequest();
|
||||
filterUdiInfoRequest.setPage(1);
|
||||
filterUdiInfoRequest.setLimit(1);
|
||||
List<BasicCorpEntity> data = filterList(filterUdiInfoRequest);
|
||||
if (data != null && data.size() > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
<?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.glxp.api.dao.auth.AuthRoleAdminDao">
|
||||
|
||||
<!-- <select id="listByAdminId" resultType="com.glxp.api.entity.auth.AuthRoleAdmin">-->
|
||||
<!-- SELECT role_id-->
|
||||
<!-- FROM auth_user_role-->
|
||||
<!-- where user_id = #{adminId}-->
|
||||
<!-- </select>-->
|
||||
|
||||
<!-- <select id="listAdminRole" resultType="com.glxp.api.entity.auth.AuthRole">-->
|
||||
<!-- select * from auth_role INNER JOIN auth_user_role on auth_role.id = auth_user_role.role_id-->
|
||||
<!-- WHERE auth_user_role.user_id = #{adminId};-->
|
||||
<!-- </select>-->
|
||||
|
||||
<!-- <select id="listByAdminIdIn" resultType="com.glxp.api.entity.auth.AuthRoleAdmin">-->
|
||||
<!-- SELECT *-->
|
||||
<!-- FROM auth_user_role-->
|
||||
<!-- where user_id in-->
|
||||
<!-- <foreach collection="list" item="id" index="index" open="(" close=")" separator=",">-->
|
||||
<!-- #{id}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- </select>-->
|
||||
|
||||
<!-- <select id="listByRoleId" resultType="com.glxp.api.entity.auth.AuthRoleAdmin">-->
|
||||
<!-- SELECT admin_id-->
|
||||
<!-- FROM auth_user_role-->
|
||||
<!-- where role_id = #{roleId}-->
|
||||
<!-- </select>-->
|
||||
|
||||
<!-- <insert id="insertAuthRoleAdminAll">-->
|
||||
<!-- INSERT INTO auth_user_role-->
|
||||
<!-- (user_id,role_id)-->
|
||||
<!-- VALUES-->
|
||||
<!-- <foreach collection="list" item="item" separator=",">-->
|
||||
<!-- <if test="item.role_id != null and item.user_id != null">-->
|
||||
<!-- (#{item.user_id}, #{item.role_id})-->
|
||||
<!-- </if>-->
|
||||
<!-- </foreach>-->
|
||||
<!-- </insert>-->
|
||||
|
||||
<!-- <delete id="deleteByAdminId" parameterType="java.lang.Long">-->
|
||||
<!-- delete from auth_user_role where user_id = #{adminId}-->
|
||||
<!-- </delete>-->
|
||||
|
||||
|
||||
<update id="updateAuthRoleAdmin" parameterType="com.glxp.api.entity.auth.AuthRoleAdmin">
|
||||
UPDATE auth_user_role
|
||||
<set>
|
||||
<if test="role_id != null">
|
||||
role_id=#{role_id},
|
||||
</if>
|
||||
</set>
|
||||
WHERE user_id = #{user_id}
|
||||
</update>
|
||||
</mapper>
|
@ -0,0 +1,318 @@
|
||||
<?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.glxp.api.dao.basic.BasicCorpDao">
|
||||
|
||||
<select id="filterList" parameterType="com.glxp.api.req.basic.BasicUnitMaintainFilterRequest"
|
||||
resultType="com.glxp.api.entity.basic.BasicCorpEntity">
|
||||
SELECT * FROM basic_corp
|
||||
<where>
|
||||
<if test="key != '' and key!=null">
|
||||
and
|
||||
( name like concat('%',#{key},'%')
|
||||
or spell like concat('%',#{key},'%')
|
||||
or erpId like concat('%',#{key},'%')
|
||||
or creditNo like concat('%',#{key},'%')
|
||||
or thirdId like concat('%',#{key},'%')
|
||||
or thirdId1 like concat('%',#{key},'%')
|
||||
or thirdId2 like concat('%',#{key},'%')
|
||||
or thirdId3 like concat('%',#{key},'%')
|
||||
or thirdId4 like concat('%',#{key},'%')
|
||||
or addr like concat('%',#{key},'%')
|
||||
)
|
||||
</if>
|
||||
<if test="id != '' and id != null">
|
||||
AND id = #{id}
|
||||
</if>
|
||||
<if test="unitId != '' and unitId != null">
|
||||
AND unitId = #{unitId}
|
||||
</if>
|
||||
<if test="erpId != '' and erpId != null">
|
||||
AND erpId = #{erpId}
|
||||
</if>
|
||||
<if test="corpType != null">
|
||||
AND corpType = #{corpType}
|
||||
</if>
|
||||
<if test="outType != null">
|
||||
AND ( outType <![CDATA[ <> ]]> #{outType} or outType is NULL)
|
||||
</if>
|
||||
<if test="lastUpdateTime!=null and lastUpdateTime!=''">
|
||||
<![CDATA[ and DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%S')>= DATE_FORMAT(#{lastUpdateTime}, '%Y-%m-%d %H:%i:%S') ]]>
|
||||
</if>
|
||||
<if test="name != '' and name != null">
|
||||
AND name = #{name}
|
||||
</if>
|
||||
</where>
|
||||
order by updateTime desc
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectByThirdId" parameterType="com.glxp.api.req.basic.BasicUnitMaintainFilterRequest"
|
||||
resultType="com.glxp.api.entity.basic.BasicCorpEntity">
|
||||
select * FROM basic_corp
|
||||
<where>
|
||||
<if test="thirdId != '' and thirdId != null">
|
||||
AND thirdId = #{thirdId}
|
||||
</if>
|
||||
<if test="thirdId1 != '' and thirdId1 != null">
|
||||
AND thirdId1 = #{thirdId1}
|
||||
</if>
|
||||
<if test="thirdId2 != '' and thirdId2 != null">
|
||||
AND thirdId2 = #{thirdId2}
|
||||
</if>
|
||||
<if test="thirdId3 != '' and thirdId3 != null">
|
||||
AND thirdId3 = #{thirdId3}
|
||||
</if>
|
||||
<if test="thirdId4 != '' and thirdId4 != null">
|
||||
AND thirdId4 = #{thirdId4}
|
||||
</if>
|
||||
<if test="corpType != null">
|
||||
AND corpType = #{corpType}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
limit 1
|
||||
</select>
|
||||
<insert id="insertBasicUnitMaintain"
|
||||
parameterType="com.glxp.api.entity.basic.BasicCorpEntity">
|
||||
REPLACE
|
||||
INTO basic_corp
|
||||
(thirdId,erpId,name,spell,
|
||||
addr,status,type,creditNo,contact,mobile,thirdId1,thirdId2,thirdId3,thirdId4,
|
||||
thirdName,thirdName1,thirdName2,thirdName3,thirdName4,updateTime,corpType,outType,createUser,createTime,updateUser,remark)
|
||||
values
|
||||
(
|
||||
#{thirdId},
|
||||
#{erpId},
|
||||
#{name},
|
||||
#{spell},
|
||||
#{addr},
|
||||
#{status},
|
||||
#{type},
|
||||
#{creditNo},
|
||||
#{contact},
|
||||
#{mobile},
|
||||
#{thirdId1},
|
||||
#{thirdId2},
|
||||
#{thirdId3},
|
||||
#{thirdId4},
|
||||
#{thirdName},
|
||||
#{thirdName1},
|
||||
#{thirdName2},
|
||||
#{thirdName3},
|
||||
#{thirdName4},
|
||||
#{updateTime},
|
||||
#{corpType},
|
||||
#{outType},
|
||||
#{createUser},
|
||||
#{createTime},
|
||||
#{updateUser},
|
||||
#{remark}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertThrUnitMaintainignore" keyProperty="id"
|
||||
parameterType="com.glxp.api.res.thrsys.ThrUnitMaintainResponse">
|
||||
insert
|
||||
ignore
|
||||
INTO basic_corp
|
||||
(thirdId,erpId,name,spell,
|
||||
addr,status,type,creditNo,contact,mobile,thirdId1,thirdId2,thirdId3,thirdId4,
|
||||
thirdName,thirdName1,thirdName2,thirdName3,thirdName4,updateTime,corpType,outType,createUser,createTime,updateUser,remark)
|
||||
values
|
||||
(
|
||||
#{thirdId},
|
||||
#{erpId},
|
||||
#{name},
|
||||
#{spell},
|
||||
#{addr},
|
||||
#{status},
|
||||
#{type},
|
||||
#{creditNo},
|
||||
#{contact},
|
||||
#{mobile},
|
||||
#{thirdId1},
|
||||
#{thirdId2},
|
||||
#{thirdId3},
|
||||
#{thirdId4},
|
||||
#{thirdName},
|
||||
#{thirdName1},
|
||||
#{thirdName2},
|
||||
#{thirdName3},
|
||||
#{thirdName4},
|
||||
#{updateTime},
|
||||
#{corpType},
|
||||
#{outType},
|
||||
#{createUser},
|
||||
#{createTime},
|
||||
#{updateUser},
|
||||
#{remark}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertEntity" parameterType="com.glxp.api.entity.basic.BasicCorpEntity">
|
||||
insert INTO basic_corp(thirdId, erpId, name, spell, addr,
|
||||
status, type, creditNo, contact, mobile, thirdId1, thirdId2, thirdId3, thirdId4,
|
||||
thirdName, thirdName1, thirdName2, thirdName3, thirdName4, updateTime, corpType, outType,createUser,createTime,updateUser,remark)
|
||||
values (#{thirdId},
|
||||
#{erpId},
|
||||
#{name},
|
||||
#{spell},
|
||||
#{addr},
|
||||
#{status},
|
||||
#{type},
|
||||
#{creditNo},
|
||||
#{contact},
|
||||
#{mobile},
|
||||
#{thirdId1}, #{thirdId2}, #{thirdId3}, #{thirdId4},
|
||||
#{thirdName}, #{thirdName1}, #{thirdName2}, #{thirdName3}, #{thirdName4}, #{updateTime}, #{corpType},
|
||||
#{outType},#{createUser},
|
||||
#{createTime},
|
||||
#{updateUser},
|
||||
#{remark})
|
||||
</insert>
|
||||
|
||||
|
||||
<update id="updateEntityById" parameterType="com.glxp.api.entity.basic.BasicCorpEntity">
|
||||
UPDATE basic_corp
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<if test="thirdId != null">thirdId=#{thirdId},</if>
|
||||
<if test="erpId != null">erpId=#{erpId},</if>
|
||||
<if test="name != null">name=#{name},</if>
|
||||
<if test="spell != null">spell=#{spell},</if>
|
||||
<if test="addr != null">addr=#{addr},</if>
|
||||
<if test="status != null">status=#{status},</if>
|
||||
<if test="type != null">type=#{type},</if>
|
||||
<if test="creditNo != null">creditNo=#{creditNo},</if>
|
||||
<if test="contact != null">contact=#{contact},</if>
|
||||
<if test="mobile != null">mobile=#{mobile},</if>
|
||||
<if test="thirdId1 != null">thirdId1=#{thirdId1},</if>
|
||||
<if test="thirdId2 != null">thirdId2=#{thirdId2},</if>
|
||||
<if test="thirdId3 != null">thirdId3=#{thirdId3},</if>
|
||||
<if test="thirdId4 != null">thirdId4=#{thirdId4},</if>
|
||||
<if test="thirdName != null">thirdName=#{thirdName},</if>
|
||||
<if test="thirdName1 != null">thirdName1=#{thirdName1},</if>
|
||||
<if test="thirdName2 != null">thirdName2=#{thirdName2},</if>
|
||||
<if test="thirdName3 != null">thirdName3=#{thirdName3},</if>
|
||||
<if test="thirdName4 != null">thirdName4=#{thirdName4},</if>
|
||||
<if test="updateTime != null">updateTime=#{updateTime},</if>
|
||||
<if test="corpType != null">corpType=#{corpType},</if>
|
||||
<if test="outType != null">outType=#{outType},</if>
|
||||
<if test="createUser != null">createUser=#{createUser},</if>
|
||||
<if test="createTime != null">createTime=#{createTime},</if>
|
||||
<if test="updateUser != null">updateUser=#{updateUser},</if>
|
||||
<if test="remark != null">remark=#{remark},</if>
|
||||
</trim>
|
||||
WHERE id=#{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteById" parameterType="Map">
|
||||
DELETE
|
||||
FROM basic_corp
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
|
||||
<select id="selectEntityById" parameterType="Map" resultType="com.glxp.api.entity.basic.BasicCorpEntity">
|
||||
select *
|
||||
FROM basic_corp
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="batchSelectByIds" resultType="com.glxp.api.entity.basic.BasicCorpEntity">
|
||||
select *
|
||||
from basic_corp where id in
|
||||
<foreach collection="ids" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="batchSelectByErpIds" resultType="com.glxp.api.entity.basic.BasicCorpEntity">
|
||||
select *
|
||||
from basic_corp where erpId in
|
||||
<foreach collection="erpIds" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectByName" parameterType="java.lang.String"
|
||||
resultType="com.glxp.api.entity.basic.BasicCorpEntity">
|
||||
SELECT *
|
||||
FROM basic_corp
|
||||
WHERE (name = #{name}) limit 1
|
||||
</select>
|
||||
|
||||
<insert id="importBasicUnitMaintain" >
|
||||
REPLACE
|
||||
INTO basic_corp
|
||||
( thirdId, erpId, `name`, spell,
|
||||
addr, status, `type`, creditNo, contact, mobile, thirdId1, thirdId2, thirdId3, thirdId4,
|
||||
thirdName, thirdName1, thirdName2, thirdName3, thirdName4, updateTime, corpType,outType,createUser,createTime,updateUser,remark)
|
||||
values (
|
||||
#{thirdId},
|
||||
#{erpId},
|
||||
#{name},
|
||||
#{spell},
|
||||
#{addr},
|
||||
#{status},
|
||||
#{type},
|
||||
#{creditNo},
|
||||
#{contact},
|
||||
#{mobile},
|
||||
#{thirdId1},
|
||||
#{thirdId2},
|
||||
#{thirdId3},
|
||||
#{thirdId4},
|
||||
#{thirdName},
|
||||
#{thirdName1},
|
||||
#{thirdName2},
|
||||
#{thirdName3},
|
||||
#{thirdName4},
|
||||
#{updateTime},
|
||||
#{corpType},
|
||||
#{outType},
|
||||
#{createUser},
|
||||
#{createTime},
|
||||
#{updateUser},
|
||||
#{remark}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<select id="batchSelectByErpIdsAndName" resultType="com.glxp.api.entity.basic.BasicCorpEntity">
|
||||
select *
|
||||
from basic_corp
|
||||
<where>
|
||||
<if test="name != null and name != ''">
|
||||
AND name like concat('%', #{name}, '%')
|
||||
</if>
|
||||
<if test="erpIds != null and erpIds.size() != 0">
|
||||
AND erpId in
|
||||
<foreach collection="erpIds" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectByNameAndCreditNo" resultType="com.glxp.api.entity.basic.BasicCorpEntity">
|
||||
select * from basic_corp
|
||||
<where>
|
||||
<if test="name != null and name != ''">
|
||||
AND name = #{name}
|
||||
</if>
|
||||
<if test="creditNo != null and creditNo != ''">
|
||||
AND creditNo = #{creditNo}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectByErpId" resultType="com.glxp.api.entity.basic.BasicCorpEntity">
|
||||
select * from basic_corp where erpId = #{erpId}
|
||||
</select>
|
||||
|
||||
<select id="selectNameByErpId" resultType="java.lang.String">
|
||||
select name from basic_corp where erpId = #{supId}
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue