Преглед на файлове

调整mybatis.xml中的关于租户标识过滤逻辑,租户标识由可空变为非空

liuyaowen преди 1 година
родител
ревизия
484ba0575d
променени са 34 файла, в които са добавени 256 реда и са изтрити 470 реда
  1. 4 0
      src/main/java/com/yunfeiyun/agmp/fms/controller/AdsWeatherController.java
  2. 10 4
      src/main/java/com/yunfeiyun/agmp/fms/controller/FmsBlockController.java
  3. 1 28
      src/main/java/com/yunfeiyun/agmp/fms/controller/FmsConsoleController.java
  4. 2 1
      src/main/java/com/yunfeiyun/agmp/fms/controller/FmsSolarController.java
  5. 2 2
      src/main/java/com/yunfeiyun/agmp/fms/mapper/FmsBlockMapper.java
  6. 1 1
      src/main/java/com/yunfeiyun/agmp/fms/mapper/FmsSolarMapper.java
  7. 0 1
      src/main/java/com/yunfeiyun/agmp/fms/scheduler/FmsAcctempScheduler.java
  8. 2 1
      src/main/java/com/yunfeiyun/agmp/fms/scheduler/FmsSolarScheduler.java
  9. 1 1
      src/main/java/com/yunfeiyun/agmp/fms/service/IFmsBlockService.java
  10. 0 1
      src/main/java/com/yunfeiyun/agmp/fms/service/IFmsSolarService.java
  11. 2 0
      src/main/java/com/yunfeiyun/agmp/fms/service/impl/AdsWeatherServiceImpl.java
  12. 3 3
      src/main/java/com/yunfeiyun/agmp/fms/service/impl/FmsBlockServiceImpl.java
  13. 4 0
      src/main/java/com/yunfeiyun/agmp/fms/service/impl/FmsCropcalarmServiceImpl.java
  14. 4 3
      src/main/java/com/yunfeiyun/agmp/fms/service/impl/FmsExpertServiceImpl.java
  15. 1 4
      src/main/java/com/yunfeiyun/agmp/fms/service/impl/FmsSolarServiceImpl.java
  16. 1 1
      src/main/java/com/yunfeiyun/agmp/fms/util/DataAuthUtil.java
  17. 1 1
      src/main/resources/mapper/AdsWeatherMapper.xml
  18. 6 13
      src/main/resources/mapper/AdsWeatherhourMapper.xml
  19. 6 19
      src/main/resources/mapper/AgmTaskpickMapper.xml
  20. 24 62
      src/main/resources/mapper/FmsBlockMapper.xml
  21. 7 13
      src/main/resources/mapper/FmsCalarmMapper.xml
  22. 8 18
      src/main/resources/mapper/FmsCropMapper.xml
  23. 6 14
      src/main/resources/mapper/FmsCropcalarmMapper.xml
  24. 8 8
      src/main/resources/mapper/FmsExpertMapper.xml
  25. 17 47
      src/main/resources/mapper/FmsLandMapper.xml
  26. 15 19
      src/main/resources/mapper/FmsPeriodMapper.xml
  27. 4 3
      src/main/resources/mapper/FmsPlanMapper.xml
  28. 6 9
      src/main/resources/mapper/FmsSolarMapper.xml
  29. 37 65
      src/main/resources/mapper/FmsTaskMapper.xml
  30. 16 13
      src/main/resources/mapper/FmsTaskassetMapper.xml
  31. 15 10
      src/main/resources/mapper/FmsTaskmachineMapper.xml
  32. 24 50
      src/main/resources/mapper/FmsTaskpickMapper.xml
  33. 10 31
      src/main/resources/mapper/FmsTaskrcdMapper.xml
  34. 8 24
      src/main/resources/mapper/FmsWarnMapper.xml

+ 4 - 0
src/main/java/com/yunfeiyun/agmp/fms/controller/AdsWeatherController.java

@@ -37,6 +37,7 @@ public class AdsWeatherController extends BaseController
     @GetMapping("/list")
     public TableDataInfo list(AdsWeatherReqVo reqVo) {
         startPage();
+        reqVo.setTid(SecurityUtils.getTid());
         List<AdsWeather> list = adsWeatherService.selectAdsWeatherList(reqVo);
         return getDataTable(list);
     }
@@ -48,6 +49,7 @@ public class AdsWeatherController extends BaseController
     @Log(title = "历史天气", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
     public void export(HttpServletResponse response,@RequestBody AdsWeatherReqVo reqVo) {
+        reqVo.setTid(SecurityUtils.getTid());
         List<AdsWeather> list = adsWeatherService.selectAdsWeatherList(reqVo);
         ExcelUtil<AdsWeather> util = new ExcelUtil<AdsWeather>(AdsWeather.class);
         util.exportExcel(response, list, "历史天气数据");
@@ -69,6 +71,7 @@ public class AdsWeatherController extends BaseController
     @Log(title = "历史天气", businessType = BusinessType.INSERT)
     @PostMapping("/add")
     public AjaxResult add(@RequestBody AdsWeather adsWeather) {
+        adsWeather.setTid(SecurityUtils.getTid());
         return toAjax(adsWeatherService.insertAdsWeather(adsWeather));
     }
 
@@ -79,6 +82,7 @@ public class AdsWeatherController extends BaseController
     @Log(title = "历史天气", businessType = BusinessType.UPDATE)
     @PutMapping("/edit")
     public AjaxResult edit(@RequestBody AdsWeather adsWeather) {
+        adsWeather.setTid(SecurityUtils.getTid());
         return toAjax(adsWeatherService.updateAdsWeather(adsWeather));
     }
 

+ 10 - 4
src/main/java/com/yunfeiyun/agmp/fms/controller/FmsBlockController.java

@@ -80,6 +80,7 @@ public class FmsBlockController extends BaseController
         }
 
         startPage();
+        fmsBlock.setTid(SecurityUtils.getTid());
         List<FmsBlock> list = fmsBlockService.selectFmsBlockList(fmsBlock);
         return getDataTable(list);
     }
@@ -97,6 +98,7 @@ public class FmsBlockController extends BaseController
             fmsBlock.setDataFilter(true);
             fmsBlock.setBlockIds(strings);
         }
+        fmsBlock.setTid(SecurityUtils.getTid());
         List<FmsBlock> list = fmsBlockService.selectFmsBlockList(fmsBlock);
         return getDataTable(list);
     }
