Ver Fonte

2021/6/22 系统管理-用户管理修改

yinhao há 4 anos atrás
pai
commit
fdeafcfd85

+ 14 - 4
huimv-smart-management/src/main/java/com/huimv/management/controller/YearPigBaseController.java

@@ -42,6 +42,16 @@ public class YearPigBaseController {
     }
 
 
+     /**
+      * 列表
+      */
+     @RequestMapping("/fattenList")
+     public R fattenList(@RequestParam Map<String, Object> params){
+         PageUtils page = yearPigBaseService.fattenList(params);
+
+         return R.ok().put("page", page);
+     }
+
     /**
      * 信息
      */
@@ -105,7 +115,7 @@ public class YearPigBaseController {
 
     //批量出栏
     @RequestMapping("/such")
-    public R such(@RequestParam Integer[] ids){
+    public R such(@RequestBody Integer[] ids){
 
 //        YearPigBaseEntity yearPigBaseEntity = new YearPigBaseEntity();
 //        yearPigBaseEntity.setOutFenceStatus(1);
@@ -123,11 +133,11 @@ public class YearPigBaseController {
 
     //出栏入栏比例
     @RequestMapping("/outAndInProportion")
-    public R outAndInProportion(Integer farmId){
+    public R outAndInProportion(Integer formFarmId){
         //出栏
-        Integer outFenct = yearPigBaseService.findByoutFenceStatus(1,farmId);
+        Integer outFenct = yearPigBaseService.findByoutFenceStatus(1,formFarmId);
         //育肥
-        Integer inFenct = yearPigBaseService.findByoutFenceStatus(0,farmId);
+        Integer inFenct = yearPigBaseService.findByoutFenceStatus(0,formFarmId);
         Map<String,Integer> resultMap = new HashMap<String,Integer>();
         resultMap.put("outFenct",outFenct);
         resultMap.put("inFenct",inFenct);

+ 2 - 0
huimv-smart-management/src/main/java/com/huimv/management/dao/YearPigBaseDao.java

@@ -34,4 +34,6 @@ public interface YearPigBaseDao extends BaseMapper<YearPigBaseEntity> {
     List<CountOut> suchStatistics(@Param("farmId") Integer farmId,@Param("ew") QueryWrapper<YearPigBaseEntity> wrapper);
 
     List<CountOut> suchStatisticsMonth(@Param("farmId") Integer farmId,@Param("ew") QueryWrapper<YearPigBaseEntity> wrapper);
+
+    IPage<PigBaseVo> fattenList(@Param("page")IPage page, @Param("ew") QueryWrapper<DrinkingWaterVo> queryWrapper);
 }

+ 2 - 0
huimv-smart-management/src/main/java/com/huimv/management/service/YearPigBaseService.java

@@ -51,5 +51,7 @@ public interface YearPigBaseService extends IService<YearPigBaseEntity> {
     void transferPeriod(HashMap<String, Object> map, HttpServletRequest request);
 
     Integer countByPeriodId(Integer currentPeriodId);
+
+    PageUtils fattenList(Map<String, Object> params);
 }
 

+ 67 - 0
huimv-smart-management/src/main/java/com/huimv/management/service/impl/YearPigBaseServiceImpl.java

@@ -346,4 +346,71 @@ public class YearPigBaseServiceImpl extends ServiceImpl<YearPigBaseDao, YearPigB
         wrapper.eq("period_id",currentPeriodId);
         return baseMapper.selectCount(wrapper);
     }
+
+    @Override
+    public PageUtils fattenList(Map<String, Object> params) {
+        //构建条件查询wrapper
+        QueryWrapper<DrinkingWaterVo> queryWrapper = new QueryWrapper<>();
+
+        //耳标
+        String eartag = (String) params.get("eartag");
+        if (StringUtils.isNotEmpty(eartag)) {
+            queryWrapper.like("base.eartag",eartag);
+        }
+
+        //性别
+        String sex = (String) params.get("sex");
+        if (StringUtils.isNotEmpty(sex)) {
+            queryWrapper.eq("base.sex",sex);
+        }
+
+        //品种
+        String breed = (String) params.get("breed");
+        if (StringUtils.isNotEmpty(breed)) {
+            queryWrapper.eq("base.breed",breed);
+        }
+
+        //健康状态
+        String healthStatus = (String) params.get("healthStatus");
+        if (StringUtils.isNotEmpty(healthStatus)) {
+            queryWrapper.eq("base.health_status",Integer.parseInt(healthStatus));
+        }
+
+        //养殖状态
+        String outFenceStatus = (String) params.get("outFenceStatus");
+        if (StringUtils.isNotEmpty(outFenceStatus)) {
+            queryWrapper.eq("base.out_fence_status",Integer.parseInt(outFenceStatus));
+        }
+
+        //栏期
+        String periodId = (String) params.get("periodId");
+        if (StringUtils.isNotEmpty(periodId)) {
+            queryWrapper.eq("base.period_id",Integer.parseInt(periodId));
+        }
+
+        //栋舍
+        String pigstyId = (String) params.get("pigstyId");
+        if (StringUtils.isNotEmpty(pigstyId)) {
+            queryWrapper.eq("base.pigsty_id",Integer.parseInt(pigstyId));
+        }
+        //单元
+        String unitId = (String) params.get("unitId");
+        if (StringUtils.isNotEmpty(unitId)) {
+            queryWrapper.eq("base.unit_id",Integer.parseInt(unitId));
+        }
+
+        //牧场
+        String farmId = (String) params.get("formFarmId");
+        if (StringUtils.isNotEmpty(farmId)) {
+            queryWrapper.eq("base.farm_id",Integer.parseInt(farmId));
+        }
+        //排除逻辑删除
+        queryWrapper.apply(" base.deleted = 0  AND pigsty.deleted = 0 AND base.out_fence_status = 0 ");
+
+        IPage<PigBaseVo> page = pigBaseDao.fattenList(new Query<>().getPage(params),queryWrapper);
+
+
+
+        return new PageUtils(page);
+    }
 }

+ 36 - 2
huimv-smart-management/src/main/resources/mapper/management/YearPigBaseDao.xml

@@ -44,10 +44,42 @@
           base.breed,
           base.sex,
           base.birthday,
+          base.origin_place,
           pigsty.number pigsty_name,
           period.number period_name,
           base.in_fence_time,
           base.out_fence_time,
+          base.out_fence_status,
+          base.mother_eartag,
+          base.father_eartag
+
+        from mgt_year_pig_base base
+        LEFT JOIN mgt_period period on period.id = base.period_id
+        JOIN mgt_pigsty pigsty on pigsty.id = base.pigsty_id
+        JOIN mgt_unit unit on unit.id = base.unit_id
+        ${ew.customSqlSegment}
+
+    </select>
+
+    <select id="fattenList" resultType="com.huimv.management.entity.vo.PigBaseVo">
+        SELECT
+          base.id,
+          base.eartag,
+          base.day_age,
+          unit.number unit_name,
+          base.weight,
+          base.foster_status,
+          base.health_status,
+          base.where_did_you_go,
+          base.breed,
+          base.sex,
+          base.birthday,
+          base.origin_place,
+          pigsty.number pigsty_name,
+          period.number period_name,
+          base.in_fence_time,
+          base.out_fence_time,
+          base.out_fence_status,
           base.mother_eartag,
           base.father_eartag
 
@@ -63,13 +95,15 @@
         SELECT DATE_FORMAT(out_fence_time,"%Y-%m-%d") DATE,COUNT(*) total
         FROM `mgt_year_pig_base`
         ${ew.customSqlSegment}
-        GROUP BY DATE_FORMAT(out_fence_time,"%Y-%m-%d")
+         GROUP BY DATE HAVING  DATE IS NOT NULL
+--         GROUP BY DATE_FORMAT(out_fence_time,"%Y-%m-%d")
     </select>
 
     <select id="suchStatisticsMonth" resultType="com.huimv.management.entity.vo.CountOut">
         SELECT DATE_FORMAT(out_fence_time,"%Y-%m") DATE,COUNT(*) total
         FROM `mgt_year_pig_base`
         ${ew.customSqlSegment}
-        GROUP BY DATE_FORMAT(out_fence_time,"%Y-%m")
+         GROUP BY DATE HAVING     IS NOT NULL
+--         GROUP BY DATE_FORMAT(out_fence_time,"%Y-%m")
     </select>
 </mapper>

+ 4 - 4
renren-fast/src/main/java/io/renren/modules/sys/entity/vo/SysUserVo.java

@@ -75,10 +75,10 @@ public class SysUserVo {
      */
     private Integer farmId;
 
-    /**
-     * 所属牧场名称
-     */
-    private String farmName;
+//    /**
+//     * 所属牧场名称
+//     */
+//    private String farmName;
 
     /**
      * 住址

+ 24 - 26
renren-fast/src/main/java/io/renren/modules/sys/service/impl/SysUserServiceImpl.java

@@ -50,44 +50,42 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserDao, SysUserEntity> i
     @Override
     public PageUtils queryPage(Map<String, Object> params) {
 
+        QueryWrapper<SysUserVo> queryWrapper = new QueryWrapper<>();
+
         String username = (String) params.get("username");
-        Object farmId = params.get("farmId");
-        if (farmId != null) {
-            farmId = Integer.parseInt((farmId.toString()));
+        if (StringUtils.isNotBlank(username)) {
+            queryWrapper.and(q -> q.like("sys_user.username", username)
+                    .or().like("sys_user.mobile", username));
         }
-        Long createUserId = (Long) params.get("createUserId");
-        String departmentCode = (String) params.get("departmentCode");
-        String jobCode = (String) params.get("jobCode");
-        Object sex = params.get("sex");
-        if (sex != null) {
-            sex = Short.parseShort((String) sex);
+
+        String farmId = (String) params.get("farmId");
+        if (StringUtils.isNotBlank(farmId)) {
+            queryWrapper.eq("sys_user.farm_id",Integer.parseInt(farmId));
         }
 
-        QueryWrapper<SysUserVo> queryWrapper = new QueryWrapper<>();
-        if (StringUtils.isNotBlank(username)) {
-            queryWrapper.and(q -> q.like("sys_user.username", username)
-                                .or().like("sys_user.mobile", username));
+        String createUserId = (String) params.get("createUserId");
+        if (StringUtils.isNotBlank(createUserId)) {
+            queryWrapper.eq("sys_user.create_user_id",Integer.parseInt(createUserId));
+        }
 
+        String departmentCode = (String) params.get("departmentCode");
+        if (StringUtils.isNotBlank(createUserId)) {
+            queryWrapper.eq("sys_user.department_code",departmentCode);
         }
 
+        String jobCode = (String) params.get("jobCode");
+        if (StringUtils.isNotBlank(jobCode)) {
+            queryWrapper.eq("sys_user.job_code",jobCode);
+        }
 
-        queryWrapper.eq(StringUtils.isNotBlank(departmentCode), "sys_user.department_code", departmentCode)
-                .eq(StringUtils.isNotEmpty(jobCode), "sys_user.job_code", jobCode)
-                .eq(sex != null,"sys_user.sex", sex)
-                .eq(farmId != null,"sys_user.farm_id", farmId)
-                .eq(createUserId != null, "sys_user.create_user_id", createUserId);
+        String sex = (String) params.get("sex");
+        if (StringUtils.isNotBlank(sex)) {
+            queryWrapper.eq("sys_user.sex",Short.parseShort(sex));
+        }
 
         IPage page = new Query<>().getPage(params);
 
         return new PageUtils(this.baseMapper.page(page, queryWrapper));
-//		IPage<SysUserEntity> page = this.page(
-//				page1,
-//			new QueryWrapper<SysUserEntity>()
-//				.like(StringUtils.isNotBlank(username),"username", username)
-//				.eq(createUserId != null,"create_user_id", createUserId)
-//		);
-//
-//		return new PageUtils(page);
     }
 
     @Override

+ 1 - 3
renren-fast/src/main/resources/mapper/sys/SysUserDao.xml

@@ -33,16 +33,14 @@
 			sys_user.status,
 			sys_department.department_code,
 			sys_department.department_name,
+			sys_user.farm_id,
 			sys_job.job_code,
 			sys_job.job_name,
-			sys_user.farm_id,
-			farm.name farm_name,
 			sys_user.address,
 			sys_user.remarks
 		FROM  sys_user
 			LEFT JOIN sys_department ON sys_user.department_code = sys_department.department_code
 			LEFT JOIN sys_job ON sys_user.job_code = sys_job.job_code
-			LEFT JOIN huimv_smart_apiservice.mgt_farm farm ON sys_user.farm_id = farm.id
 		${ew.customSqlSegment}
 	</select>