1. ProviderDao layer
//Smart label case
//Smart label multi-condition query
public ListproviderTest(@Param("proCode") String proCode, @Param("proName") String proName);
//Smart label to modify
public int updatePro(Provider provider);
//Query range (array)
public ListgetProInData(String [] proCodes);
//Query range (collection)
public ListgetProList(List list);
//Query range (multiple collections)
public ListgetProObject(@Param("proCodeList") List proCodeList,@Param("proNameList") List proNameList);
< p>Two, ProviderDao.xml small configuration file
update smbms_provider
proCode=#{proCode},
proName=#{proName},
where id=#{id}
Three, test class
public class providerTest {
SqlSession sqlSession=MybatisUtil.getSqlSession();
ProviderDao mapper = sqlSession.getMapper(ProviderDao.class);
//Smart label multi-condition query
@Test
public void getAllPro(){
Listproviders = mapper.providerTest("GZ", "Shenzhen");
for (Provider pro:providers) {
System.out.println(pro.getProName());
}
}
//Smart label to modify
@Test
public void updatePro(){
Provider provider=new Provider();
provider.setId(10);
provider.setProCode("JS_GYS012");
provider.setProName("Little Nanjing Fire Head Army Information Technology Co., Ltd.");
int count=mapper.updatePro(provider);
sqlSession.commit();
System.out.println(count);
}
//Query range (array)
@Test
public void getInPro(){
Listproviders = mapper.getProInData(new String[]{"BJ_GYS001","BJ_GYS002"});
for (Provider pro:providers) {
System.out.println(pro.getProName());
}
}
//Query range (collection)
@Test
public void getProList(){
Listlist=new ArrayList<>();
list.add("BJ_GYS002");
list.add("BJ_GYS001");
ListproviderData=mapper.getProList(list);
for (Provider pro:providerData) {
System.out.println(pro.getProName());
}
}
//Query range (multiple collections)
@Test
public void getProObject(){
Listlist =new ArrayList ();
Provider provider=new Provider();
provider.setProCode("BJ_GYS002");
list.add(provider);
Listlist2 =new ArrayList ();
Provider provider2=new Provider();
provider2.setProName("Beijing Nafore Edible Oil Co., Ltd.");
list2.add(provider2);
ListproviderData=mapper.getProObject(list,list2);
for (Provider pro:providerData) {
System.out.println(pro.getProName());
}
}
}
//Smart label case
//Smart label multi-condition query
public ListproviderTest(@Param("proCode") String proCode, @Param("proName") String proName);
//Smart label to modify
public int updatePro(Provider provider);
//Query range (array)
public ListgetProInData(String [] proCodes);
//Query range (collection)
public ListgetProList(List list);
//Query range (multiple collections)
public ListgetProObject(@Param("proCodeList") List proCodeList,@Param("proNameList") List proNameList);
< p>
update smbms_provider
proCode=#{proCode},
proName=#{proName},
where id=#{id}
public class providerTest {
SqlSession sqlSession=MybatisUtil.getSqlSession();
ProviderDao mapper = sqlSession.getMapper(ProviderDao.class);
//Smart label multi-condition query
@Test
public void getAllPro(){
Listproviders = mapper.providerTest("GZ", "Shenzhen");
for (Provider pro:providers) {
System.out.println(pro.getProName());
}
}
//Smart label to modify
@Test
public void updatePro(){
Provider provider=new Provider();
provider.setId(10);
provider.setProCode("JS_GYS012");
provider.setProName("Little Nanjing Fire Head Army Information Technology Co., Ltd.");
int count=mapper.updatePro(provider);
sqlSession.commit();
System.out.println(count);
}
//Query range (array)
@Test
public void getInPro(){
Listproviders = mapper.getProInData(new String[]{"BJ_GYS001","BJ_GYS002"});
for (Provider pro:providers) {
System.out.println(pro.getProName());
}
}
//Query range (collection)
@Test
public void getProList(){
Listlist=new ArrayList<>();
list.add("BJ_GYS002");
list.add("BJ_GYS001");
ListproviderData=mapper.getProList(list);
for (Provider pro:providerData) {
System.out.println(pro.getProName());
}
}
//Query range (multiple collections)
@Test
public void getProObject(){
Listlist =new ArrayList ();
Provider provider=new Provider();
provider.setProCode("BJ_GYS002");
list.add(provider);
Listlist2 =new ArrayList ();
Provider provider2=new Provider();
provider2.setProName("Beijing Nafore Edible Oil Co., Ltd.");
list2.add(provider2);
ListproviderData=mapper.getProObject(list,list2);
for (Provider pro:providerData) {
System.out.println(pro.getProName());
}
}
}