12 changed files with 625 additions and 14 deletions
@ -0,0 +1,96 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.resi.partymember.dto; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* 用于上报蔬菜的企业 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2024-03-22 |
|||
*/ |
|||
@Data |
|||
public class ScreenEnterpriseOutputDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 唯一标识 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 蔬菜类别: |
|||
*/ |
|||
private String vegetableCategory; |
|||
|
|||
/** |
|||
* 企业名称 |
|||
*/ |
|||
private String placeOrgName; |
|||
|
|||
/** |
|||
* 产量 |
|||
*/ |
|||
private String output; |
|||
|
|||
/** |
|||
* 删除标识:0.未删除 1.已删除 |
|||
*/ |
|||
private Integer delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
/** |
|||
* 种植时间 |
|||
*/ |
|||
private Date growTime; |
|||
|
|||
/** |
|||
* 上市时间 |
|||
*/ |
|||
private Date marketTime; |
|||
|
|||
} |
@ -0,0 +1,44 @@ |
|||
package com.epmet.resi.partymember.dto.partymember.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* |
|||
* @description: 企业上报蔬菜 |
|||
* @author qushutong |
|||
* @date 2024/3/22 15:08 |
|||
* @param |
|||
* @return |
|||
* @Version1.0 |
|||
**/ |
|||
@Data |
|||
public class vegetableFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 7719236439989973549L; |
|||
/** |
|||
* vegetableList : [{"output":"产量","placeOrgName":"企业名称","vegetableCategory":"白菜","growTime":"2020-01-02 09:27:06","marketTime":"2020-01-02 09:27:06"},{"output":"产量","placeOrgName":"企业名称","vegetableCategory":"小白菜","growTime":"2020-01-02 09:27:06","marketTime":"2020-01-02 09:27:06"}] |
|||
*/ |
|||
private List<VegetableListEntity> vegetableList; |
|||
|
|||
@Data |
|||
public static class VegetableListEntity { |
|||
|
|||
public VegetableListEntity(){} |
|||
/** |
|||
* output : 产量 |
|||
* placeOrgName : 企业名称 |
|||
* vegetableCategory : 白菜 |
|||
* growTime : 2020-01-02 09:27:06 |
|||
* marketTime : 2020-01-02 09:27:06 |
|||
*/ |
|||
private String output; |
|||
private String placeOrgName; |
|||
private String vegetableCategory; |
|||
private Date growTime; |
|||
private Date marketTime; |
|||
} |
|||
} |
@ -0,0 +1,104 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.modules.partymember.controller; |
|||
|
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.AssertUtils; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.commons.tools.validator.group.AddGroup; |
|||
import com.epmet.commons.tools.validator.group.DefaultGroup; |
|||
import com.epmet.commons.tools.validator.group.UpdateGroup; |
|||
import com.epmet.modules.partymember.service.ScreenEnterpriseOutputService; |
|||
import com.epmet.resi.partymember.dto.ScreenEnterpriseOutputDTO; |
|||
import com.epmet.resi.partymember.dto.partymember.form.vegetableFormDTO; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* 用于上报蔬菜的企业 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2024-03-22 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("screenenterpriseoutput") |
|||
public class ScreenEnterpriseOutputController { |
|||
|
|||
@Autowired |
|||
private ScreenEnterpriseOutputService screenEnterpriseOutputService; |
|||
|
|||
@GetMapping("page") |
|||
public Result<PageData<ScreenEnterpriseOutputDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<ScreenEnterpriseOutputDTO> page = screenEnterpriseOutputService.page(params); |
|||
return new Result<PageData<ScreenEnterpriseOutputDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<ScreenEnterpriseOutputDTO> get(@PathVariable("id") String id){ |
|||
ScreenEnterpriseOutputDTO data = screenEnterpriseOutputService.get(id); |
|||
return new Result<ScreenEnterpriseOutputDTO>().ok(data); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* |
|||
* @description: 上报 |
|||
* @author qushutong |
|||
* @date 2024/3/22 14:52 |
|||
* @param |
|||
* @return com.epmet.commons.tools.utils.Result |
|||
* @Version1.0 |
|||
**/ |
|||
@PostMapping("yifengScreen/submitOutput") |
|||
public Result submitOutput(@RequestBody vegetableFormDTO dto){ |
|||
//效验数据
|
|||
// ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
|
|||
screenEnterpriseOutputService.submitOutput(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody ScreenEnterpriseOutputDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
screenEnterpriseOutputService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
screenEnterpriseOutputService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody ScreenEnterpriseOutputDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
screenEnterpriseOutputService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,33 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.modules.partymember.dao; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.modules.partymember.entity.ScreenEnterpriseOutputEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* 用于上报蔬菜的企业 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2024-03-22 |
|||
*/ |
|||
@Mapper |
|||
public interface ScreenEnterpriseOutputDao extends BaseDao<ScreenEnterpriseOutputEntity> { |
|||
|
|||
} |
@ -0,0 +1,66 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.modules.partymember.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 用于上报蔬菜的企业 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2024-03-22 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("screen_enterprise_output") |
|||
public class ScreenEnterpriseOutputEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 蔬菜类别: |
|||
*/ |
|||
private String vegetableCategory; |
|||
|
|||
/** |
|||
* 企业名称 |
|||
*/ |
|||
private String placeOrgName; |
|||
|
|||
/** |
|||
* 产量 |
|||
*/ |
|||
private String output; |
|||
|
|||
/** |
|||
* 种植时间 |
|||
*/ |
|||
private Date growTime; |
|||
|
|||
/** |
|||
* 上市时间 |
|||
*/ |
|||
private Date marketTime; |
|||
|
|||
} |
@ -0,0 +1,99 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.modules.partymember.service; |
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.modules.partymember.entity.ScreenEnterpriseOutputEntity; |
|||
import com.epmet.resi.partymember.dto.ScreenEnterpriseOutputDTO; |
|||
import com.epmet.resi.partymember.dto.partymember.form.vegetableFormDTO; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 用于上报蔬菜的企业 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2024-03-22 |
|||
*/ |
|||
public interface ScreenEnterpriseOutputService extends BaseService<ScreenEnterpriseOutputEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<ScreenEnterpriseOutputDTO> |
|||
* @author generator |
|||
* @date 2024-03-22 |
|||
*/ |
|||
PageData<ScreenEnterpriseOutputDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<ScreenEnterpriseOutputDTO> |
|||
* @author generator |
|||
* @date 2024-03-22 |
|||
*/ |
|||
List<ScreenEnterpriseOutputDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return ScreenEnterpriseOutputDTO |
|||
* @author generator |
|||
* @date 2024-03-22 |
|||
*/ |
|||
ScreenEnterpriseOutputDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2024-03-22 |
|||
*/ |
|||
void save(ScreenEnterpriseOutputDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2024-03-22 |
|||
*/ |
|||
void update(ScreenEnterpriseOutputDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2024-03-22 |
|||
*/ |
|||
void delete(String[] ids); |
|||
|
|||
Result submitOutput(vegetableFormDTO dto); |
|||
} |
@ -0,0 +1,116 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.modules.partymember.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.epmet.commons.tools.constant.FieldConstant; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.modules.partymember.dao.ScreenEnterpriseOutputDao; |
|||
import com.epmet.modules.partymember.entity.ScreenEnterpriseOutputEntity; |
|||
import com.epmet.modules.partymember.service.ScreenEnterpriseOutputService; |
|||
import com.epmet.resi.partymember.dto.ScreenEnterpriseOutputDTO; |
|||
import com.epmet.resi.partymember.dto.partymember.form.vegetableFormDTO; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 用于上报蔬菜的企业 |
|||
* |
|||
* @author elink elink@elink-cn.com |
|||
* @since v1.0.0 2024-03-22 |
|||
*/ |
|||
@Service |
|||
public class ScreenEnterpriseOutputServiceImpl extends BaseServiceImpl<ScreenEnterpriseOutputDao, ScreenEnterpriseOutputEntity> implements ScreenEnterpriseOutputService { |
|||
|
|||
|
|||
@Override |
|||
public PageData<ScreenEnterpriseOutputDTO> page(Map<String, Object> params) { |
|||
IPage<ScreenEnterpriseOutputEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, ScreenEnterpriseOutputDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<ScreenEnterpriseOutputDTO> list(Map<String, Object> params) { |
|||
List<ScreenEnterpriseOutputEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, ScreenEnterpriseOutputDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<ScreenEnterpriseOutputEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<ScreenEnterpriseOutputEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public ScreenEnterpriseOutputDTO get(String id) { |
|||
ScreenEnterpriseOutputEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, ScreenEnterpriseOutputDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(ScreenEnterpriseOutputDTO dto) { |
|||
ScreenEnterpriseOutputEntity entity = ConvertUtils.sourceToTarget(dto, ScreenEnterpriseOutputEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(ScreenEnterpriseOutputDTO dto) { |
|||
ScreenEnterpriseOutputEntity entity = ConvertUtils.sourceToTarget(dto, ScreenEnterpriseOutputEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
@Override |
|||
public Result submitOutput(vegetableFormDTO dto) { |
|||
String placeOrgName = dto.getVegetableList().get(0).getPlaceOrgName(); |
|||
Map map = new HashMap(); |
|||
map.put("PLACE_ORG_NAME",placeOrgName); |
|||
baseDao.deleteByMap(map); |
|||
List<vegetableFormDTO.VegetableListEntity> vegetableList = dto.getVegetableList(); |
|||
List<ScreenEnterpriseOutputEntity> screenEnterpriseOutputEntities = ConvertUtils.sourceToTarget(vegetableList, ScreenEnterpriseOutputEntity.class); |
|||
this.insertBatch(screenEnterpriseOutputEntities); |
|||
return new Result(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,22 @@ |
|||
<?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="com.epmet.modules.partymember.dao.ScreenEnterpriseOutputDao"> |
|||
|
|||
<resultMap type="com.epmet.modules.partymember.entity.ScreenEnterpriseOutputEntity" id="screenEnterpriseOutputMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="vegetableCategory" column="VEGETABLE_CATEGORY"/> |
|||
<result property="placeOrgName" column="PLACE_ORG_NAME"/> |
|||
<result property="output" column="OUTPUT"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
<result property="growTime" column="GROW_TIME"/> |
|||
<result property="marketTime" column="MARKET_TIME"/> |
|||
</resultMap> |
|||
|
|||
|
|||
</mapper> |
Loading…
Reference in new issue