代做网站怎么进行域名备案,宁波seo网站排名,做企业网站要用什么软件,做网站需要域名和什么if标签
用于判断条件是否成立。使用test属性进行条件判断#xff0c;如果条件为true#xff0c;则拼接sql。
where标签用于识别语句是否需要连接词and#xff0c;识别sql语句。
package com.t0.maybatisc.mapper;import com.t0.maybatisc.pojo.Emp;
import org.a…if标签
用于判断条件是否成立。使用test属性进行条件判断如果条件为true则拼接sql。
where标签用于识别语句是否需要连接词and识别sql语句。
package com.t0.maybatisc.mapper;import com.t0.maybatisc.pojo.Emp;
import org.apache.ibatis.annotations.*;import java.time.LocalDate;
import java.util.List;Mapper
public interface EmpMapper {
// 条件查询public ListEmp list( String name, Short gender, LocalDate begin, LocalDate end);}?xml version1.0 encodingUTF-8 ?
!DOCTYPE mapperPUBLIC -//mybatis.org//DTD Mapper 3.0//ENhttps://mybatis.org/dtd/mybatis-3-mapper.dtd
mapper namespacecom.t0.maybatisc.mapper.EmpMapperselect idlist resultTypecom.t0.maybatisc.pojo.Empselect * from empwhereif testname ! nullname like concat(%,#{name},%)/ifif testgender ! nulland gender #{gender}/ifif testbegin ! null and end ! nulland entrydate between #{begin} and #{end}/if/whereorder by update_time desc/select
/mapper
// 根据条件查询Testpublic void list(){
// ListEmp empList empMapper.list(张,(short) 1,LocalDate.of(2010,01,01),LocalDate.of(2020,01,01));ListEmp empList empMapper.list(null,(short)1,null,null);System.out.println(empList);}
}
用于select、upgrade。
foreach标签
package com.t0.maybatisc.mapper;import com.t0.maybatisc.pojo.Emp;
import org.apache.ibatis.annotations.*;import java.time.LocalDate;
import java.util.List;Mapper
public interface EmpMapper {
// 多条删除public void deleteByids(ListInteger ids);}?xml version1.0 encodingUTF-8 ?
!DOCTYPE mapperPUBLIC -//mybatis.org//DTD Mapper 3.0//ENhttps://mybatis.org/dtd/mybatis-3-mapper.dtd
mapper namespacecom.t0.maybatisc.mapper.EmpMapperselect iddeleteByids resultTypecom.t0.maybatisc.pojo.Empdelete from emp where id inforeach collectionids itemid separator, open( close)#{id}/foreach/select/mapper
collectionids itemid separator, open( close) Testpublic void TestdeleteByids(){ListInteger ids Arrays.asList(19,18,16);empMapper.deleteByids(ids);} sql和include
?xml version1.0 encodingUTF-8 ?
!DOCTYPE mapperPUBLIC -//mybatis.org//DTD Mapper 3.0//ENhttps://mybatis.org/dtd/mybatis-3-mapper.dtd
mapper namespacecom.t0.maybatisc.mapper.EmpMappersql idcommonSselect id,username,password,name,gender,image,job,entrydate,dept_id,create_time,update_timefrom emp/sqlselect idlist resultTypecom.t0.maybatisc.pojo.Empinclude refidcommonS/includewhereif testname ! nullname like concat(%,#{name},%)/ifif testgender ! nulland gender #{gender}/ifif testbegin ! null and end ! nulland entrydate between #{begin} and #{end}/if/whereorder by update_time desc/select
/mapper