基础信息班组班次

highway
A0010407 1 year ago
parent ec89c8db95
commit dbd2f24a45

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

@ -61,4 +61,8 @@ public interface BaseTeamTMapper {
* @return * @return
*/ */
public int deleteBaseTeamTByTeamIds(String[] teamIds); 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 String selectUserName(BaseTeamUser baseTeamUser);
//批量删除 //批量删除
public void deleteBaseTeamUserByTeamId(String teamId); public void deleteBaseTeamUserByTeamId(String teamId);
void deleteBaseTeamUserByTeamIds(String[] teamIds);
} }

@ -58,4 +58,7 @@ public interface IBaseTeamTService {
* @return * @return
*/ */
public int deleteBaseTeamTByTeamId(String teamId); 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) { public int insertBaseTeamT(BaseTeamT baseTeamT) {
baseTeamT.setCreateDate(DateUtils.getNowDate()); baseTeamT.setCreateDate(DateUtils.getNowDate());
baseTeamT.setCreateBy(SecurityUtils.getUsername()); baseTeamT.setCreateBy(SecurityUtils.getUsername());
//删掉当前关联重新建 baseTeamTMapper.insertBaseTeamT(baseTeamT);
baseTeamUserMapper.deleteBaseTeamUserByTeamId(baseTeamT.getTeamId()); String teamId = baseTeamTMapper.getBaseTeamTByCode(baseTeamT);
for(int i = 0;i<baseTeamT.getRightData().size();i++){ for(int i = 0;i<baseTeamT.getRightData().size();i++){
BaseTeamUser baseTeamUser = new BaseTeamUser(); BaseTeamUser baseTeamUser = new BaseTeamUser();
baseTeamUser.setCreateBy(SecurityUtils.getUsername()); baseTeamUser.setCreateBy(SecurityUtils.getUsername());
baseTeamUser.setCreateTime(DateUtils.getNowDate()); baseTeamUser.setCreateTime(DateUtils.getNowDate());
baseTeamUser.setTeamId(baseTeamT.getTeamId()); baseTeamUser.setTeamId(teamId);
baseTeamUser.setTeamCode(baseTeamT.getTeamCode()); baseTeamUser.setTeamCode(baseTeamT.getTeamCode());
baseTeamUser.setId(IdUtils.fastSimpleUUID()); baseTeamUser.setId(IdUtils.fastSimpleUUID());
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
@ -86,17 +86,8 @@ public class BaseTeamTServiceImpl implements IBaseTeamTService {
//判断班组人员有没有变动 挨个遍历 //判断班组人员有没有变动 挨个遍历
baseTeamUser.setUserName(userName); baseTeamUser.setUserName(userName);
baseTeamUserMapper.insertBaseTeamUser(baseTeamUser); 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 @Override
@DS("#header.poolName") @DS("#header.poolName")
public int deleteBaseTeamTByTeamIds(String[] teamIds) { public int deleteBaseTeamTByTeamIds(String[] teamIds) {
baseTeamUserMapper.deleteBaseTeamUserByTeamIds(teamIds);
return baseTeamTMapper.deleteBaseTeamTByTeamIds(teamIds); return baseTeamTMapper.deleteBaseTeamTByTeamIds(teamIds);
} }
@ -161,6 +153,39 @@ public class BaseTeamTServiceImpl implements IBaseTeamTService {
@Override @Override
@DS("#header.poolName") @DS("#header.poolName")
public int deleteBaseTeamTByTeamId(String teamId) { public int deleteBaseTeamTByTeamId(String teamId) {
baseTeamUserMapper.deleteBaseTeamUserByTeamId(teamId);
return baseTeamTMapper.deleteBaseTeamTByTeamId(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"/> <include refid="selectBaseTeamTVo"/>
<where> <where>
<if test="orgId != null and orgId != ''"> and ORG_Id = #{orgId}</if> <if test="orgId != null and orgId != ''"> and ORG_Id = #{orgId}</if>
<if test="teamCode != null and teamCode != ''"> and Team_Code = #{teamCode}</if> <if test="teamCode != null and teamCode != ''"> and Team_Code like concat('%', #{teamCode}, '%')</if>
<if test="teamDesc != null and teamDesc != ''"> and Team_Desc = #{teamDesc}</if> <if test="teamDesc != null and teamDesc != ''"> and Team_Desc like concat('%', #{teamDesc}, '%')</if>
<if test="teamDescGlobal != null and teamDescGlobal != ''"> and Team_Desc_Global = #{teamDescGlobal}</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="teamDescExtended != null and teamDescExtended != ''"> and Team_Desc_Extended = #{teamDescExtended}</if>
<if test="createBy != null and createBy != ''"> and Create_By = #{createBy}</if> <if test="createBy != null and createBy != ''"> and Create_By = #{createBy}</if>
<if test="createDate != null "> and Create_Date = #{createDate}</if> <if test="createDate != null "> and Create_Date = #{createDate}</if>
@ -170,4 +170,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{teamId} #{teamId}
</foreach> </foreach>
</delete> </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> </mapper>

@ -124,4 +124,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where user_id = #{userId} where user_id = #{userId}
</select> </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> </mapper>
Loading…
Cancel
Save