智慧农业后台管理
tangzy
2022-06-11 8bdbba337b312e8d5b5769f945236b9b5472ebc2
农资统计
19 files modified
27 files added
2035 ■■■■■ changed files
src/main/java/org/springblade/common/config/BladeConfiguration.java 1 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/farmplant/controller/FarmPlantController.java 92 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/farmplant/controller/FarmProductStockController.java 8 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/farmplant/mapper/FarmPlantMapper.java 33 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/farmplant/mapper/FarmPlantMapper.xml 196 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/farmplant/mapper/FarmProductStockMapper.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/farmplant/mapper/FarmProductStockMapper.xml 14 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/farmplant/service/FarmPlantService.java 11 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/farmplant/service/FarmProductStockService.java 3 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/farmplant/service/impl/FarmPlantServiceImpl.java 91 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/farmplant/service/impl/FarmProductStockServiceImpl.java 6 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/farmplant/vo/FarmPlantVO.java 1 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/lang/controller/LandController.java 156 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/lang/entity/Land.java 53 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/lang/mapper/LandMapper.java 1 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/lang/mapper/LandMapper.xml 23 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/lang/service/ILandService.java 1 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/lang/service/impl/LandServiceImpl.java 5 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/lang/vo/LandVO.java 1 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/machining/controller/MachiningController.java 127 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/machining/dto/MachiningDTO.java 34 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/machining/entity/Machining.java 56 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/machining/mapper/MachiningMapper.java 42 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/machining/mapper/MachiningMapper.xml 26 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/machining/service/IMachiningService.java 41 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/machining/service/impl/MachiningServiceImpl.java 41 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/machining/vo/MachiningVO.java 34 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/sale/controller/SaleController.java 143 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/sale/dto/SaleDTO.java 34 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/sale/entity/Sale.java 65 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/sale/mapper/SaleMapper.java 44 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/sale/mapper/SaleMapper.xml 52 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/sale/service/ISaleService.java 45 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/sale/service/impl/SaleServiceImpl.java 54 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/sale/vo/SaleVO.java 34 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/task/controller/TaskController.java 128 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/task/dto/TaskDTO.java 34 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/task/entity/Task.java 84 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/task/mapper/TaskMapper.java 42 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/task/mapper/TaskMapper.xml 31 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/task/service/ITaskService.java 41 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/task/service/impl/TaskServiceImpl.java 41 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/task/vo/TaskVO.java 34 ●●●●● patch | view | raw | blame | history
src/main/java/sql/machining.menu.sql 10 ●●●●● patch | view | raw | blame | history
src/main/java/sql/sale.menu.sql 10 ●●●●● patch | view | raw | blame | history
src/main/java/sql/task.menu.sql 10 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/common/config/BladeConfiguration.java
@@ -51,6 +51,7 @@
        secureRegistry.excludePathPatterns("/webjars/**");
        secureRegistry.excludePathPatterns("/swagger-resources/**");
        secureRegistry.excludePathPatterns("/druid/**");
        secureRegistry.excludePathPatterns("/farmPlant/**");
        secureRegistry.excludePathPatterns("/land/land/**");
        secureRegistry.excludePathPatterns("/blade-resource/oss/endpoint/**");
        return secureRegistry;
src/main/java/org/springblade/modules/farmplant/controller/FarmPlantController.java
@@ -42,12 +42,15 @@
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * 农场养殖记录表控制器
 * @since 2022-05-12
 *
 * @author zhongrj
 * @since 2022-05-12
 */
