1 Star 0 Fork 122

vebin/DevelopAssistant

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
ServiceImplTemplate.cs 2.59 KB
一键复制 编辑 原始数据 按行查看 历史
wxdongtt2007 提交于 2022-12-02 11:42 +08:00 . 修改toolstripTextBox 样式
package ${PakageName}.service.impl;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.alibaba.druid.sql.visitor.functions.Now;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import ${PakageName}.exception.BizException;
import ${PakageName}.entity.${EntityName}Entity;
import ${PakageName}.mapper.I${EntityName}Mapper;
import ${PakageName}.demo.service.I${EntityName}Service;
import lombok.extern.log4j.Log4j2;
@Log4j2
@Service("${EntityName}Service")
public class ${EntityName}ServiceImpl extends ServiceImpl<I${EntityName}Mapper, ${EntityName}Entity> implements I${EntityName}Service {
@Autowired
public I${EntityName}Mapper ${InstanceName}Mapper;
/**
*分页获取数据
*/
@SuppressWarnings("unchecked")
public Page<Map<String, Object>> query${EntityName}PageList(Map<String,Object> params) throws BizException{
Page<Map<String, Object>> result = null;
try {
int pageSize=(int)params.get("pageSize");
int currentPage=(int)params.get("currentPage");
result = new Page<>(currentPage,pageSize);
List<Map<String, Object>> records = ${InstanceName}Mapper.select${EntityName}PageList(result,params);
result.setRecords(records);
}
catch (Exception e) {
// TODO: handle exception
log.error("查询 query${EntityName}PageList 数据出错:"+whereMap,e);
throw new BizException("查询 query${EntityName}PageList 数据出错:"+e.getMessage(),e);
}
return result;
}
/**
*获取数据列表
*/
public List<Map<String,Object>> query${EntityName}ArrayList(Map<String,Object> params) throws BizException{
List<Map<String,Object>> result = null;
try {
result = ${InstanceName}Mapper.select${EntityName}ArrayList(params);
}
catch (Exception e) {
// TODO: handle exception
log.error("查询 query${EntityName}PageList 数据出错:"+whereMap,e);
throw new BizException("查询 query${EntityName}PageList 数据出错:"+e.getMessage(),e);
}
return result;
}
@Transactional(rollbackFor = Exception.class)
public String add${EntityName}(${EntityName}Entity entity) throws BizException {
String result="";
try {
//添加数据
entity.insert();
}
catch (Exception ex) {
// TODO: handle exception
throw new BizException("添加${EntityName}时出错"+ex.getMessage(), ex);
}
return result;
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/vebin/DevelopAssistant.git
git@gitee.com:vebin/DevelopAssistant.git
vebin
DevelopAssistant
DevelopAssistant
master

搜索帮助