단속팀 등록,수정 기능 추가

main
이범준 1 year ago
parent 00de51371f
commit 5095c00ad6

@ -28,7 +28,25 @@ public interface CrdnTeamMapper extends AbstractMapper {
* @param team * @param team
* @return * @return
*/ */
int removeTeamInfo(Team team); int deleteTeamInfo(Team team);
/** .<br />
* @param team
* @return
*/
int insertTeamInfo(Team team);
/** .<br />
* @param team
* @return
*/
int updateTeamInfo(Team team);
/** .<br />
* @param team
* @return
*/
DataObject selectTeamInfoByName(Team team);
/** .<br /> /** .<br />
* @param teamId ID * @param teamId ID

@ -4,6 +4,7 @@ import java.util.List;
import cokr.xit.fims.crdn.CrdnQuery; import cokr.xit.fims.crdn.CrdnQuery;
import cokr.xit.fims.crdn.ExmptnVhcl; import cokr.xit.fims.crdn.ExmptnVhcl;
import cokr.xit.fims.crdn.Team;
import cokr.xit.fims.crdn.parsing.LayoutDescriptor; import cokr.xit.fims.crdn.parsing.LayoutDescriptor;
import cokr.xit.foundation.data.DataObject; import cokr.xit.foundation.data.DataObject;
@ -33,6 +34,12 @@ public interface CrdnStngService {
*/ */
boolean removeTeamInfo(String teamId); boolean removeTeamInfo(String teamId);
/** .
* @param team
* @return
*/
boolean saveTeamInfo(Team team);
/** . /** .
* @param teamId ID * @param teamId ID
* @return * @return

@ -234,7 +234,7 @@ public class CrdnStngBean extends AbstractComponent {
return crdnTeamMapper.selectRemovedTeamList(query); return crdnTeamMapper.selectRemovedTeamList(query);
} }
/** . /** .
* @param teamId ID * @param teamId ID
* @return * @return
* <ul><li> true</li> * <ul><li> true</li>
@ -246,7 +246,55 @@ public class CrdnStngBean extends AbstractComponent {
Team team = new Team(); Team team = new Team();
team.setTeamId(teamId); team.setTeamId(teamId);
team.setRemovedBy(currentUser().getId()); team.setRemovedBy(currentUser().getId());
return crdnTeamMapper.removeTeamInfo(team) == 1 ? true : false; return crdnTeamMapper.deleteTeamInfo(team) == 1 ? true : false;
}
/** .
* @param teamId ID
* @return
* <ul><li> true</li>
* <li> false</li>
* </ul>
*/
public boolean saveTeamInfo(Team team) {
DataObject teamInfo = crdnTeamMapper.selectTeamInfoByName(team);
boolean result = false;
if(teamInfo != null) {
boolean differ = false;
if(!ifEmpty(team.getCrdnSeCd(), () -> "").equals(teamInfo.string("CRDN_SE_CD"))) {
differ = true;
}
if(!ifEmpty(team.getTeamer1(), () -> "").equals(teamInfo.string("TEAMER_1"))) {
differ = true;
}
if(!ifEmpty(team.getTeamer2(), () -> "").equals(teamInfo.string("TEAMER_2"))) {
differ = true;
}
if(!ifEmpty(team.getTeamer3(), () -> "").equals(teamInfo.string("TEAMER_3"))) {
differ = true;
}
if(!ifEmpty(team.getTeamer4(), () -> "").equals(teamInfo.string("TEAMER_4"))) {
differ = true;
}
if(differ) {
Team del = new Team();
del.setTeamId(teamInfo.string("TEAM_ID"));
del.setRemovedBy(currentUser().getId());
crdnTeamMapper.deleteTeamInfo(del);
result = crdnTeamMapper.insertTeamInfo(team) == 1 ? true : false;
} else {
team.setTeamId(teamInfo.string("TEAM_ID"));
result = crdnTeamMapper.updateTeamInfo(team) == 1 ? true : false;
}
} else {
result = crdnTeamMapper.insertTeamInfo(team) == 1 ? true : false;
}
return result;
} }
/** . /** .
@ -323,4 +371,5 @@ public class CrdnStngBean extends AbstractComponent {
return exmptnVhclMapper.selectExemptionVehicleHistoryList(exmptnVhclId); return exmptnVhclMapper.selectExemptionVehicleHistoryList(exmptnVhclId);
} }
} }

@ -8,6 +8,7 @@ import org.springframework.stereotype.Service;
import cokr.xit.fims.crdn.CrdnQuery; import cokr.xit.fims.crdn.CrdnQuery;
import cokr.xit.fims.crdn.ExmptnVhcl; import cokr.xit.fims.crdn.ExmptnVhcl;
import cokr.xit.fims.crdn.Team;
import cokr.xit.fims.crdn.parsing.LayoutDescriptor; import cokr.xit.fims.crdn.parsing.LayoutDescriptor;
import cokr.xit.fims.crdn.service.CrdnStngService; import cokr.xit.fims.crdn.service.CrdnStngService;
import cokr.xit.foundation.component.AbstractServiceBean; import cokr.xit.foundation.component.AbstractServiceBean;
@ -44,6 +45,12 @@ public class CrdnStngServiceBean extends AbstractServiceBean implements CrdnStng
return crdnStngBean.removeTeamInfo(teamId); return crdnStngBean.removeTeamInfo(teamId);
} }
@Override
public boolean saveTeamInfo(Team team) {
return crdnStngBean.saveTeamInfo(team);
}
@Override @Override
public DataObject getTeamInfo(String teamId) { public DataObject getTeamInfo(String teamId) {
return crdnStngBean.selectTeamInfo(teamId); return crdnStngBean.selectTeamInfo(teamId);

@ -12,6 +12,7 @@ import cokr.xit.base.user.ManagedUser;
import cokr.xit.base.user.dao.UserMapper; import cokr.xit.base.user.dao.UserMapper;
import cokr.xit.base.web.ApplicationController; import cokr.xit.base.web.ApplicationController;
import cokr.xit.fims.crdn.CrdnQuery; import cokr.xit.fims.crdn.CrdnQuery;
import cokr.xit.fims.crdn.Team;
import cokr.xit.fims.crdn.dao.GlobalStngMapper; import cokr.xit.fims.crdn.dao.GlobalStngMapper;
import cokr.xit.fims.crdn.service.CrdnStngService; import cokr.xit.fims.crdn.service.CrdnStngService;
@ -29,6 +30,7 @@ public class Crdn07Controller extends ApplicationController {
, getTeamList = "/010/list.do" , getTeamList = "/010/list.do"
, getRemovedTeamList = "/010/removedTeamList.do" , getRemovedTeamList = "/010/removedTeamList.do"
, removeTeamInfo = "/010/remove.do" , removeTeamInfo = "/010/remove.do"
, saveTeamInfo = "/010/save.do"
, getTeamInfo = "/010/info.do" , getTeamInfo = "/010/info.do"
; ;
} }
@ -110,6 +112,30 @@ public class Crdn07Controller extends ApplicationController {
} }
/** .
* {@link CrdnStngService#saveTeamInfo(team)}
* @param team
* @return jsonView
* <pre><code> {
* "saved": true, false
* }</code></pre>
*/
public ModelAndView saveTeamInfo(Team team) {
boolean saved = false;
ManagedUser currentUser = userMapper.getUser(currentUser().getAccount(), currentUser().getInstitute());
String curDeptCode = currentUser.getDeptCode();
String sggCd = globalStngMapper.selectSggCd(curDeptCode);
team.setSggCd(sggCd);
saved = crdnStngService.saveTeamInfo(team);
return new ModelAndView("jsonView")
.addObject("saved", saved);
}
/** .<br /> /** .<br />
* {@link CrdnStngService#getTeamInfo(String)} * {@link CrdnStngService#getTeamInfo(String)}
* @param crdn * @param crdn

@ -10,6 +10,7 @@ import org.springframework.web.servlet.ModelAndView;
import cokr.xit.fims.crdn.Crdn; import cokr.xit.fims.crdn.Crdn;
import cokr.xit.fims.crdn.CrdnQuery; import cokr.xit.fims.crdn.CrdnQuery;
import cokr.xit.fims.crdn.ExmptnVhcl; import cokr.xit.fims.crdn.ExmptnVhcl;
import cokr.xit.fims.crdn.Team;
import cokr.xit.fims.cvlc.CrdnCvlcpt; import cokr.xit.fims.cvlc.CrdnCvlcpt;
import cokr.xit.fims.excl.CrdnReReg; import cokr.xit.fims.excl.CrdnReReg;
import cokr.xit.fims.excl.ExclQuery; import cokr.xit.fims.excl.ExclQuery;
@ -319,6 +320,12 @@ public class BpvController {
return super.removeTeamInfo(teamId); return super.removeTeamInfo(teamId);
} }
@Override
@RequestMapping(name="전용차로과태료업무 단속팀 정보 저장", value=METHOD_URL.saveTeamInfo)
public ModelAndView saveTeamInfo(Team team) {
return super.saveTeamInfo(team);
}
@Override @Override
@RequestMapping(name="전용차로과태료업무 단속팀 정보 조회", value=METHOD_URL.getTeamInfo) @RequestMapping(name="전용차로과태료업무 단속팀 정보 조회", value=METHOD_URL.getTeamInfo)
public ModelAndView getTeamInfo(String teamId) { public ModelAndView getTeamInfo(String teamId) {

@ -9,6 +9,7 @@ import org.springframework.web.servlet.ModelAndView;
import cokr.xit.fims.crdn.Crdn; import cokr.xit.fims.crdn.Crdn;
import cokr.xit.fims.crdn.CrdnQuery; import cokr.xit.fims.crdn.CrdnQuery;
import cokr.xit.fims.crdn.Team;
import cokr.xit.fims.cvlc.CrdnCvlcpt; import cokr.xit.fims.cvlc.CrdnCvlcpt;
import cokr.xit.fims.excl.CrdnReReg; import cokr.xit.fims.excl.CrdnReReg;
import cokr.xit.fims.excl.ExclQuery; import cokr.xit.fims.excl.ExclQuery;
@ -326,11 +327,17 @@ public class PvsController {
} }
@Override @Override
@RequestMapping(name="전용차로과태료업무 단속팀 정보 삭제", value=METHOD_URL.removeTeamInfo) @RequestMapping(name="주정차과태료업무 단속팀 정보 삭제", value=METHOD_URL.removeTeamInfo)
public ModelAndView removeTeamInfo(String teamId) { public ModelAndView removeTeamInfo(String teamId) {
return super.removeTeamInfo(teamId); return super.removeTeamInfo(teamId);
} }
@Override
@RequestMapping(name="주정차과태료업무 단속팀 정보 저장", value=METHOD_URL.saveTeamInfo)
public ModelAndView saveTeamInfo(Team team) {
return super.saveTeamInfo(team);
}
@Override @Override
@RequestMapping(name="주정차과태료업무 단속팀 정보 조회", value=METHOD_URL.getTeamInfo) @RequestMapping(name="주정차과태료업무 단속팀 정보 조회", value=METHOD_URL.getTeamInfo)
public ModelAndView getTeamInfo(String teamId) { public ModelAndView getTeamInfo(String teamId) {

@ -40,8 +40,8 @@ SELECT A.TEAM_ID
ORDER BY A.MDFCN_DT ORDER BY A.MDFCN_DT
</select> </select>
<update id="removeTeamInfo" parameterType="cokr.xit.fims.crdn.Team"> <update id="deleteTeamInfo" parameterType="cokr.xit.fims.crdn.Team">
/* 단속팀 정보 삭제(crdnTeamMapper.removeTeamInfo) */ /* 단속팀 정보 삭제(crdnTeamMapper.deleteTeamInfo) */
UPDATE TB_TEAM_INFO UPDATE TB_TEAM_INFO
SET USE_YN = 'N' SET USE_YN = 'N'
, MDFCN_DT = <include refid="utility.now" /> , MDFCN_DT = <include refid="utility.now" />
@ -49,6 +49,78 @@ UPDATE TB_TEAM_INFO
WHERE TEAM_ID = #{teamId} WHERE TEAM_ID = #{teamId}
</update> </update>
<insert id="insertTeamInfo" parameterType="cokr.xit.fims.crdn.Team">
/* 단속팀 정보 등록(crdnTeamMapper.insertTeamInfo) */
<selectKey resultType="string" keyProperty="teamId" keyColumn="NEW_ID" order="BEFORE">
SELECT
LPAD(CAST(IFNULL(MAX(TEAM_ID) + 1, 1) AS INT), 10, '0')
AS NEW_ID
FROM TB_TEAM_INFO
</selectKey>
INSERT
INTO TB_TEAM_INFO (
TEAM_ID
, SGG_CD
, TASK_SE_CD
, OGDP_SE_CD
, TEAM_NM
, CRDN_SE_CD
, TEAMER_1
, TEAMER_2
, TEAMER_3
, TEAMER_4
, ETC_CN
, USE_YN
, REG_DT
, RGTR
, MDFCN_DT
, MDFR
) VALUES (
#{teamId}
, #{sggCd}
, #{taskSeCd}
, #{ogdpSeCd}
, #{teamNm}
, #{crdnSeCd}
, #{teamer1}
, #{teamer2}
, #{teamer3}
, #{teamer4}
, #{etcCn}
, 'Y'
, <include refid="utility.now" />
, #{createdBy}
, <include refid="utility.now" />
, #{modifiedBy}
)
</insert>
<update id="updateTeamInfo" parameterType="cokr.xit.fims.crdn.Team">
/* 단속팀 정보 수정(crdnTeamMapper.updateTeamInfo) */
UPDATE TB_TEAM_INFO
SET ETC_CN = #{etcCn}
, MDFCN_DT = <include refid="utility.now" />
, MDFR = #{modifiedBy}
WHERE TEAM_ID = #{teamId}
</update>
<select id="selectTeamInfoByName" parameterType="cokr.xit.fims.crdn.Team" resultType="dataobject">
/* 단속팀명으로 단속팀 정보 조회(crdnTeamMapper.selectTeamInfoByName) */
SELECT TEAM_ID
, CRDN_SE_CD
, TEAM_NM
, TEAMER_1
, TEAMER_2
, TEAMER_3
, TEAMER_4
, ETC_CN
FROM TB_TEAM_INFO
WHERE TEAM_NM = #{teamNm}
AND SGG_CD = #{sggCd}
AND TASK_SE_CD = #{taskSeCd}
AND USE_YN = 'Y'
</select>
<select id="selectTeamInfo" parameterType="string" resultType="dataobject"> <select id="selectTeamInfo" parameterType="string" resultType="dataobject">
/* 단속팀 정보 조회(crdnTeamMapper.selectTeamInfo) */ /* 단속팀 정보 조회(crdnTeamMapper.selectTeamInfo) */
SELECT TEAM_ID SELECT TEAM_ID

