基础信息班组班次

highway
A0010407 1 year ago
parent ec89c8db95
commit dbd2f24a45

@ -74,7 +74,13 @@ public class BaseTeamTController extends BaseController {
@Log(title = "班组", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BaseTeamT baseTeamT) {
return toAjax(baseTeamTService.insertBaseTeamT(baseTeamT));
if (baseTeamTService.checkTeamCodeUnique(baseTeamT)) {
return AjaxResult.error("班组编码已存在!");
}else if(baseTeamTService.checkTeamDescUnique(baseTeamT)){
return AjaxResult.error("班组名称已存在!");
}else{
return toAjax(baseTeamTService.insertBaseTeamT(baseTeamT));
}
}
/**

@ -61,4 +61,8 @@ public interface BaseTeamTMapper {
* @return
*/
public int deleteBaseTeamTByTeamIds(String[] teamIds);
String checkTeamCodeUnique(BaseTeamT baseTeamT);
String checkTeamDescUnique(BaseTeamT baseTeamT);
String getBaseTeamTByCode(BaseTeamT baseTeamT);
}

@ -72,4 +72,5 @@ public interface BaseTeamUserMapper {
public String selectUserName(BaseTeamUser baseTeamUser);
//批量删除
public void deleteBaseTeamUserByTeamId(String teamId);
void deleteBaseTeamUserByTeamIds(String[] teamIds);
}

@ -58,4 +58,7 @@ public interface IBaseTeamTService {
* @return
*/
public int deleteBaseTeamTByTeamId(String teamId);
boolean checkTeamCodeUnique(BaseTeamT baseTeamT);
boolean checkTeamDescUnique(BaseTeamT baseTeamT);
}

@ -69,13 +69,13 @@ public class BaseTeamTServiceImpl implements IBaseTeamTService {
public int insertBaseTeamT(BaseTeamT baseTeamT) {
baseTeamT.setCreateDate(DateUtils.getNowDate());
baseTeamT.setCreateBy(SecurityUtils.getUsername());
//删掉当前关联重新建
baseTeamUserMapper.deleteBaseTeamUserByTeamId(baseTeamT.getTeamId());
baseTeamTMapper.insertBaseTeamT(baseTeamT);
String teamId = baseTeamTMapper.getBaseTeamTByCode(baseTeamT);
for(int i = 0;i<baseTeamT.getRightData().size();i++){
BaseTeamUser baseTeamUser = new BaseTeamUser();
baseTeamUser.setCreateBy(SecurityUtils.getUsername());
baseTeamUser.setCreateTime(DateUtils.getNowDate());
baseTeamUser.setTeamId(baseTeamT.getTeamId());
baseTeamUser.setTeamId(teamId);
baseTeamUser.setTeamCode(baseTeamT.getTeamCode());
baseTeamUser.setId(IdUtils.fastSimpleUUID());
List<String> list = new ArrayList<>();
@ -86,17 +86,8 @@ public class BaseTeamTServiceImpl implements IBaseTeamTService {
//判断班组人员有没有变动 挨个遍历
baseTeamUser.setUserName(userName);
baseTeamUserMapper.insertBaseTeamUser(baseTeamUser);
// BaseTeamUser baseTeamUser1 = new BaseTeamUser();
// List<String> members = baseTeamUserMapper.selectTeamMembersIds(baseTeamUser1);
// boolean bool = members.contains(userId);
//倒查id
// String id = baseTeamUserMapper.selectId(baseTeamUser);
// baseTeamUser.setUpdateTime(DateUtils.getNowDate());
// baseTeamUser.setUpdateBy(SecurityUtils.getUsername());
// baseTeamUserMapper.updateBaseTeamUser(baseTeamUser);
//如果过来的班组成员ID不存在于表中直接新增
}
return baseTeamTMapper.insertBaseTeamT(baseTeamT);
return 1;
}
/**
@ -149,6 +140,7 @@ public class BaseTeamTServiceImpl implements IBaseTeamTService {
@Override
@DS("#header.poolName")
public int deleteBaseTeamTByTeamIds(String[] teamIds) {
baseTeamUserMapper.deleteBaseTeamUserByTeamIds(teamIds);
return baseTeamTMapper.deleteBaseTeamTByTeamIds(teamIds);
}
@ -161,6 +153,39 @@ public class BaseTeamTServiceImpl implements IBaseTeamTService {
@Override
@DS("#header.poolName")
public int deleteBaseTeamTByTeamId(String teamId) {
baseTeamUserMapper.deleteBaseTeamUserByTeamId(teamId);
return baseTeamTMapper.deleteBaseTeamTByTeamId(teamId);
}
/**
*
*
* @return
*/
@Override
@DS("#header.poolName")
public boolean checkTeamCodeUnique(BaseTeamT baseTeamT) {
String code = baseTeamTMapper.checkTeamCodeUnique(baseTeamT);
if(code == null){
return false;
}else{
return true;
}
}
/**
*
*
* @return
*/
@Override
@DS("#header.poolName")
public boolean checkTeamDescUnique(BaseTeamT baseTeamT) {
String name = baseTeamTMapper.checkTeamDescUnique(baseTeamT);
if(name == null){
return false;
}else{
return true;
}
}
}

@ -40,9 +40,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectBaseTeamTVo"/>
<where>
<if test="orgId != null and orgId != ''"> and ORG_Id = #{orgId}</if>
<if test="teamCode != null and teamCode != ''"> and Team_Code = #{teamCode}</if>
<if test="teamDesc != null and teamDesc != ''"> and Team_Desc = #{teamDesc}</if>
<if test="teamDescGlobal != null and teamDescGlobal != ''"> and Team_Desc_Global = #{teamDescGlobal}</if>
<if test="teamCode != null and teamCode != ''"> and Team_Code like concat('%', #{teamCode}, '%')</if>
<if test="teamDesc != null and teamDesc != ''"> and Team_Desc like concat('%', #{teamDesc}, '%')</if>
<if test="teamDescGlobal != null and teamDescGlobal != ''"> and Team_Desc_Global like concat('%', #{teamDescGlobal}, '%')</if>
<if test="teamDescExtended != null and teamDescExtended != ''"> and Team_Desc_Extended = #{teamDescExtended}</if>
<if test="createBy != null and createBy != ''"> and Create_By = #{createBy}</if>
<if test="createDate != null "> and Create_Date = #{createDate}</if>
@ -170,4 +170,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{teamId}
</foreach>
</delete>
<select id="checkTeamCodeUnique" parameterType="BaseTeamT" resultType ="java.lang.String">
select Team_Code
from base_team_t
where Team_Code = #{teamCode}
</select>
<select id="checkTeamDescUnique" parameterType="BaseTeamT" resultType ="java.lang.String">
select Team_Desc
from base_team_t
where Team_Desc = #{teamDesc}
</select>
<select id="getBaseTeamTByCode" parameterType="BaseTeamT" resultType ="java.lang.String">
select Team_Id
from base_team_t
where Team_Code = #{teamCode}
</select>
</mapper>

@ -124,4 +124,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where user_id = #{userId}
</select>
<delete id="deleteBaseTeamUserByTeamIds" parameterType="String">
delete from base_team_user where team_id in
<foreach item="teamId" collection="array" open="(" separator="," close=")">
#{teamId}
</foreach>
</delete>
</mapper>
Loading…
Cancel
Save