hujiali_branch
hjl 8 months ago
parent 8945f4a85a
commit b218c34cc3

@ -52,331 +52,240 @@ import com.entity.StoreupEntity;
@RequestMapping("/wenjuandiaocha") @RequestMapping("/wenjuandiaocha")
public class WenjuandiaochaController { public class WenjuandiaochaController {
@Autowired @Autowired
private WenjuandiaochaService wenjuandiaochaService; private WenjuandiaochaService wenjuandiaochaService; // 注入问卷调查服务
@Autowired @Autowired
private StoreupService storeupService; private StoreupService storeupService; // 注入收藏服务
/** /**
* *
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,WenjuandiaochaEntity wenjuandiaocha,
HttpServletRequest request){
EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>();
PageUtils page = wenjuandiaochaService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wenjuandiaocha), params), params));
request.setAttribute("data", page);
return R.ok().put("data", page);
}
/**
*
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,WenjuandiaochaEntity wenjuandiaocha,
HttpServletRequest request){
EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>();
PageUtils page = wenjuandiaochaService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wenjuandiaocha), params), params));
request.setAttribute("data", page);
return R.ok().put("data", page);
}
/**
*
*/ */
@RequestMapping("/lists") @RequestMapping("/remind/{columnName}/{type}")
public R list( WenjuandiaochaEntity wenjuandiaocha){ public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>(); @PathVariable("type") String type, @RequestParam Map<String, Object> map) {
ew.allEq(MPUtil.allEQMapPre( wenjuandiaocha, "wenjuandiaocha")); // 将列名和类型添加到 map 中
return R.ok().put("data", wenjuandiaochaService.selectListView(ew)); map.put("column", columnName);
} map.put("type", type);
// 如果类型为 "2",处理日期范围
if (type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); // 定义日期格式
Calendar c = Calendar.getInstance(); // 获取当前日期时间
Date remindStartDate = null;
Date remindEndDate = null;
// 处理 remindstart 参数
if (map.get("remindstart") != null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString()); // 将 remindstart 转换为整数
c.setTime(new Date()); // 设置当前时间
c.add(Calendar.DAY_OF_MONTH, remindStart); // 添加 remindStart 天
remindStartDate = c.getTime(); // 获取新的开始日期
map.put("remindstart", sdf.format(remindStartDate)); // 格式化并添加到 map 中
}
// 处理 remindend 参数
if (map.get("remindend") != null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString()); // 将 remindend 转换为整数
c.setTime(new Date()); // 设置当前时间
c.add(Calendar.DAY_OF_MONTH, remindEnd); // 添加 remindEnd 天
remindEndDate = c.getTime(); // 获取新的结束日期
map.put("remindend", sdf.format(remindEndDate)); // 格式化并添加到 map 中
}
}
// 创建 EntityWrapper 对象,用于构建查询条件
Wrapper<WenjuandiaochaEntity> wrapper = new EntityWrapper<WenjuandiaochaEntity>();
if (map.get("remindstart") != null) {
wrapper.ge(columnName, map.get("remindstart")); // 大于等于 remindstart
}
if (map.get("remindend") != null) {
wrapper.le(columnName, map.get("remindend")); // 小于等于 remindend
}
/** // 查询符合条件的记录数
* int count = wenjuandiaochaService.selectCount(wrapper);
*/ return R.ok().put("count", count); // 返回记录数
@RequestMapping("/query")
public R query(WenjuandiaochaEntity wenjuandiaocha){
EntityWrapper< WenjuandiaochaEntity> ew = new EntityWrapper< WenjuandiaochaEntity>();
ew.allEq(MPUtil.allEQMapPre( wenjuandiaocha, "wenjuandiaocha"));
WenjuandiaochaView wenjuandiaochaView = wenjuandiaochaService.selectView(ew);
return R.ok("查询问卷调查成功").put("data", wenjuandiaochaView);
} }
/** /**
*
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
WenjuandiaochaEntity wenjuandiaocha = wenjuandiaochaService.selectById(id);
wenjuandiaocha.setClicktime(new Date());
wenjuandiaochaService.updateById(wenjuandiaocha);
return R.ok().put("data", wenjuandiaocha);
}
/**
*
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
WenjuandiaochaEntity wenjuandiaocha = wenjuandiaochaService.selectById(id);
wenjuandiaocha.setClicktime(new Date());
wenjuandiaochaService.updateById(wenjuandiaocha);
return R.ok().put("data", wenjuandiaocha);
}
/**
*
*/
@RequestMapping("/save")
public R save(@RequestBody WenjuandiaochaEntity wenjuandiaocha, HttpServletRequest request){
wenjuandiaocha.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(wenjuandiaocha);
wenjuandiaochaService.insert(wenjuandiaocha);
return R.ok();
}
/**
*
*/
@RequestMapping("/add")
public R add(@RequestBody WenjuandiaochaEntity wenjuandiaocha, HttpServletRequest request){
wenjuandiaocha.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(wenjuandiaocha);
wenjuandiaochaService.insert(wenjuandiaocha);
return R.ok();
}
/**
*
*/
@RequestMapping("/update")
@Transactional
public R update(@RequestBody WenjuandiaochaEntity wenjuandiaocha, HttpServletRequest request){
//ValidatorUtils.validateEntity(wenjuandiaocha);
wenjuandiaochaService.updateById(wenjuandiaocha);//全部更新
return R.ok();
}
/**
*
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
wenjuandiaochaService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
*
*/
@RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type,@RequestParam Map<String, Object> map) {
map.put("column", columnName);
map.put("type", type);
if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
if(map.get("remindstart")!=null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate));
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
}
}
Wrapper<WenjuandiaochaEntity> wrapper = new EntityWrapper<WenjuandiaochaEntity>();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
int count = wenjuandiaochaService.selectCount(wrapper);
return R.ok().put("count", count);
}
/**
* *
*/ */
@IgnoreAuth @IgnoreAuth // 忽略认证
@RequestMapping("/autoSort") @RequestMapping("/autoSort")
public R autoSort(@RequestParam Map<String, Object> params,WenjuandiaochaEntity wenjuandiaocha, HttpServletRequest request,String pre){ public R autoSort(@RequestParam Map<String, Object> params, WenjuandiaochaEntity wenjuandiaocha, HttpServletRequest request, String pre) {
// 创建 EntityWrapper 对象,用于构建查询条件
EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>(); EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>();
Map<String, Object> newMap = new HashMap<String, Object>(); Map<String, Object> newMap = new HashMap<String, Object>();
Map<String, Object> param = new HashMap<String, Object>(); Map<String, Object> param = new HashMap<String, Object>();
Iterator<Map.Entry<String, Object>> it = param.entrySet().iterator(); Iterator<Map.Entry<String, Object>> it = param.entrySet().iterator();
while (it.hasNext()) { while (it.hasNext()) {
Map.Entry<String, Object> entry = it.next(); Map.Entry<String, Object> entry = it.next();
String key = entry.getKey(); String key = entry.getKey();
String newKey = entry.getKey(); String newKey = entry.getKey();
if (pre.endsWith(".")) {
newMap.put(pre + newKey, entry.getValue()); // 处理 pre 参数
} else if (StringUtils.isEmpty(pre)) { if (pre.endsWith(".")) {
newMap.put(newKey, entry.getValue()); newMap.put(pre + newKey, entry.getValue());
} else { } else if (StringUtils.isEmpty(pre)) {
newMap.put(pre + "." + newKey, entry.getValue()); newMap.put(newKey, entry.getValue());
} } else {
} newMap.put(pre + "." + newKey, entry.getValue());
params.put("sort", "clicktime"); }
}
// 设置排序条件
params.put("sort", "clicktime");
params.put("order", "desc"); params.put("order", "desc");
PageUtils page = wenjuandiaochaService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wenjuandiaocha), params), params));
return R.ok().put("data", page); // 查询分页数据
PageUtils page = wenjuandiaochaService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wenjuandiaocha), params), params));
return R.ok().put("data", page); // 返回分页数据
} }
/** /**
* *
*/ */
@RequestMapping("/autoSort2") @RequestMapping("/autoSort2")
public R autoSort2(@RequestParam Map<String, Object> params,WenjuandiaochaEntity wenjuandiaocha, HttpServletRequest request){ public R autoSort2(@RequestParam Map<String, Object> params, WenjuandiaochaEntity wenjuandiaocha, HttpServletRequest request) {
// 获取用户 ID
String userId = request.getSession().getAttribute("userId").toString(); String userId = request.getSession().getAttribute("userId").toString();
String inteltypeColumn = "leixing"; String inteltypeColumn = "leixing"; // 定义智能类型列名
List<StoreupEntity> storeups = storeupService.selectList(new EntityWrapper<StoreupEntity>().eq("type", 1).eq("userid", userId).eq("tablename", "wenjuandiaocha").orderBy("addtime", false)); List<StoreupEntity> storeups = storeupService.selectList(new EntityWrapper<StoreupEntity>().eq("type", 1).eq("userid", userId).eq("tablename", "wenjuandiaocha").orderBy("addtime", false));
List<String> inteltypes = new ArrayList<String>(); List<String> inteltypes = new ArrayList<String>();
Integer limit = params.get("limit")==null?10:Integer.parseInt(params.get("limit").toString()); Integer limit = params.get("limit") == null ? 10 : Integer.parseInt(params.get("limit").toString()); // 设置限制数量,默认为 10
List<WenjuandiaochaEntity> wenjuandiaochaList = new ArrayList<WenjuandiaochaEntity>(); List<WenjuandiaochaEntity> wenjuandiaochaList = new ArrayList<WenjuandiaochaEntity>();
//去重
if(storeups!=null && storeups.size()>0) { // 去重
for(StoreupEntity s : storeups) { if (storeups != null && storeups.size() > 0) {
for (StoreupEntity s : storeups) {
wenjuandiaochaList.addAll(wenjuandiaochaService.selectList(new EntityWrapper<WenjuandiaochaEntity>().eq(inteltypeColumn, s.getInteltype()))); wenjuandiaochaList.addAll(wenjuandiaochaService.selectList(new EntityWrapper<WenjuandiaochaEntity>().eq(inteltypeColumn, s.getInteltype())));
} }
} }
// 创建 EntityWrapper 对象,用于构建查询条件
EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>(); EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>();
params.put("sort", "id"); params.put("sort", "id");
params.put("order", "desc"); params.put("order", "desc");
// 查询分页数据
PageUtils page = wenjuandiaochaService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wenjuandiaocha), params), params)); PageUtils page = wenjuandiaochaService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wenjuandiaocha), params), params));
List<WenjuandiaochaEntity> pageList = (List<WenjuandiaochaEntity>)page.getList(); List<WenjuandiaochaEntity> pageList = (List<WenjuandiaochaEntity>) page.getList();
if(wenjuandiaochaList.size()<limit) {
int toAddNum = (limit-wenjuandiaochaList.size())<=pageList.size()?(limit-wenjuandiaochaList.size()):pageList.size(); // 如果结果数量小于限制数量,则从分页数据中添加
for(WenjuandiaochaEntity o1 : pageList) { if (wenjuandiaochaList.size() < limit) {
int toAddNum = (limit - wenjuandiaochaList.size()) <= pageList.size() ? (limit - wenjuandiaochaList.size()) : pageList.size();
for (WenjuandiaochaEntity o1 : pageList) {
boolean addFlag = true; boolean addFlag = true;
for(WenjuandiaochaEntity o2 : wenjuandiaochaList) { for (WenjuandiaochaEntity o2 : wenjuandiaochaList) {
if(o1.getId().intValue()==o2.getId().intValue()) { if (o1.getId().intValue() == o2.getId().intValue()) {
addFlag = false; addFlag = false;
break; break;
} }
} }
if(addFlag) { if (addFlag) {
wenjuandiaochaList.add(o1); wenjuandiaochaList.add(o1);
if(--toAddNum==0) break; if (--toAddNum == 0) break;
} }
} }
} else if(wenjuandiaochaList.size()>limit) { } else if (wenjuandiaochaList.size() > limit) {
wenjuandiaochaList = wenjuandiaochaList.subList(0, limit); wenjuandiaochaList = wenjuandiaochaList.subList(0, limit); // 如果结果数量大于限制数量,则截取前 limit 个
} }
page.setList(wenjuandiaochaList);
return R.ok().put("data", page); page.setList(wenjuandiaochaList); // 设置新的列表
return R.ok().put("data", page); // 返回分页数据
} }
/** /**
* *
*/ */
@RequestMapping("/value/{xColumnName}/{yColumnName}") @RequestMapping("/value/{xColumnName}/{yColumnName}")
public R value(@PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName,HttpServletRequest request) { public R value(@PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName, HttpServletRequest request) {
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("xColumn", xColumnName); params.put("xColumn", xColumnName);
params.put("yColumn", yColumnName); params.put("yColumn", yColumnName);
// 创建 EntityWrapper 对象,用于构建查询条件
EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>(); EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>();
// 查询统计结果
List<Map<String, Object>> result = wenjuandiaochaService.selectValue(params, ew); List<Map<String, Object>> result = wenjuandiaochaService.selectValue(params, ew);
// 处理日期格式
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for(Map<String, Object> m : result) { for (Map<String, Object> m : result) {
for(String k : m.keySet()) { for (String k : m.keySet()) {
if(m.get(k) instanceof Date) { if (m.get(k) instanceof Date) {
m.put(k, sdf.format((Date)m.get(k))); m.put(k, sdf.format((Date) m.get(k)));
} }
} }
} }
return R.ok().put("data", result); return R.ok().put("data", result); // 返回统计结果
} }
/** /**
* *
*/ */
@RequestMapping("/value/{xColumnName}/{yColumnName}/{timeStatType}") @RequestMapping("/value/{xColumnName}/{yColumnName}/{timeStatType}")
public R valueDay(@PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName, @PathVariable("timeStatType") String timeStatType,HttpServletRequest request) { public R valueDay(@PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName, @PathVariable("timeStatType") String timeStatType, HttpServletRequest request) {
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("xColumn", xColumnName); params.put("xColumn", xColumnName);
params.put("yColumn", yColumnName); params.put("yColumn", yColumnName);
params.put("timeStatType", timeStatType); params.put("timeStatType", timeStatType);
// 创建 EntityWrapper 对象,用于构建查询条件
EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>(); EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>();
// 查询时间统计结果
List<Map<String, Object>> result = wenjuandiaochaService.selectTimeStatValue(params, ew); List<Map<String, Object>> result = wenjuandiaochaService.selectTimeStatValue(params, ew);
// 处理日期格式
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for(Map<String, Object> m : result) { for (Map<String, Object> m : result) {
for(String k : m.keySet()) { for (String k : m.keySet()) {
if(m.get(k) instanceof Date) { if (m.get(k) instanceof Date) {
m.put(k, sdf.format((Date)m.get(k))); m.put(k, sdf.format((Date) m.get(k)));
} }
} }
} }
return R.ok().put("data", result); return R.ok().put("data", result); // 返回时间统计结果
} }
/** /**
* *
*/ */
@RequestMapping("/group/{columnName}") @RequestMapping("/group/{columnName}")
public R group(@PathVariable("columnName") String columnName,HttpServletRequest request) { public R group(@PathVariable("columnName") String columnName, HttpServletRequest request) {
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("column", columnName); params.put("column", columnName);
// 创建 EntityWrapper 对象,用于构建查询条件
EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>(); EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>();
// 查询分组统计结果
List<Map<String, Object>> result = wenjuandiaochaService.selectGroup(params, ew); List<Map<String, Object>> result = wenjuandiaochaService.selectGroup(params, ew);
// 处理日期格式
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for(Map<String, Object> m : result) { for (Map<String, Object> m : result) {
for(String k : m.keySet()) { for (String k : m.keySet()) {
if(m.get(k) instanceof Date) { if (m.get(k) instanceof Date) {
m.put(k, sdf.format((Date)m.get(k))); m.put(k, sdf.format((Date) m.get(k)));
} }
} }
} }
return R.ok().put("data", result); return R.ok().put("data", result); // 返回分组统计结果
} }
/** /**
* *
*/ */
@RequestMapping("/count") @RequestMapping("/count")
public R count(@RequestParam Map<String, Object> params,WenjuandiaochaEntity wenjuandiaocha, HttpServletRequest request){ public R count(@RequestParam Map<String, Object> params, WenjuandiaochaEntity wenjuandiaocha, HttpServletRequest request) {
// 创建 EntityWrapper 对象,用于构建查询条件
EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>(); EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>();
// 查询符合条件的记录数
int count = wenjuandiaochaService.selectCount(MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wenjuandiaocha), params), params)); int count = wenjuandiaochaService.selectCount(MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wenjuandiaocha), params), params));
return R.ok().put("data", count); return R.ok().put("data", count); // 返回记录数
} }
} }

@ -13,31 +13,73 @@ import com.entity.view.WenjuandiaochaView;
/** /**
* * 访
* * BaseMapperCRUD
* @author * @author
* @email * @email
* @date 2023-02-21 09:46:06 * @date 2023-02-21 09:46:06
*/ */
public interface WenjuandiaochaDao extends BaseMapper<WenjuandiaochaEntity> { public interface WenjuandiaochaDao extends BaseMapper<WenjuandiaochaEntity> {
List<WenjuandiaochaVO> selectListVO(@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper);
WenjuandiaochaVO selectVO(@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper);
List<WenjuandiaochaView> selectListView(@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper);
List<WenjuandiaochaView> selectListView(Pagination page,@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper); /**
* WenjuandiaochaVO
WenjuandiaochaView selectView(@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper); * @param ew
* @return VO
*/
List<WenjuandiaochaVO> selectListVO(@Param("ew") Wrapper<WenjuandiaochaEntity> ew);
List<Map<String, Object>> selectValue(@Param("params") Map<String, Object> params,@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper); /**
* WenjuandiaochaVO
* @param ew
* @return VO
*/
WenjuandiaochaVO selectVO(@Param("ew") Wrapper<WenjuandiaochaEntity> ew);
List<Map<String, Object>> selectTimeStatValue(@Param("params") Map<String, Object> params,@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper); /**
* WenjuandiaochaView
List<Map<String, Object>> selectGroup(@Param("params") Map<String, Object> params,@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper); * @param ew
* @return View
*/
List<WenjuandiaochaView> selectListView(@Param("ew") Wrapper<WenjuandiaochaEntity> ew);
/**
* WenjuandiaochaView
* @param page
* @param ew
* @return View
*/
List<WenjuandiaochaView> selectListView(Pagination page, @Param("ew") Wrapper<WenjuandiaochaEntity> ew);
/**
* WenjuandiaochaView
* @param ew
* @return View
*/
WenjuandiaochaView selectView(@Param("ew") Wrapper<WenjuandiaochaEntity> ew);
/**
* Map
* @param params
* @param ew
* @return Map
*/
List<Map<String, Object>> selectValue(@Param("params") Map<String, Object> params, @Param("ew") Wrapper<WenjuandiaochaEntity> ew);
/**
* Map
* @param params
* @param ew
* @return Map
*/
List<Map<String, Object>> selectTimeStatValue(@Param("params") Map<String, Object> params, @Param("ew") Wrapper<WenjuandiaochaEntity> ew);
/**
* Map
* @param params
* @param ew
* @return Map
*/
List<Map<String, Object>> selectGroup(@Param("params") Map<String, Object> params, @Param("ew") Wrapper<WenjuandiaochaEntity> ew);
} }

@ -3,7 +3,6 @@ package com.entity;
import com.baomidou.mybatisplus.annotations.TableId; import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName; import com.baomidou.mybatisplus.annotations.TableName;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@ -11,37 +10,39 @@ import java.lang.reflect.InvocationTargetException;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.baomidou.mybatisplus.enums.IdType;
/** /**
* *
* *
* @author * @author
* @email * @email
* @date 2023-02-21 09:46:06 * @date 2023-02-21 09:46:06
*/ */
@TableName("wenjuandiaocha") @TableName("wenjuandiaocha") // 指定该实体类对应的数据库表名为“wenjuandiaocha”
public class WenjuandiaochaEntity<T> implements Serializable { @JsonIgnoreProperties(ignoreUnknown = true) // 忽略未知属性,防止反序列化时出现错误
private static final long serialVersionUID = 1L; public class WenjuandiaochaEntity<T> implements Serializable { // 实现Serializable接口以支持序列化
private static final long serialVersionUID = 1L; // 序列化版本号
/**
*
*/
public WenjuandiaochaEntity() { public WenjuandiaochaEntity() {
} }
/**
* t
* @param t
*/
public WenjuandiaochaEntity(T t) { public WenjuandiaochaEntity(T t) {
try { try {
BeanUtils.copyProperties(this, t); BeanUtils.copyProperties(this, t); // 使用BeanUtils工具类复制属性
} catch (IllegalAccessException | InvocationTargetException e) { } catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block // 打印堆栈跟踪信息以便调试
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -49,210 +50,274 @@ public class WenjuandiaochaEntity<T> implements Serializable {
/** /**
* id * id
*/ */
@TableId @TableId // 指定该字段为主键
private Long id; private Long id;
/** /**
* *
* 使NotBlank
*/ */
@NotBlank(message = "问卷标题不能为空")
private String wenjuanbiaoti; private String wenjuanbiaoti;
/** /**
* *
* 使NotBlank
*/ */
@NotBlank(message = "封面图片路径不能为空")
private String fengmiantupian; private String fengmiantupian;
/** /**
* *
* 使NotBlank
*/ */
@NotBlank(message = "类型不能为空")
private String leixing; private String leixing;
/** /**
* *
* 使NotBlank
*/ */
@NotBlank(message = "问题一不能为空")
private String wentiyi; private String wentiyi;
/** /**
* *
* 使NotBlank
*/ */
@NotBlank(message = "问题二不能为空")
private String wentier; private String wentier;
/** /**
* *
* 使NotBlank
*/ */
@NotBlank(message = "问题三不能为空")
private String wentisan; private String wentisan;
/** /**
* *
* 使NotBlank
*/ */
@NotBlank(message = "问题四不能为空")
private String wentisi; private String wentisi;
/** /**
* *
* 使NotBlank
*/ */
@NotBlank(message = "问题五不能为空")
private String wentiwu; private String wentiwu;
/** /**
* *
* 使JsonFormatyyyy-MM-dd HH:mm:ss
* 使DateTimeFormatyyyy-MM-dd HH:mm:ss
* 使NotNullnull
*/ */
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat @NotNull(message = "发布日期不能为空")
private Date faburiqi; private Date faburiqi;
/** /**
* *
* 使JsonFormatyyyy-MM-dd HH:mm:ss
* 使DateTimeFormatyyyy-MM-dd HH:mm:ss
*/ */
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date clicktime; private Date clicktime;
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat
private Date addtime;
public Date getAddtime() { /**
return addtime; *
} * @param addtime
*/
public void setAddtime(Date addtime) { public void setAddtime(Date addtime) {
this.addtime = addtime; this.addtime = addtime;
} }
public Long getId() { /**
return id; *
* @return
*/
public Date getAddtime() {
return addtime;
} }
/**
* id
* @param id id
*/
public void setId(Long id) { public void setId(Long id) {
this.id = id; this.id = id;
} }
/**
* /**
*/ * id
* @return id
*/
public Long getId() {
return id;
}
/**
*
* @param wenjuanbiaoti
*/
public void setWenjuanbiaoti(String wenjuanbiaoti) { public void setWenjuanbiaoti(String wenjuanbiaoti) {
this.wenjuanbiaoti = wenjuanbiaoti; this.wenjuanbiaoti = wenjuanbiaoti;
} }
/**
* /**
*/ *
* @return
*/
public String getWenjuanbiaoti() { public String getWenjuanbiaoti() {
return wenjuanbiaoti; return wenjuanbiaoti;
} }
/**
* /**
*/ *
* @param fengmiantupian
*/
public void setFengmiantupian(String fengmiantupian) { public void setFengmiantupian(String fengmiantupian) {
this.fengmiantupian = fengmiantupian; this.fengmiantupian = fengmiantupian;
} }
/**
* /**
*/ *
* @return
*/
public String getFengmiantupian() { public String getFengmiantupian() {
return fengmiantupian; return fengmiantupian;
} }
/**
* /**
*/ *
* @param leixing
*/
public void setLeixing(String leixing) { public void setLeixing(String leixing) {
this.leixing = leixing; this.leixing = leixing;
} }
/**
* /**
*/ *
* @return
*/
public String getLeixing() { public String getLeixing() {
return leixing; return leixing;
} }
/**
* /**
*/ *
* @param wentiyi
*/
public void setWentiyi(String wentiyi) { public void setWentiyi(String wentiyi) {
this.wentiyi = wentiyi; this.wentiyi = wentiyi;
} }
/**
* /**
*/ *
* @return
*/
public String getWentiyi() { public String getWentiyi() {
return wentiyi; return wentiyi;
} }
/**
* /**
*/ *
* @param wentier
*/
public void setWentier(String wentier) { public void setWentier(String wentier) {
this.wentier = wentier; this.wentier = wentier;
} }
/**
* /**
*/ *
* @return
*/
public String getWentier() { public String getWentier() {
return wentier; return wentier;
} }
/**
* /**
*/ *
* @param wentisan
*/
public void setWentisan(String wentisan) { public void setWentisan(String wentisan) {
this.wentisan = wentisan; this.wentisan = wentisan;
} }
/**
* /**
*/ *
* @return
*/
public String getWentisan() { public String getWentisan() {
return wentisan; return wentisan;
} }
/**
* /**
*/ *
* @param wentisi
*/
public void setWentisi(String wentisi) { public void setWentisi(String wentisi) {
this.wentisi = wentisi; this.wentisi = wentisi;
} }
/**
* /**
*/ *
* @return
*/
public String getWentisi() { public String getWentisi() {
return wentisi; return wentisi;
} }
/**
* /**
*/ *
* @param wentiwu
*/
public void setWentiwu(String wentiwu) { public void setWentiwu(String wentiwu) {
this.wentiwu = wentiwu; this.wentiwu = wentiwu;
} }
/**
* /**
*/ *
* @return
*/
public String getWentiwu() { public String getWentiwu() {
return wentiwu; return wentiwu;
} }
/**
* /**
*/ *
* @param faburiqi
*/
public void setFaburiqi(Date faburiqi) { public void setFaburiqi(Date faburiqi) {
this.faburiqi = faburiqi; this.faburiqi = faburiqi;
} }
/**
* /**
*/ *
* @return
*/
public Date getFaburiqi() { public Date getFaburiqi() {
return faburiqi; return faburiqi;
} }
/**
* /**
*/ *
* @param clicktime
*/
public void setClicktime(Date clicktime) { public void setClicktime(Date clicktime) {
this.clicktime = clicktime; this.clicktime = clicktime;
} }
/**
* /**
*/ *
* @return
*/
public Date getClicktime() { public Date getClicktime() {
return clicktime; return clicktime;
} }
} }

@ -1,227 +1,195 @@
package com.entity.model; package com.entity.model;
import com.entity.WenjuandiaochaEntity; import com.entity.WenjuandiaochaEntity;
import com.baomidou.mybatisplus.annotations.TableName; import com.baomidou.mybatisplus.annotations.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date; import java.util.Date;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
/** /**
* *
* *
* entity * ModelAndViewmodel
* ModelAndView model * @author
* @author * @email
* @email
* @date 2023-02-21 09:46:06 * @date 2023-02-21 09:46:06
*/ */
public class WenjuandiaochaModel implements Serializable { public class WenjuandiaochaModel implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* *
*/ */
private String fengmiantupian; private String fengmiantupian;
/** /**
* *
*/ */
private String leixing; private String leixing;
/** /**
* *
*/ */
private String wentiyi; private String wentiyi;
/** /**
* *
*/ */
private String wentier; private String wentier;
/** /**
* *
*/ */
private String wentisan; private String wentisan;
/** /**
* *
*/ */
private String wentisi; private String wentisi;
/** /**
* *
*/ */
private String wentiwu; private String wentiwu;
/** /**
* *
*/ */
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") @DateTimeFormat
@DateTimeFormat
private Date faburiqi; private Date faburiqi;
/** /**
* *
*/ */
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") @DateTimeFormat
@DateTimeFormat
private Date clicktime; private Date clicktime;
/** /**
* *
*/ */
public void setFengmiantupian(String fengmiantupian) { public void setFengmiantupian(String fengmiantupian) {
this.fengmiantupian = fengmiantupian; this.fengmiantupian = fengmiantupian;
} }
/** /**
* *
*/ */
public String getFengmiantupian() { public String getFengmiantupian() {
return fengmiantupian; return fengmiantupian;
} }
/** /**
* *
*/ */
public void setLeixing(String leixing) { public void setLeixing(String leixing) {
this.leixing = leixing; this.leixing = leixing;
} }
/** /**
* *
*/ */
public String getLeixing() { public String getLeixing() {
return leixing; return leixing;
} }
/** /**
* *
*/ */
public void setWentiyi(String wentiyi) { public void setWentiyi(String wentiyi) {
this.wentiyi = wentiyi; this.wentiyi = wentiyi;
} }
/** /**
* *
*/ */
public String getWentiyi() { public String getWentiyi() {
return wentiyi; return wentiyi;
} }
/** /**
* *
*/ */
public void setWentier(String wentier) { public void setWentier(String wentier) {
this.wentier = wentier; this.wentier = wentier;
} }
/** /**
* *
*/ */
public String getWentier() { public String getWentier() {
return wentier; return wentier;
} }
/** /**
* *
*/ */
public void setWentisan(String wentisan) { public void setWentisan(String wentisan) {
this.wentisan = wentisan; this.wentisan = wentisan;
} }
/** /**
* *
*/ */
public String getWentisan() { public String getWentisan() {
return wentisan; return wentisan;
} }
/** /**
* *
*/ */
public void setWentisi(String wentisi) { public void setWentisi(String wentisi) {
this.wentisi = wentisi; this.wentisi = wentisi;
} }
/** /**
* *
*/ */
public String getWentisi() { public String getWentisi() {
return wentisi; return wentisi;
} }
/** /**
* *
*/ */
public void setWentiwu(String wentiwu) { public void setWentiwu(String wentiwu) {
this.wentiwu = wentiwu; this.wentiwu = wentiwu;
} }
/** /**
* *
*/ */
public String getWentiwu() { public String getWentiwu() {
return wentiwu; return wentiwu;
} }
/** /**
* *
*/ */
public void setFaburiqi(Date faburiqi) { public void setFaburiqi(Date faburiqi) {
this.faburiqi = faburiqi; this.faburiqi = faburiqi;
} }
/** /**
* *
*/ */
public Date getFaburiqi() { public Date getFaburiqi() {
return faburiqi; return faburiqi;
} }
/** /**
* *
*/ */
public void setClicktime(Date clicktime) { public void setClicktime(Date clicktime) {
this.clicktime = clicktime; this.clicktime = clicktime;
} }
/** /**
* *
*/ */
public Date getClicktime() { public Date getClicktime() {
return clicktime; return clicktime;
} }
} }

@ -1,36 +1,40 @@
package com.entity.view; package com.entity.view;
import com.entity.WenjuandiaochaEntity; import com.entity.WenjuandiaochaEntity;
import com.baomidou.mybatisplus.annotations.TableName; import com.baomidou.mybatisplus.annotations.TableName;
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.io.Serializable; import java.io.Serializable;
/** /**
* *
* * 使
* 使 * 使
* @author * @author
* @email * @email
* @date 2023-02-21 09:46:06 * @date 2023-02-21 09:46:06
*/ */
@TableName("wenjuandiaocha") @TableName("wenjuandiaocha")
public class WenjuandiaochaView extends WenjuandiaochaEntity implements Serializable { public class WenjuandiaochaView extends WenjuandiaochaEntity implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/**
*
*/
public WenjuandiaochaView() {
}
public WenjuandiaochaView(){ /**
} * WenjuandiaochaEntityWenjuandiaochaView
* @param wenjuandiaochaEntity
public WenjuandiaochaView(WenjuandiaochaEntity wenjuandiaochaEntity){ */
try { public WenjuandiaochaView(WenjuandiaochaEntity wenjuandiaochaEntity) {
BeanUtils.copyProperties(this, wenjuandiaochaEntity); try {
} catch (IllegalAccessException | InvocationTargetException e) { BeanUtils.copyProperties(this, wenjuandiaochaEntity);
// TODO Auto-generated catch block } catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace(); // 打印堆栈跟踪信息以便调试
} e.printStackTrace();
}
} }
} }

@ -10,36 +10,80 @@ import com.entity.vo.WenjuandiaochaVO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.entity.view.WenjuandiaochaView; import com.entity.view.WenjuandiaochaView;
/** /**
* *
* *
* @author * @author
* @email * @email
* @date 2023-02-21 09:46:06 * @date 2023-02-21 09:46:06
*/ */
public interface WenjuandiaochaService extends IService<WenjuandiaochaEntity> { public interface WenjuandiaochaService extends IService<WenjuandiaochaEntity> {
/**
*
* @param params
* @return
*/
PageUtils queryPage(Map<String, Object> params); PageUtils queryPage(Map<String, Object> params);
List<WenjuandiaochaVO> selectListVO(Wrapper<WenjuandiaochaEntity> wrapper); /**
*
* @param wrapper
* @return
*/
List<WenjuandiaochaVO> selectListVO(Wrapper<WenjuandiaochaEntity> wrapper);
WenjuandiaochaVO selectVO(@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper); /**
*
* @param wrapper
* @return
*/
WenjuandiaochaVO selectVO(@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper);
List<WenjuandiaochaView> selectListView(Wrapper<WenjuandiaochaEntity> wrapper); /**
*
* @param wrapper
* @return
*/
List<WenjuandiaochaView> selectListView(Wrapper<WenjuandiaochaEntity> wrapper);
WenjuandiaochaView selectView(@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper); /**
*
* @param wrapper
* @return
*/
WenjuandiaochaView selectView(@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper);
PageUtils queryPage(Map<String, Object> params,Wrapper<WenjuandiaochaEntity> wrapper); /**
*
* @param params
* @param wrapper
* @return
*/
PageUtils queryPage(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper);
List<Map<String, Object>> selectValue(Map<String, Object> params,Wrapper<WenjuandiaochaEntity> wrapper); /**
*
* @param params
* @param wrapper
* @return
*/
List<Map<String, Object>> selectValue(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper);
List<Map<String, Object>> selectTimeStatValue(Map<String, Object> params,Wrapper<WenjuandiaochaEntity> wrapper); /**
*
* @param params
* @param wrapper
* @return
*/
List<Map<String, Object>> selectTimeStatValue(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper);
List<Map<String, Object>> selectGroup(Map<String, Object> params,Wrapper<WenjuandiaochaEntity> wrapper); /**
*
* @param params
* @param wrapper
* @return
*/
List<Map<String, Object>> selectGroup(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper);
} }

@ -11,19 +11,27 @@ import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.utils.PageUtils; import com.utils.PageUtils;
import com.utils.Query; import com.utils.Query;
import com.dao.WenjuandiaochaDao; import com.dao.WenjuandiaochaDao;
import com.entity.WenjuandiaochaEntity; import com.entity.WenjuandiaochaEntity;
import com.service.WenjuandiaochaService; import com.service.WenjuandiaochaService;
import com.entity.vo.WenjuandiaochaVO; import com.entity.vo.WenjuandiaochaVO;
import com.entity.view.WenjuandiaochaView; import com.entity.view.Wenjuandiaocha;
/**
*
* MyBatis-PlusServiceImplWenjuandiaochaService
*/
@Service("wenjuandiaochaService") @Service("wenjuandiaochaService")
public class WenjuandiaochaServiceImpl extends ServiceImpl<WenjuandiaochaDao, WenjuandiaochaEntity> implements WenjuandiaochaService { public class WenjuandiaochaServiceImpl extends ServiceImpl<WenjuandiaochaDao, WenjuandiaochaEntity> implements WenjuandiaochaService {
/**
*
* @param params
* @return
*/
@Override @Override
public PageUtils queryPage(Map<String, Object> params) { public PageUtils queryPage(Map<String, Object> params) {
// 使用MyBatis-Plus的分页插件进行分页查询
Page<WenjuandiaochaEntity> page = this.selectPage( Page<WenjuandiaochaEntity> page = this.selectPage(
new Query<WenjuandiaochaEntity>(params).getPage(), new Query<WenjuandiaochaEntity>(params).getPage(),
new EntityWrapper<WenjuandiaochaEntity>() new EntityWrapper<WenjuandiaochaEntity>()
@ -31,50 +39,93 @@ public class WenjuandiaochaServiceImpl extends ServiceImpl<WenjuandiaochaDao, We
return new PageUtils(page); return new PageUtils(page);
} }
/**
*
* @param params
* @param wrapper
* @return
*/
@Override @Override
public PageUtils queryPage(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper) { public PageUtils queryPage(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper) {
Page<WenjuandiaochaView> page =new Query<WenjuandiaochaView>(params).getPage(); // 创建分页对象
page.setRecords(baseMapper.selectListView(page,wrapper)); Page<WenjuandiaochaView> page = new Query<WenjuandiaochaView>(params).getPage();
PageUtils pageUtil = new PageUtils(page); // 设置分页记录
return pageUtil; page.setRecords(baseMapper.selectListView(page, wrapper));
// 返回分页工具类
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
} }
/**
*
* @param wrapper
* @return
*/
@Override @Override
public List<WenjuandiaochaVO> selectListVO(Wrapper<WenjuandiaochaEntity> wrapper) { public List<WenjuandiaochaVO> selectListVO(Wrapper<WenjuandiaochaEntity> wrapper) {
return baseMapper.selectListVO(wrapper); return baseMapper.selectListVO(wrapper);
} }
/**
*
* @param wrapper
* @return
*/
@Override @Override
public WenjuandiaochaVO selectVO(Wrapper<WenjuandiaochaEntity> wrapper) { public WenjuandiaochaVO selectVO(Wrapper<WenjuandiaochaEntity> wrapper) {
return baseMapper.selectVO(wrapper); return baseMapper.selectVO(wrapper);
} }
/**
*
* @param wrapper
* @return
*/
@Override @Override
public List<WenjuandiaochaView> selectListView(Wrapper<WenjuandiaochaEntity> wrapper) { public List<WenjuandiaochaView> selectListView(Wrapper<WenjuandiaochaEntity> wrapper) {
return baseMapper.selectListView(wrapper); return baseMapper.selectListView(wrapper);
} }
/**
*
* @param wrapper
* @return
*/
@Override @Override
public WenjuandiaochaView selectView(Wrapper<WenjuandiaochaEntity> wrapper) { public WenjuandiaochaView selectView(Wrapper<WenjuandiaochaEntity> wrapper) {
return baseMapper.selectView(wrapper); return baseMapper.selectView(wrapper);
} }
/**
*
* @param params
* @param wrapper
* @return
*/
@Override @Override
public List<Map<String, Object>> selectValue(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper) { public List<Map<String, Object>> selectValue(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper) {
return baseMapper.selectValue(params, wrapper); return baseMapper.selectValue(params, wrapper);
} }
/**
*
* @param params
* @param wrapper
* @return
*/
@Override @Override
public List<Map<String, Object>> selectTimeStatValue(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper) { public List<Map<String, Object>> selectTimeStatValue(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper) {
return baseMapper.selectTimeStatValue(params, wrapper); return baseMapper.selectTimeStatValue(params, wrapper);
} }
/**
*
* @param params
* @param wrapper
* @return
*/
@Override @Override
public List<Map<String, Object>> selectGroup(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper) { public List<Map<String, Object>> selectGroup(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper) {
return baseMapper.selectGroup(params, wrapper); return baseMapper.selectGroup(params, wrapper);
} }
} }

@ -3,38 +3,109 @@
<mapper namespace="com.dao.ChatDao"> <mapper namespace="com.dao.ChatDao">
<!-- 可根据自己的需求,是否要使用 --> <!--
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.ChatEntity的属性
-->
<resultMap type="com.entity.ChatEntity" id="chatMap"> <resultMap type="com.entity.ChatEntity" id="chatMap">
<result property="userid" column="userid"/> <result property="userid" column="userid"/> <!-- 将数据库列userid映射到ChatEntity的属性userid -->
<result property="adminid" column="adminid"/> <result property="adminid" column="adminid"/> <!-- 将数据库列adminid映射到ChatEntity的属性adminid -->
<result property="ask" column="ask"/> <result property="ask" column="ask"/> <!-- 将数据库列ask映射到ChatEntity的属性ask -->
<result property="reply" column="reply"/> <result property="reply" column="reply"/> <!-- 将数据库列reply映射到ChatEntity的属性reply -->
<result property="isreply" column="isreply"/> <result property="isreply" column="isreply"/> <!-- 将数据库列isreply映射到ChatEntity的属性isreply -->
</resultMap> </resultMap>
<select id="selectListVO" <!--
resultType="com.entity.vo.ChatVO" > 分页查询Chat的VO列表
SELECT * FROM chat chat 使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.ChatVO
-->
<select id="selectListVO"
resultType="com.entity.vo.ChatVO">
SELECT * FROM chat chat
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<select id="selectVO" <!--
resultType="com.entity.vo.ChatVO" > 查询单个Chat的VO记录
SELECT chat.* FROM chat chat 使用${ew.sqlSegment}来动态拼接SQL条件
<where> 1=1 ${ew.sqlSegment}</where> resultType指定返回的结果类型为com.entity.vo.ChatVO
</select> -->
<select id="selectVO"
resultType="com.entity.vo.ChatVO">
SELECT chat.* FROM chat chat
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
分页查询Chat的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.ChatView
-->
<select id="selectListView" <select id="selectListView"
resultType="com.entity.view.ChatView" > resultType="com.entity.view.ChatView">
SELECT chat.* FROM chat chat
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
查询单个Chat的视图记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.ChatView
-->
<select id="selectView"
resultType="com.entity.view.ChatView">
SELECT * FROM chat chat
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
SELECT chat.* FROM chat chat <!--
查询Chat的统计值
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为map
这里假设需要查询每个用户和管理员的聊天总数,具体查询逻辑需要根据实际需求编写
-->
<select id="selectValue"
resultType="map">
SELECT COUNT(*) AS total, userid, adminid
FROM chat chat
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
GROUP BY userid, adminid <!-- 按userid和adminid分组统计每个用户和管理员的聊天总数 -->
</select>
<!--
查询Chat的时间统计值
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为map
这里假设需要查询某个时间范围内的每日聊天总数,具体查询逻辑需要根据实际需求编写
-->
<select id="selectTimeStatValue"
resultType="map">
SELECT DATE(ask) AS date, COUNT(*) AS count
FROM chat chat
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE(ask) <!-- 按ask列的日期分组统计每日聊天总数 -->
</select>
<!--
查询Chat的分组统计值
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为map
这里假设需要查询按isreply字段分组的聊天记录数具体查询逻辑需要根据实际需求编写
-->
<select id="selectGroup"
resultType="map">
SELECT isreply, COUNT(*) AS count
FROM chat chat
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> GROUP BY isreply <!-- 按isreply字段分组统计每个分组的聊天记录数 -->
</select>
<select id="selectView"
resultType="com.entity.view.ChatView" >
SELECT * FROM chat chat <where> 1=1 ${ew.sqlSegment}</where>
</select>
</mapper> </mapper>

@ -2,70 +2,158 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dao.CommonDao"> <mapper namespace="com.dao.CommonDao">
<select id="getOption" resultType="String" >
SELECT distinct ${column} FROM ${table} <!--
where ${column} is not null and ${column} !='' 查询表中的唯一选项值
<if test = "conditionColumn != null and conditionValue != null"> @param column 需要查询的列名
and ${conditionColumn}=#{conditionValue} @param table 需要查询的表名
@param conditionColumn 附加条件的列名(可选)
@param conditionValue 附加条件的列值(可选)
@param level 级别条件(可选)
@param parent 父级条件(可选)
@return 唯一的选项值列表
-->
<select id="getOption" resultType="String">
SELECT DISTINCT ${column} FROM ${table}
WHERE ${column} IS NOT NULL AND ${column} != ''
<!-- 如果条件列和条件值不为空,则添加相应的条件 -->
<if test="conditionColumn != null and conditionValue != null">
AND ${conditionColumn} = #{conditionValue}
</if>
<!-- 如果级别条件不为空,则添加相应的条件 -->
<if test="level != null">
AND level = #{level}
</if>
<!-- 如果父级条件不为空,则添加相应的条件 -->
<if test="parent != null">
AND parent = #{parent}
</if>
</select>
<!--
根据选项值查询表中的记录
@param column 需要查询的列名
@param columnValue 列的值
@param table 需要查询的表名
@return 符合条件的记录列表
-->
<select id="getFollowByOption" resultType="map">
SELECT * FROM ${table}
WHERE ${column} = #{columnValue}
</select>
<!--
更新表中记录的审核状态
@param table 需要更新的表名
@param sfsh 审核状态
@param id 记录的id
-->
<update id="sh">
UPDATE ${table}
SET sfsh = #{sfsh}
WHERE id = #{id}
</update>
<!--
查询表中需要提醒的记录数
@param table 需要查询的表名
@param column 需要查询的列名
@param type 提醒类型1或2
@param remindstart 提醒开始时间
@param remindend 提醒结束时间
@return 符合条件的记录数
-->
<select id="remindCount" resultType="int">
SELECT COUNT(1) FROM ${table}
WHERE 1=1
<!-- 如果类型为1则根据数值范围进行过滤 -->
<if test="type == 1">
<if test="remindstart != null">
AND ${column} >= #{remindstart}
</if>
<if test="remindend != null">
AND ${column} <= #{remindend}
</if>
</if>
<!-- 如果类型为2则根据日期范围进行过滤 -->
<if test="type == 2">
<if test="remindstart != null">
AND ${column} >= STR_TO_DATE(#{remindstart}, '%Y-%m-%d')
</if>
<if test="remindend != null">
AND ${column} <= STR_TO_DATE(#{remindend}, '%Y-%m-%d')
</if> </if>
<if test = "level != null"> </if>
and level=#{level} </select>
</if>
<if test = "parent != null"> <!--
and parent=#{parent} 查询表中某一列的统计信息(总和、最大值、最小值、平均值)
</if> @param column 需要查询的列名
</select> @param table 需要查询的表名
@return 包含统计信息的map
<select id="getFollowByOption" resultType="map" > -->
SELECT * FROM ${table} where ${column}=#{columnValue} <select id="selectCal" resultType="map">
</select> SELECT SUM(${column}) AS sum,
MAX(${column}) AS max,
<update id="sh"> MIN(${column}) AS min,
UPDATE ${table} set sfsh=#{sfsh} where id=#{id} AVG(${column}) AS avg
</update> FROM ${table}
</select>
<select id="remindCount" resultType="int" >
SELECT count(1) FROM ${table} <!--
where 1=1 按某一列分组查询记录总数
<if test = "type == 1 "> @param column 需要分组的列名
<if test = " remindstart != null "> @param table 需要查询的表名
and ${column} &gt;= #{remindstart} @return 包含分组信息和记录总数的map列表
</if> -->
<if test = " remindend != null "> <select id="selectGroup" resultType="map">
and ${column} &lt;= #{remindend} SELECT ${column},
</if> COUNT(1) AS total
</if> FROM ${table}
<if test = "type == 2 "> GROUP BY ${column}
<if test = " remindstart != null "> </select>
and ${column} &gt;= str_to_date(#{remindstart},'%Y-%m-%d')
</if> <!--
<if test = " remindend != null "> 按某一列分组查询另一列的总和
and ${column} &lt;= str_to_date(#{remindend},'%Y-%m-%d') @param xColumn 需要分组的列名
</if> @param yColumn 需要求和的列名
</if> @param table 需要查询的表名
</select> @return 包含分组信息和总和的map列表
-->
<select id="selectCal" resultType="map" > <select id="selectValue" resultType="map">
SELECT sum(${column}) sum,max(${column}) max,min(${column}) min,avg(${column}) avg FROM ${table} SELECT ${xColumn},
</select> SUM(${yColumn}) AS total
FROM ${table}
<select id="selectGroup" resultType="map" > GROUP BY ${xColumn}
SELECT ${column} , count(1) total FROM ${table} group by ${column} </select>
</select>
<select id="selectValue" resultType="map" >
SELECT ${xColumn}, sum(${yColumn}) total FROM ${table} group by ${xColumn}
</select>
<select id="selectTimeStatValue" resultType="map" > <!--
<if test = 'timeStatType == "日"'> 按时间统计查询某一列的总和
SELECT DATE_FORMAT(${xColumn},'%Y-%m-%d') ${xColumn}, sum(${yColumn}) total FROM ${table} group by DATE_FORMAT(${xColumn},'%Y-%m-%d') @param timeStatType 时间统计类型(日、月、年)
</if> @param xColumn 需要格式化的时间列名
<if test = 'timeStatType == "月"'> @param yColumn 需要求和的列名
SELECT DATE_FORMAT(${xColumn},'%Y-%m') ${xColumn}, sum(${yColumn}) total FROM ${table} group by DATE_FORMAT(${xColumn},'%Y-%m') @param table 需要查询的表名
</if> @return 包含格式化时间信息和总和的map列表
<if test = 'timeStatType == "年"'> -->
SELECT DATE_FORMAT(${xColumn},'%Y') ${xColumn}, sum(${yColumn}) total FROM ${table} group by DATE_FORMAT(${xColumn},'%Y') <select id="selectTimeStatValue" resultType="map">
</if> <!-- 根据时间统计类型进行不同的日期格式化处理 -->
</select> <if test='timeStatType == "日"'>
SELECT DATE_FORMAT(${xColumn}, '%Y-%m-%d') AS ${xColumn},
SUM(${yColumn}) AS total
FROM ${table}
GROUP BY DATE_FORMAT(${xColumn}, '%Y-%m-%d')
</if>
<if test='timeStatType == "月"'>
SELECT DATE_FORMAT(${xColumn}, '%Y-%m') AS ${xColumn},
SUM(${yColumn}) AS total
FROM ${table}
GROUP BY DATE_FORMAT(${xColumn}, '%Y-%m')
</if>
<if test='timeStatType == "年"'>
SELECT DATE_FORMAT(${xColumn}, '%Y') AS ${xColumn},
SUM(${yColumn}) AS total
FROM ${table}
GROUP BY DATE_FORMAT(${xColumn}, '%Y')
</if>
</select>
</mapper> </mapper>

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.ConfigDao"> <mapper namespace="com.dao.ConfigDao">
</mapper> <!-- 定义Mapper的命名空间对应于ConfigDao接口 -->
</mapper>

@ -1,42 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.ForumDao"> <mapper namespace="com.dao.ForumDao">
<!-- 定义Mapper的命名空间对应于ForumDao接口 -->
<!-- 可根据自己的需求,是否要使用 --> <!--
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.ForumEntity的属性
-->
<resultMap type="com.entity.ForumEntity" id="forumMap"> <resultMap type="com.entity.ForumEntity" id="forumMap">
<result property="title" column="title"/> <result property="title" column="title"/> <!-- 将数据库列title映射到ForumEntity的属性title -->
<result property="content" column="content"/> <result property="content" column="content"/> <!-- 将数据库列content映射到ForumEntity的属性content -->
<result property="parentid" column="parentid"/> <result property="parentid" column="parentid"/> <!-- 将数据库列parentid映射到ForumEntity的属性parentid -->
<result property="userid" column="userid"/> <result property="userid" column="userid"/> <!-- 将数据库列userid映射到ForumEntity的属性userid -->
<result property="username" column="username"/> <result property="username" column="username"/> <!-- 将数据库列username映射到ForumEntity的属性username -->
<result property="avatarurl" column="avatarurl"/> <result property="avatarurl" column="avatarurl"/> <!-- 将数据库列avatarurl映射到ForumEntity的属性avatarurl -->
<result property="isdone" column="isdone"/> <result property="isdone" column="isdone"/> <!-- 将数据库列isdone映射到ForumEntity的属性isdone -->
</resultMap> </resultMap>
<select id="selectListVO" <!--
resultType="com.entity.vo.ForumVO" > 分页查询Forum的VO列表
SELECT * FROM forum forum 使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.ForumVO
-->
<select id="selectListVO"
resultType="com.entity.vo.ForumVO">
SELECT * FROM forum forum
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<select id="selectVO" <!--
resultType="com.entity.vo.ForumVO" > 查询单个Forum的VO记录
SELECT forum.* FROM forum forum 使用${ew.sqlSegment}来动态拼接SQL条件
<where> 1=1 ${ew.sqlSegment}</where> resultType指定返回的结果类型为com.entity.vo.ForumVO
</select> -->
<select id="selectVO"
resultType="com.entity.vo.ForumVO">
SELECT forum.* FROM forum forum
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
分页查询Forum的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.ForumView
-->
<select id="selectListView" <select id="selectListView"
resultType="com.entity.view.ForumView" > resultType="com.entity.view.ForumView">
SELECT forum.* FROM forum forum
SELECT forum.* FROM forum forum <!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
查询单个Forum的视图记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.ForumView
-->
<select id="selectView"
resultType="com.entity.view.ForumView">
SELECT * FROM forum forum
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<select id="selectView"
resultType="com.entity.view.ForumView" >
SELECT * FROM forum forum <where> 1=1 ${ew.sqlSegment}</where>
</select>
</mapper> </mapper>

@ -1,36 +1,108 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.LeixingDao"> <mapper namespace="com.dao.LeixingDao">
<!-- 定义Mapper的命名空间对应于LeixingDao接口 -->
<!-- 可根据自己的需求,是否要使用 --> <!--
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.LeixingEntity的属性
-->
<resultMap type="com.entity.LeixingEntity" id="leixingMap"> <resultMap type="com.entity.LeixingEntity" id="leixingMap">
<result property="leixing" column="leixing"/> <result property="leixing" column="leixing"/> <!-- 将数据库列leixing映射到LeixingEntity的属性leixing -->
</resultMap> </resultMap>
<select id="selectListVO" <!--
resultType="com.entity.vo.LeixingVO" > 分页查询Leixing的VO列表
SELECT * FROM leixing leixing 使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.LeixingVO
-->
<select id="selectListVO"
resultType="com.entity.vo.LeixingVO">
SELECT * FROM leixing leixing
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<select id="selectVO" <!--
resultType="com.entity.vo.LeixingVO" > 查询单个Leixing的VO记录
SELECT leixing.* FROM leixing leixing 使用${ew.sqlSegment}来动态拼接SQL条件
<where> 1=1 ${ew.sqlSegment}</where> resultType指定返回的结果类型为com.entity.vo.LeixingVO
</select> -->
<select id="selectVO"
resultType="com.entity.vo.LeixingVO">
SELECT leixing.* FROM leixing leixing
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<select id="selectListView" 当然,我会在你的代码中添加详细的注释,以确保每个部分的功能和参数都能被详细理解。以下是添加了注释的代码:
resultType="com.entity.view.LeixingView" >
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.LeixingDao">
<!-- 定义Mapper的命名空间对应于LeixingDao接口 -->
SELECT leixing.* FROM leixing leixing <!--
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.LeixingEntity的属性
-->
<resultMap type="com.entity.LeixingEntity" id="leixingMap">
<result property="leixing" column="leixing"/> <!-- 将数据库列leixing映射到LeixingEntity的属性leixing -->
</resultMap>
<!--
分页查询Leixing的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.LeixingVO
-->
<select id="selectListVO"
resultType="com.entity.vo.LeixingVO">
SELECT * FROM leixing leixing
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
查询单个Leixing的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.LeixingVO
-->
<select id="selectVO"
resultType="com.entity.vo.LeixingVO">
SELECT leixing.* FROM leixing leixing
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
分页查询Leixing的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.LeixingView
-->
<select id="selectListView"
resultType="com.entity.view.LeixingView">
SELECT leixing.* FROM leixing leixing
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
查询单个Leixing的视图记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.LeixingView
-->
<select id="selectView"
resultType="com.entity.view.LeixingView">
SELECT * FROM leixing leixing
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<select id="selectView"
resultType="com.entity.view.LeixingView" >
SELECT * FROM leixing leixing <where> 1=1 ${ew.sqlSegment}</where>
</select>
</mapper> </mapper>

@ -1,39 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.NewsDao"> <mapper namespace="com.dao.NewsDao">
<!-- 定义Mapper的命名空间对应于NewsDao接口 -->
<!-- 可根据自己的需求,是否要使用 --> <!--
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.NewsEntity的属性
-->
<resultMap type="com.entity.NewsEntity" id="newsMap"> <resultMap type="com.entity.NewsEntity" id="newsMap">
<result property="title" column="title"/> <result property="title" column="title"/> <!-- 将数据库列title映射到NewsEntity的属性title -->
<result property="introduction" column="introduction"/> <result property="introduction" column="introduction"/> <!-- 将数据库列introduction映射到NewsEntity的属性introduction -->
<result property="picture" column="picture"/> <result property="picture" column="picture"/> <!-- 将数据库列picture映射到NewsEntity的属性picture -->
<result property="content" column="content"/> <result property="content" column="content"/> <!-- 将数据库列content映射到NewsEntity的属性content -->
</resultMap> </resultMap>
<select id="selectListVO" <!--
resultType="com.entity.vo.NewsVO" > 分页查询News的VO列表
SELECT * FROM news news 使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.NewsVO
-->
<select id="selectListVO"
resultType="com.entity.vo.NewsVO">
SELECT * FROM news news
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<select id="selectVO" <!--
resultType="com.entity.vo.NewsVO" > 查询单个News的VO记录
SELECT news.* FROM news news 使用${ew.sqlSegment}来动态拼接SQL条件
<where> 1=1 ${ew.sqlSegment}</where> resultType指定返回的结果类型为com.entity.vo.NewsVO
</select> -->
<select id="selectVO"
resultType="com.entity.vo.NewsVO">
SELECT news.* FROM news news
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
分页查询News的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.NewsView
-->
<select id="selectListView" <select id="selectListView"
resultType="com.entity.view.NewsView" > resultType="com.entity.view.NewsView">
SELECT news.* FROM news news
SELECT news.* FROM news news <!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
查询单个News的视图记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.NewsView
-->
<select id="selectView"
resultType="com.entity.view.NewsView">
SELECT * FROM news news
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<select id="selectView"
resultType="com.entity.view.NewsView" >
SELECT * FROM news news <where> 1=1 ${ew.sqlSegment}</where>
</select>
</mapper> </mapper>

@ -1,43 +1,72 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.StoreupDao"> <mapper namespace="com.dao.StoreupDao">
<!-- 定义Mapper的命名空间对应于StoreupDao接口 -->
<!-- 可根据自己的需求,是否要使用 --> <!--
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.StoreupEntity的属性
-->
<resultMap type="com.entity.StoreupEntity" id="storeupMap"> <resultMap type="com.entity.StoreupEntity" id="storeupMap">
<result property="userid" column="userid"/> <result property="userid" column="userid"/> <!-- 将数据库列userid映射到StoreupEntity的属性userid -->
<result property="refid" column="refid"/> <result property="refid" column="refid"/> <!-- 将数据库列refid映射到StoreupEntity的属性refid -->
<result property="tablename" column="tablename"/> <result property="tablename" column="tablename"/> <!-- 将数据库列tablename映射到StoreupEntity的属性tablename -->
<result property="name" column="name"/> <result property="name" column="name"/> <!-- 将数据库列name映射到StoreupEntity的属性name -->
<result property="picture" column="picture"/> <result property="picture" column="picture"/> <!-- 将数据库列picture映射到StoreupEntity的属性picture -->
<result property="type" column="type"/> <result property="type" column="type"/> <!-- 将数据库列type映射到StoreupEntity的属性type -->
<result property="inteltype" column="inteltype"/> <result property="inteltype" column="inteltype"/> <!-- 将数据库列inteltype映射到StoreupEntity的属性inteltype -->
<result property="remark" column="remark"/> <result property="remark" column="remark"/> <!-- 将数据库列remark映射到StoreupEntity的属性remark -->
</resultMap> </resultMap>
<select id="selectListVO" <!--
resultType="com.entity.vo.StoreupVO" > 分页查询Storeup的VO列表
SELECT * FROM storeup storeup 使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.StoreupVO
-->
<select id="selectListVO"
resultType="com.entity.vo.StoreupVO">
SELECT * FROM storeup storeup
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<select id="selectVO" <!--
resultType="com.entity.vo.StoreupVO" > 查询单个Storeup的VO记录
SELECT storeup.* FROM storeup storeup 使用${ew.sqlSegment}来动态拼接SQL条件
<where> 1=1 ${ew.sqlSegment}</where> resultType指定返回的结果类型为com.entity.vo.StoreupVO
</select> -->
<select id="selectVO"
resultType="com.entity.vo.StoreupVO">
SELECT storeup.* FROM storeup storeup
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
分页查询Storeup的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.StoreupView
-->
<select id="selectListView" <select id="selectListView"
resultType="com.entity.view.StoreupView" > resultType="com.entity.view.StoreupView">
SELECT storeup.* FROM storeup storeup
SELECT storeup.* FROM storeup storeup <!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
查询单个Storeup的视图记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.StoreupView
-->
<select id="selectView"
resultType="com.entity.view.StoreupView">
SELECT * FROM storeup storeup
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<select id="selectView"
resultType="com.entity.view.StoreupView" >
SELECT * FROM storeup storeup <where> 1=1 ${ew.sqlSegment}</where>
</select>
</mapper> </mapper>

@ -1,41 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.SystemintroDao"> <mapper namespace="com.dao.SystemintroDao">
<!-- 定义Mapper的命名空间对应于SystemintroDao接口 -->
<!-- 可根据自己的需求,是否要使用 --> <!--
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.SystemintroEntity的属性
-->
<resultMap type="com.entity.SystemintroEntity" id="systemintroMap"> <resultMap type="com.entity.SystemintroEntity" id="systemintroMap">
<result property="title" column="title"/> <result property="title" column="title"/> <!-- 将数据库列title映射到SystemintroEntity的属性title -->
<result property="subtitle" column="subtitle"/> <result property="subtitle" column="subtitle"/> <!-- 将数据库列subtitle映射到SystemintroEntity的属性subtitle -->
<result property="content" column="content"/> <result property="content" column="content"/> <!-- 将数据库列content映射到SystemintroEntity的属性content -->
<result property="picture1" column="picture1"/> <result property="picture1" column="picture1"/> <!-- 将数据库列picture1映射到SystemintroEntity的属性picture1 -->
<result property="picture2" column="picture2"/> <result property="picture2" column="picture2"/> <!-- 将数据库列picture2映射到SystemintroEntity的属性picture2 -->
<result property="picture3" column="picture3"/> <result property="picture3" column="picture3"/> <!-- 将数据库列picture3映射到SystemintroEntity的属性picture3 -->
</resultMap> </resultMap>
<select id="selectListVO" <!--
resultType="com.entity.vo.SystemintroVO" > 分页查询Systemintro的VO列表
SELECT * FROM systemintro systemintro 使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.SystemintroVO
-->
<select id="selectListVO"
resultType="com.entity.vo.SystemintroVO">
SELECT * FROM systemintro systemintro
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<select id="selectVO" <!--
resultType="com.entity.vo.SystemintroVO" > 查询单个Systemintro的VO记录
SELECT systemintro.* FROM systemintro systemintro 使用${ew.sqlSegment}来动态拼接SQL条件
<where> 1=1 ${ew.sqlSegment}</where> resultType指定返回的结果类型为com.entity.vo.SystemintroVO
</select> -->
<select id="selectVO"
resultType="com.entity.vo.SystemintroVO">
SELECT systemintro.* FROM systemintro systemintro
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
分页查询Systemintro的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.SystemintroView
-->
<select id="selectListView" <select id="selectListView"
resultType="com.entity.view.SystemintroView" > resultType="com.entity.view.SystemintroView">
SELECT systemintro.* FROM systemintro systemintro
SELECT systemintro.* FROM systemintro systemintro <!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
查询单个Systemintro的视图记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.SystemintroView
-->
<select id="selectView"
resultType="com.entity.view.SystemintroView">
SELECT * FROM systemintro systemintro
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<select id="selectView"
resultType="com.entity.view.SystemintroView" >
SELECT * FROM systemintro systemintro <where> 1=1 ${ew.sqlSegment}</where>
</select>
</mapper> </mapper>

@ -1,13 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.TokenDao"> <mapper namespace="com.dao.TokenDao">
<!-- 定义Mapper的命名空间对应于TokenDao接口 -->
<!--
分页查询Token的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.TokenEntity
-->
<select id="selectListView" <select id="selectListView"
resultType="com.entity.TokenEntity" > resultType="com.entity.TokenEntity" >
SELECT t.* FROM token t
SELECT t.* FROM token t <!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
</mapper> </mapper>

@ -1,13 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.UsersDao"> <mapper namespace="com.dao.UsersDao">
<!-- 定义Mapper的命名空间对应于UsersDao接口 -->
<!--
分页查询Users的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.UsersEntity
-->
<select id="selectListView" <select id="selectListView"
resultType="com.entity.UsersEntity" > resultType="com.entity.UsersEntity" >
SELECT u.* FROM users u
SELECT u.* FROM users u <!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
</mapper> </mapper>

@ -1,84 +1,138 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.WenjuandafuDao"> <mapper namespace="com.dao.WenjuandafuDao">
<!-- 定义Mapper的命名空间对应于WenjuandafuDao接口 -->
<!-- 可根据自己的需求,是否要使用 --> <!--
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.WenjuandafuEntity的属性
-->
<resultMap type="com.entity.WenjuandafuEntity" id="wenjuandafuMap"> <resultMap type="com.entity.WenjuandafuEntity" id="wenjuandafuMap">
<result property="wenjuanbiaoti" column="wenjuanbiaoti"/> <result property="wenjuanbiaoti" column="wenjuanbiaoti"/> <!-- 将数据库列wenjuanbiaoti映射到WenjuandafuEntity的属性wenjuanbiaoti -->
<result property="leixing" column="leixing"/> <result property="leixing" column="leixing"/> <!-- 将数据库列leixing映射到WenjuandafuEntity的属性leixing -->
<result property="wentiyi" column="wentiyi"/> <result property="wentiyi" column="wentiyi"/> <!-- 将数据库列wentiyi映射到WenjuandafuEntity的属性wentiyi -->
<result property="dafuyi" column="dafuyi"/> <result property="dafuyi" column="dafuyi"/> <!-- 将数据库列dafuyi映射到WenjuandafuEntity的属性dafuyi -->
<result property="wentier" column="wentier"/> <result property="wentier" column="wentier"/> <!-- 将数据库列wentier映射到WenjuandafuEntity的属性wentier -->
<result property="dafuer" column="dafuer"/> <result property="dafuer" column="dafuer"/> <!-- 将数据库列dafuer映射到WenjuandafuEntity的属性dafuer -->
<result property="wentisan" column="wentisan"/> <result property="wentisan" column="wentisan"/> <!-- 将数据库列wentisan映射到WenjuandafuEntity的属性wentisan -->
<result property="dafusan" column="dafusan"/> <result property="dafusan" column="dafusan"/> <!-- 将数据库列dafusan映射到WenjuandafuEntity的属性dafusan -->
<result property="wentisi" column="wentisi"/> <result property="wentisi" column="wentisi"/> <!-- 将数据库列wentisi映射到WenjuandafuEntity的属性wentisi -->
<result property="dafusi" column="dafusi"/> <result property="dafusi" column="dafusi"/> <!-- 将数据库列dafusi映射到WenjuandafuEntity的属性dafusi -->
<result property="wentiwu" column="wentiwu"/> <result property="wentiwu" column="wentiwu"/> <!-- 将数据库列wentiwu映射到WenjuandafuEntity的属性wentiwu -->
<result property="dafuwu" column="dafuwu"/> <result property="dafuwu" column="dafuwu"/> <!-- 将数据库列dafuwu映射到WenjuandafuEntity的属性dafuwu -->
<result property="zhanghao" column="zhanghao"/> <result property="zhanghao" column="zhanghao"/> <!-- 将数据库列zhanghao映射到WenjuandafuEntity的属性zhanghao -->
<result property="xingming" column="xingming"/> <result property="xingming" column="xingming"/> <!-- 将数据库列xingming映射到WenjuandafuEntity的属性xingming -->
<result property="tijiaoriqi" column="tijiaoriqi"/> <result property="tijiaoriqi" column="tijiaoriqi"/> <!-- 将数据库列tijiaoriqi映射到WenjuandafuEntity的属性tijiaoriqi -->
</resultMap> </resultMap>
<select id="selectListVO" <!--
resultType="com.entity.vo.WenjuandafuVO" > 分页查询Wenjuandafu的VO列表
SELECT * FROM wenjuandafu wenjuandafu 使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.WenjuandafuVO
-->
<select id="selectListVO"
resultType="com.entity.vo.WenjuandafuVO">
SELECT * FROM wenjuandafu wenjuandafu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<select id="selectVO" <!--
resultType="com.entity.vo.WenjuandafuVO" > 查询单个Wenjuandafu的VO记录
SELECT wenjuandafu.* FROM wenjuandafu wenjuandafu 使用${ew.sqlSegment}来动态拼接SQL条件
<where> 1=1 ${ew.sqlSegment}</where> resultType指定返回的结果类型为com.entity.vo.WenjuandafuVO
</select> -->
<select id="selectVO"
resultType="com.entity.vo.WenjuandafuVO">
SELECT wenjuandafu.* FROM wenjuandafu wenjuandafu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
分页查询Wenjuandafu的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.WenjuandafuView
-->
<select id="selectListView" <select id="selectListView"
resultType="com.entity.view.WenjuandafuView" > resultType="com.entity.view.WenjuandafuView">
SELECT wenjuandafu.* FROM wenjuandafu wenjuandafu
SELECT wenjuandafu.* FROM wenjuandafu wenjuandafu <!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<select id="selectView" <!--
resultType="com.entity.view.WenjuandafuView" > 查询单个Wenjuandafu的视图记录
SELECT * FROM wenjuandafu wenjuandafu <where> 1=1 ${ew.sqlSegment}</where> 使用${ew.sqlSegment}来动态拼接SQL条件
</select> resultType指定返回的结果类型为com.entity.view.WenjuandafuView
-->
<select id="selectView"
resultType="com.entity.view.WenjuandafuView">
SELECT * FROM wenjuandafu wenjuandafu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<select id="selectValue" resultType="map" > <!--
SELECT ${params.xColumn}, sum(${params.yColumn}) total FROM wenjuandafu 查询Wenjuandafu的统计值
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为map
@param params 包含查询参数的map包括xColumn和yColumn
@return 包含统计值的map列表
-->
<select id="selectValue" resultType="map">
SELECT ${params.xColumn}, sum(${params.yColumn}) AS total FROM wenjuandafu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
group by ${params.xColumn} GROUP BY ${params.xColumn} <!-- 按xColumn分组统计每个组的yColumn总和 -->
limit 10 LIMIT 10 <!-- 限制结果集最多返回10条记录 -->
</select> </select>
<select id="selectTimeStatValue" resultType="map" > <!--
<if test = 'params.timeStatType == "日"'> 查询Wenjuandafu的时间统计值
SELECT DATE_FORMAT(${params.xColumn},'%Y-%m-%d') ${params.xColumn}, sum(${params.yColumn}) total FROM wenjuandafu 使用${ew.sqlSegment}来动态拼接SQL条件
<where> 1=1 ${ew.sqlSegment}</where> resultType指定返回的结果类型为map
group by DATE_FORMAT(${params.xColumn},'%Y-%m-%d') @param params 包含查询参数的map包括timeStatType、xColumn和yColumn
@return 包含时间统计值的map列表
-->
<select id="selectTimeStatValue" resultType="map">
<!-- 根据时间统计类型进行不同的日期格式化处理 -->
<if test='params.timeStatType == "日"'>
SELECT DATE_FORMAT(${params.xColumn}, '%Y-%m-%d') AS ${params.xColumn}, sum(${params.yColumn}) AS total FROM wenjuandafu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE_FORMAT(${params.xColumn}, '%Y-%m-%d') <!-- 按日分组统计每个组的yColumn总和 -->
</if> </if>
<if test = 'params.timeStatType == "月"'> <if test='params.timeStatType == "月"'>
SELECT DATE_FORMAT(${params.xColumn},'%Y-%m') ${params.xColumn}, sum(${params.yColumn}) total FROM wenjuandafu SELECT DATE_FORMAT(${params.xColumn}, '%Y-%m') AS ${params.xColumn}, sum(${params.yColumn}) AS total FROM wenjuandafu
<where> 1=1 ${ew.sqlSegment}</where> <!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
group by DATE_FORMAT(${params.xColumn},'%Y-%m') <where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE_FORMAT(${params.xColumn}, '%Y-%m') <!-- 按月分组统计每个组的yColumn总和 -->
</if> </if>
<if test = 'params.timeStatType == "年"'> <if test='params.timeStatType == "年"'>
SELECT DATE_FORMAT(${params.xColumn},'%Y') ${params.xColumn}, sum(${params.yColumn}) total FROM wenjuandafu SELECT DATE_FORMAT(${params.xColumn}, '%Y') AS ${params.xColumn}, sum(${params.yColumn}) AS total FROM wenjuandafu
<where> 1=1 ${ew.sqlSegment}</where> <!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
group by DATE_FORMAT(${params.xColumn},'%Y') <where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE_FORMAT(${params.xColumn}, '%Y') <!-- 按年分组统计每个组的yColumn总和 -->
</if> </if>
</select> </select>
<select id="selectGroup" resultType="map" > <!--
SELECT ${params.column} , count(1) total FROM wenjuandafu 查询Wenjuandafu的分组统计值
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为map
@param params 包含查询参数的map包括column
@return 包含分组统计值的map列表
-->
<select id="selectGroup" resultType="map">
SELECT ${params.column}, count(1) AS total FROM wenjuandafu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
group by ${params.column} GROUP BY ${params.column} <!-- 按column分组统计每个组的记录数 -->
limit 10 LIMIT 10 <!-- 限制结果集最多返回10条记录 -->
</select> </select>
</mapper> </mapper>

@ -1,79 +1,133 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.WenjuandiaochaDao"> <mapper namespace="com.dao.WenjuandiaochaDao">
<!-- 定义Mapper的命名空间对应于WenjuandiaochaDao接口 -->
<!-- 可根据自己的需求,是否要使用 --> <!--
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.WenjuandiaochaEntity的属性
-->
<resultMap type="com.entity.WenjuandiaochaEntity" id="wenjuandiaochaMap"> <resultMap type="com.entity.WenjuandiaochaEntity" id="wenjuandiaochaMap">
<result property="wenjuanbiaoti" column="wenjuanbiaoti"/> <result property="wenjuanbiaoti" column="wenjuanbiaoti"/> <!-- 将数据库列wenjuanbiaoti映射到WenjuandiaochaEntity的属性wenjuanbiaoti -->
<result property="fengmiantupian" column="fengmiantupian"/> <result property="fengmiantupian" column="fengmiantupian"/> <!-- 将数据库列fengmiantupian映射到WenjuandiaochaEntity的属性fengmiantupian -->
<result property="leixing" column="leixing"/> <result property="leixing" column="leixing"/> <!-- 将数据库列leixing映射到WenjuandiaochaEntity的属性leixing -->
<result property="wentiyi" column="wentiyi"/> <result property="wentiyi" column="wentiyi"/> <!-- 将数据库列wentiyi映射到WenjuandiaochaEntity的属性wentiyi -->
<result property="wentier" column="wentier"/> <result property="wentier" column="wentier"/> <!-- 将数据库列wentier映射到WenjuandiaochaEntity的属性wentier -->
<result property="wentisan" column="wentisan"/> <result property="wentisan" column="wentisan"/> <!-- 将数据库列wentisan映射到WenjuandiaochaEntity的属性wentisan -->
<result property="wentisi" column="wentisi"/> <result property="wentisi" column="wentisi"/> <!-- 将数据库列wentisi映射到WenjuandiaochaEntity的属性wentisi -->
<result property="wentiwu" column="wentiwu"/> <result property="wentiwu" column="wentiwu"/> <!-- 将数据库列wentiwu映射到WenjuandiaochaEntity的属性wentiwu -->
<result property="faburiqi" column="faburiqi"/> <result property="faburiqi" column="faburiqi"/> <!-- 将数据库列faburiqi映射到WenjuandiaochaEntity的属性faburiqi -->
<result property="clicktime" column="clicktime"/> <result property="clicktime" column="clicktime"/> <!-- 将数据库列clicktime映射到WenjuandiaochaEntity的属性clicktime -->
</resultMap> </resultMap>
<select id="selectListVO" <!--
resultType="com.entity.vo.WenjuandiaochaVO" > 分页查询Wenjuandiaocha的VO列表
SELECT * FROM wenjuandiaocha wenjuandiaocha 使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.WenjuandiaochaVO
-->
<select id="selectListVO"
resultType="com.entity.vo.WenjuandiaochaVO">
SELECT * FROM wenjuandiaocha wenjuandiaocha
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<select id="selectVO" <!--
resultType="com.entity.vo.WenjuandiaochaVO" > 查询单个Wenjuandiaocha的VO记录
SELECT wenjuandiaocha.* FROM wenjuandiaocha wenjuandiaocha 使用${ew.sqlSegment}来动态拼接SQL条件
<where> 1=1 ${ew.sqlSegment}</where> resultType指定返回的结果类型为com.entity.vo.WenjuandiaochaVO
</select> -->
<select id="selectVO"
resultType="com.entity.vo.WenjuandiaochaVO">
SELECT wenjuandiaocha.* FROM wenjuandiaocha wenjuandiaocha
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
分页查询Wenjuandiaocha的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.WenjuandiaochaView
-->
<select id="selectListView" <select id="selectListView"
resultType="com.entity.view.WenjuandiaochaView" > resultType="com.entity.view.WenjuandiaochaView">
SELECT wenjuandiaocha.* FROM wenjuandiaocha wenjuandiaocha
SELECT wenjuandiaocha.* FROM wenjuandiaocha wenjuandiaocha <!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<select id="selectView" <!--
resultType="com.entity.view.WenjuandiaochaView" > 查询单个Wenjuandiaocha的视图记录
SELECT * FROM wenjuandiaocha wenjuandiaocha <where> 1=1 ${ew.sqlSegment}</where> 使用${ew.sqlSegment}来动态拼接SQL条件
</select> resultType指定返回的结果类型为com.entity.view.WenjuandiaochaView
-->
<select id="selectView"
resultType="com.entity.view.WenjuandiaochaView">
SELECT * FROM wenjuandiaocha wenjuandiaocha
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<select id="selectValue" resultType="map" > <!--
SELECT ${params.xColumn}, sum(${params.yColumn}) total FROM wenjuandiaocha 查询Wenjuandiaocha的统计值
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为map
@param params 包含查询参数的map包括xColumn和yColumn
@return 包含统计值的map列表
-->
<select id="selectValue" resultType="map">
SELECT ${params.xColumn}, sum(${params.yColumn}) AS total FROM wenjuandiaocha
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
group by ${params.xColumn} GROUP BY ${params.xColumn} <!-- 按xColumn分组统计每个组的yColumn总和 -->
limit 10 LIMIT 10 <!-- 限制结果集最多返回10条记录 -->
</select> </select>
<select id="selectTimeStatValue" resultType="map" > <!--
<if test = 'params.timeStatType == "日"'> 查询Wenjuandiaocha的时间统计值
SELECT DATE_FORMAT(${params.xColumn},'%Y-%m-%d') ${params.xColumn}, sum(${params.yColumn}) total FROM wenjuandiaocha 使用${ew.sqlSegment}来动态拼接SQL条件
<where> 1=1 ${ew.sqlSegment}</where> resultType指定返回的结果类型为map
group by DATE_FORMAT(${params.xColumn},'%Y-%m-%d') @param params 包含查询参数的map包括timeStatType、xColumn和yColumn
@return 包含时间统计值的map列表
-->
<select id="selectTimeStatValue" resultType="map">
<!-- 根据时间统计类型进行不同的日期格式化处理 -->
<if test='params.timeStatType == "日"'>
SELECT DATE_FORMAT(${params.xColumn}, '%Y-%m-%d') AS ${params.xColumn}, sum(${params.yColumn}) AS total FROM wenjuandiaocha
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE_FORMAT(${params.xColumn}, '%Y-%m-%d') <!-- 按日分组统计每个组的yColumn总和 -->
</if> </if>
<if test = 'params.timeStatType == "月"'> <if test='params.timeStatType == "月"'>
SELECT DATE_FORMAT(${params.xColumn},'%Y-%m') ${params.xColumn}, sum(${params.yColumn}) total FROM wenjuandiaocha SELECT DATE_FORMAT(${params.xColumn}, '%Y-%m') AS ${params.xColumn}, sum(${params.yColumn}) AS total FROM wenjuandiaocha
<where> 1=1 ${ew.sqlSegment}</where> <!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
group by DATE_FORMAT(${params.xColumn},'%Y-%m') <where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE_FORMAT(${params.xColumn}, '%Y-%m') <!-- 按月分组统计每个组的yColumn总和 -->
</if> </if>
<if test = 'params.timeStatType == "年"'> <if test='params.timeStatType == "年"'>
SELECT DATE_FORMAT(${params.xColumn},'%Y') ${params.xColumn}, sum(${params.yColumn}) total FROM wenjuandiaocha SELECT DATE_FORMAT(${params.xColumn}, '%Y') AS ${params.xColumn}, sum(${params.yColumn}) AS total FROM wenjuandiaocha
<where> 1=1 ${ew.sqlSegment}</where> <!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
group by DATE_FORMAT(${params.xColumn},'%Y') <where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE_FORMAT(${params.xColumn}, '%Y') <!-- 按年分组统计每个组的yColumn总和 -->
</if> </if>
</select> </select>
<select id="selectGroup" resultType="map" > <!--
SELECT ${params.column} , count(1) total FROM wenjuandiaocha 查询Wenjuandiaocha的分组统计值
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为map
@param params 包含查询参数的map包括column
@return 包含分组统计值的map列表
-->
<select id="selectGroup" resultType="map">
SELECT ${params.column}, count(1) AS total FROM wenjuandiaocha
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
group by ${params.column} GROUP BY ${params.column} <!-- 按column分组统计每个组的记录数 -->
limit 10 LIMIT 10 <!-- 限制结果集最多返回10条记录 -->
</select> </select>
</mapper> </mapper>

@ -1,76 +1,130 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.YonghuDao"> <mapper namespace="com.dao.YonghuDao">
<!-- 定义Mapper的命名空间对应于YonghuDao接口 -->
<!-- 可根据自己的需求,是否要使用 --> <!--
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.YonghuEntity的属性
-->
<resultMap type="com.entity.YonghuEntity" id="yonghuMap"> <resultMap type="com.entity.YonghuEntity" id="yonghuMap">
<result property="zhanghao" column="zhanghao"/> <result property="zhanghao" column="zhanghao"/> <!-- 将数据库列zhanghao映射到YonghuEntity的属性zhanghao -->
<result property="mima" column="mima"/> <result property="mima" column="mima"/> <!-- 将数据库列mima映射到YonghuEntity的属性mima -->
<result property="xingming" column="xingming"/> <result property="xingming" column="xingming"/> <!-- 将数据库列xingming映射到YonghuEntity的属性xingming -->
<result property="xingbie" column="xingbie"/> <result property="xingbie" column="xingbie"/> <!-- 将数据库列xingbie映射到YonghuEntity的属性xingbie -->
<result property="youxiang" column="youxiang"/> <result property="youxiang" column="youxiang"/> <!-- 将数据库列youxiang映射到YonghuEntity的属性youxiang -->
<result property="shoujihaoma" column="shoujihaoma"/> <result property="shoujihaoma" column="shoujihaoma"/> <!-- 将数据库列shoujihaoma映射到YonghuEntity的属性shoujihaoma -->
<result property="touxiang" column="touxiang"/> <result property="touxiang" column="touxiang"/> <!-- 将数据库列touxiang映射到YonghuEntity的属性touxiang -->
</resultMap> </resultMap>
<select id="selectListVO" <!--
resultType="com.entity.vo.YonghuVO" > 分页查询Yonghu的VO列表
SELECT * FROM yonghu yonghu 使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.YonghuVO
-->
<select id="selectListVO"
resultType="com.entity.vo.YonghuVO">
SELECT * FROM yonghu yonghu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<select id="selectVO" <!--
resultType="com.entity.vo.YonghuVO" > 查询单个Yonghu的VO记录
SELECT yonghu.* FROM yonghu yonghu 使用${ew.sqlSegment}来动态拼接SQL条件
<where> 1=1 ${ew.sqlSegment}</where> resultType指定返回的结果类型为com.entity.vo.YonghuVO
</select> -->
<select id="selectVO"
resultType="com.entity.vo.YonghuVO">
SELECT yonghu.* FROM yonghu yonghu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
分页查询Yonghu的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.YonghuView
-->
<select id="selectListView" <select id="selectListView"
resultType="com.entity.view.YonghuView" > resultType="com.entity.view.YonghuView">
SELECT yonghu.* FROM yonghu yonghu
SELECT yonghu.* FROM yonghu yonghu <!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
</select> </select>
<select id="selectView" <!--
resultType="com.entity.view.YonghuView" > 查询单个Yonghu的视图记录
SELECT * FROM yonghu yonghu <where> 1=1 ${ew.sqlSegment}</where> 使用${ew.sqlSegment}来动态拼接SQL条件
</select> resultType指定返回的结果类型为com.entity.view.YonghuView
-->
<select id="selectView"
resultType="com.entity.view.YonghuView">
SELECT * FROM yonghu yonghu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<select id="selectValue" resultType="map" > <!--
SELECT ${params.xColumn}, sum(${params.yColumn}) total FROM yonghu 查询Yonghu的统计值
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为map
@param params 包含查询参数的map包括xColumn和yColumn
@return 包含统计值的map列表
-->
<select id="selectValue" resultType="map">
SELECT ${params.xColumn}, sum(${params.yColumn}) AS total FROM yonghu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
group by ${params.xColumn} GROUP BY ${params.xColumn} <!-- 按xColumn分组统计每个组的yColumn总和 -->
limit 10 LIMIT 10 <!-- 限制结果集最多返回10条记录 -->
</select> </select>
<select id="selectTimeStatValue" resultType="map" > <!--
<if test = 'params.timeStatType == "日"'> 查询Yonghu的时间统计值
SELECT DATE_FORMAT(${params.xColumn},'%Y-%m-%d') ${params.xColumn}, sum(${params.yColumn}) total FROM yonghu 使用${ew.sqlSegment}来动态拼接SQL条件
<where> 1=1 ${ew.sqlSegment}</where> resultType指定返回的结果类型为map
group by DATE_FORMAT(${params.xColumn},'%Y-%m-%d') @param params 包含查询参数的map包括timeStatType、xColumn和yColumn
@return 包含时间统计值的map列表
-->
<select id="selectTimeStatValue" resultType="map">
<!-- 根据时间统计类型进行不同的日期格式化处理 -->
<if test='params.timeStatType == "日"'>
SELECT DATE_FORMAT(${params.xColumn}, '%Y-%m-%d') AS ${params.xColumn}, sum(${params.yColumn}) AS total FROM yonghu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE_FORMAT(${params.xColumn}, '%Y-%m-%d') <!-- 按日分组统计每个组的yColumn总和 -->
</if> </if>
<if test = 'params.timeStatType == "月"'> <if test='params.timeStatType == "月"'>
SELECT DATE_FORMAT(${params.xColumn},'%Y-%m') ${params.xColumn}, sum(${params.yColumn}) total FROM yonghu SELECT DATE_FORMAT(${params.xColumn}, '%Y-%m') AS ${params.xColumn}, sum(${params.yColumn}) AS total FROM yonghu
<where> 1=1 ${ew.sqlSegment}</where> <!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
group by DATE_FORMAT(${params.xColumn},'%Y-%m') <where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE_FORMAT(${params.xColumn}, '%Y-%m') <!-- 按月分组统计每个组的yColumn总和 -->
</if> </if>
<if test = 'params.timeStatType == "年"'> <if test='params.timeStatType == "年"'>
SELECT DATE_FORMAT(${params.xColumn},'%Y') ${params.xColumn}, sum(${params.yColumn}) total FROM yonghu SELECT DATE_FORMAT(${params.xColumn}, '%Y') AS ${params.xColumn}, sum(${params.yColumn}) AS total FROM yonghu
<where> 1=1 ${ew.sqlSegment}</where> <!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
group by DATE_FORMAT(${params.xColumn},'%Y') <where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE_FORMAT(${params.xColumn}, '%Y') <!-- 按年分组统计每个组的yColumn总和 -->
</if> </if>
</select> </select>
<select id="selectGroup" resultType="map" > <!--
SELECT ${params.column} , count(1) total FROM yonghu 查询Yonghu的分组统计值
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为map
@param params 包含查询参数的map包括column
@return 包含分组统计值的map列表
-->
<select id="selectGroup" resultType="map">
SELECT ${params.column}, count(1) AS total FROM yonghu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where> <where> 1=1 ${ew.sqlSegment}</where>
group by ${params.column} GROUP BY ${params.column} <!-- 按column分组统计每个组的记录数 -->
limit 10 LIMIT 10 <!-- 限制结果集最多返回10条记录 -->
</select> </select>
</mapper> </mapper>

Loading…
Cancel
Save