作者 shenhailong

消毒记录 删除修改为软删

分单批量挂载功能
分单批量删除功能
package com.tianbo.analysis.controller;
import com.tianbo.analysis.model.ResultJson;
import com.tianbo.analysis.service.NmmsImportService;
import com.tianbo.analysis.service.OriginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @author shenhl
* <p>
* 2022/2/14/11:22
*/
@RestController
@RequestMapping("/nmms/imp")
public class NmmsImportController {
@Autowired
OriginService originService;
@Autowired
NmmsImportService nmmsImportService;
/**
* 批量删除
* @param awbhIds
* @return
*/
@RequestMapping(value = "/imp_removes")
@ResponseBody
public ResultJson antivirus_log_remove(String[] awbhIds){
int r = 0;
for (int i=0; i< awbhIds.length; i++){
r += originService.deleteAwbh(awbhIds[i]);
}
return r > 0 ? new ResultJson("200", "批量删除成功")
: new ResultJson("201", "批量删除失败");
}
/**
*
* @param awbhIds
* @param flightNo
* @param flightDate
* @return
*/
@RequestMapping(value = "/mountAwbh")
@ResponseBody
public ResultJson antivirus_log_remove(@RequestParam(value ="awbhIds")String[] awbhIds,
@RequestParam(value ="flightNo") String flightNo,
@RequestParam(value ="flightDate") String flightDate){
return nmmsImportService.mountAwbh(awbhIds,flightNo,flightDate) > 0 ? new ResultJson("200", "分单挂载成功")
: new ResultJson("201", "分单挂载失败");
}
}
... ...
... ... @@ -23,7 +23,7 @@ public class TB_ANTIVIRUS_LOGCongtoller {
* 消毒记录查询
* @return
*/
@GetMapping(value = "/antivirus_log_list")
@RequestMapping(value = "/antivirus_log_list")
@ResponseBody
public ResultJson antivirus_log_list(@RequestParam(value = "pageSize", required = false, defaultValue = "1") int pageSize,
@RequestParam(value = "limitSize", required = false, defaultValue = "10") int limitSize,
... ... @@ -40,11 +40,11 @@ public class TB_ANTIVIRUS_LOGCongtoller {
* 消毒记录新增
* @return
*/
@GetMapping(value = "/antivirus_log_add")
@RequestMapping(value = "/antivirus_log_add")
@ResponseBody
public ResultJson antivirus_log_add(TB_ANTIVIRUS_LOG tbAntivirusLog){
return tbAntivirusLogService.updateByPrimaryKeySelective(tbAntivirusLog) > 0 ? new ResultJson("200", "新增成功")
return tbAntivirusLogService.insertSelective(tbAntivirusLog) > 0 ? new ResultJson("200", "新增成功")
: new ResultJson("201", "新增失败");
}
... ... @@ -52,7 +52,7 @@ public class TB_ANTIVIRUS_LOGCongtoller {
* 消毒记录修改
* @return
*/
@GetMapping(value = "/antivirus_log_edit")
@RequestMapping(value = "/antivirus_log_edit")
@ResponseBody
public ResultJson antivirus_log_edit(TB_ANTIVIRUS_LOG tbAntivirusLog){
... ... @@ -64,7 +64,7 @@ public class TB_ANTIVIRUS_LOGCongtoller {
* 消毒记录删除
* @return
*/
@GetMapping(value = "/antivirus_log_remove")
@RequestMapping(value = "/antivirus_log_remove")
@ResponseBody
public ResultJson antivirus_log_remove(@RequestParam(value = "autoid") String autoid){
... ...
... ... @@ -23,6 +23,11 @@ public interface ORIGINMANIFESTMASTERMapper {
@Param("flightDate")String var3
);
ORIGINMANIFESTMASTER findAwba(@Param("waybillnomaster") String var1,
@Param("flightNo")String var2,
@Param("flightDate")String var3
);
List<ORIGINMANIFESTMASTER> searchSec(String autoid);
ORIGINMANIFESTMASTER selectwaybill(@Param("waybillnomaster") String waybillnomaster);
... ...
package com.tianbo.analysis.dao;
import com.tianbo.analysis.model.Originmanifestsecondary;
import org.apache.ibatis.annotations.Param;
import java.util.List;
... ... @@ -11,8 +12,13 @@ public interface OriginmanifestsecondaryMapper {
int updateRECEIPTION(Originmanifestsecondary record);
int updateMasterAutoId(@Param(value ="awbhAutoId") String awbhAutoId,
@Param(value ="masterAutoId") String masterAutoId);
List<Originmanifestsecondary> selectAutoIdByawbAawbH(Originmanifestsecondary record);
Originmanifestsecondary findAwba(@Param(value ="awbhAutoId") String awbhAutoId);
int deleteAwbh(String awbhAutoId);
int updateByPrimaryKeySelective(Originmanifestsecondary record);
... ...
package com.tianbo.analysis.service;
import com.tianbo.analysis.model.ResultJson;
/**
* @author shenhl
* <p>
* 2022/2/15/15:12
*/
public interface NmmsImportService {
int mountAwbh(String[] awbhIds,
String flightNo,
String flightDate);
}
... ...
package com.tianbo.analysis.service.imp;
import com.tianbo.analysis.dao.ORIGINMANIFESTMASTERMapper;
import com.tianbo.analysis.dao.OriginmanifestsecondaryMapper;
import com.tianbo.analysis.model.ORIGINMANIFESTMASTER;
import com.tianbo.analysis.model.Originmanifestsecondary;
import com.tianbo.analysis.service.NmmsImportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author shenhl
* <p>
* 2022/2/15/15:14
*/
@Service
@Slf4j
public class NmmsImportServiceImpl implements NmmsImportService{
@Autowired
OriginmanifestsecondaryMapper originmanifestsecondaryMapper;
@Autowired
ORIGINMANIFESTMASTERMapper originmanifestmasterMapper;
@Override
public int mountAwbh(String[] awbhIds, String flightNo, String flightDate) {
int w = 0;
try {
String awba = "";
// 查询该分单绑定的主单id
for (int i=0; i< awbhIds.length; i++){
Originmanifestsecondary originmanifestsecondary = originmanifestsecondaryMapper.findAwba(awbhIds[i]);
log.info("查询的主单id:{}", originmanifestsecondary);
awba = originmanifestsecondary.getWaybillnomaster();
// 查询需要挂载的主单id
ORIGINMANIFESTMASTER originmanifestmaster = originmanifestmasterMapper.findAwba(awba, flightNo, flightDate);
log.info("挂载主单的id:{}", originmanifestmaster);
log.info("修改分单数据参数:{}", awbhIds, originmanifestmaster.getAutoid());
// 修改分单表 所绑定的主单id
w = originmanifestsecondaryMapper.updateMasterAutoId(awbhIds[i], originmanifestmaster.getAutoid());
log.info("修改后的状态:{}", w);
}
return w;
}catch (Exception e){
e.printStackTrace();
return w;
}
}
}
... ...
... ... @@ -6,11 +6,9 @@ import com.github.pagehelper.PageInfo;
import com.tianbo.analysis.dao.TB_ANTIVIRUS_LOGMapper;
import com.tianbo.analysis.model.TB_ANTIVIRUS_LOG;
import com.tianbo.analysis.service.TB_ANTIVIRUS_LOGService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
... ... @@ -38,7 +36,9 @@ public class TB_ANTIVIRUS_LOGServiceImpI implements TB_ANTIVIRUS_LOGService {
@Override
public int deleteByPrimaryKey(String autoid) {
return tbAntivirusLogMapper.deleteByPrimaryKey(autoid);
TB_ANTIVIRUS_LOG tbAntivirusLog = new TB_ANTIVIRUS_LOG();
tbAntivirusLog.setAutoid(autoid);
return tbAntivirusLogMapper.updateByPrimaryKey(tbAntivirusLog);
}
@Override
... ...
... ... @@ -487,6 +487,14 @@ GROUP BY
messagetype ASC
</select>
<select id="findAwba" parameterType="java.lang.String" resultMap="BaseResultMap">
select * from ORIGINMANIFESTMASTER
where
WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR}
and FLIGHTNO = #{flightNo,jdbcType=VARCHAR}
and flight_date = TO_DATE( #{flightDate ,jdbcType=DATE}, 'yyyy-MM-dd' )
</select>
<select id="searchSec" parameterType="string" resultMap="BaseResultMap">
select autoid,
waybillnosecondary as waybillnomaster,
... ...
... ... @@ -206,20 +206,8 @@
</update>
<update id="updateByPrimaryKey" parameterType="com.tianbo.analysis.model.TB_ANTIVIRUS_LOG" >
update CGONMS.TB_ANTIVIRUS_LOG
set FLIGHTNO = #{flightno,jdbcType=VARCHAR},
FLIGHT_DATE = #{flightDate,jdbcType=TIMESTAMP},
WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR},
WAYBILLNOSECONDARY = #{waybillnosecondary,jdbcType=VARCHAR},
ANTIVIRUS_PC = #{antivirusPc,jdbcType=DECIMAL},
ANTIVIRUS_WT = #{antivirusWt,jdbcType=DECIMAL},
ANTIVIRUS_TIME = #{antivirusTime,jdbcType=TIMESTAMP},
ANTIVIRUS_NAME = #{antivirusName,jdbcType=VARCHAR},
UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
ANTIVIRUS_STATUS = #{antivirusStatus,jdbcType=DECIMAL},
ANTIVIRUS_DES = #{antivirusDes,jdbcType=VARCHAR},
TRAY_NUM = #{trayNum,jdbcType=VARCHAR},
IS_DELETE = #{isDelete,jdbcType=DECIMAL},
BINDING_AUTOID = #{bindingAutoid,jdbcType=VARCHAR}
set
IS_DELETE = '1'
where AUTOID = #{autoid,jdbcType=VARCHAR}
</update>
</mapper>
... ...
... ... @@ -272,6 +272,14 @@
AND ORIGINMANIFESTMASTERAUTOID = #{originmanifestmasterautoid,jdbcType=VARCHAR }
</update>
<update id="updateMasterAutoId" parameterType="string" >
UPDATE ORIGINMANIFESTSECONDARY
SET
ORIGINMANIFESTMASTERAUTOID = #{masterAutoId,jdbcType=VARCHAR}
WHERE
AUTOID = #{awbhAutoId,jdbcType=VARCHAR}
</update>
<select id="selectAutoIdByawbAawbH" parameterType="com.tianbo.analysis.model.Originmanifestsecondary" resultType="com.tianbo.analysis.model.Originmanifestsecondary">
SELECT AUTOID
FROM ORIGINMANIFESTSECONDARY
... ... @@ -281,6 +289,13 @@
AND ORIGINMANIFESTMASTERAUTOID = #{originmanifestmasterautoid,jdbcType=VARCHAR }
</select>
<select id="findAwba" parameterType="java.lang.String" resultType="com.tianbo.analysis.model.Originmanifestsecondary">
SELECT *
FROM ORIGINMANIFESTSECONDARY
WHERE
AUTOID = #{awbhAutoId,jdbcType=VARCHAR}
</select>
<delete id="deleteAwbh" parameterType="java.lang.String">
DELETE FROM ORIGINMANIFESTSECONDARY
WHERE
... ...