@RestController
@AllArgsConstructor
@@ -104,23 +107,23 @@
    public R save(@Valid @RequestBody FarmPlant farmPlant) {
        farmPlant.setCreateTime(new Date());
        boolean save = farmplantService.save(farmPlant);
        if (save){
        if (save) {
            //同时生成农事记录
            FarmingRecord record = new FarmingRecord();
            record.setCreateTime(new Date());
            record.setJobWay(farmPlant.getJobWay());
            record.setTime(farmPlant.getTransplanTime());
            if(farmPlant.getPlantingWay().equals("0")){
            if (farmPlant.getPlantingWay().equals("0")) {
                //移栽
                record.setType("10");
            }
            if(farmPlant.getPlantingWay().equals("1")){
            if (farmPlant.getPlantingWay().equals("1")) {
                //直播
                record.setType("11");
            }
            record.setLandId(farmPlant.getLandId());
            record.setOperator(farmPlant.getCreateUser());
            record.setRemarks("品种: "+farmPlant.getVarieties());
            record.setRemarks("品种: " + farmPlant.getVarieties());
            //新增
            farmingRecordService.save(record);
@@ -143,7 +146,7 @@
    public R update(@Valid @RequestBody FarmPlant farmPlant) {
        boolean status = false;
        //如果是结束
        if (farmPlant.getStatus().equals("2")){
        if (farmPlant.getStatus().equals("2")) {
            //更新
            status = farmplantService.updateById(farmPlant);
            //判断该地块是否还有种植的农产品
@@ -152,14 +155,14 @@
            farmPlant1.setLandId(farmPlant2.getLandId());
            farmPlant1.setStatus("1");
            List<FarmPlant> list = farmplantService.list(new QueryWrapper<>(farmPlant1));
            if (list.size()<1){
            if (list.size() < 1) {
                //更新该地块的耕种状态
                Land land = new Land();
                land.setType(1);
                land.setId(Long.parseLong(farmPlant2.getLandId()));
                landService.updateById(land);
            }
        }else {
        } else {
            //更新
            status = farmplantService.updateById(farmPlant);
        }
@@ -191,17 +194,19 @@
    /**
     * 农产品种养统计
     *
     * @param farmPlantVO 农产品种植对象
     * @param query 分页查询对象
     * @param query       分页查询对象
     * @return
     */
    @GetMapping("/getFarmPlantStatistics")
    public R<IPage<FarmPlantVO>> getFarmPlantStatistics(FarmPlantVO farmPlantVO, Query query) {
        return R.data(farmplantService.getFarmPlantStatistics(Condition.getPage(query),farmPlantVO));
        return R.data(farmplantService.getFarmPlantStatistics(Condition.getPage(query), farmPlantVO));
    }
    /**
     * 农产品种养统计(累计和)
     *
     * @param farmPlantVO 农产品种植对象
     * @return
     */
@@ -212,12 +217,77 @@
    /**
     * 农产品列表
     *
     * @param farm 农产品对象
     * @return
     */
    @GetMapping("/strain-tree")
    public R strainTree(FarmPlantVO farm){
    public R strainTree(FarmPlantVO farm) {
        return R.data(farmplantService.strainTree(farm));
    }
    /**
     * 大屏种养品种接口
     *
     * @param farmPlant
     * @param query
     * @return
     */
    @GetMapping("/pagePalnt")
    public R pagePalnt(FarmPlantVO farmPlant, Query query) {
        int i = farmplantService.selectCount();
        IPage<FarmPlantVO> pages = farmplantService.selectFarmPlantPage(Condition.getPage(query), farmPlant);
        Map map = new HashMap<>();
        map.put("num", i);
        map.put("page", pages);
        return R.data(map);
    }
    /**
     * 种植品种监管 0:有机 1:绿色 2:无公害 3:普通
     * code=1(当天) =2(月) =3(年)
     *
     * @return
     */
    @GetMapping("/selectPlant")
    public R selectPlant(String code, String time) {
        Map map1 = farmplantService.selectPlant(code, time);
        Map map2 = farmplantService.selectPlantl(code, time);
        Map map3 = farmplantService.selectPlantw(code, time);
        Map map4 = farmplantService.selectPlantp(code, time);
        Map map = new HashMap();
        map.put("yj", map1.get("num"));
        map.put("ls", map2.get("num"));
        map.put("wgh", map3.get("num"));
        map.put("pt", map4.get("num"));
        return R.data(map);
    }
    /**
     * 种植采收监管 产品等级(0:一等品 1:二等品 2:三等品 3:四等品4:五等品  code=1(当天) =2(月) =3(年)
     *
     * @return
     */
    @GetMapping("/selectProduct")
    public R selectProduct(String code, String time) {
        //(0:一等品
        Map map1 = farmplantService.selectProduct(code, time);
        //1:二等品
        Map map2 = farmplantService.selectProducty(code, time);
        //2:三等品
        Map map3 = farmplantService.selectProductr(code, time);
        //3:四等品
        Map map4 = farmplantService.selectProducts(code, time);
        //4:五等品
        Map map5 = farmplantService.selectProductf(code, time);
        Map map = new HashMap();
        map.put("yi", map1.get("num"));
        map.put("er", map2.get("num"));
        map.put("san", map3.get("num"));
        map.put("shi", map4.get("num"));
        map.put("wu", map5.get("num"));
        return R.data(map);
    }
}
src/main/java/org/springblade/modules/farmplant/controller/FarmProductStockController.java
@@ -116,4 +116,12 @@
        return R.status(farmProductStockService.removeByIds(Func.toLongList(ids)));
    }
    /**
     * 大屏产量统计
     */
    @PostMapping("/selctProductCount")
    public R selctProductCount( String year) {
        return R.data(farmProductStockService.selctProductCount(year));
    }
}
src/main/java/org/springblade/modules/farmplant/mapper/FarmPlantMapper.java
@@ -9,11 +9,13 @@
import org.springblade.modules.farmplant.vo.StrainVO;
import java.util.List;
import java.util.Map;
/**
 *  农产品种植记录表Mapper 接口
 * @since 2022-05-12
 * 农产品种植记录表Mapper 接口
 *
 * @author zhongrj
 * @since 2022-05-12
 */
public interface FarmPlantMapper extends BaseMapper<FarmPlant> {
@@ -24,28 +26,45 @@
     * @param farm
     * @return
     */
    List<FarmPlantVO> selectFarmPlantPage(@Param("page") IPage page,@Param("farmPlant") FarmPlantVO farm);
    List<FarmPlantVO> selectFarmPlantPage(@Param("page") IPage page, @Param("farmPlant") FarmPlantVO farm);
    /**
     *
     * @param page
     * @param farm
     * @return
     */
    List<FarmPlantVO> getFarmPlantStatistics(@Param("page") IPage<FarmPlantVO> page,@Param("farmPlant") FarmPlantVO farm);
    List<FarmPlantVO> getFarmPlantStatistics(@Param("page") IPage<FarmPlantVO> page, @Param("farmPlant") FarmPlantVO farm);
    /**
     * 农产品列表
     *
     * @param farm 农产品对象
     * @return
     */
    List<Strain> strainTree(@Param("farm") FarmPlantVO farm);
    List<Strain> strainTree(@Param("farm") FarmPlantVO farm);
    /**
     * 统计查询种植面积
      * @param farm
     *
     * @param farm
     * @return
     */
    List<FarmPlantVO> getFarmPlantStatisticsCount(@Param("farmPlant") FarmPlantVO farm);
    int selectCount();
    Map selectPlant(String code, String time);
    Map selectPlantl(String code, String time);
    Map selectPlantw(String code, String time);
    Map selectPlantp(String code, String time);
    Map selectProduct(String code, String time);
    Map selectProducty(String code, String time);
    Map selectProductr(String code, String time);
    Map selectProducts(String code, String time);
    Map selectProductf(String code, String time);
}
src/main/java/org/springblade/modules/farmplant/mapper/FarmPlantMapper.xml
@@ -4,7 +4,8 @@
    <!--自定义查询农场养殖记录分页数据-->
    <select id="selectFarmPlantPage" resultType="org.springblade.modules.farmplant.vo.FarmPlantVO">
        select sfp.*,ss.strain_name strainName,ss.url,sl.land_name landName,sl.land_area area,land_unit landUnit from sys_farm_plant sfp
        select sfp.*,ss.strain_name strainName,ss.url,sl.land_name landName,sl.land_area area,land_unit landUnit from
        sys_farm_plant sfp
        left join sys_strain ss on ss.id = sfp.strain_id
        left join sys_land sl on sl.id = sfp.land_id
        where 1=1
@@ -40,7 +41,8 @@
    <!--自定义查询农场养殖记录分页数据-->
    <select id="getFarmPlantStatistics" resultType="org.springblade.modules.farmplant.vo.FarmPlantVO">
        select sfp.strain_id,ss.strain_name strainName,sum(sl.land_area) areas,land_unit landUnit from sys_farm_plant sfp
        select sfp.strain_id,ss.strain_name strainName,sum(sl.land_area) areas,land_unit landUnit from sys_farm_plant
        sfp
        left join sys_strain ss on ss.id = sfp.strain_id
        left join sys_land sl on sl.id = sfp.land_id
        where 1=1
@@ -55,7 +57,8 @@
    <!--查询农场养殖记录数据-->
    <select id="getFarmPlantStatisticsCount" resultType="org.springblade.modules.farmplant.vo.FarmPlantVO">
        select sfp.strain_id,ss.strain_name strainName,sum(sl.land_area) areas,land_unit landUnit from sys_farm_plant sfp
        select sfp.strain_id,ss.strain_name strainName,sum(sl.land_area) areas,land_unit landUnit from sys_farm_plant
        sfp
        left join sys_strain ss on ss.id = sfp.strain_id
        left join sys_land sl on sl.id = sfp.land_id
        where 1=1
@@ -70,8 +73,189 @@
    <!--已种植农产品列表-->
    <select id="strainTree" resultType="org.springblade.modules.farmplant.entity.Strain">
        select ss.id,ss.strain_name strainName from sys_farm_plant sfp
        left join sys_strain ss on ss.id = sfp.strain_id
        where sfp.status = "1" and sfp.land_id = #{farm.landId}
        select ss.id, ss.strain_name strainName
        from sys_farm_plant sfp
                 left join sys_strain ss on ss.id = sfp.strain_id
        where sfp.status = "1"
          and sfp.land_id = #{farm.landId}
    </select>
    <select id="selectCount" resultType="java.lang.Integer">
        SELECT IFNULL(COUNT(*), 0) as num
        FROM (SELECT strain_id FROM `sys_farm_plant` WHERE STATUS = 1 GROUP BY strain_id) a
    </select>
    <!--种植品种监管 0:有机 code=1(当天) =2(月) =3(年)-->
    <select id="selectPlant" resultType="java.util.HashMap">
        SELECT
        IFNULL( COUNT( * ), 0 ) AS num
        FROM
        `sys_farm_plant`
        WHERE
        plant = 0
        AND STATUS = 1
        <if test="1 == code">
            and to_days(create_time) = to_days(#{time});
        </if>
        <if test="2 == code">
            and DATE_FORMAT( create_time, '%Y%m' ) = DATE_FORMAT(#{time} ,'%Y%m' )
        </if>
        <if test="3 == code">
            and YEAR(create_time)=YEAR(#{time});
        </if>
    </select>
    <!--种植品种监管 1:绿色 -->
    <select id="selectPlantl" resultType="java.util.HashMap">
        SELECT
        IFNULL( COUNT( * ), 0 ) AS num
        FROM
        `sys_farm_plant`
        WHERE
        plant = 1
        AND STATUS = 1
        <if test="1 == code">
            and to_days(create_time) = to_days(#{time});
        </if>
        <if test="2 == code">
            and DATE_FORMAT( create_time, '%Y%m' ) = DATE_FORMAT(#{time} ,'%Y%m' )
        </if>
        <if test="3 == code">
            and YEAR(create_time)=YEAR(#{time});
        </if>
    </select>
    <!--种植品种监管 2:无公害 -->
    <select id="selectPlantw" resultType="java.util.HashMap">
        SELECT
        IFNULL( COUNT( * ), 0 ) AS num
        FROM
        `sys_farm_plant`
        WHERE
        plant = 2
        AND STATUS = 1
        <if test="1 == code">
            and to_days(create_time) = to_days(#{time});
        </if>
        <if test="2 == code">
            and DATE_FORMAT( create_time, '%Y%m' ) = DATE_FORMAT(#{time} ,'%Y%m' )
        </if>
        <if test="3 == code">
            and YEAR(create_time)=YEAR(#{time});
        </if>
    </select>
    <!--种植品种监管 3:普通 -->
    <select id="selectPlantp" resultType="java.util.HashMap">
        SELECT
        IFNULL( COUNT( * ), 0 ) AS num
        FROM
        `sys_farm_plant`
        WHERE
        plant = 3
        AND STATUS = 1
        <if test="1 == code">
            and to_days(create_time) = to_days(#{time});
        </if>
        <if test="2 == code">
            and DATE_FORMAT( create_time, '%Y%m' ) = DATE_FORMAT(#{time} ,'%Y%m' )
        </if>
        <if test="3 == code">
            and YEAR(create_time)=YEAR(#{time});
        </if>
    </select>
    <!--种植采收监管 产品等级(0:一等品)-->
    <select id="selectProduct" resultType="java.util.HashMap">
        SELECT
        IFNULL( COUNT( * ), 0 ) AS num
        FROM
        `sys_farm_product_stock`
        WHERE
        leaves = 0
        <if test="1 == code">
            and to_days(create_time) = to_days(#{time});
        </if>
        <if test="2 == code">
            and DATE_FORMAT( create_time, '%Y%m' ) = DATE_FORMAT(#{time} ,'%Y%m' )
        </if>
        <if test="3 == code">
            and YEAR(create_time)=YEAR(#{time});
        </if>
    </select>
    <!--种植采收监管 产品等级 1:二等品 -->
    <select id="selectProducty" resultType="java.util.HashMap">
        SELECT
        IFNULL( COUNT( * ), 0 ) AS num
        FROM
        `sys_farm_product_stock`
        WHERE
        leaves = 1
        <if test="1 == code">
            and to_days(create_time) = to_days(#{time});
        </if>
        <if test="2 == code">
            and DATE_FORMAT( create_time, '%Y%m' ) = DATE_FORMAT(#{time} ,'%Y%m' )
        </if>
        <if test="3 == code">
            and YEAR(create_time)=YEAR(#{time});
        </if>
    </select>
    <!--种植采收监管 产品等级 2:三等品 -->
    <select id="selectProductr" resultType="java.util.HashMap">
        SELECT
        IFNULL( COUNT( * ), 0 ) AS num
        FROM
        `sys_farm_product_stock`
        WHERE
        leaves = 2
        <if test="1 == code">
            and to_days(create_time) = to_days(#{time});
        </if>
        <if test="2 == code">
            and DATE_FORMAT( create_time, '%Y%m' ) = DATE_FORMAT(#{time} ,'%Y%m' )
        </if>
        <if test="3 == code">
            and YEAR(create_time)=YEAR(#{time});
        </if>
    </select>
    <!--种植采收监管 产品等级3:四等品-->
    <select id="selectProducts" resultType="java.util.HashMap">
        SELECT
        IFNULL( COUNT( * ), 0 ) AS num
        FROM
        `sys_farm_product_stock`
        WHERE
        leaves = 3
        <if test="1 == code">
            and to_days(create_time) = to_days(#{time});
        </if>
        <if test="2 == code">
            and DATE_FORMAT( create_time, '%Y%m' ) = DATE_FORMAT(#{time} ,'%Y%m' )
        </if>
        <if test="3 == code">
            and YEAR(create_time)=YEAR(#{time});
        </if>
    </select>
    <!--种植采收监管 产品等级 4:五等品 -->
    <select id="selectProductf" resultType="java.util.HashMap">
        SELECT
        IFNULL( COUNT( * ), 0 ) AS num
        FROM
        `sys_farm_product_stock`
        WHERE
        leaves = 4
        <if test="1 == code">
            and to_days(create_time) = to_days(#{time});
        </if>
        <if test="2 == code">
            and DATE_FORMAT( create_time, '%Y%m' ) = DATE_FORMAT(#{time} ,'%Y%m' )
        </if>
        <if test="3 == code">
            and YEAR(create_time)=YEAR(#{time});
        </if>
    </select>
</mapper>
src/main/java/org/springblade/modules/farmplant/mapper/FarmProductStockMapper.java
@@ -8,6 +8,7 @@
import org.springblade.modules.farmplant.vo.FarmProductStockVO;
import java.util.List;
import java.util.Map;
/**
 *  农产品库存Mapper 接口
@@ -31,4 +32,5 @@
     * @return
     */
    List<FarmProductStockVO> statisticsProduct(@Param("farmProductStock") FarmProductStockVO farmProductStock);
    Map<String, String> selctProductCount(String year);
}
src/main/java/org/springblade/modules/farmplant/mapper/FarmProductStockMapper.xml
@@ -4,7 +4,8 @@
    <!--自定义查询农产品库存分页数据-->
    <select id="selectFarmProductStockPage" resultType="org.springblade.modules.farmplant.vo.FarmProductStockVO">
        select sfps.strain_id strainId,sum(sfps.weight) weight,ss.url,ss.strain_name strainName from sys_farm_product_stock sfps
        select sfps.strain_id strainId,sum(sfps.weight) weight,ss.url,ss.strain_name strainName from
        sys_farm_product_stock sfps
        left join sys_strain ss on ss.id = sfps.strain_id
        where 1=1
        <if test="farmProductStock.strainId!=null and farmProductStock.strainId!=''">
@@ -25,7 +26,8 @@
    <!--查询农产品库存数据-->
    <select id="statisticsProduct" resultType="org.springblade.modules.farmplant.vo.FarmProductStockVO">
        select sfps.strain_id strainId,sum(sfps.weight) weight,ss.url,ss.strain_name strainName from sys_farm_product_stock sfps
        select sfps.strain_id strainId,sum(sfps.weight) weight,ss.url,ss.strain_name strainName from
        sys_farm_product_stock sfps
        left join sys_strain ss on ss.id = sfps.strain_id
        where 1=1
        <if test="farmProductStock.strainId!=null and farmProductStock.strainId!=''">
@@ -42,4 +44,12 @@
        </if>
        group by sfps.strain_id,ss.url,ss.strain_name
    </select>
    <!--大屏产量每个月统计-->
    <select id="selctProductCount" resultType="java.util.HashMap">
        SELECT SUM(CASE WHEN MONTH ( s.time ) = 1 THEN s.weight END ) AS '1', SUM(CASE WHEN MONTH ( s.time ) = 2 THEN s.weight END ) AS '2', SUM(CASE WHEN MONTH ( s.time ) = 3 THEN s.weight END ) AS '3', SUM(CASE WHEN MONTH ( s.time ) = 4 THEN s.weight END ) AS '4', SUM(CASE WHEN MONTH ( s.time ) = 5 THEN s.weight END ) AS '5', SUM(CASE WHEN MONTH ( s.time ) = 6 THEN s.weight END ) AS '6', SUM(CASE WHEN MONTH ( s.time ) = 7 THEN s.weight END ) AS '7', SUM(CASE WHEN MONTH ( s.time ) = 8 THEN s.weight END ) AS '8', SUM(CASE WHEN MONTH ( s.time ) = 9 THEN s.weight END ) AS '9', SUM(CASE WHEN MONTH ( s.time ) = 10 THEN s.weight END ) AS '10', SUM(CASE WHEN MONTH ( s.time ) = 11 THEN s.weight END ) AS '11', SUM(CASE WHEN MONTH ( s.time ) = 12 THEN s.weight END ) AS '12'
        FROM sys_farm_product_stock AS s
        WHERE
            YEAR ( s.time ) =#{year}
    </select>
</mapper>
src/main/java/org/springblade/modules/farmplant/service/FarmPlantService.java
@@ -9,6 +9,7 @@
import org.springblade.modules.farmplant.vo.StrainVO;
import java.util.List;
import java.util.Map;
/**
 * 农场养殖记录表服务类
@@ -47,4 +48,14 @@
     * @return
     */
    FarmPlantVO getFarmPlantStatisticsCount(FarmPlantVO farmPlantVO);
    int selectCount();
    Map selectPlant(String code,String time);
    Map selectPlantl(String code,String time);
    Map selectPlantw(String code,String time);
    Map selectPlantp(String code,String time);
    Map selectProduct(String code,String time);
    Map selectProducty(String code, String time);
    Map selectProductr(String code, String time);
    Map selectProducts(String code, String time);
    Map selectProductf(String code, String time);
}
src/main/java/org/springblade/modules/farmplant/service/FarmProductStockService.java
@@ -6,6 +6,8 @@
import org.springblade.modules.farmplant.entity.FarmProductStock;
import org.springblade.modules.farmplant.vo.FarmProductStockVO;
import java.util.Map;
/**
 * 农产品库存服务类
 * @since 2022-05-18
@@ -28,4 +30,5 @@
     * @return
     */
    FarmProductStockVO statisticsProduct(FarmProductStockVO farmProductStock);
    Map<String, String> selctProductCount(String year);
}
src/main/java/org/springblade/modules/farmplant/service/impl/FarmPlantServiceImpl.java
@@ -1,4 +1,5 @@
package org.springblade.modules.farmplant.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.modules.farm.entity.Farm;
@@ -12,11 +13,13 @@
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/**
 * 农场养殖记录表服务实现类
 * @since 2022-05-12
 *
 * @author zhongrj
 * @since 2022-05-12
 */
@Service
public class FarmPlantServiceImpl extends ServiceImpl<FarmPlantMapper, FarmPlant> implements FarmPlantService {
@@ -33,11 +36,11 @@
        List<FarmPlantVO> farmPlantVOS = baseMapper.selectFarmPlantPage(page, farm);
        //遍历
        farmPlantVOS.forEach(farmPlantVO -> {
            if (farmPlantVO.getLandUnit().equals("1")){
                farmPlantVO.setArea(String.format("%.2f", Double.parseDouble(farmPlantVO.getArea())*0.1));
            if (farmPlantVO.getLandUnit().equals("1")) {
                farmPlantVO.setArea(String.format("%.2f", Double.parseDouble(farmPlantVO.getArea()) * 0.1));
            }
            if (farmPlantVO.getLandUnit().equals("2")){
                farmPlantVO.setArea(String.format("%.2f",Double.parseDouble(farmPlantVO.getArea())*0.0015));
            if (farmPlantVO.getLandUnit().equals("2")) {
                farmPlantVO.setArea(String.format("%.2f", Double.parseDouble(farmPlantVO.getArea()) * 0.0015));
            }
        });
        return page.setRecords(farmPlantVOS);
@@ -45,6 +48,7 @@
    /**
     * 农产品种养统计
     *
     * @param farm 农产品种植对象
     * @param page 分页查询对象
     * @return
@@ -54,12 +58,12 @@
        List<FarmPlantVO> farmPlantVOS = baseMapper.getFarmPlantStatistics(page, farm);
        //遍历
        farmPlantVOS.forEach(farmPlantVO -> {
            if (farmPlantVO.getLandUnit().equals("1")){
                BigDecimal bg = new BigDecimal(farmPlantVO.getAreas()*0.1);
            if (farmPlantVO.getLandUnit().equals("1")) {
                BigDecimal bg = new BigDecimal(farmPlantVO.getAreas() * 0.1);
                farmPlantVO.setAreas(bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
            }
            if (farmPlantVO.getLandUnit().equals("2")){
                BigDecimal bg = new BigDecimal(farmPlantVO.getAreas()*0.0015);
            if (farmPlantVO.getLandUnit().equals("2")) {
                BigDecimal bg = new BigDecimal(farmPlantVO.getAreas() * 0.0015);
                farmPlantVO.setAreas(bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
            }
        });
@@ -69,6 +73,7 @@
    /**
     * 农产品列表
     *
     * @param farm 农产品对象
     * @return
     */
@@ -79,6 +84,7 @@
    /**
     * 农产品种养统计(累计和)
     *
     * @param farm 农产品种植对象
     * @return
     */
@@ -86,30 +92,81 @@
    public FarmPlantVO getFarmPlantStatisticsCount(FarmPlantVO farm) {
        List<FarmPlantVO> farmPlantVOS = baseMapper.getFarmPlantStatisticsCount(farm);
        FarmPlantVO plantVO = new FarmPlantVO();
        if (farmPlantVOS.size()>0){
        if (farmPlantVOS.size() > 0) {
            BigDecimal decimal = new BigDecimal(0.0);
            //遍历
            for (FarmPlantVO farmPlantVO : farmPlantVOS) {
                if (farmPlantVO.getLandUnit().equals("0")){
                    BigDecimal bg = new BigDecimal(farmPlantVO.getAreas()*1);
                if (farmPlantVO.getLandUnit().equals("0")) {
                    BigDecimal bg = new BigDecimal(farmPlantVO.getAreas() * 1);
                    decimal = decimal.add(bg.setScale(2, BigDecimal.ROUND_HALF_UP));
                }
                if (farmPlantVO.getLandUnit().equals("1")){
                    BigDecimal bg = new BigDecimal(farmPlantVO.getAreas()*0.1);
                if (farmPlantVO.getLandUnit().equals("1")) {
                    BigDecimal bg = new BigDecimal(farmPlantVO.getAreas() * 0.1);
                    decimal = decimal.add(bg.setScale(2, BigDecimal.ROUND_HALF_UP));
                }
                if (farmPlantVO.getLandUnit().equals("2")){
                    BigDecimal bg = new BigDecimal(farmPlantVO.getAreas()*0.0015);
                if (farmPlantVO.getLandUnit().equals("2")) {
                    BigDecimal bg = new BigDecimal(farmPlantVO.getAreas() * 0.0015);
                    decimal = decimal.add(bg.setScale(2, BigDecimal.ROUND_HALF_UP));
                }
            }
            //求和
            plantVO.setArea(decimal.toString());
        }else {
        } else {
            //求和
            plantVO.setArea("0");
        }
        //返回
        return plantVO;
    }
    @Override
    public int selectCount() {
        return baseMapper.selectCount();
    }
    @Override
    public Map selectPlant(String code, String time) {
        return baseMapper.selectPlant(code, time);
    }
    @Override
    public Map selectPlantl(String code, String time) {
        return baseMapper.selectPlantl(code, time);
    }
    @Override
    public Map selectPlantw(String code, String time) {
        return baseMapper.selectPlantw(code, time);
    }
    @Override
    public Map selectPlantp(String code, String time) {
        return baseMapper.selectPlantp(code, time);
    }
    @Override
    public Map selectProduct(String code, String time) {
        return baseMapper.selectProduct(code, time);
    }
    @Override
    public Map selectProducty(String code, String time) {
        return baseMapper.selectProducty(code, time);
    }
    @Override
    public Map selectProductr(String code, String time) {
        return baseMapper.selectProductr(code, time);
    }
    @Override
    public Map selectProducts(String code, String time) {
        return baseMapper.selectProducts(code, time);
    }
    @Override
    public Map selectProductf(String code, String time) {
        return baseMapper.selectProductf(code, time);
    }
}
src/main/java/org/springblade/modules/farmplant/service/impl/FarmProductStockServiceImpl.java
@@ -9,6 +9,7 @@
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/**
 * 农产品库存服务实现类
@@ -48,4 +49,9 @@
        //返回
        return stock;
    }
    @Override
    public Map<String, String> selctProductCount(String year) {
        return baseMapper.selctProductCount(year);
    }
}
src/main/java/org/springblade/modules/farmplant/vo/FarmPlantVO.java
@@ -51,5 +51,4 @@
     * 面积合计
     */
    private Double areas;
}
src/main/java/org/springblade/modules/lang/controller/LandController.java
@@ -32,6 +32,8 @@
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.farm.entity.Farm;
import org.springblade.modules.farm.vo.FarmVO;
import org.springblade.modules.system.entity.DictBiz;
import org.springblade.modules.system.service.IDictBizService;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestParam;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -60,6 +62,7 @@
public class LandController extends BladeController {
    private final ILandService landService;
    private final IDictBizService dictService;
    /**
     * 详情
@@ -230,60 +233,149 @@
        List<Map<String, Object>> lists = landService.selectSAre();
        List list1 = landService.selectNum();
        //总面积
        Double num=0.0;
        for (int i=0;i<list.size();i++){
        Double num = 0.0;
        for (int i = 0; i < list.size(); i++) {
            //面积
            String area = list.get(i).get("area").toString();
            //单位
            String unit = list.get(i).get("unit").toString();
            Double area1=Double.parseDouble(area);
            Double area1 = Double.parseDouble(area);
            //面积单位(0: 亩 1:分 2:平方米)
            if (unit.equals("0")){
                num+=area1;
            if (unit.equals("0")) {
                num += area1;
            }
            if (unit.equals("1")){
            if (unit.equals("1")) {
                double v = area1 * 0.1;
                num+=v;
            }
            else {
                double v = area1 *0.0015;
                num+=v;
                num += v;
            } else {
                double v = area1 * 0.0015;
                num += v;
            }
        }
        //使用面积
        Double snum=0.0;
        for (int i=0;i<lists.size();i++){
        Double snum = 0.0;
        for (int i = 0; i < lists.size(); i++) {
            //面积
            String area = lists.get(i).get("area").toString();
            //单位
            String unit = lists.get(i).get("unit").toString();
            Double area1=Double.parseDouble(area);
            Double area1 = Double.parseDouble(area);
            //面积单位(0: 亩 1:分 2:平方米)
            if (unit.equals("0")){
                snum+=area1;
            if (unit.equals("0")) {
                snum += area1;
            }
            if (unit.equals("1")){
            if (unit.equals("1")) {
                double v = area1 * 0.1;
                snum+=v;
            }
            else {
                double v = area1 *0.0015;
                snum+=v;
                snum += v;
            } else {
                double v = area1 * 0.0015;
                snum += v;
            }
        }
        //品种数量
        int size = list1.size();
        Map map = new HashMap();
        //地块使用率
        double v = snum / num;
        double v1 = v * 100;
        DecimalFormat df = new DecimalFormat("#0.00");
        String format = df.format(v1);
        Double a=Double.parseDouble(format);
        Map map =new HashMap();
        map.put("rate",a);
        map.put("zarea",(double) Math.round(num * 100) / 100);
        map.put("sarea",(double) Math.round(snum * 100) / 100);
        map.put("num",size);
        if(snum!=0.0|| num!=0.0){
            double v = snum / num;
            double v1 = v * 100;
            DecimalFormat df = new DecimalFormat("#0.00");
            String format = df.format(v1);
            Double a = Double.parseDouble(format);
            map.put("rate", a);
            map.put("zarea", (double) Math.round(num * 100) / 100);
            map.put("sarea", (double) Math.round(snum * 100) / 100);
            map.put("num", size);
        }
        else {
            map.put("rate", 0.0);
            map.put("zarea", 0.0);
            map.put("sarea", 0.0);
            map.put("num", size);
        }
        return R.data(map);
    }
    /**
     * 大屏地块统计接口
     */
    @GetMapping("/selectXCount")
    public R selectXCount() {
        List<Map<String, Object>> list = landService.selectZAre();
        List<Map<String, Object>> lists = landService.selectSAre();
        List<Map<String, Object>> listw = landService.selectWAre();
        List list1 = landService.selectNum();
        //总面积
        Double num = 0.0;
        for (int i = 0; i < list.size(); i++) {
            //面积
            String area = list.get(i).get("area").toString();
            //单位
            String unit = list.get(i).get("unit").toString();
            Double area1 = Double.parseDouble(area);
            //面积单位(0: 亩 1:分 2:平方米)
            if (unit.equals("0")) {
                num += area1;
            }
            if (unit.equals("1")) {
                double v = area1 * 0.1;
                num += v;
            } else {
                double v = area1 * 0.0015;
                num += v;
            }
        }
        //使用面积
        Double snum = 0.0;
        for (int i = 0; i < lists.size(); i++) {
            //面积
            String area = lists.get(i).get("area").toString();
            //单位
            String unit = lists.get(i).get("unit").toString();
            Double area1 = Double.parseDouble(area);
            //面积单位(0: 亩 1:分 2:平方米)
            if (unit.equals("0")) {
                snum += area1;
            }
            if (unit.equals("1")) {
                double v = area1 * 0.1;
                snum += v;
            } else {
                double v = area1 * 0.0015;
                snum += v;
            }
        }
        //未使用面积
        Double wnum = 0.0;
        for (int i = 0; i < listw.size(); i++) {
            //面积
            String area = listw.get(i).get("area").toString();
            //单位
            String unit = listw.get(i).get("unit").toString();
            Double area1 = Double.parseDouble(area);
            //面积单位(0: 亩 1:分 2:平方米)
            if (unit.equals("0")) {
                wnum += area1;
            }
            if (unit.equals("1")) {
                double v = area1 * 0.1;
                wnum += v;
            } else {
                double v = area1 * 0.0015;
                wnum += v;
            }
        }
        //品种数量
        int size = list1.size();
        //农资种类
        List<DictBiz> tree = dictService.getList("stockType");
        int size1 = tree.size();
        Map map = new HashMap();
        map.put("num", num);
        map.put("snum", snum);
        map.put("wnum", wnum);
        map.put("zynum", size);
        map.put("nznum", size1);
        return R.data(map);
    }
src/main/java/org/springblade/modules/lang/entity/Land.java
@@ -17,7 +17,9 @@
package org.springblade.modules.lang.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import org.springblade.core.mp.base.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -32,39 +34,42 @@
@Data
@TableName("sys_land")
@EqualsAndHashCode(callSuper = true)
public class Land  extends TenantEntity {
public class Land extends TenantEntity {
    private static final long serialVersionUID = 1L;
    /**
    * 用户id
    */
        private String userId;
     * 用户id
     */
    private String userId;
    /**
    * 地块名称
    */
        private String landName;
     * 地块名称
     */
    private String landName;
    /**
    * 地块类型(0:大田 1:大棚 2:果园 3:鱼塘 4:山地 5:养殖区)
    */
        private Integer landType;
     * 地块类型(0:大田 1:大棚 2:果园 3:鱼塘 4:山地 5:养殖区)
     */
    private Integer landType;
    /**
    * 地块面积
    */
        private String landArea;
        private String url;
     * 地块面积
     */
    private String landArea;
    private String url;
    /**
    * 地块范围
    */
        private String landRange;
     * 地块范围
     */
    private String landRange;
    /**
    * 状态 (0:已耕种 1:未耕种)
    */
        private Integer type;
     * 状态 (0:已耕种 1:未耕种)
     */
    private Integer type;
    /**
    * 面积单位(0: 亩 1:分 2:平方米)
    */
        private Integer landUnit;
     * 面积单位(0: 亩 1:分 2:平方米)
     */
    private Integer landUnit;
    /**
     * 部门id
     */
    private String deptId;
}
src/main/java/org/springblade/modules/lang/mapper/LandMapper.java
@@ -58,4 +58,5 @@
    List selectNum();
    List<Map<String, Object>> selectZAre();
    List<Map<String, Object>> selectSAre();
    List<Map<String, Object>> selectWAre();
}
src/main/java/org/springblade/modules/lang/mapper/LandMapper.xml
@@ -21,14 +21,16 @@
        ST_ASTEXT(land_range) as land_range,
        l.url,
        d.dict_value as dic,
        c.dict_value as dica
        c.dict_value as dica,
        v.dept_name as deptname
        FROM `sys_land` l
        LEFT JOIN (SELECT dict_key, dict_value FROM blade_dict_biz WHERE CODE = 'land' AND is_deleted = 0) d
        ON d.dict_key = l.land_type
        LEFT JOIN (SELECT dict_key, dict_value
        FROM blade_dict_biz
        WHERE CODE = 'landunit'
        AND is_deleted = 0) c ON c.dict_key = l.type
        AND is_deleted = 0) c ON c.dict_key = l.land_unit
        LEFT JOIN ( SELECT id, dept_name FROM blade_dept WHERE is_deleted = 0 ) v ON v.id = l.dept_id
        where l.is_deleted = 0
        <if test="land.landType!=null and land.landType != ''">
            and l.land_type = #{land.landType}
@@ -40,13 +42,13 @@
    <insert id="saveLandInfo">
        insert into sys_land
        (user_id,land_name,land_type,land_area,land_range,type,land_unit)
        (user_id,land_name,land_type,land_area,land_range,type,land_unit,dept_id)
        values
        (#{land.userId},#{land.landName},#{land.landType},#{land.landArea},
        <if test="land.landRange!=null and land.landRange!=''">
            ST_GeomFromText(${land.landRange}),
        </if>
        #{land.type},#{land.landUnit})
        #{land.type},#{land.landUnit},#{land.deptId})
    </insert>
    <!--详情信息(自定义查询)-->
@@ -81,22 +83,29 @@
    <select id="selectLandList" resultType="java.util.HashMap">
        select id, land_name as landName
        from sys_land
        where user_id = #{userid}
        where dept_id = #{userid}
          and is_deleted = 0
    </select>
    <!--土地总面积-->
    <select id="selectZAre" resultType="java.util.HashMap">
        SELECT land_area as area, land_unit as unit
        SELECT IFNULL(land_area, 0) as area, IFNULL(land_unit, 0) as unit
        FROM sys_land
        WHERE is_deleted = 0
    </select>
    <!--土地使用面积-->
    <select id="selectSAre" resultType="java.util.HashMap">
        SELECT land_area as area, land_unit as unit
        SELECT IFNULL(land_area, 0) as area, IFNULL(land_unit, 0) as unit
        FROM sys_land
        WHERE is_deleted = 0
          and type = 0
    </select>
    <!--土地未使用面积-->
    <select id="selectWAre" resultType="java.util.HashMap">
        SELECT IFNULL(land_area, 0) as area, IFNULL(land_unit, 0) as unit
        FROM sys_land
        WHERE is_deleted = 0
          and type = 1
    </select>
    <select id="selectNum" resultType="java.util.HashMap">
        SELECT strain_id
        FROM `sys_farm_plant`
src/main/java/org/springblade/modules/lang/service/ILandService.java
@@ -68,5 +68,6 @@
     */
    List<Map<String, Object>> selectZAre();
    List<Map<String, Object>> selectSAre();
    List<Map<String, Object>> selectWAre();
    List selectNum();
}
src/main/java/org/springblade/modules/lang/service/impl/LandServiceImpl.java
@@ -76,6 +76,11 @@
    }
    @Override
    public List<Map<String, Object>> selectWAre() {
        return baseMapper.selectWAre();
    }
    @Override
    public List selectNum() {
        return baseMapper.selectNum();
    }
src/main/java/org/springblade/modules/lang/vo/LandVO.java
@@ -32,5 +32,6 @@
    private static final long serialVersionUID = 1L;
    String dic;
    String dica;
    String deptname;
}
src/main/java/org/springblade/modules/machining/controller/MachiningController.java
New file
@@ -0,0 +1,127 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.machining.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import javax.validation.Valid;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestParam;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.machining.entity.Machining;
import org.springblade.modules.machining.vo.MachiningVO;
import org.springblade.modules.machining.service.IMachiningService;
import org.springblade.core.boot.ctrl.BladeController;
/**
 * 加工管理 控制器
 *
 * @author BladeX
 * @since 2022-06-07
 */
@RestController
@AllArgsConstructor
@RequestMapping("/machining/machining")
@Api(value = "加工管理", tags = "加工管理接口")
public class MachiningController extends BladeController {
    private final IMachiningService machiningService;
    /**
     * 详情
     */
    @GetMapping("/detail")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "详情", notes = "传入machining")
    public R<Machining> detail(Machining machining) {
        Machining detail = machiningService.getOne(Condition.getQueryWrapper(machining));
        return R.data(detail);
    }
    /**
     * 分页 加工管理
     */
    @GetMapping("/list")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "分页", notes = "传入machining")
    public R<IPage<Machining>> list(Machining machining, Query query) {
        IPage<Machining> pages = machiningService.page(Condition.getPage(query), Condition.getQueryWrapper(machining));
        return R.data(pages);
    }
    /**
     * 自定义分页 加工管理
     */
    @GetMapping("/page")
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "分页", notes = "传入machining")
    public R<IPage<MachiningVO>> page(MachiningVO machining, Query query) {
        IPage<MachiningVO> pages = machiningService.selectMachiningPage(Condition.getPage(query), machining);
        return R.data(pages);
    }
    /**
     * 新增 加工管理
     */
    @PostMapping("/save")
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "新增", notes = "传入machining")
    public R save(@Valid @RequestBody Machining machining) {
        return R.status(machiningService.save(machining));
    }
    /**
     * 修改 加工管理
     */
    @PostMapping("/update")
    @ApiOperationSupport(order = 5)
    @ApiOperation(value = "修改", notes = "传入machining")
    public R update(@Valid @RequestBody Machining machining) {
        return R.status(machiningService.updateById(machining));
    }
    /**
     * 新增或修改 加工管理
     */
    @PostMapping("/submit")
    @ApiOperationSupport(order = 6)
    @ApiOperation(value = "新增或修改", notes = "传入machining")
    public R submit(@Valid @RequestBody Machining machining) {
        return R.status(machiningService.saveOrUpdate(machining));
    }
    /**
     * 删除 加工管理
     */
    @PostMapping("/remove")
    @ApiOperationSupport(order = 7)
    @ApiOperation(value = "逻辑删除", notes = "传入ids")
    public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
        return R.status(machiningService.deleteLogic(Func.toLongList(ids)));
    }
}
src/main/java/org/springblade/modules/machining/dto/MachiningDTO.java
New file
@@ -0,0 +1,34 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.machining.dto;
import org.springblade.modules.machining.entity.Machining;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
 * 加工管理数据传输对象实体类
 *
 * @author BladeX
 * @since 2022-06-07
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class MachiningDTO extends Machining {
    private static final long serialVersionUID = 1L;
}
src/main/java/org/springblade/modules/machining/entity/Machining.java
New file
@@ -0,0 +1,56 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.machining.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import org.springblade.core.mp.base.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
 * 加工管理实体类
 *
 * @author BladeX
 * @since 2022-06-07
 */
@Data
@TableName("sys_machining")
@EqualsAndHashCode(callSuper = true)
public class Machining extends BaseEntity {
    private static final long serialVersionUID = 1L;
    /**
    * 加工类型
    */
        private String machiningType;
    /**
    * 图片
    */
        private String machiningTp;
    /**
    * 加工原料
    */
        private String machiningYl;
    /**
    * 备注
    */
        private String remarks;
}
src/main/java/org/springblade/modules/machining/mapper/MachiningMapper.java
New file
@@ -0,0 +1,42 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.machining.mapper;
import org.springblade.modules.machining.entity.Machining;
import org.springblade.modules.machining.vo.MachiningVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
/**
 * 加工管理 Mapper 接口
 *
 * @author BladeX
 * @since 2022-06-07
 */
public interface MachiningMapper extends BaseMapper<Machining> {
    /**
     * 自定义分页
     *
     * @param page
     * @param machining
     * @return
     */
    List<MachiningVO> selectMachiningPage(IPage page, MachiningVO machining);
}
src/main/java/org/springblade/modules/machining/mapper/MachiningMapper.xml
New file
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.springblade.modules.machining.mapper.MachiningMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="machiningResultMap" type="org.springblade.modules.machining.entity.Machining">
        <result column="id" property="id"/>
        <result column="create_user" property="createUser"/>
        <result column="create_dept" property="createDept"/>
        <result column="create_time" property="createTime"/>
        <result column="update_user" property="updateUser"/>
        <result column="update_time" property="updateTime"/>
        <result column="status" property="status"/>
        <result column="is_deleted" property="isDeleted"/>
        <result column="machining_type" property="machiningType"/>
        <result column="machining_tp" property="machiningTp"/>
        <result column="machining_yl" property="machiningYl"/>
        <result column="remarks" property="remarks"/>
    </resultMap>
    <select id="selectMachiningPage" resultMap="machiningResultMap">
        select * from sys_machining where is_deleted = 0
    </select>
</mapper>
src/main/java/org/springblade/modules/machining/service/IMachiningService.java
New file
@@ -0,0 +1,41 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.machining.service;
import org.springblade.modules.machining.entity.Machining;
import org.springblade.modules.machining.vo.MachiningVO;
import org.springblade.core.mp.base.BaseService;
import com.baomidou.mybatisplus.core.metadata.IPage;
/**
 * 加工管理 服务类
 *
 * @author BladeX
 * @since 2022-06-07
 */
public interface IMachiningService extends BaseService<Machining> {
    /**
     * 自定义分页
     *
     * @param page
     * @param machining
     * @return
     */
    IPage<MachiningVO> selectMachiningPage(IPage<MachiningVO> page, MachiningVO machining);
}
src/main/java/org/springblade/modules/machining/service/impl/MachiningServiceImpl.java
New file
@@ -0,0 +1,41 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.machining.service.impl;
import org.springblade.modules.machining.entity.Machining;
import org.springblade.modules.machining.vo.MachiningVO;
import org.springblade.modules.machining.mapper.MachiningMapper;
import org.springblade.modules.machining.service.IMachiningService;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
/**
 * 加工管理 服务实现类
 *
 * @author BladeX
 * @since 2022-06-07
 */
@Service
public class MachiningServiceImpl extends BaseServiceImpl<MachiningMapper, Machining> implements IMachiningService {
    @Override
    public IPage<MachiningVO> selectMachiningPage(IPage<MachiningVO> page, MachiningVO machining) {
        return page.setRecords(baseMapper.selectMachiningPage(page, machining));
    }
}
src/main/java/org/springblade/modules/machining/vo/MachiningVO.java
New file
@@ -0,0 +1,34 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.machining.vo;
import org.springblade.modules.machining.entity.Machining;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
 * 加工管理视图实体类
 *
 * @author BladeX
 * @since 2022-06-07
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class MachiningVO extends Machining {
    private static final long serialVersionUID = 1L;
}
src/main/java/org/springblade/modules/sale/controller/SaleController.java
New file
@@ -0,0 +1,143 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.sale.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import javax.validation.Valid;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestParam;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.sale.entity.Sale;
import org.springblade.modules.sale.vo.SaleVO;
import org.springblade.modules.sale.service.ISaleService;
import org.springblade.core.boot.ctrl.BladeController;
/**
 * 销售记录表 控制器
 *
 * @author BladeX
 * @since 2022-06-09
 */
@RestController
@AllArgsConstructor
@RequestMapping("/sale/sale")
@Api(value = "销售记录表", tags = "销售记录表接口")
public class SaleController extends BladeController {
    private final ISaleService saleService;
    /**
     * 详情
     */
    @GetMapping("/detail")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "详情", notes = "传入sale")
    public R<Sale> detail(Sale sale) {
        Sale detail = saleService.getOne(Condition.getQueryWrapper(sale));
        return R.data(detail);
    }
    /**
     * 分页 销售记录表
     */
    @GetMapping("/list")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "分页", notes = "传入sale")
    public R<IPage<Sale>> list(Sale sale, Query query) {
        IPage<Sale> pages = saleService.page(Condition.getPage(query), Condition.getQueryWrapper(sale));
        return R.data(pages);
    }
    /**
     * 自定义分页 销售记录表
     */
    @GetMapping("/page")
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "分页", notes = "传入sale")
    public R<IPage<SaleVO>> page(SaleVO sale, Query query) {
        IPage<SaleVO> pages = saleService.selectSalePage(Condition.getPage(query), sale);
        return R.data(pages);
    }
    /**
     * 新增 销售记录表
     */
    @PostMapping("/save")
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "新增", notes = "传入sale")
    public R save(@Valid @RequestBody Sale sale) {
        return R.status(saleService.save(sale));
    }
    /**
     * 修改 销售记录表
     */
    @PostMapping("/update")
    @ApiOperationSupport(order = 5)
    @ApiOperation(value = "修改", notes = "传入sale")
    public R update(@Valid @RequestBody Sale sale) {
        return R.status(saleService.updateById(sale));
    }
    /**
     * 新增或修改 销售记录表
     */
    @PostMapping("/submit")
    @ApiOperationSupport(order = 6)
    @ApiOperation(value = "新增或修改", notes = "传入sale")
    public R submit(@Valid @RequestBody Sale sale) {
        return R.status(saleService.saveOrUpdate(sale));
    }
    /**
     * 删除 销售记录表
     */
    @PostMapping("/remove")
    @ApiOperationSupport(order = 7)
    @ApiOperation(value = "逻辑删除", notes = "传入ids")
    public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
        return R.status(saleService.deleteLogic(Func.toLongList(ids)));
    }
    /**
     * 大屏销售统计
     */
    @PostMapping("/selctSaletCount")
    public R selctSaletCount(String year) {
        return R.data(saleService.selctSaletCount(year));
    }
    /**
     * 统计今年和去年的销售总额
     */
    @PostMapping("/selctSaletZ")
    public R selctSaletZ() {
        return R.data(saleService.selctSaletZ());
    }
}
src/main/java/org/springblade/modules/sale/dto/SaleDTO.java
New file
@@ -0,0 +1,34 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.sale.dto;
import org.springblade.modules.sale.entity.Sale;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
 * 销售记录表数据传输对象实体类
 *
 * @author BladeX
 * @since 2022-06-09
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class SaleDTO extends Sale {
    private static final long serialVersionUID = 1L;
}
src/main/java/org/springblade/modules/sale/entity/Sale.java
New file
@@ -0,0 +1,65 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.sale.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
import org.springblade.core.mp.base.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
 * 销售记录表实体类
 *
 * @author BladeX
 * @since 2022-06-09
 */
@Data
@TableName("sys_sale")
@EqualsAndHashCode(callSuper = true)
public class Sale extends BaseEntity {
    private static final long serialVersionUID = 1L;
    /**
    * 品种id
    */
        private Integer strainId;
    /**
    * 销售时间
    */
        private LocalDateTime saleTime;
    /**
    * 销售数量
    */
        private Integer saleNum;
    /**
    * 销售去向
    */
        private Integer saleDestination;
    /**
    * 具体销售去向
    */
        private String saleDestination1;
    /**
    * 销售价格
    */
        private Double salePrice;
}
src/main/java/org/springblade/modules/sale/mapper/SaleMapper.java
New file
@@ -0,0 +1,44 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.sale.mapper;
import org.springblade.modules.sale.entity.Sale;
import org.springblade.modules.sale.vo.SaleVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
import java.util.Map;
/**
 * 销售记录表 Mapper 接口
 *
 * @author BladeX
 * @since 2022-06-09
 */
public interface SaleMapper extends BaseMapper<Sale> {
    /**
     * 自定义分页
     *
     * @param page
     * @param sale
     * @return
     */
    List<SaleVO> selectSalePage(IPage page, SaleVO sale);
    Map<String, String> selctSaletCount(String year);
    List<Map<Object,String>> selctSaletZ();
}
src/main/java/org/springblade/modules/sale/mapper/SaleMapper.xml
New file
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.springblade.modules.sale.mapper.SaleMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="saleResultMap" type="org.springblade.modules.sale.entity.Sale">
        <result column="id" property="id"/>
        <result column="create_user" property="createUser"/>
        <result column="create_dept" property="createDept"/>
        <result column="create_time" property="createTime"/>
        <result column="update_user" property="updateUser"/>
        <result column="update_time" property="updateTime"/>
        <result column="status" property="status"/>
        <result column="is_deleted" property="isDeleted"/>
        <result column="strain_id" property="strainId"/>
        <result column="sale_time" property="saleTime"/>
        <result column="sale_num" property="saleNum"/>
        <result column="sale_destination" property="saleDestination"/>
        <result column="sale_destination1" property="saleDestination1"/>
        <result column="sale_price" property="salePrice"/>
    </resultMap>
    <select id="selectSalePage" resultMap="saleResultMap">
        select *
        from sys_sale
        where is_deleted = 0
    </select>
    <!--大屏销售每个月统计-->
    <select id="selctSaletCount" resultType="java.util.HashMap">
        SELECT SUM(CASE WHEN MONTH ( s.sale_time ) = 1 THEN s.sale_price END ) AS '1', SUM(CASE WHEN MONTH ( s.sale_time ) = 2 THEN s.sale_price END ) AS '2', SUM(CASE WHEN MONTH ( s.sale_time ) = 3 THEN s.sale_price END ) AS '3', SUM(CASE WHEN MONTH ( s.sale_time ) = 4 THEN s.sale_price END ) AS '4', SUM(CASE WHEN MONTH ( s.sale_time ) = 5 THEN s.sale_price END ) AS '5', SUM(CASE WHEN MONTH ( s.sale_time ) = 6 THEN s.sale_price END ) AS '6', SUM(CASE WHEN MONTH ( s.sale_time ) = 7 THEN s.sale_price END ) AS '7', SUM(CASE WHEN MONTH ( s.sale_time ) = 8 THEN s.sale_price END ) AS '8', SUM(CASE WHEN MONTH ( s.sale_time ) = 9 THEN s.sale_price END ) AS '9', SUM(CASE WHEN MONTH ( s.sale_time ) = 10 THEN s.sale_price END ) AS '10', SUM(CASE WHEN MONTH ( s.sale_time ) = 11 THEN s.sale_price END ) AS '11', SUM(CASE WHEN MONTH ( s.sale_time ) = 12 THEN s.sale_price END ) AS '12'
        FROM sys_sale AS s
        WHERE
            YEAR ( s.sale_time ) = #{year}
    </select>
    <!--统计今年和去年的销售总额-->
    <select id="selctSaletZ" resultType="java.util.HashMap" >
        SELECT IFNULL(SUM(sale_num), 0) AS num
        FROM sys_sale
        WHERE
            YEAR ( sale_time ) = YEAR ( NOW( ) )
        UNION ALL
        SELECT IFNULL(SUM(sale_num), 0) AS num
        FROM sys_sale
        WHERE
            YEAR ( sale_time ) = YEAR ( date_sub( now( )
            , INTERVAL 1 YEAR ) );
    </select>
</mapper>
src/main/java/org/springblade/modules/sale/service/ISaleService.java
New file
@@ -0,0 +1,45 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.sale.service;
import org.springblade.modules.sale.entity.Sale;
import org.springblade.modules.sale.vo.SaleVO;
import org.springblade.core.mp.base.BaseService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
import java.util.Map;
/**
 * 销售记录表 服务类
 *
 * @author BladeX
 * @since 2022-06-09
 */
public interface ISaleService extends BaseService<Sale> {
    /**
     * 自定义分页
     *
     * @param page
     * @param sale
     * @return
     */
    IPage<SaleVO> selectSalePage(IPage<SaleVO> page, SaleVO sale);
    Map<String, String> selctSaletCount(String year);
    List<Map<Object,String>> selctSaletZ();
}
src/main/java/org/springblade/modules/sale/service/impl/SaleServiceImpl.java
New file
@@ -0,0 +1,54 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.sale.service.impl;
import org.springblade.modules.sale.entity.Sale;
import org.springblade.modules.sale.vo.SaleVO;
import org.springblade.modules.sale.mapper.SaleMapper;
import org.springblade.modules.sale.service.ISaleService;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
import java.util.Map;
/**
 * 销售记录表 服务实现类
 *
 * @author BladeX
 * @since 2022-06-09
 */
@Service
public class SaleServiceImpl extends BaseServiceImpl<SaleMapper, Sale> implements ISaleService {
    @Override
    public IPage<SaleVO> selectSalePage(IPage<SaleVO> page, SaleVO sale) {
        return page.setRecords(baseMapper.selectSalePage(page, sale));
    }
    @Override
    public Map<String, String> selctSaletCount(String year) {
        return baseMapper.selctSaletCount(year);
    }
    @Override
    public List<Map<Object, String>> selctSaletZ() {
        return baseMapper.selctSaletZ();
    }
}
src/main/java/org/springblade/modules/sale/vo/SaleVO.java
New file
@@ -0,0 +1,34 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.sale.vo;
import org.springblade.modules.sale.entity.Sale;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
 * 销售记录表视图实体类
 *
 * @author BladeX
 * @since 2022-06-09
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class SaleVO extends Sale {
    private static final long serialVersionUID = 1L;
}
src/main/java/org/springblade/modules/task/controller/TaskController.java
New file
@@ -0,0 +1,128 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.task.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import javax.validation.Valid;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestParam;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.task.entity.Task;
import org.springblade.modules.task.vo.TaskVO;
import org.springblade.modules.task.service.ITaskService;
import org.springblade.core.boot.ctrl.BladeController;
/**
 *  控制器
 *
 * @author BladeX
 * @since 2022-06-10
 */
@RestController
@AllArgsConstructor
@RequestMapping("/task/task")
@Api(value = "", tags = "接口")
public class TaskController extends BladeController {
    private final ITaskService taskService;
    /**
     * 详情
     */
    @GetMapping("/detail")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "详情", notes = "传入task")
    public R<Task> detail(Task task) {
        Task detail = taskService.getOne(Condition.getQueryWrapper(task));
        return R.data(detail);
    }
    /**
     * 分页
     */
    @GetMapping("/list")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "分页", notes = "传入task")
    public R<IPage<Task>> list(Task task, Query query) {
        IPage<Task> pages = taskService.page(Condition.getPage(query), Condition.getQueryWrapper(task));
        return R.data(pages);
    }
    /**
     * 自定义分页
     */
    @GetMapping("/page")
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "分页", notes = "传入task")
    public R<IPage<TaskVO>> page(TaskVO task, Query query) {
        IPage<TaskVO> pages = taskService.selectTaskPage(Condition.getPage(query), task);
        return R.data(pages);
    }
    /**
     * 新增
     */
    @PostMapping("/save")
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "新增", notes = "传入task")
    public R save(@Valid @RequestBody Task task) {
        task.setStatus(1);
        return R.status(taskService.save(task));
    }
    /**
     * 修改
     */
    @PostMapping("/update")
    @ApiOperationSupport(order = 5)
    @ApiOperation(value = "修改", notes = "传入task")
    public R update(@Valid @RequestBody Task task) {
        return R.status(taskService.updateById(task));
    }
    /**
     * 新增或修改
     */
    @PostMapping("/submit")
    @ApiOperationSupport(order = 6)
    @ApiOperation(value = "新增或修改", notes = "传入task")
    public R submit(@Valid @RequestBody Task task) {
        return R.status(taskService.saveOrUpdate(task));
    }
    /**
     * 删除
     */
    @PostMapping("/remove")
    @ApiOperationSupport(order = 7)
    @ApiOperation(value = "逻辑删除", notes = "传入ids")
    public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
        return R.status(taskService.deleteLogic(Func.toLongList(ids)));
    }
}
src/main/java/org/springblade/modules/task/dto/TaskDTO.java
New file
@@ -0,0 +1,34 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.task.dto;
import org.springblade.modules.task.entity.Task;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
 * 数据传输对象实体类
 *
 * @author BladeX
 * @since 2022-06-10
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class TaskDTO extends Task {
    private static final long serialVersionUID = 1L;
}
src/main/java/org/springblade/modules/task/entity/Task.java
New file
@@ -0,0 +1,84 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.task.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springblade.core.mp.base.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
/**
 * 实体类
 *
 * @author BladeX
 * @since 2022-06-10
 */
@Data
@TableName("sys_task")
@EqualsAndHashCode(callSuper = true)
public class Task extends BaseEntity {
    private static final long serialVersionUID = 1L;
    /**
     * 任务名称
     */
    private String taskName;
    /**
     * 地块id
     */
    private String landId;
    /**
     * 截止时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date time;
    /**
     * 操作人
     */
    private String taskUser;
    /**
     * 是否上传照片 0:是 1:否
     */
    private String type;
    /**
     * 任务说明
     */
    private String taskExplain;
    /**
     * 备注
     */
    private String remark;
    /**
     * 图片
     */
    private String tp;
    /**
     * 农事操作
     */
    private String farm;
}
src/main/java/org/springblade/modules/task/mapper/TaskMapper.java
New file
@@ -0,0 +1,42 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.task.mapper;
import org.springblade.modules.task.entity.Task;
import org.springblade.modules.task.vo.TaskVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
/**
 *  Mapper 接口
 *
 * @author BladeX
 * @since 2022-06-10
 */
public interface TaskMapper extends BaseMapper<Task> {
    /**
     * 自定义分页
     *
     * @param page
     * @param task
     * @return
     */
    List<TaskVO> selectTaskPage(IPage page, TaskVO task);
}
src/main/java/org/springblade/modules/task/mapper/TaskMapper.xml
New file
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.springblade.modules.task.mapper.TaskMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="taskResultMap" type="org.springblade.modules.task.entity.Task">
        <result column="id" property="id"/>
        <result column="create_user" property="createUser"/>
        <result column="create_dept" property="createDept"/>
        <result column="create_time" property="createTime"/>
        <result column="update_user" property="updateUser"/>
        <result column="update_time" property="updateTime"/>
        <result column="status" property="status"/>
        <result column="is_deleted" property="isDeleted"/>
        <result column="task_name" property="taskName"/>
        <result column="land_id" property="landId"/>
        <result column="time" property="time"/>
        <result column="task_user" property="taskUser"/>
        <result column="type" property="type"/>
        <result column="task_explain" property="taskExplain"/>
        <result column="remark" property="remark"/>
        <result column="tp" property="tp"/>
        <result column="farm" property="farm"/>
    </resultMap>
    <select id="selectTaskPage" resultMap="taskResultMap">
        select * from sys_task where is_deleted = 0
    </select>
</mapper>
src/main/java/org/springblade/modules/task/service/ITaskService.java
New file
@@ -0,0 +1,41 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.task.service;
import org.springblade.modules.task.entity.Task;
import org.springblade.modules.task.vo.TaskVO;
import org.springblade.core.mp.base.BaseService;
import com.baomidou.mybatisplus.core.metadata.IPage;
/**
 *  服务类
 *
 * @author BladeX
 * @since 2022-06-10
 */
public interface ITaskService extends BaseService<Task> {
    /**
     * 自定义分页
     *
     * @param page
     * @param task
     * @return
     */
    IPage<TaskVO> selectTaskPage(IPage<TaskVO> page, TaskVO task);
}
src/main/java/org/springblade/modules/task/service/impl/TaskServiceImpl.java
New file
@@ -0,0 +1,41 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.task.service.impl;
import org.springblade.modules.task.entity.Task;
import org.springblade.modules.task.vo.TaskVO;
import org.springblade.modules.task.mapper.TaskMapper;
import org.springblade.modules.task.service.ITaskService;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
/**
 *  服务实现类
 *
 * @author BladeX
 * @since 2022-06-10
 */
@Service
public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implements ITaskService {
    @Override
    public IPage<TaskVO> selectTaskPage(IPage<TaskVO> page, TaskVO task) {
        return page.setRecords(baseMapper.selectTaskPage(page, task));
    }
}
src/main/java/org/springblade/modules/task/vo/TaskVO.java
New file
@@ -0,0 +1,34 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.task.vo;
import org.springblade.modules.task.entity.Task;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
 * 视图实体类
 *
 * @author BladeX
 * @since 2022-06-10
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class TaskVO extends Task {
    private static final long serialVersionUID = 1L;
}
src/main/java/sql/machining.menu.sql
New file
@@ -0,0 +1,10 @@
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1534069206188834817', 1123598815738675201, 'machining', '加工产品管理', 'menu', '/machining/machining', NULL, 1, 1, 0, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1534069206188834818', '1534069206188834817', 'machining_add', '新增', 'add', '/machining/machining/add', 'plus', 1, 2, 1, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1534069206188834819', '1534069206188834817', 'machining_edit', '修改', 'edit', '/machining/machining/edit', 'form', 2, 2, 2, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1534069206188834820', '1534069206188834817', 'machining_delete', '删除', 'delete', '/api/machining/machining/remove', 'delete', 3, 2, 3, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1534069206188834821', '1534069206188834817', 'machining_view', '查看', 'view', '/machining/machining/view', 'file-text', 4, 2, 2, 1, NULL, 0);
src/main/java/sql/sale.menu.sql
New file
@@ -0,0 +1,10 @@
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1534699115533852674', 1123598815738675201, 'sale', '销售管理', 'menu', '/sale/sale', NULL, 1, 1, 0, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1534699115533852675', '1534699115533852674', 'sale_add', '新增', 'add', '/sale/sale/add', 'plus', 1, 2, 1, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1534699115533852676', '1534699115533852674', 'sale_edit', '修改', 'edit', '/sale/sale/edit', 'form', 2, 2, 2, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1534699115533852677', '1534699115533852674', 'sale_delete', '删除', 'delete', '/api/sale/sale/remove', 'delete', 3, 2, 3, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1534699115533852678', '1534699115533852674', 'sale_view', '查看', 'view', '/sale/sale/view', 'file-text', 4, 2, 2, 1, NULL, 0);
src/main/java/sql/task.menu.sql
New file
@@ -0,0 +1,10 @@
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1535070746886311938', 1123598815738675201, 'task', '任务管理', 'menu', '/task/task', NULL, 1, 1, 0, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1535070746886311939', '1535070746886311938', 'task_add', '新增', 'add', '/task/task/add', 'plus', 1, 2, 1, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1535070746886311940', '1535070746886311938', 'task_edit', '修改', 'edit', '/task/task/edit', 'form', 2, 2, 2, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1535070746886311941', '1535070746886311938', 'task_delete', '删除', 'delete', '/api/task/task/remove', 'delete', 3, 2, 3, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1535070746886311942', '1535070746886311938', 'task_view', '查看', 'view', '/task/task/view', 'file-text', 4, 2, 2, 1, NULL, 0);