@ -99,7 +99,7 @@
<label for="teamNm--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end required"> <label for="teamNm--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end required">
단속조명 단속조명
</label> </label>
<input type="text" id="teamNm--${pageName}" name="vhrno" class="form-control" <input type="text" id="teamNm--${pageName}" name="teamNm" class="form-control"
data-maxlengthb="20" required /> data-maxlengthb="20" required />
</div> </div>
<div class="col-md-9"> <div class="col-md-9">
@ -248,7 +248,8 @@ $(document).ready(function(){
$P.useTeamControl = new DatasetControl({ $P.useTeamControl = new DatasetControl({
urls : { urls : {
load : "", load : "",
remove : "" remove : "",
save : ""
}, },
dataGetter : obj => obj["List"], appendData:false, dataGetter : obj => obj["List"], appendData:false,
keymapper : info => info ? info.TEAM_ID : "", keymapper : info => info ? info.TEAM_ID : "",
@ -356,6 +357,7 @@ $(document).ready(function(){
$P.useTeamControl.urls.load = wctx.url("/"+taskSeCd+"/crdn/crdn07/010/list.do"); $P.useTeamControl.urls.load = wctx.url("/"+taskSeCd+"/crdn/crdn07/010/list.do");
$P.useTeamControl.urls.remove = wctx.url("/"+taskSeCd+"/crdn/crdn07/010/remove.do"); $P.useTeamControl.urls.remove = wctx.url("/"+taskSeCd+"/crdn/crdn07/010/remove.do");
$P.useTeamControl.urls.save = wctx.url("/"+taskSeCd+"/crdn/crdn07/010/save.do");
} }
$P.refreshUseTeamList = () => { $P.refreshUseTeamList = () => {
@ -398,7 +400,19 @@ $(document).ready(function(){
} }
$P.fnSave = () => { $P.fnSave = () => {
var formFields = new FimsFormFields("#frmEdit--${pageName}");
var data = formFields.get();
data.taskSeCd = $("#frmSearch--${pageName} input[name='taskSeCd']:checked").val();
ajax.get({
url : $P.useTeamControl.urls.save,
data : data,
success : resp => {
if(resp.saved){
$P.refreshUseTeamList();
}
}
});
} }
$P.fnRemove = () => { $P.fnRemove = () => {

Loading…
Cancel
Save