@@ -109,15 +111,17 @@ public class FmsBlockController extends BaseController
     @PreAuthorize("@ss.hasPermi('fms:block:tree:list')")
     @GetMapping("/tree/list")
     public AjaxResult treeList(FmsBlock fmsBlock) {
+        FmsLand fmsLandQuery = new FmsLand();
+        fmsLandQuery.setTid(SecurityUtils.getTid());
         //查询基地列表
-        List<FmsLand> list = fmsLandService.selectFmsLandList(new FmsLand());
+        List<FmsLand> list = fmsLandService.selectFmsLandList(fmsLandQuery);
         List<FmsLandTreeResVo> resultList = new ArrayList<>();
         for (FmsLand fmsLand : list) {
             FmsLandTreeResVo resVo = new FmsLandTreeResVo();
             BeanUtils.copyProperties(fmsLand, resVo);
             resultList.add(resVo);
         }
-
+        fmsBlock.setTid(SecurityUtils.getTid());
         List<FmsBlock> list2 = fmsBlockService.selectFmsBlockList(fmsBlock);
         for (FmsLandTreeResVo resVo : resultList) {
             for (FmsBlock block : list2) {
@@ -145,8 +149,8 @@ public class FmsBlockController extends BaseController
             reqVo.setDataFilter(true);
             reqVo.setBlockIds(strings);
         }
-
         startPage();
+        reqVo.setTid(SecurityUtils.getTid());
         List<FmsBlockResVo> list = fmsBlockService.selectFmsBlockHasPlan(reqVo);
         return getDataTable(list);
     }
@@ -159,6 +163,7 @@ public class FmsBlockController extends BaseController
     @Log(title = "地块", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
     public void export(HttpServletResponse response,@RequestBody FmsBlock fmsBlock) {
+        fmsBlock.setTid(SecurityUtils.getTid());
         List<FmsBlock> list = fmsBlockService.selectFmsBlockList(fmsBlock);
         ExcelUtil<FmsBlock> util = new ExcelUtil<FmsBlock>(FmsBlock.class);
         util.exportExcel(response, list, "地块数据");
@@ -191,11 +196,12 @@ public class FmsBlockController extends BaseController
 
     @PostMapping("/bind/user")
     public AjaxResult bindUser(@Valid @RequestBody FmsBlockBindUserReqVo fmsBlockBindUserReqVo){
+        fmsBlockBindUserReqVo.setTid(SecurityUtils.getTid());
       return AjaxResult.success(fmsBlockService.bindUser(fmsBlockBindUserReqVo));
     }
 
     @GetMapping("/user/bind/list")
     public AjaxResult userBindList(String userId){
-        return AjaxResult.success(fmsBlockService.userBindList(userId));
+        return AjaxResult.success(fmsBlockService.userBindList(userId,SecurityUtils.getTid()));
     }
 }

+ 1 - 28
src/main/java/com/yunfeiyun/agmp/fms/controller/FmsConsoleController.java

@@ -156,10 +156,9 @@ public class FmsConsoleController {
     public AjaxResult selectMessageMap() {
         LinkedHashMap<String, FmsMessageResVo> fmsMessageResVoMap = new LinkedHashMap<>();
         fmsMessageResVoMap.put(FmsMessageResVoType.WARN.getType(),new FmsMessageResVo(FmsMessageResVoType.WARN));
-/*        fmsMessageResVoMap.put(FmsMessageResVoType.TASK.getType(),new FmsMessageResVo(FmsMessageResVoType.TASK));
+        fmsMessageResVoMap.put(FmsMessageResVoType.TASK.getType(),new FmsMessageResVo(FmsMessageResVoType.TASK));
         fmsMessageResVoMap.put(FmsMessageResVoType.CHANGE.getType(),new FmsMessageResVo(FmsMessageResVoType.CHANGE));
         fmsMessageResVoMap.put(FmsMessageResVoType.PICK.getType(),new FmsMessageResVo(FmsMessageResVoType.PICK));
-        fmsMessageResVoMap.put(FmsMessageResVoType.PATROL.getType(),new FmsMessageResVo(FmsMessageResVoType.PATROL));*/
         //  fmsTaskService.appendTaskMessage(fmsMessageResVoMap);
         fmsWarnService.appendWarnMessage(fmsMessageResVoMap);
         // wmsChangeapplyService.appendChangeMessage(fmsMessageResVoMap);
@@ -190,33 +189,7 @@ public class FmsConsoleController {
         return AjaxResult.success(jsonArray);
     }
 
-    public void getWeather(ScreenDataReqVo reqVo, Map<String, Object> resultMap) {
-        FmsWeatherInfoResVo fmsWeatherInfoResVo = null;
-        try {
-            JSONObject resultObj = weatherService.getProjectWeather();
-            fmsWeatherInfoResVo = JSONObject.parseObject(resultObj.toString(), FmsWeatherInfoResVo.class);
-            Map<String, Object> map = new HashMap<>();
-            if (!StringUtils.isEmpty(fmsWeatherInfoResVo.getCityid())) {
-                map = iFmsSolarService.getSysZoneByZoneCode(fmsWeatherInfoResVo.getCityid(),SecurityUtils.getTid());
-            }
-            List<FmsWeatherInfoResVo> weatherList = new ArrayList<>();
-            JSONArray data = resultObj.getJSONArray("data");
-            if (data != null) {
-                for (int i = 0; i < data.size(); i++) {
-                    String str = data.getString(i);
-                    FmsWeatherInfoResVo weatherResVo = JSONObject.parseObject(str, FmsWeatherInfoResVo.class);
-                    weatherResVo.setCity(fmsWeatherInfoResVo.getCity());
-                    weatherResVo.setZoneProvincezh(map.get("zoneProvincezh") == null ? "" : map.get("zoneProvincezh").toString());
-                    weatherResVo.setZoneCapitalzh(map.get("zoneCapitalzh") == null ? "" : map.get("zoneCapitalzh").toString());
-                    weatherList.add(weatherResVo);
-                }
-            }
-            resultMap.put("weather", weatherList);
-        }catch (Exception e){
-            throw new BizException(ErrorCode.FMS_WEATHER_SEARCH_FAILED);
-        }
 
-    }
 
     public void getLandStat(ScreenDataReqVo reqVo, Map<String, Object> resultMap, boolean isValid) {
         /* 获取基地统计信息 */

+ 2 - 1
src/main/java/com/yunfeiyun/agmp/fms/controller/FmsSolarController.java

@@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.*;
 import javax.servlet.http.HttpServletResponse;
 import java.util.Date;
 import java.util.List;
-
+// TODO://该业务相关接口均弃用
 /**
  * 节气时令Controller
  * 
@@ -26,6 +26,7 @@ import java.util.List;
  */
 @RestController
 @RequestMapping("/fms/solar")
+@Deprecated
 public class FmsSolarController extends BaseController
 {
 

+ 2 - 2
src/main/java/com/yunfeiyun/agmp/fms/mapper/FmsBlockMapper.java

@@ -92,7 +92,7 @@ public interface FmsBlockMapper
 
     int bindUser(FmsBlockBindUserReqVo fmsBlockBindUserReqVo);
 
-    List<String> userBindList(String userId);
+    List<String> userBindList(@Param("userId") String userId,@Param("tid") String tid);
 
-    int unbindUser(String userId);
+    int unbindUser(@Param("userId") String userId,@Param("tid")String tid);
 }

+ 1 - 1
src/main/java/com/yunfeiyun/agmp/fms/mapper/FmsSolarMapper.java

@@ -78,5 +78,5 @@ public interface FmsSolarMapper
      * */
     public FmsSolar getFmsSolarByDate(@Param("date") String date,@Param("tid") String tid);
 
-    public Map<String, Object> getSysZoneByZoneCode(@Param("zoneCode") String zoneCode,@Param("tid") String tid);
+
 }

+ 0 - 1
src/main/java/com/yunfeiyun/agmp/fms/scheduler/FmsAcctempScheduler.java

@@ -42,7 +42,6 @@ public class FmsAcctempScheduler {
     @Scheduled(cron = "0 30 */1 * * ?")
     public void adsWeatherhourAddTask() throws Exception{
         log.info("每日新增每小时天气数据任务开始");
-
         JSONObject resultObj = weatherService.getProjectWeather();
         JSONArray hours = resultObj.getJSONArray("hours");
         List<AdsWeatherhour> list = new ArrayList<>();

+ 2 - 1
src/main/java/com/yunfeiyun/agmp/fms/scheduler/FmsSolarScheduler.java

@@ -3,6 +3,7 @@ package com.yunfeiyun.agmp.fms.scheduler;
 import com.yunfeiyun.agmp.fms.service.IFmsSolarService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
@@ -16,7 +17,7 @@ public class FmsSolarScheduler {
     /**
      * 更新24节气的日期
      */
-//    @Scheduled(cron = "0 0 0 1 1 ?")
+    @Scheduled(cron = "0 0 0 1 1 ?")
     public void updateFmsSolarAll(){
         log.info("更新24节气的开始时间开始");
         int result = fmsSolarService.updateFmsSolarAll();

+ 1 - 1
src/main/java/com/yunfeiyun/agmp/fms/service/IFmsBlockService.java

@@ -85,5 +85,5 @@ public interface IFmsBlockService
 
     int bindUser(FmsBlockBindUserReqVo fmsBlockBindUserReqVo);
 
-    List<String> userBindList(String userId);
+    List<String> userBindList(String userId,String tid);
 }

+ 0 - 1
src/main/java/com/yunfeiyun/agmp/fms/service/IFmsSolarService.java

@@ -73,5 +73,4 @@ public interface IFmsSolarService
      **/
     public FmsSolar getNowSolar(String date, String tid);
 
-    public Map<String, Object> getSysZoneByZoneCode(String zoneCode,String tid);
 }

+ 2 - 0
src/main/java/com/yunfeiyun/agmp/fms/service/impl/AdsWeatherServiceImpl.java

@@ -2,6 +2,7 @@ package com.yunfeiyun.agmp.fms.service.impl;
 
 import java.util.List;
 
+import com.yunfeiyun.agmp.common.utils.SecurityUtils;
 import com.yunfeiyun.agmp.fms.domain.AdsWeather;
 import com.yunfeiyun.agmp.fms.domain.reqvo.AdsWeatherReqVo;
 import com.yunfeiyun.agmp.fms.mapper.AdsWeatherMapper;
@@ -40,6 +41,7 @@ public class AdsWeatherServiceImpl implements IAdsWeatherService
      */
     @Override
     public List<AdsWeather> selectAdsWeatherList(AdsWeatherReqVo reqVo) {
+        reqVo.setTid(SecurityUtils.getTid());
         return adsWeatherMapper.selectAdsWeatherList(reqVo);
     }
 

+ 3 - 3
src/main/java/com/yunfeiyun/agmp/fms/service/impl/FmsBlockServiceImpl.java

@@ -252,13 +252,13 @@ public class FmsBlockServiceImpl implements IFmsBlockService
 
     @Override
     public int bindUser(FmsBlockBindUserReqVo fmsBlockBindUserReqVo) {
-        fmsBlockMapper.unbindUser(fmsBlockBindUserReqVo.getUserId());
+        fmsBlockMapper.unbindUser(fmsBlockBindUserReqVo.getUserId(),SecurityUtils.getTid());
         return fmsBlockMapper.bindUser(fmsBlockBindUserReqVo);
     }
 
     @Override
-    public List<String> userBindList(String userId) {
-        return  fmsBlockMapper.userBindList(userId);
+    public List<String> userBindList(String userId,String tid) {
+        return  fmsBlockMapper.userBindList(userId,tid);
     }
 
 }

+ 4 - 0
src/main/java/com/yunfeiyun/agmp/fms/service/impl/FmsCropcalarmServiceImpl.java

@@ -1,5 +1,6 @@
 package com.yunfeiyun.agmp.fms.service.impl;
 
+import com.yunfeiyun.agmp.common.utils.SecurityUtils;
 import com.yunfeiyun.agmp.fms.domain.FmsCropcalarm;
 import com.yunfeiyun.agmp.fms.mapper.FmsCropcalarmMapper;
 import com.yunfeiyun.agmp.fms.domain.reqvo.FmsCalarmListReqVo;
@@ -42,11 +43,13 @@ public class FmsCropcalarmServiceImpl implements IFmsCropcalarmService
      */
     @Override
     public List<FmsCalarmListResVo> selectFmsCropcalarmList(FmsCalarmListReqVo reqVo) {
+        reqVo.setTid(SecurityUtils.getTid());
         return fmsCropcalarmMapper.selectFmsCropcalarmList(reqVo);
     }
 
     @Override
     public List<FmsCalarmListResVo> selectNameListForCalarm(FmsCalarmListReqVo reqVo) {
+        reqVo.setTid(SecurityUtils.getTid());
         return fmsCropcalarmMapper.selectNameListForCalarm(reqVo);
     }
 
@@ -58,6 +61,7 @@ public class FmsCropcalarmServiceImpl implements IFmsCropcalarmService
      */
     @Override
     public int insertFmsCropcalarm(FmsCropcalarm fmsCropcalarm) {
+
         return fmsCropcalarmMapper.insertFmsCropcalarm(fmsCropcalarm);
     }
 

+ 4 - 3
src/main/java/com/yunfeiyun/agmp/fms/service/impl/FmsExpertServiceImpl.java

@@ -3,6 +3,7 @@ package com.yunfeiyun.agmp.fms.service.impl;
 import java.util.List;
 
 import com.yunfeiyun.agmp.common.framework.manager.ResManager;
+import com.yunfeiyun.agmp.common.utils.SecurityUtils;
 import com.yunfeiyun.agmp.common.utils.StringUtils;
 import com.yunfeiyun.agmp.common.web.system.domain.SysRes;
 import com.yunfeiyun.agmp.fms.domain.FmsExpert;
@@ -24,8 +25,7 @@ import javax.annotation.Resource;
  * @date 2023-09-22
  */
 @Service
-public class FmsExpertServiceImpl implements IFmsExpertService
-{
+public class FmsExpertServiceImpl implements IFmsExpertService {
     @Autowired
     private FmsExpertMapper fmsExpertMapper;
 
@@ -51,6 +51,7 @@ public class FmsExpertServiceImpl implements IFmsExpertService
      */
     @Override
     public List<FmsExpert> selectFmsExpertList(FmsExpertQueryParam fmsExpertQueryParam) {
+        fmsExpertQueryParam.setTid(SecurityUtils.getTid());
         return fmsExpertMapper.selectFmsExpertList(fmsExpertQueryParam);
     }
 
@@ -62,7 +63,7 @@ public class FmsExpertServiceImpl implements IFmsExpertService
      */
     @Override
     public int insertFmsExpert(FmsExpert fmsExpert) {
-
+        fmsExpert.setTid(SecurityUtils.getTid());
         return fmsExpertMapper.insertFmsExpert(fmsExpert);
     }
 

+ 1 - 4
src/main/java/com/yunfeiyun/agmp/fms/service/impl/FmsSolarServiceImpl.java

@@ -178,8 +178,5 @@ public class FmsSolarServiceImpl implements IFmsSolarService
         return fmsSolar;
     }
 
-    @Override
-    public Map<String, Object> getSysZoneByZoneCode(String zoneCode,String tid) {
-        return fmsSolarMapper.getSysZoneByZoneCode(zoneCode,tid);
-    }
+
 }

+ 1 - 1
src/main/java/com/yunfeiyun/agmp/fms/util/DataAuthUtil.java

@@ -65,7 +65,7 @@ public class DataAuthUtil
      */
     public List<String> blockList() {
         List<String> list = new ArrayList<>();
-        List<String> blockIds = fmsBlockService.userBindList(SecurityUtils.getUserId());
+        List<String> blockIds = fmsBlockService.userBindList(SecurityUtils.getUserId(),SecurityUtils.getTid());
         if(!blockIds.isEmpty()){
             FmsBlock fmsBlock = new FmsBlock();
             fmsBlock.setTid(SecurityUtils.getTid());

+ 1 - 1
src/main/resources/mapper/AdsWeatherMapper.xml

@@ -14,7 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <where>  
             <if test="startTime != null and startTime != '' "> and weatherRecorddate <![CDATA[ >= ]]> #{startTime}</if>
             <if test="endTime != null and endTime != '' "> and weatherRecorddate <![CDATA[ <= ]]> #{endTime}</if>
-            <if test="tid != null and tid != '-1'">and tid = #{tid}</if>
+            tid = #{tid}
         </where>
         order by weatherRecorddate desc
     </select>

+ 6 - 13
src/main/resources/mapper/AdsWeatherhourMapper.xml

@@ -11,10 +11,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectAdsWeatherhourList" parameterType="AdsWeatherReqVo" resultType="com.yunfeiyun.agmp.fms.domain.AdsWeatherhour">
         <include refid="selectAdsWeatherhourVo"/>
         <where>
+            tid = #{tid}
             <if test="startTime != null and startTime != '' "> and weatherhourHour <![CDATA[ >= ]]> #{startTime}</if>
             <if test="endTime != null and endTime != '' "> and weatherhourHour <![CDATA[ <= ]]> #{endTime}</if>
             <if test="weatherhourHour != null and weatherhourHour != '' "> and weatherhourHour = #{weatherhourHour}</if>
-            <if test="tid != null and tid !='' and tid != '-1'">and tid = #{tid}</if>
         </where>
         order by weatherhourHour
     </select>
@@ -22,7 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectAdsWeatherhourByWeatherhourId" parameterType="String" resultType="com.yunfeiyun.agmp.fms.domain.AdsWeatherhour">
         <include refid="selectAdsWeatherhourVo"/>
         <where>
-            <if test="tid != null and tid != '-1'">and tid = #{tid}</if>
+            tid = #{tid}
             <if test="weatherhourId != null and weatherhourId != ''">weatherhourId = #{weatherhourId}</if>
         </where>
     </select>
@@ -105,20 +105,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="tid != null">tid = #{tid},</if>
         </trim>
         <where>
-            weatherhourId = #{weatherhourId}
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and tid = #{tid}
-            </if>
+            weatherhourId = #{weatherhourId} and tid = #{tid}
         </where>
     </update>
 
     <delete id="deleteAdsWeatherhourByWeatherhourId" parameterType="String">
         delete from AdsWeatherhour
         <where>
-            weatherhourId = #{weatherhourId}
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and tid = #{tid}
-            </if>
+            weatherhourId = #{weatherhourId} and tid = #{tid}
+
         </where>
     </delete>
 
@@ -129,9 +124,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <foreach item="weatherhourId" collection="array" open="(" separator="," close=")">
                 #{weatherhourId}
             </foreach>
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and tid = #{tid}
-            </if>
+            and tid = #{tid}
         </where>
     </delete>
 </mapper>

+ 6 - 19
src/main/resources/mapper/AgmTaskpickMapper.xml

@@ -18,7 +18,7 @@
         LEFT JOIN FmsTaskrcd s ON t.taskId = s.taskId
         LEFT JOIN WmsWarehouse h ON s.warehouseId = h.warehouseId
         WHERE (i.pickChangestatus is null or i.pickChangestatus = '0') and s.taskrcdAuditstatus = '2'
-
+        and i.tid = #{tid}
         <if test="warehouseId != null and warehouseId != ''">and h.warehouseId = #{warehouseId}</if>
         <if test="goodsName != null and goodsName != ''">and c.cropName like concat('%', #{goodsName}, '%')</if>
         <if test="landIds != null  and landIds.size > 0">
@@ -27,9 +27,6 @@
                 #{landId}
             </foreach>
         </if>
-        <if test="tid != null and tid != '-1'">
-            and i.tid = #{tid}
-        </if>
     </select>
 
     <select id="selectFmsTaskpickByTaskpickId" parameterType="String" resultType="AgmTaskPickListResVo">
@@ -46,10 +43,7 @@
         LEFT JOIN FmsTaskrcd s ON t.taskId = s.taskId and s.taskrcdAuditstatus = '2'
         LEFT JOIN WmsWarehouse h ON s.warehouseId = h.warehouseId
         <where>
-            taskpickId = #{taskpickId}
-            <if test="tid != null and tid != '-1'">
-                and i.tid = #{tid}
-            </if>
+            taskpickId = #{taskpickId} and i.tid = #{tid}
         </where>
         limit 1
     </select>
@@ -63,6 +57,7 @@
         LEFT JOIN WmsWarehouse h on h.warehouseId = s.warehouseId
         LEFT JOIN TssTracecodetpl t on t.tracecodetplId = si.tracecodetplId
         <where>
+            fg.tid = #{tid}
             <if test="warehouseId != null and warehouseId != ''">and h.warehouseId = #{warehouseId}</if>
             <if test="finishgoodscode != null and finishgoodscode != ''">and fg.finishgoodscode = #{finishgoodscode}</if>
             <if test="finishgoodsType != null and finishgoodsType != ''">and fg.finishgoodsType = #{finishgoodsType}</if>
@@ -93,9 +88,6 @@
             <if test="productType != null and productType != ''">
                 and t.productType = #{productType}
             </if>
-            <if test="tid != null and tid != '-1'">
-                and fg.tid = #{tid}
-            </if>
         </where>
     </select>
     <select id="selectAppSeedOutAddInfo"
@@ -114,10 +106,7 @@
         LEFT JOIN WmsStock ws on ws.goodsId = wfg.goodsId
         LEFT JOIN MppQualitycheck mq on mq.finishgoodsId = wfg.finishgoodsId
         <where>
-            wfg.finishgoodsId = #{finishgoodsId}
-            <if test="tid != null and tid != '-1'">
-                and wfg.tid = #{tid}
-            </if>
+            wfg.finishgoodsId = #{finishgoodsId} and wfg.tid = #{tid}
         </where>
         limit 1
     </select>
@@ -131,10 +120,8 @@
         LEFT JOIN WmsStock s on s.goodsId = g.goodsId
         LEFT JOIN WmsWarehouse h on h.warehouseId = s.warehouseId
         <where>
-            fg.finishgoodsId = #{finishgoodsId}
-            <if test="tid != null and tid != '-1'">
-                and fg.tid = #{tid}
-            </if>
+            fg.finishgoodsId = #{finishgoodsId}  and fg.tid = #{tid}
+
         </where>
         limit 1
     </select>

+ 24 - 62
src/main/resources/mapper/FmsBlockMapper.xml

@@ -39,6 +39,7 @@
     <select id="selectFmsBlockList" parameterType="FmsBlock" resultType="FmsBlock">
         <include refid="selectFmsBlockHasResVo"/>
         <where>
+            b.tid = #{tid}
             <if test="landId != null  and landId != ''"> and landId = #{landId}</if>
             <if test="blockName != null  and blockName != ''"> and blockName like concat('%', #{blockName}, '%')</if>
             <if test="blockNameEq != null  and blockNameEq != ''"> and blockName = #{blockNameEq}</if>
@@ -56,7 +57,6 @@
                     #{blockId}
                 </foreach>
             </if>
-            <if test="tid != null and tid !='' and tid != '-1'">and b.tid = #{tid}</if>
         </where>
         order by b.blockSeq
     </select>
@@ -65,9 +65,7 @@
         <include refid="selectFmsBlockHasResVo"/>
         <where>
             blockId = #{blockId}
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and tid = #{tid}
-            </if>
+            and tid = #{tid}
         </where>
     </select>
 
@@ -77,19 +75,15 @@
         LEFT JOIN FmsLand l ON b.landId = l.landId
         <where>
             blockId = #{blockId}
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and b.tid = #{tid}
-            </if>
+            and b.tid = #{tid}
         </where>
     </select>
 
     <select id="selectCountByLandId" parameterType="String" resultType="Integer">
         select count(1) from FmsBlock
         <where>
+            tid = #{tid}
             <if test="landId != null  and landId != ''"> and landId = #{landId}</if>
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and tid = #{tid}
-            </if>
         </where>
     </select>
 
@@ -98,22 +92,18 @@
         (SELECT b.blockId,(SELECT count(1) FROM FmsPlan p
         <where>
             p.blockId = b.blockId
+            and p.tid = #{tid}
             <if test="planStatus != null  and planStatus != ''">
                 and p.planStatus in
                 <foreach collection="planStatus.split(',')" item="item" index="index" open="(" close=")" separator=",">
                     #{item}
                 </foreach>
             </if>
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and p.tid = #{tid}
-            </if>
         </where>
         ) count FROM FmsBlock b
         <where>
+            b.tid = #{tid}
             <if test="landId != null  and landId != ''">and b.landId = #{landId}</if>
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and b.tid = #{tid}
-            </if>
         </where>
         ) tb
         WHERE tb.count > 0
@@ -122,6 +112,7 @@
     <select id="selectSumAreaByLandId" parameterType="FmsLand" resultType="BigDecimal">
         select sum(blockArea) from FmsBlock
         <where>
+            tid = #{tid}
             <if test="landId != null  and landId != ''"> and landId = #{landId}</if>
             <if test="dataFilter == true and blockIds !=null and blockIds.size()>0">
                 and blockId in
@@ -129,14 +120,12 @@
                     #{blockId}
                 </foreach>
             </if>
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and tid = #{tid}
-            </if>
         </where>
     </select>
 
     <select id="selectSumArea" parameterType="FmsBlockReqVo" resultType="BigDecimal">
         select sum(b.blockArea) from FmsBlock b LEFT JOIN FmsLand l ON b.landId = l.landId WHERE l.landId is not null
+        and b.tid = #{tid}
         <if test="landId != null  and landId != ''"> and l.landId = #{landId}</if>
         <if test="dataFilter == true and blockIds !=null and blockIds.size()>0">
             and b.blockId in
@@ -144,9 +133,7 @@
                 #{blockId}
             </foreach>
         </if>
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and b.tid = #{tid}
-        </if>
+
     </select>
 
     <select id="selectFmsBlockHasPlan" parameterType="FmsBlockReqVo" resultType="FmsBlockResVo">
@@ -159,6 +146,7 @@
         left join (select GROUP_CONCAT(resUrl) blockPreview, GROUP_CONCAT(resId) resIds, resBusId  from SysRes
         WHERE resBiztype = 'BLOCK' group by resBusId  ) tb1 on b.blockId = tb1.resBusId
         having 1=1
+        and  b.tid = #{tid}
         <if test="hasPlan != null  and hasPlan == '0'.toString() "> and cropNames is null</if>
         <if test="hasPlan != null  and hasPlan == '1'.toString() "> and cropNames is not null</if>
         <if test="landId != null  and landId != ''"> and landId = #{landId}</if>
@@ -171,9 +159,7 @@
                 #{blockId}
             </foreach>
         </if>
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and b.tid = #{tid}
-        </if>
+
         order by b.blockSeq
     </select>
 
@@ -232,9 +218,7 @@
         </trim>
         <where>
             blockId = #{blockId}
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and tid = #{tid}
-            </if>
+            and tid = #{tid}
         </where>
     </update>
 
@@ -258,9 +242,7 @@
             </trim>
             <where>
                 blockId = #{block.blockId}
-                <if test="tid != null and tid !='' and tid != '-1'">
-                    and tid = #{block.tid}
-                </if>
+                and tid = #{block.tid}
             </where>
         </foreach>
     </update>
@@ -271,18 +253,14 @@
             <foreach collection="blockIds" index="index" item="item" open="(" separator="," close=")">
                 #{item}
             </foreach>
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and tid = #{tid}
-            </if>
+            and tid = #{tid}
         </where>
     </update>
     <update id="clearManagerByManagerId">
         update FmsBlock set blockManager = null
         <where>
             blockManager = #{manager}
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and tid = #{tid}
-            </if>
+            and tid = #{tid}
         </where>
     </update>
 
@@ -290,9 +268,7 @@
         delete from FmsBlock
         <where>
             blockId = #{blockId}
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and tid = #{tid}
-            </if>
+            and tid = #{tid}
         </where>
 
     </delete>
@@ -304,9 +280,7 @@
             <foreach item="blockId" collection="array" open="(" separator="," close=")">
                 #{blockId}
             </foreach>
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and tid = #{tid}
-            </if>
+            and tid = #{tid}
         </where>
 
     </delete>
@@ -318,9 +292,7 @@
             <foreach item="blockId" collection="array" open="(" separator="," close=")">
                 #{blockId}
             </foreach>
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and tid = #{tid}
-            </if>
+            and tid = #{tid}
         </where>
         group by b.landId
     </select>
@@ -342,23 +314,22 @@
         GROUP_CONCAT(r.roleKey) as roleKey,
         res.resUrl as userAvatar
         from SysUser u
-
         left join SysUserrole ur on u.userId = ur.userId
         left join SysRole r on r.roleId = ur.roleId
         left join SysRes res on res.resBusId = u.userId
         <where>
-            r.roleKey in ('land_admin','block_admin')
+            r.roleKey in ('land_admin','block_admin') and u.tid = #{tid}
             <if test="roleName != null and roleName != ''">and r.roleName like CONCAT('%',#{roleName},'%')</if>
             <if test="userName != null and userName != ''">and u.userName like CONCAT('%',#{userName},'%')</if>
             <if test="userLoginname != null and userLoginname !=''">and u.userLoginname = #{userLoginname}</if>
             <if test="userMobile != null and userMobile !=''">and u.userMobile = #{userMobile}</if>
-            <if test="tid != null and tid != '-1'">and u.tid = #{tid}</if>
         </where>
         GROUP BY u.userId
     </select>
     <select id="selectFmsBlockBaseDataList" resultType="com.yunfeiyun.agmp.fms.domain.FmsBlock">
         <include refid="selectFmsBlockVo"/>
         <where>
+            and tid = #{tid}
             <if test="landId != null  and landId != ''"> and landId = #{landId}</if>
             <if test="blockName != null  and blockName != ''"> and blockName like concat('%', #{blockName}, '%')</if>
             <if test="blockNameEq != null  and blockNameEq != ''"> and blockName = #{blockNameEq}</if>
@@ -382,9 +353,6 @@
                     #{item}
                 </foreach>
             </if>
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and tid = #{tid}
-            </if>
         </where>
     </select>
     <select id="selectFmsBlockListByLandManager" resultType="com.yunfeiyun.agmp.fms.domain.FmsBlock">
@@ -400,10 +368,7 @@
         FROM
         FmsPlan
         <where>
-            blockId = #{blockId}
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and tid = #{tid}
-            </if>
+            blockId = #{blockId} and tid = #{tid}
         </where>
     </sql>
     <sql id="selectIcsIrrgrcdValidData">
@@ -412,10 +377,7 @@
         FROM
         IcsIrrgrcd
         <where>
-            blockId = #{blockId}
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and tid = #{tid}
-            </if>
+            blockId = #{blockId} and tid = #{tid}
         </where>
     </sql>
 
@@ -437,11 +399,11 @@
     </insert>
 
     <select id="userBindList" resultType="java.lang.String">
-        select blockId from FmsBlockUser where userId =#{userId}
+        select blockId from FmsBlockUser where userId =#{userId} and tid = #{tid}
     </select>
 
     <delete id="unbindUser">
-        delete from FmsBlockUser where userId = #{userId}
+        delete from FmsBlockUser where userId = #{userId} and tid = #{tid}
     </delete>
 
 

+ 7 - 13
src/main/resources/mapper/FmsCalarmMapper.xml

@@ -10,14 +10,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectFmsCalarmList" parameterType="FmsCalarm" resultType="FmsCalarm">
         <include refid="selectFmsCalarmVo"/>
-        <where>  
+        <where>
+            tid = #{tid}
             <if test="calarmType != null  and calarmType != ''"> and calarmType = #{calarmType}</if>
             <if test="calarmName != null  and calarmName != ''"> and calarmName like concat('%', #{calarmName}, '%')</if>
             <if test="calarmCloudresurl != null  and calarmCloudresurl != ''"> and calarmCloudresurl = #{calarmCloudresurl}</if>
             <if test="calarmCreateddate != null  and calarmCreateddate != ''"> and calarmCreateddate = #{calarmCreateddate}</if>
             <if test="calarmCreator != null  and calarmCreator != ''"> and calarmCreator = #{calarmCreator}</if>
             <if test="calamRemark != null  and calamRemark != ''"> and calamRemark = #{calamRemark}</if>
-            <if test="tid != null and tid != '-1'">and tid = #{tid}</if>
+
         </where>
     </select>
     
@@ -25,9 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectFmsCalarmVo"/>
         <where>
             calarmId = #{calarmId}
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and tid = #{tid}
-            </if>
+            and tid = #{tid}
         </where>
     </select>
         
@@ -67,15 +66,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="tid != null">tid = #{tid},</if>
         </trim>
         <where>
-            calarmId = #{calarmId}
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and tid = #{tid}
-            </if>
+            calarmId = #{calarmId} and tid = #{tid}
         </where>
     </update>
 
     <delete id="deleteFmsCalarmByCalarmId" parameterType="String">
-        delete from FmsCalarm where calarmId = #{calarmId}
+        delete from FmsCalarm where calarmId = #{calarmId}  and tid = #{tid}
     </delete>
 
     <delete id="deleteFmsCalarmByCalarmIds" parameterType="String">
@@ -85,9 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <foreach item="calarmId" collection="array" open="(" separator="," close=")">
                 #{calarmId}
             </foreach>
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and tid = #{tid}
-            </if>
+            and tid = #{tid}
         </where>
     </delete>
 </mapper>

+ 8 - 18
src/main/resources/mapper/FmsCropMapper.xml

@@ -34,13 +34,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         (select GROUP_CONCAT(resId) from SysRes r where r.resBusId = c.cropId and r.resBiztype = 'CROP_VIDEO') videoIds
         FROM
         FmsCrop c
-        <where>  
+        <where>
+            tid = #{tid}
             <if test="cropName != null  and cropName != ''"> and c.cropName = #{cropName}</if>
             <if test="cropType != null  and cropType != ''"> and c.cropType = #{cropType}</if>
             <if test="cropMaintype != null  and cropMaintype != ''"> and c.cropMaintype = #{cropMaintype}</if>
             <if test="cropRcmdstatus != null  and cropRcmdstatus != ''"> and c.cropRcmdstatus = #{cropRcmdstatus}</if>
             <if test="cropRemark != null  and cropRemark != ''"> and c.cropRemark = #{cropRemark}</if>
-            <if test="tid != null and tid != '-1'">and tid = #{tid}</if>
         </where>
         order by c.cropCreateddate desc
     </select>
@@ -49,9 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectFmsCropHasResVo"/>
         <where>
             cropId = #{cropId}
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and tid = #{tid}
-            </if>
+            and tid = #{tid}
         </where>
 
     </select>
@@ -60,9 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         select cropName from FmsCrop
         where cropRcmdstatus = '0'
         <if test="cropMaintype != null  and cropMaintype != ''"> and cropMaintype = #{cropMaintype}</if>
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and tid = #{tid}
-        </if>
+        and tid = #{tid}
         group by cropName
     </select>
 
@@ -76,9 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{blockId}
           </foreach>
         and p.planStatus != '2'
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and p.tid = #{tid}
-        </if>
+        and p.tid = #{tid}
 
 
     </select>
@@ -124,14 +118,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="cropInitialvalue != null">cropInitialvalue = #{cropInitialvalue},</if>
             <if test="tid != null">tid = #{tid},</if>
         </trim>
-        where cropId = #{cropId}
+        where cropId = #{cropId} and tid = #{tid}
     </update>
 
     <delete id="deleteFmsCropByCropId" parameterType="String">
         delete from FmsCrop where cropId = #{cropId}
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and tid = #{tid}
-        </if>
+        and tid = #{tid}
     </delete>
 
     <delete id="deleteFmsCropByCropIds" parameterType="String">
@@ -139,8 +131,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <foreach item="cropId" collection="array" open="(" separator="," close=")">
             #{cropId}
         </foreach>
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and tid = #{tid}
-        </if>
+        and tid = #{tid}
     </delete>
 </mapper>

+ 6 - 14
src/main/resources/mapper/FmsCropcalarmMapper.xml

@@ -13,6 +13,7 @@
         <where>
             calarmCloudresurl is not null
             and calamRemark is not null
+            and tid = #{tid}
             <if test="calarmName != null and calarmName != ''">and (calarmName like CONCAT("%",#{calarmName},"%")) </if>
             <if test="calarmType != null  and calarmType != ''">
                 <if test="calarmType == 2">
@@ -27,7 +28,6 @@
                 <if test="cropName != null  and cropName != ''"> and ( calamRemark like CONCAT("%",#{cropName},"%") or calarmName like CONCAT("%",#{cropName},"%") )
                 </if>
             </if>
-            <if test="tid != null and tid != '-1'">and tid = #{tid}</if>
         </where>
     </select>
 
@@ -35,7 +35,7 @@
         select cropName
         from FmsCropcalarm
         <where>
-            <if test="tid != null and tid != '-1'">and tid = #{tid}</if>
+            tid = #{tid}
         </where>
         group by cropName
     </select>
@@ -44,9 +44,7 @@
         <include refid="selectFmsCropcalarmVo"/>
         <where>
             cropcalarmId = #{cropcalarmId}
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and tid = #{tid}
-            </if>
+            and tid = #{tid}
         </where>
     </select>
 
@@ -75,9 +73,7 @@
         </trim>
         <where>
             cropcalarmId = #{cropcalarmId}
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and tid = #{tid}
-            </if>
+            and tid = #{tid}
         </where>
     </update>
 
@@ -85,9 +81,7 @@
         delete from FmsCropcalarm
         <where>
             cropcalarmId = #{cropcalarmId}
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and tid = #{tid}
-            </if>
+            and tid = #{tid}
         </where>
     </delete>
 
@@ -98,9 +92,7 @@
             <foreach item="cropcalarmId" collection="array" open="(" separator="," close=")">
                 #{cropcalarmId}
             </foreach>
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and tid = #{tid}
-            </if>
+            and tid = #{tid}
         </where>
     </delete>
 </mapper>

+ 8 - 8
src/main/resources/mapper/FmsExpertMapper.xml

@@ -19,13 +19,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="expertSkills != null  and expertSkills != ''"> and expertSkills = #{expertSkills}</if>
             <if test="expertRemark != null  and expertRemark != ''"> and expertRemark = #{expertRemark}</if>
             <if test="expandParam != null and expandParam != ''">and (expertName like concat('%', #{expandParam}, '%') or expertPhone like concat('%',#{expandParam},'%'))</if>
-
+            <if test="tid != null and tid != ''">and tid = #{tid}</if>
         </where>
     </select>
     
     <select id="selectFmsExpertByExpertId" parameterType="String" resultType="FmsExpert">
         <include refid="selectFmsExpertVo"/>
-        where expertId = #{expertId}
+        where expertId = #{expertId} and tid = #{tid}
 
     </select>
         
@@ -40,7 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="expertPosition != null">expertPosition,</if>
             <if test="expertSkills != null">expertSkills,</if>
             <if test="expertRemark != null">expertRemark,</if>
-
+            <if test="tid != null">tid,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="expertId != null">#{expertId},</if>
@@ -51,7 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="expertPosition != null">#{expertPosition},</if>
             <if test="expertSkills != null">#{expertSkills},</if>
             <if test="expertRemark != null">#{expertRemark},</if>
-
+            <if test="tid != null">#{tid},</if>
          </trim>
     </insert>
 
@@ -65,14 +65,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="expertPosition != null">expertPosition = #{expertPosition},</if>
             <if test="expertSkills != null">expertSkills = #{expertSkills},</if>
             <if test="expertRemark != null">expertRemark = #{expertRemark},</if>
-
+            <if test="tid != null">tid = #{tid},</if>
         </trim>
         where expertId = #{expertId}
-
+        and tid = #{tid}
     </update>
 
     <delete id="deleteFmsExpertByExpertId" parameterType="String">
-        delete from FmsExpert where expertId = #{expertId}
+        delete from FmsExpert where expertId = #{expertId} and tid = #{tid}
 
     </delete>
 
@@ -81,6 +81,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <foreach item="expertId" collection="array" open="(" separator="," close=")">
             #{expertId}
         </foreach>
-
+        and tid = #{tid}
     </delete>
 </mapper>

+ 17 - 47
src/main/resources/mapper/FmsLandMapper.xml

@@ -35,7 +35,7 @@
                 (SELECT u.userName FROM SysUser u WHERE u.userId = l.landManager) landManagerName
         from FmsLand l
             LEFT JOIN (
-                select count(landId) as landBlockcount,landId from FmsBlock GROUP BY landId
+                select count(landId) as landBlockcount,landId from FmsBlock where tid = #{tid} GROUP BY landId
             ) bc on bc.landId = l.landId
         <where>
             <if test="landId != null ">and l.landId = #{landId}</if>
@@ -54,9 +54,7 @@
                     #{landId}
                 </foreach>
             </if>
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and tid = #{tid}
-            </if>
+            and l.tid = #{tid}
         </where>
         order by l.landSeq
 
@@ -64,10 +62,7 @@
 
     <select id="selectFmsLandByLandId" parameterType="String" resultType="FmsLand">
         <include refid="selectFmsLandHasResVo"/>
-        where landId = #{landId}
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and tid = #{tid}
-        </if>
+        where landId = #{landId} and tid = #{tid}
     </select>
 
     <select id="selectFmsLandTotal" parameterType="FmsLand" resultType="FmsLandTotalResVo">
@@ -76,7 +71,7 @@
         SELECT COUNT(tmnlandId) FROM TmnLand tl
         LEFT JOIN IotDevice idv on idv.devBid = tl.tmnId
         <where>
-            idv.devDelstatus = '0'
+            idv.devDelstatus = '0' and tl.tid = #{tid}
             <if test="landId != null  and landId != ''">and tl.landId = #{landId}</if>
             <if test="dataFilter == true and landIds !=null and landIds.size()>0">
                 and tl.landId in
@@ -84,9 +79,6 @@
                     #{landId}
                 </foreach>
             </if>
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and tl.tid = #{tid}
-            </if>
         </where>
         ) landDevcountSum
         from FmsLand fl
@@ -94,6 +86,7 @@
         select count(blockId) as landBlockcountSum,landId from FmsBlock GROUP BY landId
         ) fb on fb.landId = fl.landId
         <where>
+            fl.tid = #{tid}
             <if test="landId != null  and landId != ''">and fl.landId = #{landId}</if>
             <if test="dataFilter == true and landIds !=null and landIds.size()>0">
                 and fl.landId in
@@ -101,15 +94,13 @@
                     #{landId}
                 </foreach>
             </if>
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and fl.tid = #{tid}
-            </if>
         </where>
     </select>
 
     <select id="selectDevCount" parameterType="FmsLand" resultType="int">
         SELECT COUNT(1) FROM (SELECT COUNT(tmnId) count FROM TmnLand
         <where>
+            tid = #{tid}
             <if test="landId != null  and landId != ''">and landId = #{landId}</if>
             <if test="dataFilter == true and landIds !=null and landIds.size()>0">
                 and landId in
@@ -117,9 +108,6 @@
                     #{landId}
                 </foreach>
             </if>
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and tid = #{tid}
-            </if>
         </where>
         GROUP BY tmnId
         ) tb
@@ -174,10 +162,7 @@
             <if test="landLongitude != null">landLongitude = #{landLongitude},</if>
             <if test="landSeq != null">landSeq =#{landSeq},</if>
         </trim>
-        where landId = #{landId}
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and tid = #{tid}
-        </if>
+        where landId = #{landId} and tid = #{tid}
     </update>
 
     <update id="updateFmsLandBatch">
@@ -199,15 +184,12 @@
                     and tid = #{fmsLand.tid}
                 </if>
             </trim>
-            where landId = #{fmsLand.landId}
+            where landId = #{fmsLand.landId} and tid = #{fmsLand.tid}
         </foreach>
     </update>
 
     <delete id="deleteFmsLandByLandId" parameterType="String">
-        delete from FmsLand where landId = #{landId}
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and tid = #{tid}
-        </if>
+        delete from FmsLand where landId = #{landId} and tid = #{tid}
     </delete>
 
     <delete id="deleteFmsLandByLandIds" parameterType="String">
@@ -215,9 +197,7 @@
         <foreach item="landId" collection="array" open="(" separator="," close=")">
             #{landId}
         </foreach>
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and tid = #{tid}
-        </if>
+        and tid = #{tid}
     </delete>
 
     <select id="selectFmsLandByTarcecodeapplyno" parameterType="String" resultType="FmsLand">
@@ -228,9 +208,7 @@
         LEFT JOIn FmsTask t on t.landId = l.landId
         LEFT JOIN FmsTaskpick tp on tp.taskId = t.taskId
         where tp.pickNo = #{tarcecodeapplyno}
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and l.tid = #{tid}
-        </if>
+        and l.tid = #{tid}
     </select>
 
     <select id="selectFmsLandDeviceList" parameterType="TmnLandDeviceListReqVo"
@@ -241,16 +219,14 @@
         FROM TmnLand AS tl
         LEFT JOIN TmnBase AS tb ON tl.tmnId = tb.tmnId
         <where>
-            tl.landId = #{landId}
+            tl.landId = #{landId} and tl.tid = #{tid}
             <if test="tmnTypes !=null">
                 and tb.tmnType in
                 <foreach item="ty" collection="tmnTypes" open="(" separator="," close=")">
                     #{ty}
                 </foreach>
             </if>
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and tl.tid = #{tid}
-            </if>
+
         </where>
     </select>
     <select id="selectUserManagerWarehouseLandIds" resultType="java.lang.String">
@@ -261,9 +237,7 @@
         FmsLand
         WHERE
         landManager = #{userId}
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and tid = #{tid}
-        </if>
+        and tid = #{tid}
         )
         UNION ALL
         (
@@ -272,10 +246,8 @@
         FROM
         FmsLandHouse
         WHERE
-        warehouseId IN ( SELECT warehouseId FROM WmsWarehouse WHERE warehouseManager = #{userId})
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and tid = #{tid}
-        </if>
+        warehouseId IN ( SELECT warehouseId FROM WmsWarehouse WHERE warehouseManager = #{userId} and tid = #{tid})
+        and tid = #{tid}
         )
     </select>
 
@@ -287,9 +259,7 @@
         FROM TmnLand AS t
         LEFT JOIN IotDevice AS d ON d.devBid = t.tmnId
         WHERE d.devDelstatus = '0' AND (NOT ((t.landId IS NULL) OR (t.landId = '') OR (d.devBid IS NULL)))
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and t.tid = #{tid}
-        </if>
+        and t.tid = #{tid}
         GROUP BY t.tmnId, t.landId
         ) AS t ON f.landId = t.landId
         GROUP BY f.landId

+ 15 - 19
src/main/resources/mapper/FmsPeriodMapper.xml

@@ -13,14 +13,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectFmsPeriodList" parameterType="FmsPeriod" resultType="FmsPeriod">
         <include refid="selectFmsPeriodVo"/>
-        <where>  
+        <where>
+            tid = #{tid}
             <if test="cropId != null  and cropId != ''"> and cropId = #{cropId}</if>
             <if test="periodName != null  and periodName != ''"> and periodName like concat('%', #{periodName}, '%')</if>
             <if test="periodDays != null "> and periodDays = #{periodDays}</if>
             <if test="periodRemark != null  and periodRemark != ''"> and periodRemark = #{periodRemark}</if>
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and tid = #{tid}
-            </if>
         </where>
         order by periodSeq
     </select>
@@ -29,18 +27,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectFmsPeriodVo"/>
         where
         periodId = #{periodId}
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and tid = #{tid}
-        </if>
+        and tid = #{tid}
     </select>
 
     <select id="selectFmsPeriodByCropId" parameterType="String" resultType="FmsPeriod">
         <include refid="selectFmsPeriodVo"/>
         where
         cropId = #{cropId}
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and tid = #{tid}
-        </if>
+        and tid = #{tid}
         order by periodSeq
     </select>
 
@@ -51,9 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         FmsPeriod p
         LEFT JOIN FmsCrop c ON c.cropId = p.cropId
         where c.cropId is not null
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and p.tid = #{tid}
-        </if>
+        and p.tid = #{tid}
         GROUP BY p.cropId;
     </select>
 
@@ -116,13 +108,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="periodSeq != null">periodSeq = #{periodSeq},</if>
             <if test="tid != null">tid = #{tid},</if>
         </trim>
-        where periodId = #{periodId}
-        <if test="tid != null and tid !='' and tid != '-1'">and tid = #{tid}</if>
+        where
+        periodId = #{periodId}
+        and tid = #{tid}
     </update>
 
     <delete id="deleteFmsPeriodByPeriodId" parameterType="String">
-        delete from FmsPeriod where periodId = #{periodId}
-        <if test="tid != null and tid !='' and tid != '-1'">and tid = #{tid}</if>
+        delete from FmsPeriod
+        where
+        periodId = #{periodId}
+        and tid = #{tid}
     </delete>
 
     <delete id="deleteFmsPeriodByPeriodIds" parameterType="String">
@@ -130,13 +125,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <foreach item="periodId" collection="array" open="(" separator="," close=")">
             #{periodId}
         </foreach>
-        <if test="tid != null and tid !='' and tid != '-1'">and tid = #{tid}</if>
+        and tid = #{tid}
     </delete>
 
     <delete id="deleteFmsPeriodByCropId" parameterType="String">
         delete from FmsPeriod
         where
         cropId = #{cropId}
-        <if test="tid != null and tid !='' and tid != '-1'">and tid = #{tid}</if>
+        and
+        tid = #{tid}
     </delete>
 </mapper>

+ 4 - 3
src/main/resources/mapper/FmsPlanMapper.xml

@@ -10,7 +10,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectFmsPlanList" parameterType="FmsPlan" resultType="FmsPlan">
         <include refid="selectFmsPlanVo"/>
-        <where>  
+        <where>
+            tid = #{tid}
             <if test="planNo != null  and planNo != ''"> and planNo = #{planNo}</if>
             <if test="landId != null  and landId != ''"> and landId = #{landId}</if>
             <if test="blockId != null  and blockId != ''"> and blockId = #{blockId}</if>
@@ -34,7 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="planModifier != null  and planModifier != ''"> and planModifier = #{planModifier}</if>
             <if test="planModifieddate != null  and planModifieddate != ''"> and planModifieddate = #{planModifieddate}</if>
             <if test="planPeriodname != null  and planPeriodname != ''"> and planPeriodname = #{planPeriodname}</if>
-            <if test="tid != null and tid !='' and tid != '-1'">and tid = #{tid}</if>
+
         </where>
     </select>
 
@@ -44,7 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         planNo
         from FmsPlan
         <where>
-            <if test="tid != null and tid !='' and tid != '-1'">and tid = #{tid}</if>
+            tid = #{tid}
         </where>
         order by planNo desc
     </select>

+ 6 - 9
src/main/resources/mapper/FmsSolarMapper.xml

@@ -10,12 +10,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectFmsSolarList" parameterType="FmsSolar" resultType="FmsSolar">
         <include refid="selectFmsSolarVo"/>
-        <where>  
+        <where>
+            tid = #{tid}
             <if test="solarName != null  and solarName != ''"> and solarName like concat('%', #{solarName}, '%')</if>
             <if test="solarRemark != null  and solarRemark != ''"> and solarRemark = #{solarRemark}</if>
             <if test="solarStartdate != null  and solarStartdate != ''"> and solarStartdate = #{solarStartdate}</if>
             <if test="solarDigest != null  and solarDigest != ''"> and solarDigest = #{solarDigest}</if>
-            <if test="tid != null and tid !='' and tid != '-1'">and tid = #{tid}</if>
         </where>
         order by solarStartdate
     </select>
@@ -24,27 +24,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectFmsSolarVo"/>
         where
         solarId = #{solarId}
-        <if test="tid != null and tid !='' and tid != '-1'">and tid = #{tid}</if>
+        and
+        tid = #{tid}
     </select>
     <select id="selectFmsSolarBySolarName" parameterType="String" resultType="FmsSolar">
         <include refid="selectFmsSolarVo"/>
         where
         solarName = #{solarName}
-        <if test="tid != null and tid !='' and tid != '-1'">and tid = #{tid}</if>
+        and tid = #{tid}
     </select>
 
     <select id="getFmsSolarByDate" parameterType="String" resultType="FmsSolar">
         <include refid="selectFmsSolarVo"/>
         <where>
+            tid = #{tid}
             <if test="date != null and date != ''">and solarStartdate &lt;= #{date}</if>
-            <if test="tid != null and tid !='' and tid != '-1'">and tid = #{tid}</if>
         </where>
         order by solarStartdate desc limit 1
     </select>
-
-    <select id="getSysZoneByZoneCode" parameterType="String" resultType="map">
-        select zoneCode, zoneProvincezh, zoneCapitalzh from SysZone where zoneCode = #{zoneCode}
-    </select>
         
     <insert id="insertFmsSolar" parameterType="FmsSolar">
         insert into FmsSolar

+ 37 - 65
src/main/resources/mapper/FmsTaskMapper.xml

@@ -10,7 +10,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectFmsTaskList" parameterType="FmsTask" resultType="FmsTask">
         <include refid="selectFmsTaskVo"/>
-        <where>  
+        <where>
+            tid = #{tid}
             <if test="taskNo != null  and taskNo != ''"> and taskNo = #{taskNo}</if>
             <if test="planId != null  and planId != ''"> and planId = #{planId}</if>
             <if test="blockId != null  and blockId != ''"> and blockId = #{blockId}</if>
@@ -28,7 +29,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="taskCompletedate != null  and taskCompletedate != ''"> and taskCompletedate = #{taskCompletedate}</if>
             <if test="taskModifieddate != null  and taskModifieddate != ''"> and taskModifieddate = #{taskModifieddate}</if>
             <if test="taskVisible != null and taskVisible != ''">and taskVisible = #{taskVisible}</if>
-            <if test="tid != null and tid !='' and tid != '-1'">and tid = #{tid}</if>
         </where>
     </select>
 
@@ -43,6 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         LEFT JOIN FmsPlan p ON t.planId = p.planId
         LEFT JOIN FmsTaskrcd s ON t.taskId = s.taskId and s.taskrcdAuditstatus = 2
         <where>
+            t.tid = #{tid}
             <if test="taskNo != null  and taskNo != ''"> and t.taskNo = #{taskNo}</if>
             <if test="planNo != null  and planNo != ''"> and p.planNo = #{planNo}</if>
             <if test="planId != null  and planId != ''"> and t.planId = #{planId}</if>
@@ -80,7 +81,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                     #{item}
                 </foreach>
             </if>
-            <if test="tid != null and tid !='' and tid != '-1'">and t.tid = #{tid}</if>
             <if test="taskVisible != null and taskVisible != ''">and t.taskVisible = #{taskVisible}</if>
         </where>
     </select>
@@ -94,6 +94,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         LEFT JOIN FmsPlan p ON t.planId = p.planId
         LEFT JOIN FmsTaskrcd s ON t.taskId = s.taskId and s.taskrcdAuditstatus = 2
         <where>
+            t.tid = #{tid}
             <if test="taskNo != null  and taskNo != ''"> and t.taskNo = #{taskNo}</if>
             <if test="planId != null  and planId != ''"> and t.planId = #{planId}</if>
             <if test="blockId != null  and blockId != ''"> and t.blockId = #{blockId}</if>
@@ -127,7 +128,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                     #{item}
                 </foreach>
             </if>
-            <if test="tid != null and tid !='' and tid != '-1'">and t.tid = #{tid}</if>
             <if test="taskVisible != null and taskVisible != ''">and t.taskVisible = #{taskVisible}</if>
         </where>
     </select>
@@ -139,6 +139,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         LEFT JOIN FmsLand l ON t.landId = l.landId
         LEFT JOIN FmsBlock b ON t.blockId = b.blockId
         <where>
+            t.tid = #{tid}
             <if test="blockId != null  and blockId != ''"> and t.blockId = #{blockId}</if>
             <if test="landId != null  and landId != ''"> and t.landId = #{landId}</if>
             <if test="dataFilter == true and blockIds !=null and blockIds.size()>0">
@@ -147,7 +148,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                     #{blockId}
                 </foreach>
             </if>
-            <if test="tid != null and tid !='' and tid != '-1'">and t.tid = #{tid}</if>
             <if test="taskVisible != null and taskVisible != ''">and t.taskVisible = #{taskVisible}</if>
         </where>
         order by taskCreateddate desc limit 10
@@ -162,6 +162,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         LEFT JOIN FmsPlan p ON t.planId = p.planId
         LEFT JOIN FmsTaskpatrol tp on tp.taskId = t.taskId
         <where>
+            t.tid = #{tid}
             <if test="taskNo != null  and taskNo != ''"> and t.taskNo = #{taskNo}</if>
             <if test="planId != null  and planId != ''"> and t.planId = #{planId}</if>
             <if test="blockId != null  and blockId != ''"> and t.blockId = #{blockId}</if>
@@ -183,7 +184,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             </if>
             <if test="dataFilter == true and  blockIds != null and blockIds.size()>0 and landIds !=null and landIds.size()>0">
                 AND (
-
                 t.blockId in
                 <foreach collection="blockIds" item="item" open="(" separator="," close=")">
                     #{item}
@@ -195,7 +195,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 </foreach>
                 )
             </if>
-            <if test="tid != null and tid !='' and tid != '-1'">and t.tid = #{tid}</if>
             <if test="taskVisible != null and taskVisible != ''">and t.taskVisible = #{taskVisible}</if>
         </where>
     </select>
@@ -204,19 +203,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectFmsTaskVo"/>
         where
         taskId = #{taskId}
-        <if test="tid != null and tid !='' and tid != '-1'">and tid = #{tid}</if>
+        and tid = #{tid}
     </select>
 
     <select id="selectCountFmsTaskByPlanId" parameterType="String" resultType="int">
         select count(1) from FmsTask
         where
         planId = #{planId}
-        <if test="tid != null and tid !='' and tid != '-1'">and tid = #{tid}</if>
+        and tid = #{tid}
     </select>
 
     <select id="selectCountFmsTask" parameterType="FmsTaskListReqVo" resultType="int">
         select count(1) from FmsTask
         <where>
+            tid = #{tid}
             <if test="taskAuditstatus != null  and taskAuditstatus != ''">
                 and
                 <foreach collection="taskAuditstatus.split(',')" item="items" open="(" separator="or" close=")">
@@ -229,7 +229,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="endDate != null  and endDate != ''"> and taskCompletedate <![CDATA[ <= ]]> #{endDate}</if>
             <if test="taskManager != null  and taskManager != ''"> and taskManager = #{taskManager}</if>
             <if test="landId != null  and landId != ''"> and landId = #{landId}</if>
-            <if test="tid != null and tid !='' and tid != '-1'">and tid = #{tid}</if>
             <if test="taskVisible != null and taskVisible != ''">and taskVisible = #{taskVisible}</if>
         </where>
     </select>
@@ -237,6 +236,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectCountFmsTaskByType" parameterType="FmsTaskListReqVo" resultType="FmsTaskTypeCountResVo">
         SELECT count(taskType) count, taskType FROM FmsTask
         <where>
+            tid = #{tid}
             <if test="taskAuditstatus != null  and taskAuditstatus != ''"> and taskStatus = #{taskAuditstatus}</if>
             <if test="landId != null  and landId != ''"> and landId = #{landId}</if>
             <if test="taskAudittype != null  and taskAudittype != ''">
@@ -255,7 +255,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                     #{item}
                 </foreach>
             </if>
-            <if test="tid != null and tid !='' and tid != '-1'">and tid = #{tid}</if>
             <if test="taskVisible != null and taskVisible != ''">and taskVisible = #{taskVisible}</if>
             and taskType >=0
         </where>
@@ -266,6 +265,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectCountFmsTaskByTypeBoard" parameterType="FmsTaskListReqVo" resultType="FmsTaskTypeCountResVo">
         SELECT count(taskType) count, taskType FROM FmsTask
         <where>
+            tid = #{tid}
             <if test="taskAuditstatus != null  and taskAuditstatus != ''"> and taskStatus = #{taskAuditstatus}</if>
             <if test="landId != null  and landId != ''"> and landId = #{landId}</if>
             <if test="planId != null  and planId != ''"> and planId = #{planId}</if>
@@ -292,7 +292,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                     #{item}
                 </foreach>
             </if>
-            <if test="tid != null and tid !='' and tid != '-1'">and tid = #{tid}</if>
             <if test="taskVisible != null and taskVisible != ''">and taskVisible = #{taskVisible}</if>
         </where>
         GROUP BY taskType
@@ -304,7 +303,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         left join
         (select tr.* from FmsTaskrcd tr where tr.taskrcdAuditstatus = '1' or tr.taskrcdAuditstatus = '2') tb1
         on tb1.taskId = t.taskId
-        where t.taskType >= 0 and tb1.taskrcdAuditstatus = '2'
+        where t.taskType >= 0 and tb1.taskrcdAuditstatus = '2' and t.tid = #{tid}
         <if test="landId != null  and landId != ''"> and t.landId = #{landId}</if>
         <if test="blockId != null  and blockId != ''"> and t.blockId = #{blockId}</if>
         <if test="startDate != null  and startDate != ''"> and t.taskCompletedate <![CDATA[ >= ]]> #{startDate}</if>
@@ -315,7 +314,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 #{item}
             </foreach>
         </if>
-        <if test="tid != null and tid !='' and tid != '-1'">and t.tid = #{tid}</if>
         <if test="taskVisible != null and taskVisible != ''">and t.taskVisible = #{taskVisible}</if>
         group by t.taskType
     </select>
@@ -328,8 +326,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         LEFT JOIN FmsBlock b ON t.blockId = b.blockId
         LEFT JOIN FmsPlan p ON t.planId = p.planId
         LEFT JOIN SysUser u ON t.taskCreator = u.userId
-        where t.taskId = #{taskId}
-        <if test="tid != null and tid !='' and tid != '-1'">and t.tid = #{tid}</if>
+        where
+        t.taskId = #{taskId}
+        and t.tid = #{tid}
     </select>
 
     <select id="getInfoByPlanId" parameterType="String" resultType="FmsTaskResVo">
@@ -342,7 +341,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         t.taskType >= 0
         and t.taskStatus = '3'
         and t.planId = #{planId}
-        <if test="tid != null and tid !='' and tid != '-1'">and t.tid = #{tid}</if>
+        and t.tid = #{tid}
     </select>
 
     <insert id="insertFmsTask" parameterType="FmsTask">
@@ -423,28 +422,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="tid != null">tid = #{tid},</if>
         </trim>
         where taskId = #{taskId}
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and tid = #{tid}
-        </if>
+        and tid = #{tid}
     </update>
 
     <delete id="deleteFmsTaskByTaskId" parameterType="String">
         delete from FmsTask
         where
         taskId = #{taskId}
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and tid = #{tid}
-        </if>
+        and tid = #{tid}
     </delete>
 
     <delete id="deleteFmsTaskByTaskIds" parameterType="String">
-        delete from FmsTask where taskId in 
+        delete from FmsTask
+        where
+        taskId in
         <foreach item="taskId" collection="array" open="(" separator="," close=")">
             #{taskId}
         </foreach>
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and tid = #{tid}
-        </if>
+        and tid = #{tid}
     </delete>
 
     <select id="selectTaskCountOfTaskStatus" parameterType="String" resultType="int">
@@ -460,9 +455,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="taskVisible != null and taskVisible != ''">
             and t.taskVisible = #{taskVisible}
         </if>
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and t.tid = #{tid}
-        </if>
+        and t.tid = #{tid}
     </select>
 
     <select id="selectTaskListOfTaskStatus" parameterType="String" resultType="FmsTaskMessageResVo">
@@ -473,16 +466,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         LEFT JOIN FmsBlock b ON t.blockId = b.blockId
         LEFT JOIN FmsPlan p ON t.planId = p.planId
         LEFT JOIN FmsTaskpatrol tp on tp.taskId = t.taskId
-        WHERE t.taskStatus <![CDATA[ < ]]> 2
+        WHERE
+        t.taskStatus <![CDATA[ < ]]> 2
+        and t.tid = #{tid}
         <if test="landId != null and landId != ''">
             and t.landId  = #{landId}
         </if>
         <if test="taskManager != null and taskManager != ''">
             and t.taskManager =#{taskManager}
         </if>
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and t.tid = #{tid}
-        </if>
         <if test="taskVisible != null and taskVisible != ''">
             and t.taskVisible = #{taskVisible}
         </if>
@@ -498,10 +490,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         (select tr.* from FmsTaskrcd tr where tr.taskrcdAuditstatus = '2') tb1
         on tb1.taskId = t.taskId
         where left(t.taskCompletedate,4)=#{startTime}
+        and t.tid = #{tid}
         <if test="landId != null  and landId != ''"> and t.landId = #{landId}</if>
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and t.tid = #{tid}
-        </if>
         <if test="taskVisible != null and taskVisible != ''">
             and t.taskVisible = #{taskVisible}
         </if>
@@ -517,11 +507,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         (select tr.* from FmsTaskrcd tr where tr.taskrcdAuditstatus = '2') tb1
         on tb1.taskId = t.taskId
         left join FmsLand l on l.landId = t.landId
-        where left(t.taskCompletedate,4)=#{startTime}
+        where left(t.taskCompletedate,4)=#{startTime} and t.tid = #{tid}
         <if test="landId != null  and landId != ''"> and t.landId = #{landId}</if>
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and t.tid = #{tid}
-        </if>
         <if test="taskVisible != null and taskVisible != ''">
             and t.taskVisible = #{taskVisible}
         </if>
@@ -539,10 +526,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         on tb1.taskId = t.taskId
         left join FmsBlock b on b.blockId = t.blockId
         where left(t.taskCompletedate,4)=#{startTime}
+        and t.tid = #{tid}
         <if test="landId != null  and landId != ''"> and t.landId = #{landId}</if>
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and t.tid = #{tid}
-        </if>
         <if test="taskVisible != null and taskVisible != ''">
             and t.taskVisible = #{taskVisible}
         </if>
@@ -558,10 +543,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         (select tr.* from FmsTaskrcd tr where tr.taskrcdAuditstatus = '2') tb1
         on tb1.taskId = t.taskId
         where left(tb1.taskrcdSubmitdate,4)=#{startTime}
+        and t.tid = #{tid}
         <if test="landId != null  and landId != ''"> and t.landId = #{landId}</if>
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and t.tid = #{tid}
-        </if>
+
         <if test="taskVisible != null and taskVisible != ''">
             and t.taskVisible = #{taskVisible}
         </if>
@@ -581,10 +565,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <where>
         	and left(t.taskCompletedate,4)=#{startTime}
         	and tb1.taskrcdCost>0
+            and t.tid = #{tid}
             <if test="landId != null  and landId != ''"> and t.landId = #{landId}</if>
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and t.tid = #{tid}
-            </if>
             <if test="taskVisible != null and taskVisible != ''">
                 and t.taskVisible = #{taskVisible}
             </if>
@@ -601,10 +583,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         (select tr.* from FmsTaskrcd tr where tr.taskrcdAuditstatus = '2') tb1
         on tb1.taskId = t.taskId
         where left(tb1.taskrcdSubmitdate,4)=#{startTime}
+        and t.tid = #{tid}
         <if test="landId != null  and landId != ''"> and t.landId = #{landId}</if>
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and t.tid = #{tid}
-        </if>
         <if test="taskVisible != null and taskVisible != ''">
             and t.taskVisible = #{taskVisible}
         </if>
@@ -622,10 +602,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         (select tr.* from FmsTaskrcd tr where tr.taskrcdAuditstatus = '2') tb1
         on tb1.taskId = t.taskId
         where left(t.taskCompletedate,4)=#{startTime} and tb1.taskrcdAssetInvestment>0
+        and t.tid = #{tid}
         <if test="landId != null  and landId != ''"> and t.landId = #{landId}</if>
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and t.tid = #{tid}
-        </if>
         <if test="taskVisible != null and taskVisible != ''">
             and t.taskVisible = #{taskVisible}
         </if>
@@ -641,10 +619,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         (select tr.* from FmsTaskrcd tr where tr.taskrcdAuditstatus = '2') tb1
         on tb1.taskId = t.taskId
         where left(tb1.taskrcdSubmitdate,4)=#{startTime}
+        and t.tid = #{tid}
         <if test="landId != null  and landId != ''"> and t.landId = #{landId}</if>
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and t.tid = #{tid}
-        </if>
         <if test="taskVisible != null and taskVisible != ''">
             and t.taskVisible = #{taskVisible}
         </if>
@@ -664,10 +640,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <where>
         	and left(t.taskCompletedate,4)=#{startTime}
         	and tb1.taskrcdMachineInvestment>0
+            and t.tid = #{tid}
             <if test="landId != null  and landId != ''"> and t.landId = #{landId}</if>
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and t.tid = #{tid}
-            </if>
             <if test="taskVisible != null and taskVisible != ''">
                 and t.taskVisible = #{taskVisible}
             </if>
@@ -701,6 +675,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         LEFT JOIN FmsTaskasset fta on fta.taskrcdId = ftr.taskrcdId
         LEFT JOIN SysUser su on su.userId = ft.taskManager
         <where>
+            ft.tid = #{tid}
             <if test="taskNo != null  and taskNo != ''"> and ft.taskNo = #{taskNo}</if>
             <if test="planId != null  and planId != ''"> and ft.planId = #{planId}</if>
             <if test="planNo != null  and planNo != ''"> and fp.planNo = #{planNo}</if>
@@ -730,9 +705,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                     #{item}
                 </foreach>
             </if>
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and ft.tid = #{tid}
-            </if>
         </where>
         GROUP BY ft.taskId
         order by taskCreateddate desc

+ 16 - 13
src/main/resources/mapper/FmsTaskassetMapper.xml

@@ -11,10 +11,10 @@
     <select id="selectFmsTaskassetList" parameterType="FmsTaskasset" resultType="FmsTaskasset">
         <include refid="selectFmsTaskassetVo"/>
         <where>
+            tid = #{tid}
             <if test="assetgoodsId != null  and assetgoodsId != ''"> and assetgoodsId = #{assetgoodsId}</if>
             <if test="taskrcdId != null  and taskrcdId != ''"> and taskrcdId = #{taskrcdId}</if>
             <if test="taskassetUsedcount != null "> and taskassetUsedcount = #{taskassetUsedcount}</if>
-            <if test="tid != null and tid !='' and tid != '-1'">and tid = #{tid}</if>
         </where>
     </select>
 
@@ -22,7 +22,7 @@
         <include refid="selectFmsTaskassetVo"/>
         where
         taskassetId = #{taskassetId}
-        <if test="tid != null and tid !='' and tid != '-1'">and tid = #{tid}</if>
+        and tid = #{tid}
     </select>
 
     <insert id="insertFmsTaskasset" parameterType="FmsTaskasset">
@@ -75,7 +75,7 @@
         </trim>
         where
         taskassetId = #{taskassetId}
-        <if test="tid != null and tid !='' and tid != '-1'">and tid = #{tid}</if>
+        and tid = #{tid}
     </update>
 
     <update id="updateFmsTaskassetBatch" parameterType="FmsTaskasset">
@@ -86,14 +86,14 @@
                 <if test="taskasset.taskrcdId != null">taskrcdId = #{taskasset.taskrcdId},</if>
                 <if test="taskasset.taskassetUsedcount != null">taskassetUsedcount = #{taskasset.taskassetUsedcount},</if>
             </trim>
-            where taskassetId = #{taskasset.taskassetId}
-            <if test="taskasset.tid != null and taskasset.tid != null">and tid = #{taskasset.tid}</if>
+            where
+            taskassetId = #{taskasset.taskassetId}
+            and tid = #{taskasset.tid}
         </foreach>
     </update>
 
     <delete id="deleteFmsTaskassetByTaskassetId" parameterType="String">
-        delete from FmsTaskasset where taskassetId = #{taskassetId}
-        <if test="tid != null and tid !='' and tid != '-1'">and tid = #{tid}</if>
+        delete from FmsTaskasset where taskassetId = #{taskassetId} and tid = #{tid}
     </delete>
 
     <delete id="deleteFmsTaskassetByTaskassetIds" parameterType="String">
@@ -101,7 +101,7 @@
         <foreach item="taskassetId" collection="array" open="(" separator="," close=")">
             #{taskassetId}
         </foreach>
-        <if test="tid != null and tid !='' and tid != '-1'">and tid = #{tid}</if>
+        and tid = #{tid}
     </delete>
 
     <select id="selectFmsTaskAssetUsageResVoList" parameterType="FmsTaskAssetUsageReqVo" resultType="FmsTaskAssetUsageResVo">
@@ -129,6 +129,7 @@
         LEFT JOIN FmsCrop c ON c.cropId = p.cropId
         LEFT JOIN SysUser su ON su.userId = t.taskManager
         <where>
+            a.tid = #{tid}
             <if test="goodsType != null and goodsType != '' ">and ag.assetgoodsType = #{goodsType}</if>
             <if test="goodsName != null and goodsName != '' ">and g.goodsName = #{goodsName}</if>
             <if test="planNo != null and planNo != '' ">and p.planNo = #{planNo}</if>
@@ -143,7 +144,6 @@
                     #{item}
                 </foreach>
             </if>
-            <if test="tid != null and tid !='' and tid != '-1'">and a.tid = #{tid}</if>
             and r.taskrcdAuditstatus = '2'
         </where>
     </select>
@@ -159,11 +159,14 @@
         FmsTaskasset ta
         LEFT JOIN WmsAssetgoods ag on ag.assetgoodsId = ta.assetgoodsId
         LEFT JOIN WmsGoods g ON g.goodsId = ag.goodsId
-        where ta.taskrcdId in
+        where
+        ta.tid = #{tid}
+        and
+        ta.taskrcdId in
         <foreach collection="taskrcdIds" item="taskrcdId" open="(" separator="," close=")">
             #{taskrcdId}
         </foreach>
-        <if test="tid != null and tid !='' and tid != '-1'">and ta.tid = #{tid}</if>
+
     </select>
 
     <select id="selectFmsTaskAssetStat" parameterType="FmsTaskListReqVo" resultType="FmsTaskAssetUsageResVo">
@@ -181,6 +184,7 @@
         LEFT JOIN WmsGoods g ON g.goodsId = ag.goodsId
         LEFT JOIN FmsTask t ON t.taskId = r.taskId
         <where>
+            a.tid = #{tid}
             <if test="landId != null  and landId != ''"> and t.landId = #{landId}</if>
             <if test="blockId != null  and blockId != ''"> and t.blockId = #{blockId}</if>
             <if test="planId != null and planId != '' ">and t.planId = #{planId}</if>
@@ -192,7 +196,6 @@
                     #{item}
                 </foreach>
             </if>
-            <if test="tid != null and tid !='' and tid != '-1'">and a.tid = #{tid}</if>
             and r.taskrcdAuditstatus = '2'
         </where>
         GROUP BY g.goodsId,ag.assetgoodsType
@@ -223,6 +226,7 @@
         LEFT JOIN FmsCrop c ON c.cropId = p.cropId
         LEFT JOIN SysUser su on su.userId = t.taskManager
         <where>
+            a.tid = #{tid}
             <if test="goodsType != null and goodsType != '' ">and ag.assetgoodsType = #{goodsType}</if>
             <if test="goodsName != null and goodsName != '' ">and g.goodsName = #{goodsName}</if>
             <if test="planNo != null and planNo != '' ">and p.planNo = #{planNo}</if>
@@ -237,7 +241,6 @@
                     #{item}
                 </foreach>
             </if>
-            <if test="tid != null and tid !='' and tid != '-1'">and a.tid = #{tid}</if>
             and r.taskrcdAuditstatus = '2'
         </where>
         order by r.taskrcdCompletedate desc

+ 15 - 10
src/main/resources/mapper/FmsTaskmachineMapper.xml

@@ -10,28 +10,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectFmsTaskmachineList" parameterType="FmsTaskmachine" resultType="FmsTaskmachine">
         <include refid="selectFmsTaskmachineVo"/>
-        <where>  
+        <where>
+            tid = #{tid}
             <if test="taskrcdId != null  and taskrcdId != ''"> and taskrcdId = #{taskrcdId}</if>
             <if test="machId != null  and machId != ''"> and machId = #{machId}</if>
             <if test="taskmachUsedcount != null "> and taskmachUsedcount = #{taskmachUsedcount}</if>
-            <if test="tid != null and tid !='' and tid != '-1'">and tid = #{tid}</if>
         </where>
     </select>
     
     <select id="selectFmsTaskmachineByTaskmachId" parameterType="String" resultType="FmsTaskmachine">
         <include refid="selectFmsTaskmachineVo"/>
-        where taskmachId = #{taskmachId}
-        <if test="tid != null and tid !='' and tid != '-1'">and tid = #{tid}</if>
+        where
+        tid = #{tid}
+        and
+        taskmachId = #{taskmachId}
+
     </select>
 
     <select id="selectFmsTaskmachineByRcdId" parameterType="String" resultType="FmsTaskmachineResVo">
         select * from FmsTaskmachine tm left join FmsMach m on tm.machId = m.machId
         where
+        tm.tid = #{tid}
+        and
         tm.taskrcdId in
         <foreach collection="taskrcdIds" item="taskrcdId" open="(" separator="," close=")">
             #{taskrcdId}
         </foreach>
-        <if test="tid != null and tid !='' and tid != '-1'">and tm.tid = #{tid}</if>
+
     </select>
 
     <select id="selectFmsTaskmachineStat" parameterType="FmsTaskListReqVo" resultType="FmsTaskmachineResVo">
@@ -42,6 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         LEFT JOIN FmsMach m ON m.machId = tm.machId
         LEFT JOIN FmsTask t ON t.taskId = r.taskId
         <where>
+            tm.tid = #{tid}
             <if test="landId != null  and landId != ''"> and t.landId = #{landId}</if>
             <if test="blockId != null  and blockId != ''"> and t.blockId = #{blockId}</if>
             <if test="planId != null and planId != '' ">and t.planId = #{planId}</if>
@@ -53,7 +59,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                     #{item}
                 </foreach>
             </if>
-            <if test="tid != null and tid !='' and tid != '-1'">and tm.tid = #{tid}</if>
         </where>
         GROUP BY m.machId
     </select>
@@ -109,7 +114,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </trim>
         where
         taskmachId = #{taskmachId}
-        <if test="tid != null and tid !='' and tid != '-1'">and tid = #{tid}</if>
+        and tid = #{tid}
     </update>
 
     <update id="updateFmsTaskmachineBatch" parameterType="FmsTaskmachine">
@@ -123,7 +128,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             </trim>
             where
             taskmachId = #{taskmachine.taskmachId}
-            <if test="tid != null and tid !='' and tid != '-1'">and tid = #{taskmachine.tid}</if>
+            and tid = #{taskmachine.tid}
         </foreach>
     </update>
 
@@ -131,7 +136,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         delete from FmsTaskmachine
         where
         taskmachId = #{taskmachId}
-        <if test="tid != null and tid !='' and tid != '-1'">and tid = #{tid}</if>
+        and tid = #{tid}
     </delete>
 
     <delete id="deleteFmsTaskmachineByTaskmachIds" parameterType="String">
@@ -139,6 +144,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <foreach item="taskmachId" collection="array" open="(" separator="," close=")">
             #{taskmachId}
         </foreach>
-        <if test="tid != null and tid !='' and tid != '-1'">and tid = #{tid}</if>
+        and tid = #{tid}
     </delete>
 </mapper>

+ 24 - 50
src/main/resources/mapper/FmsTaskpickMapper.xml

@@ -44,9 +44,7 @@
                     #{item}
                 </foreach>
             </if>
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and t.tid = #{tid}
-            </if>
+            and t.tid = #{tid}
             and t.taskType = -1
         </where>
     </select>
@@ -60,6 +58,7 @@
         LEFT JOIN FmsCrop c on c.cropId = t.cropId
         <where>
             t.cropId is not null
+            and tp.tid = #{tid}
             <if test="cropName != null and cropName != ''">and c.cropName like CONCAT("%",#{cropName},"%")</if>
             <if test="dataFilter == true and blockIds != null and blockIds.size() > 0">
                 AND t.blockId in
@@ -67,9 +66,6 @@
                     #{item}
                 </foreach>
             </if>
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and tp.tid = #{tid}
-            </if>
         </where>
         GROUP BY t.cropId,c.cropName,c.cropType
     </select>
@@ -84,6 +80,7 @@
         LEFT JOIN FmsCrop c on c.cropId = t.cropId
         <where>
             t.cropId is not null
+            and tp.tid = #{tid}
             <if test="taskStatus != null and taskStatus != ''">and t.taskStatus = #{taskStatus}</if>
             <if test="landId != null and landId != ''">and t.landId = #{landId}</if>
             <if test="blockId != null and blockId != ''">and t.blockId = #{blockId}</if>
@@ -93,9 +90,6 @@
                     #{blockId}
                 </foreach>
             </if>
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and tp.tid = #{tid}
-            </if>
         </where>
         GROUP BY t.cropId,c.cropName,c.cropType
     </select>
@@ -105,7 +99,9 @@
         from FmsTaskpick tp
         left join FmsTask t on t.taskId = tp.taskId
         left join FmsCrop c on t.cropId = c.cropId
-        where t.taskStatus = '3'
+        where
+        t.taskStatus = '3'
+        and tp.tid = #{tid}
         <if test="landId != null  and landId != ''">
             and t.landId =  #{landId}
         </if>
@@ -121,9 +117,6 @@
                 #{item}
             </foreach>
         </if>
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and tp.tid = #{tid}
-        </if>
         group by c.cropName
     </select>
 
@@ -133,7 +126,10 @@
         left join FmsTask t on t.taskId = tp.taskId
         left join FmsCrop c on t.cropId = c.cropId
         left join FmsLand l on l.landId = t.landId
-        where t.taskStatus = '3' and l.landId is not null
+        where
+        t.taskStatus = '3'
+        and l.landId is not null
+        and tp.tid = #{tid}
         <if test="landId != null  and landId != ''">
             and t.landId =  #{landId}
         </if>
@@ -149,9 +145,6 @@
                 #{item}
             </foreach>
         </if>
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and tp.tid = #{tid}
-        </if>
         group by l.landId
     </select>
 
@@ -161,7 +154,10 @@
         left join FmsTask t on t.taskId = tp.taskId
         left join FmsCrop c on t.cropId = c.cropId
         left join FmsBlock b on b.blockId = t.blockId
-        where t.taskStatus = '3' and b.blockId is not null
+        where
+        t.taskStatus = '3'
+        and b.blockId is not null
+        and tp.tid = #{tid}
         <if test="landId != null  and landId != ''">
             and t.landId =  #{landId}
         </if>
@@ -177,9 +173,6 @@
                 #{item}
             </foreach>
         </if>
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and tp.tid = #{tid}
-        </if>
         group by b.blockId
     </select>
 
@@ -201,32 +194,26 @@
         LEFT JOIN FmsTaskrcd r on r.taskId = t.taskId and r.taskrcdAuditstatus = '2'
         <where>
             t.cropId = #{cropId}
+            and
+            t.tid = #{tid}
             <if test="landId !=null and landId != ''">and t.landId = #{landId}</if>
             <if test="blockId !=null and blockId != ''">and t.blockId = #{blockId}</if>
             <if test="planNo !=null and planNo != ''">and p.planNo = #{planNo}</if>
             <if test="pickNo !=null and pickNo != ''">and tp.pickNo = #{pickNo}</if>
             <if test="taskCompletedatestart !=null and taskCompletedatestart != '' and taskCompletedateend !=null and taskCompletedateend != ''">and t.taskCompletedate between #{taskCompletedatestart} and #{taskCompletedateend}</if>
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and t.tid = #{tid}
-            </if>
         </where>
 
     </select>
 
     <select id="selectFmsTaskpickByTaskpickId" parameterType="String" resultType="FmsTaskpick">
         <include refid="selectFmsTaskpickVo"/>
-        where taskpickId = #{taskpickId}
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and tid = #{tid}
-        </if>
+        where taskpickId = #{taskpickId} and tid = #{tid}
+
     </select>
 
     <select id="selectFmsTaskpickByTaskId" parameterType="String" resultType="FmsTaskpick">
         <include refid="selectFmsTaskpickVo"/>
-        where taskId = #{taskId}
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and tid = #{tid}
-        </if>
+        where taskId = #{taskId} and tid = #{tid}
     </select>
 
     <select id="selectFmsTaskpickByPlanId" parameterType="String" resultType="FmsTaskPickListResVo">
@@ -236,10 +223,7 @@
         where
         t.taskStatus = '3'
         and
-        t.planId = #{planId}
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and t.tid = #{tid}
-        </if>
+        t.planId = #{planId} and t.tid = #{tid}
     </select>
 
 
@@ -293,9 +277,7 @@
                     #{item}
                 </foreach>
             </if>
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and ft.tid = #{tid}
-            </if>
+            and ft.tid = #{tid}
             and ft.taskType = -1
         </where>
         group by ft.taskId
@@ -339,19 +321,13 @@
             <if test="tid != null">tid = #{tid},</if>
         </trim>
         where
-        taskpickId = #{taskpickId}
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and tid = #{tid}
-        </if>
+        taskpickId = #{taskpickId} and tid = #{tid}
     </update>
 
     <delete id="deleteFmsTaskpickByTaskpickId" parameterType="String">
         delete from FmsTaskpick
         where
-        taskpickId = #{taskpickId}
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and tid = #{tid}
-        </if>
+        taskpickId = #{taskpickId} and tid = #{tid}
     </delete>
 
     <delete id="deleteFmsTaskpickByTaskpickIds" parameterType="String">
@@ -361,8 +337,6 @@
         <foreach item="taskpickId" collection="array" open="(" separator="," close=")">
             #{taskpickId}
         </foreach>
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and tid = #{tid}
-        </if>
+        and tid = #{tid}
     </delete>
 </mapper>

+ 10 - 31
src/main/resources/mapper/FmsTaskrcdMapper.xml

@@ -12,11 +12,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectTaskrcdList" parameterType="FmsTaskListReqVo" resultType="FmsTaskrcdListDto">
         <include refid="selectFmsTaskrcdVo"/>
         <where>
+            tid = #{tid}
             <if test="taskId != null  and taskId != ''"> and taskId = #{taskId}</if>
             <if test="taskrcdAuditstatus != null  and taskrcdAuditstatus != ''"> and taskrcdAuditstatus = #{taskrcdAuditstatus}</if>
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and tid = #{tid}
-            </if>
         </where>
     </select>
 
@@ -51,7 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         LEFT JOIN SysUser AS u ON t.taskrcdAuditor = u.userId
         LEFT JOIN FmsTask ft on ft.taskId = t.taskId
         <where>
-            r.resMediatype = '1'
+            r.resMediatype = '1' and t.tid = #{tid}
             <if test="taskId != null  and taskId != ''"> and t.taskId = #{taskId}</if>
             <if test="taskrcdAuditstatus != null  and taskrcdAuditstatus != ''"> and t.taskrcdAuditstatus = #{taskrcdAuditstatus}</if>
             <if test="dataFilter == true and blockIds != null and blockIds.size() > 0">
@@ -60,9 +58,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                     #{item}
                 </foreach>
             </if>
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and t.tid = #{tid}
-            </if>
         </where>
         order by t.taskrcdSubmitdate desc
     </select>
@@ -99,9 +94,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         LEFT JOIN SysRes AS r ON t.taskrcdId = r.resBusId
         <where>
             <if test="taskId != null  and taskId != ''"> and taskId = #{taskId}</if>
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and t.tid = #{tid}
-            </if>
+            and t.tid = #{tid}
             and t.taskrcdId = (
                 SELECT t2.taskrcdId
                 FROM FmsTaskrcd AS t2
@@ -115,9 +108,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectFmsTaskrcdByTaskrcdId" parameterType="String" resultType="FmsTaskrcd">
         <include refid="selectFmsTaskrcdVo"/>
         where taskrcdId = #{taskrcdId}
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and tid = #{tid}
-        </if>
+        and tid = #{tid}
     </select>
 
     <select id="selectFmsTaskrcdInfoByTaskrcdId" parameterType="String" resultType="FmsTaskrcdByTaskrcdIdDto">
@@ -176,9 +167,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         LEFT JOIN SysUser AS u ON u.userId = t.taskManager
         LEFT JOIN SysRes AS r ON tc.taskrcdId = r.resBusId
         where tc.taskrcdId = #{taskrcdId}
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and tc.tid = #{tid}
-        </if>
+        and tc.tid = #{tid}
     </select>
     <select id="selectFmsPlanTaskrcdList" resultType="com.yunfeiyun.agmp.fms.domain.vo.FmsTaskrcdVo">
         SELECT
@@ -196,9 +185,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         WHERE
         taskrcdAuditstatus = '2'
         and planId = #{planId}
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and tr.tid = #{tid}
-        </if>
+        and tr.tid = #{tid}
         order by ft.taskCompletedate desc
     </select>
 
@@ -271,18 +258,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="tid != null">tid = #{tid},</if>
         </trim>
         where taskrcdId = #{taskrcdId}
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and tid = #{tid}
-        </if>
+        and tid = #{tid}
     </update>
 
     <delete id="deleteFmsTaskrcdByTaskrcdId" parameterType="String">
         delete from FmsTaskrcd
         where
         taskrcdId = #{taskrcdId}
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and tid = #{tid}
-        </if>
+        and tid = #{tid}
     </delete>
 
     <delete id="deleteFmsTaskrcdByTaskrcdIds" parameterType="String">
@@ -292,18 +275,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <foreach item="taskrcdId" collection="array" open="(" separator="," close=")">
             #{taskrcdId}
         </foreach>
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and tid = #{tid}
-        </if>
+        and tid = #{tid}
     </delete>
 
     <select id="selectOneByTaskId" resultType="com.yunfeiyun.agmp.fms.domain.FmsTaskrcd">
         <include refid="selectFmsTaskrcdVo"/>
         <where>
             taskId = #{taskId}
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and tid = #{tid}
-            </if>
+            and tid = #{tid}
         </where>
         limit 1
     </select>

+ 8 - 24
src/main/resources/mapper/FmsWarnMapper.xml

@@ -44,9 +44,7 @@
                     #{item}
                 </foreach>
             </if>
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and w.tid = #{tid}
-            </if>
+            and w.tid = #{tid}
         </where>
         ORDER BY w.warnCreatedate DESC
     </select>
@@ -54,9 +52,7 @@
     <select id="selectFmsWarnByWarnId" parameterType="String" resultType="FmsWarnResVo">
         <include refid="selectFmsWarnReqVo"/>
         where warnId = #{warnId}
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and w.tid = #{tid}
-        </if>
+        and w.tid = #{tid}
     </select>
 
     <!--    定时任务调度中使用-->
@@ -64,9 +60,7 @@
         SELECT planId, periodId
         FROM FmsWarn
         <where>
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and tid = #{tid}
-            </if>
+            tid = #{tid}
         </where>
     </select>
 
@@ -144,16 +138,12 @@
         </trim>
         where
         warnId = #{warnId}
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and tid = #{tid}
-        </if>
+        and tid = #{tid}
     </update>
 
     <delete id="deleteFmsWarnByWarnId" parameterType="String">
         delete from FmsWarn where warnId = #{warnId}
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and tid = #{tid}
-        </if>
+        and tid = #{tid}
     </delete>
 
     <delete id="deleteFmsWarnByWarnIds" parameterType="String">
@@ -163,9 +153,7 @@
         <foreach item="warnId" collection="array" open="(" separator="," close=")">
             #{warnId}
         </foreach>
-        <if test="tid != null and tid !='' and tid != '-1'">
-            and tid = #{tid}
-        </if>
+        and tid = #{tid}
     </delete>
     <select id="selectFmsWarnResVoByBlockManager" resultType="FmsWarnResVo" parameterType="FmsWarnResVo">
         SELECT
@@ -183,15 +171,13 @@
         LEFT JOIN FmsCrop c ON c.cropId = p.cropId
         <where>
             warnHandlestatus = '1'
+            and w.tid = #{tid}
             <if test="dataFilter == true and blockIds != null and blockIds.size() > 0">
                 AND b.blockId in
                 <foreach collection="blockIds" item="item" open="(" separator="," close=")">
                     #{item}
                 </foreach>
             </if>
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and w.tid = #{tid}
-            </if>
         </where>
 
 
@@ -210,6 +196,7 @@
         LEFT JOIN FmsBlock fb ON fb.blockId = fp.blockId
         LEFT JOIN FmsCrop fc on fc.cropId = fp.cropId
         <where>
+            fw.tid = #{tid}
             <if test="landId != null  and landId != ''"> and fl.landId = #{landId}</if>
             <if test="blockId != null  and blockId != ''"> and fb.blockId = #{blockId}</if>
             <if test="cropName != null  and cropName != ''"> and fc.cropName like concat('%', #{cropName}, '%')</if>
@@ -226,9 +213,6 @@
                     #{item}
                 </foreach>
             </if>
-            <if test="tid != null and tid !='' and tid != '-1'">
-                and fw.tid = #{tid}
-            </if>
         </where>
         order by fw.warnCreatedate desc
     </select>