Commit 39074881 by guojuxing

协作人对外新增、查询、删除接口

parent 5a8d2d28
......@@ -91,4 +91,22 @@ public interface CollaboratorApiService {
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Void>


 */
ServiceResponse<Void> cancel(Integer collaboratorId);
/**
* 查询主键ID,协作人那边授权跳转,需要主键ID
* @param enterpriseId
* @param phone
* @param appId
* @return
*/
ServiceResponse<Integer> getIdByPhoneAndAppId(Integer enterpriseId, String phone, String appId);
/**
* 删除
* @param enterpriseId
* @param phone
* @param appId
* @return
*/
ServiceResponse<Void> deleteByPhoneAndAppId(Integer enterpriseId, String phone, String appId);
}
......@@ -88,4 +88,10 @@ public interface TabSysCollaboratorMapper {

 */
List<TabSysCollaborator> listNotInCollaboratorIdList(@Param("list") List<Integer> collaboratorIdList,
@Param("search") String search, @Param("enterpriseId") Integer enterpriseId);
TabSysCollaborator getByPhoneAndAppId(@Param("enterpriseId") Integer enterpriseId, @Param("phone") String phone,
@Param("appId") String appId);
void deleteByPhoneAndAppId(@Param("enterpriseId") Integer enterpriseId, @Param("phone") String phone,
@Param("appId") String appId);
}
\ No newline at end of file
......@@ -63,4 +63,8 @@ public interface CollaboratorService {
TabSysCollaborator getById(Integer id);
void update(CollaboratorDTO dto);
TabSysCollaborator getByPhoneAndAppId(Integer enterpriseId, String phone, String appId);
void deleteByPhoneAndAppId(Integer enterpriseId, String phone, String appId);
}
......@@ -58,4 +58,15 @@ public class CollaboratorServiceImpl implements CollaboratorService {
TabSysCollaborator record = EntityUtil.changeEntityNew(TabSysCollaborator.class, dto);
tabSysCollaboratorMapper.updateByPrimaryKeySelective(record);
}
@Override
public TabSysCollaborator getByPhoneAndAppId(Integer enterpriseId, String phone, String appId) {
TabSysCollaborator record = tabSysCollaboratorMapper.getByPhoneAndAppId(enterpriseId, phone, appId);
return record;
}
@Override
public void deleteByPhoneAndAppId(Integer enterpriseId, String phone, String appId) {
tabSysCollaboratorMapper.deleteByPhoneAndAppId(enterpriseId, phone, appId);
}
}
......@@ -11,6 +11,8 @@ import com.gic.enterprise.dto.EnterpriseDTO;
import com.gic.enterprise.service.EnterpriseApiService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -38,6 +40,7 @@ import com.gic.open.api.service.ApplicationSubApiService;
@Service("collaboratorApiService")
public class CollaboratorApiServiceImpl implements CollaboratorApiService {
private static final Logger LOGGER = LogManager.getLogger(CollaboratorApiServiceImpl.class);
@Autowired
private CollaboratorService collaboratorService;
@Autowired
......@@ -206,6 +209,27 @@ public class CollaboratorApiServiceImpl implements CollaboratorApiService {
return ServiceResponse.success();
}
@Override
public ServiceResponse<Integer> getIdByPhoneAndAppId(Integer enterpriseId, String phone, String appId) {
TabSysCollaborator record = collaboratorService.getByPhoneAndAppId(enterpriseId, phone, appId);
if (record == null) {
LOGGER.info("协作人接口getIdByPhoneAndAppId入参数据:{}, {}, {}", enterpriseId, phone, appId);
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "参数有误,查无数据");
}
return ServiceResponse.success(record.getCollaboratorId());
}
@Override
public ServiceResponse<Void> deleteByPhoneAndAppId(Integer enterpriseId, String phone, String appId) {
TabSysCollaborator record = collaboratorService.getByPhoneAndAppId(enterpriseId, phone, appId);
if (record == null) {
LOGGER.info("协作人接口getIdByPhoneAndAppId入参数据:{}, {}, {}", enterpriseId, phone, appId);
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "参数有误,查无数据");
}
collaboratorService.deleteByPhoneAndAppId(enterpriseId, phone, appId);
return ServiceResponse.success();
}
/**
* 英文逗号隔开的字符串转为下划线隔开
* @param string
......
......@@ -246,4 +246,23 @@
and ( collaborator_name like concat('%', #{search}, '%') or phone like concat('%', #{search}, '%') )
</if>
</select>
<select id="getByPhoneAndAppId" resultMap="BaseResultMap">
select <include refid="Base_Column_List"></include>
from
tab_sys_collaborator
where enterprise_id = #{enterpriseId}
and phone = #{phone}
and app_id = #{appId}
and status != 0
limit 1
</select>
<update id="deleteByPhoneAndAppId">
update tab_sys_collaborator set status = 0
where enterprise_id = #{enterpriseId}
and phone = #{phone}
and app_id = #{appId}
and status != 0
</update>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment