java单表增删改页面生成_单表增删改查一套全部自动生成--测试类

package service;

import java.util.Date;

import java.util.List;

import org.junit.Test;

import org.junit.runner.RunWith;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.test.context.ContextConfiguration;

import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.eaju.bos.dao.mapper.DownloadCenterMapper;

import com.eaju.bos.entity.DownloadCenter;

import com.eaju.bos.entity.DownloadCenterExample;

import com.eaju.bos.entity.DownloadCenterExample.Criteria;

@RunWith(SpringJUnit4ClassRunner.class)

@ContextConfiguration("/spring/spring-config.xml")

public class DownloadCenterServiceTest {

@Autowired

private DownloadCenterMapper downloadCenterMapper;

//增 success

@Test

public void testInsert(){

DownloadCenterExample record = new DownloadCenterExample();

Criteria createCriteria = record.createCriteria();

createCriteria.andCreateTimeEqualTo(new Date());

DownloadCenter downloadCenter = new DownloadCenter();

downloadCenter.setCreateTime(new Date());

downloadCenter.setCreator("shun");

downloadCenter.setOperateStatus("2");

downloadCenter.setOperateResult("success");

downloadCenter.setRemark("test");

downloadCenter.setDownloadUrl("http://127.0.0.1:8083/bos/downloadCenter/test0627.txt");

int insertSelective = downloadCenterMapper.insertSelective(downloadCenter);

System.out.println(insertSelective);

}

//删 success

@Test

public void testDelete(){

DownloadCenterExample example = new DownloadCenterExample();

Criteria criteria = example.createCriteria();

criteria.andIdEqualTo(4);

int deleteByExample = downloadCenterMapper.deleteByExample(example);

System.out.println(deleteByExample);

}

//改 success

@Test

public void testUpdate(){

DownloadCenterExample example = new DownloadCenterExample();

DownloadCenter record = new DownloadCenter();

Criteria criteria = example.createCriteria();

criteria.andOperateStatusEqualTo("1");

record.setRemark("test update case");

record.setCreateTime(new Date());

int updateByExample = downloadCenterMapper.updateByExampleSelective(record, example);

System.out.println(updateByExample);

}

//查 success

@Test

public void testSelect(){

DownloadCenterExample example = new DownloadCenterExample();

Criteria criteria = example.createCriteria();

criteria.andOperateStatusEqualTo("1");

List selectByExample = downloadCenterMapper.selectByExample(example);

System.out.println(selectByExample);

}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值